resources

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadRequestError added in v0.4.0

type BadRequestError struct {
	Status string `json:"status"`
	Title  string `json:"title"`
}

type Details

type Details json.RawMessage

func (Details) MarshalJSON

func (d Details) MarshalJSON() ([]byte, error)

MarshalJSON - casts Details to []byte

func (*Details) Scan

func (r *Details) Scan(src interface{}) error

Scan - implements db driver method for auto unmarshal

func (Details) String

func (d Details) String() string

func (*Details) UnmarshalJSON

func (d *Details) UnmarshalJSON(data []byte) error

UnmarshalJSON - casts data to Details

func (Details) Value

func (r Details) Value() (driver.Value, error)

Value - implements db driver method for auto marshal

type Flag

type Flag struct {
	Name  string `json:"name"`
	Value int32  `json:"value"`
}

type Flagger

type Flagger interface {
	IsFlag() bool
}

type Flags

type Flags struct {
	Mask   int32  `json:"mask"`
	Values []Flag `json:"flags"`
}

func FlagsFromMask

func FlagsFromMask(mask int32, allFlags map[int32]string) Flags

type ForbiddenError added in v0.4.0

type ForbiddenError struct {
	Status string `json:"status"`
	Title  string `json:"title"`
}

type Included

type Included struct {
	// contains filtered or unexported fields
}

Included - an array of Resource objects that are related to the primary data and/or each other (“included resources”).

func (*Included) Add

func (c *Included) Add(includes ...Resource)

Add - adds new include into collection. If one already present - skips it

func (Included) MarshalJSON

func (c Included) MarshalJSON() ([]byte, error)

MarshalJSON - marshals include collection as array of json objects

func (*Included) MustProposalInfo added in v0.5.0

func (c *Included) MustProposalInfo(key Key) *ProposalInfo

MustProposalInfo - returns ProposalInfo from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustSendTx added in v0.4.0

func (c *Included) MustSendTx(key Key) *SendTx

MustSendTx - returns SendTx from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustState added in v0.3.4

func (c *Included) MustState(key Key) *State

MustState - returns State from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustStateV2 added in v0.5.1

func (c *Included) MustStateV2(key Key) *StateV2

MustStateV2 - returns StateV2 from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustTx

func (c *Included) MustTx(key Key) *Tx

MustTx - returns Tx from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustVoteCount added in v0.4.0

func (c *Included) MustVoteCount(key Key) *VoteCount

MustVoteCount - returns VoteCount from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustVotingAvailability added in v0.4.0

func (c *Included) MustVotingAvailability(key Key) *VotingAvailability

MustVotingAvailability - returns VotingAvailability from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustVotingInfo added in v0.5.0

func (c *Included) MustVotingInfo(key Key) *VotingInfo

MustVotingInfo - returns VotingInfo from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustVotingPredict added in v0.4.0

func (c *Included) MustVotingPredict(key Key) *VotingPredict

MustVotingPredict - returns VotingPredict from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustVotingPredictResp added in v0.4.0

func (c *Included) MustVotingPredictResp(key Key) *VotingPredictResp

MustVotingPredictResp - returns VotingPredictResp from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) UnmarshalJSON

func (c *Included) UnmarshalJSON(data []byte) error

UnmarshalJSON - unmarshal array of json objects into include collection

type InternalError added in v0.4.0

type InternalError struct {
	Status string `json:"status"`
	Title  string `json:"title"`
}

type Key

type Key struct {
	ID   string       `json:"id"`
	Type ResourceType `json:"type"`
}

func NewKeyInt64

func NewKeyInt64(id int64, resourceType ResourceType) Key

func (Key) AsRelation

func (r Key) AsRelation() *Relation

func (*Key) GetKey

func (r *Key) GetKey() Key

func (Key) GetKeyP

func (r Key) GetKeyP() *Key
type Links struct {
	First string `json:"first,omitempty"`
	Last  string `json:"last,omitempty"`
	Next  string `json:"next,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Self  string `json:"self,omitempty"`
}

type NotAllowedError added in v0.4.0

type NotAllowedError struct {
	Status string `json:"status"`
	Title  string `json:"title"`
}

type NotFoundError added in v0.4.0

type NotFoundError struct {
	Status string `json:"status"`
	Title  string `json:"title"`
}

type Options added in v0.5.0

type Options struct {
	Title    string   `json:"title"`
	Variants []string `json:"variants"`
}

type ParsedVotingWhiteData added in v0.5.0

type ParsedVotingWhiteData struct {
	// birth_date_lowerbound in hex format without first 0x
	BirthDateLowerbound string `json:"birth_date_lowerbound"`
	// birth_date_upper_bound in hex format without first 0x
	BirthDateUpperBound string `json:"birth_date_upper_bound"`
	// Citizenship whitelist for the voting
	CitizenshipWhitelist []string `json:"citizenship_whitelist"`
	// expiration_date_lower_bound in hex format without first 0x
	ExpirationDateLowerBound string `json:"expiration_date_lower_bound"`
	// uniqueness 0 | 1
	IdentityCounterUpperBound           string `json:"identity_counter_upper_bound"`
	IdentityCreationTimestampUpperBound string `json:"identity_creation_timestamp_upper_bound"`
	MaxAge                              int64  `json:"max_age"`
	MinAge                              int64  `json:"min_age"`
	// Proposal selector without first 0x
	Selector string `json:"selector"`
	// toHex('M') // male, toHex('F') // female, 0 // any
	Sex string `json:"sex"`
}

type ParsedVotingWhitelistData added in v0.5.0

type ParsedVotingWhitelistData struct {
	// birth_date_upper_bound in hex format
	BirthDateUpperBound  string   `json:"birth_date_upper_bound"`
	CitizenshipWhitelist []string `json:"citizenship_whitelist"`
	// expiration_date_lower_bound in hex format
	ExpirationDateLowerBound string `json:"expiration_date_lower_bound"`
	// uniqueness 0 | 1
	IdentityCounterUpperBound           string `json:"identity_counter_upper_bound"`
	IdentityCreationTimestampUpperBound string `json:"identity_creation_timestamp_upper_bound"`
	MinAge                              int64  `json:"min_age"`
}

type ParsedWhiteListDataWithMetadata added in v0.5.0

type ParsedWhiteListDataWithMetadata struct {
	Metadata                  ProposalInfoAttributesMetadata `json:"metadata"`
	ParsedVotingWhitelistData []ParsedVotingWhiteData        `json:"parsed_voting_whitelist_data"`
}

type ProposalInfo added in v0.5.0

type ProposalInfo struct {
	Key
	Attributes ProposalInfoAttributes `json:"attributes"`
}

type ProposalInfoAttributes added in v0.5.0

type ProposalInfoAttributes struct {
	// End time of the proposal
	EndTimestamp int64                          `json:"end_timestamp"`
	Metadata     ProposalInfoAttributesMetadata `json:"metadata"`
	// Address creator of the proposal
	Owner string `json:"owner"`
	// Remaining balance
	RemainingBalance string `json:"remaining_balance"`
	// Total number of available votes for this proposal
	RemainingVotesCount int64 `json:"remaining_votes_count"`
	// Start time of the proposal
	StartTimestamp int64  `json:"start_timestamp"`
	Status         string `json:"status"`
	// Balance what is the starting balance with deposits
	TotalBalance string `json:"total_balance"`
	// Total number of votes already cast for this proposal
	VotesCount int64 `json:"votes_count"`
}

type ProposalInfoAttributesMetadata added in v0.5.0

type ProposalInfoAttributesMetadata struct {
	AcceptedOptions []Options `json:"acceptedOptions"`
	// Detailed description of the proposal
	Description string `json:"description"`
	// Proposal image CID
	ImageCid string `json:"imageCid"`
	// Indicates if the proposal is ranking based
	RankingBased *bool `json:"rankingBased,omitempty"`
	// Title of the proposal
	Title string `json:"title"`
}

Additional proposal data stored on IPFS

type ProposalInfoListResponse added in v0.5.0

type ProposalInfoListResponse struct {
	Data     []ProposalInfo `json:"data"`
	Included Included       `json:"included"`
	Links    *Links         `json:"links"`
}

type ProposalInfoResponse added in v0.5.0

type ProposalInfoResponse struct {
	Data     ProposalInfo `json:"data"`
	Included Included     `json:"included"`
}

type Relation

type Relation struct {
	Data  *Key   `json:"data,omitempty"`
	Links *Links `json:"links,omitempty"`
}

type RelationCollection

type RelationCollection struct {
	Data  []Key  `json:"data"`
	Links *Links `json:"links,omitempty"`
}

func (RelationCollection) MarshalJSON

func (r RelationCollection) MarshalJSON() ([]byte, error)

type Resource

type Resource interface {
	//GetKey - returns key of the Resource
	GetKey() Key
}

type ResourceType

type ResourceType string
const (
	PROPOSALS             ResourceType = "proposals"
	SEND_TRANSACTION      ResourceType = "send_transaction"
	STATE                 ResourceType = "state"
	STATE_V2              ResourceType = "state_v2"
	TXS                   ResourceType = "txs"
	VOTE_COUNT            ResourceType = "vote_count"
	IS_ENOUGH             ResourceType = "is_enough"
	VOTING_INFO           ResourceType = "voting_info"
	VOTE_PREDICT_AMOUNT   ResourceType = "vote_predict_amount"
	VOTE_PREDICT_COUNT_TX ResourceType = "vote_predict_count_tx"
)

List of ResourceType

type SendTx added in v0.4.0

type SendTx struct {
	Key
	Attributes SendTxAttributes `json:"attributes"`
}

type SendTxAttributes added in v0.4.0

type SendTxAttributes struct {
	// Address of the contract to which the transaction data should be sent
	Destination string `json:"destination"`
	// Serialized transaction data
	TxData string `json:"tx_data"`
}

type SendTxListRequest added in v0.4.0

type SendTxListRequest struct {
	Data     []SendTx `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type SendTxRequest added in v0.4.0

type SendTxRequest struct {
	Data     SendTx   `json:"data"`
	Included Included `json:"included"`
}

type State added in v0.3.4

type State struct {
	Key
	Attributes StateAttributes `json:"attributes"`
}

type StateAttributes added in v0.3.4

type StateAttributes struct {
	// Signature of root state signed by relayer private key.
	Signature string `json:"signature"`
	// Time indicates when the event was caught, a.k.a state transition timestamp
	Timestamp int64 `json:"timestamp"`
}

type StateListResponse added in v0.3.4

type StateListResponse struct {
	Data     []State  `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type StateResponse added in v0.3.4

type StateResponse struct {
	Data     State    `json:"data"`
	Included Included `json:"included"`
}

type StateV2 added in v0.5.1

type StateV2 struct {
	Key
	Attributes StateV2Attributes `json:"attributes"`
}

type StateV2Attributes added in v0.5.1

type StateV2Attributes struct {
	// Root hash of the state tree
	Root string `json:"root"`
	// Signature of root state signed by relayer private key, with the last byte of the signature set to 27/28.
	Signature string `json:"signature"`
	// Time indicates when the event was caught, a.k.a state transition timestamp
	Timestamp int64 `json:"timestamp"`
}

type StateV2ListResponse added in v0.5.1

type StateV2ListResponse struct {
	Data     []StateV2 `json:"data"`
	Included Included  `json:"included"`
	Links    *Links    `json:"links"`
}

type StateV2Response added in v0.5.1

type StateV2Response struct {
	Data     StateV2  `json:"data"`
	Included Included `json:"included"`
}

type Tx

type Tx struct {
	Key
	Attributes TxAttributes `json:"attributes"`
}

type TxAttributes

type TxAttributes struct {
	TxHash string `json:"tx_hash"`
}

type TxListResponse

type TxListResponse struct {
	Data     []Tx     `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type TxResponse

type TxResponse struct {
	Data     Tx       `json:"data"`
	Included Included `json:"included"`
}

type VoteCount added in v0.4.0

type VoteCount struct {
	Key
	Attributes VoteCountAttributes `json:"attributes"`
}

type VoteCountAttributes added in v0.4.0

type VoteCountAttributes struct {
	VoteCount *uint64 `json:"vote_count,omitempty"`
}

type VoteCountListResponse added in v0.4.0

type VoteCountListResponse struct {
	Data     []VoteCount `json:"data"`
	Included Included    `json:"included"`
	Links    *Links      `json:"links"`
}

type VoteCountResponse added in v0.4.0

type VoteCountResponse struct {
	Data     VoteCount `json:"data"`
	Included Included  `json:"included"`
}

type VotingAvailability added in v0.4.0

type VotingAvailability struct {
	Key
	Attributes VotingAvailabilityAttributes `json:"attributes"`
}

type VotingAvailabilityAttributes added in v0.4.0

type VotingAvailabilityAttributes struct {
	IsEnough *bool `json:"is_enough,omitempty"`
}

type VotingAvailabilityListResponse added in v0.4.0

type VotingAvailabilityListResponse struct {
	Data     []VotingAvailability `json:"data"`
	Included Included             `json:"included"`
	Links    *Links               `json:"links"`
}

type VotingAvailabilityResponse added in v0.4.0

type VotingAvailabilityResponse struct {
	Data     VotingAvailability `json:"data"`
	Included Included           `json:"included"`
}

type VotingInfo added in v0.5.0

type VotingInfo struct {
	Key
	Attributes VotingInfoAttributes `json:"attributes"`
}

type VotingInfoAttributes added in v0.5.0

type VotingInfoAttributes struct {
	// Address creator of the proposal
	Author   string                       `json:"author"`
	Contract VotingInfoContractInfo       `json:"contract"`
	Metadata VotingInfoAttributesMetadata `json:"metadata"`
}

type VotingInfoAttributesInfo added in v0.5.0

type VotingInfoAttributesInfo struct {
	// Detailed description of the proposal
	Description string `json:"description"`
	// End time of the proposal
	EndTimestamp int64 `json:"end_timestamp"`
	// Unique identifier of the proposal
	ProposalId int64 `json:"proposal_id"`
	// Start time of the proposal
	StartTimestamp int64 `json:"start_timestamp"`
}

Proposal info

type VotingInfoAttributesMetadata added in v0.5.0

type VotingInfoAttributesMetadata struct {
	AcceptedOptions []Options `json:"acceptedOptions"`
	// Detailed description of the proposal
	Description string `json:"description"`
	// Title of the proposal
	Title string `json:"title"`
}

Additional proposal data stored on IPFS

type VotingInfoConfig added in v0.5.0

type VotingInfoConfig struct {
	// Ipfs CID
	Description string `json:"description"`
	// End time of the proposal
	EndTimestamp int64 `json:"end_timestamp"`
	// Multichoice option for voting
	Multichoice               int64                   `json:"multichoice"`
	ParsedVotingWhitelistData []ParsedVotingWhiteData `json:"parsed_voting_whitelist_data"`
	// Unique identifier of the proposal
	ProposalId int64 `json:"proposal_id"`
	// Start time of the proposal
	StartTimestamp int64 `json:"start_timestamp"`
	// List of addresses allowed to vote
	VotingWhitelist []string `json:"voting_whitelist"`
	// Additional whitelist data in bytes
	VotingWhitelistData []string `json:"voting_whitelist_data"`
}

Proposal info

type VotingInfoContractInfo added in v0.5.0

type VotingInfoContractInfo struct {
	Config VotingInfoConfig `json:"config"`
	// Address of the proposal SMT
	ProposalSMT string `json:"proposalSMT"`
	// Status of the proposal
	Status        uint8     `json:"status"`
	VotingResults [][]int64 `json:"voting_results"`
}

type VotingInfoListResponse added in v0.5.0

type VotingInfoListResponse struct {
	Data     []VotingInfo `json:"data"`
	Included Included     `json:"included"`
	Links    *Links       `json:"links"`
}

type VotingInfoResponse added in v0.5.0

type VotingInfoResponse struct {
	Data     VotingInfo `json:"data"`
	Included Included   `json:"included"`
}

type VotingParsedWhiteListDataWithMetadata added in v0.5.0

type VotingParsedWhiteListDataWithMetadata struct {
	Metadata                  ProposalInfoAttributesMetadata `json:"metadata"`
	ParsedVotingWhitelistData []ParsedVotingWhiteData        `json:"parsed_voting_whitelist_data"`
}

type VotingPredict added in v0.4.0

type VotingPredict struct {
	Key
	Attributes VotingPredictAttributes `json:"attributes"`
}

type VotingPredictAttributes added in v0.4.0

type VotingPredictAttributes struct {
	// The amount of tokens available for covering transactions
	Amount *string `json:"amount,omitempty"`
	// The number of transactions that need to be covered
	CountTx *string `json:"count_tx,omitempty"`
	// ID of the voting to which the vote
	VotingId *int64 `json:"voting_id,omitempty"`
}

type VotingPredictListRequest added in v0.4.0

type VotingPredictListRequest struct {
	Data     []VotingPredict `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
}

type VotingPredictRequest added in v0.4.0

type VotingPredictRequest struct {
	Data     VotingPredict `json:"data"`
	Included Included      `json:"included"`
}

type VotingPredictResp added in v0.4.0

type VotingPredictResp struct {
	Key
	Attributes VotingPredictRespAttributes `json:"attributes"`
}

type VotingPredictRespAttributes added in v0.4.0

type VotingPredictRespAttributes struct {
	AmountPredict  *string `json:"amount_predict,omitempty"`
	CountTxPredict *string `json:"count_tx_predict,omitempty"`
}

type VotingPredictRespListResponse added in v0.4.0

type VotingPredictRespListResponse struct {
	Data     []VotingPredictResp `json:"data"`
	Included Included            `json:"included"`
	Links    *Links              `json:"links"`
}

type VotingPredictRespResponse added in v0.4.0

type VotingPredictRespResponse struct {
	Data     VotingPredictResp `json:"data"`
	Included Included          `json:"included"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL