Documentation
¶
Index ¶
- type BadRequestError
- type Details
- type Flag
- type Flagger
- type Flags
- type ForbiddenError
- type Included
- func (c *Included) Add(includes ...Resource)
- func (c Included) MarshalJSON() ([]byte, error)
- func (c *Included) MustProposalInfo(key Key) *ProposalInfo
- func (c *Included) MustSendTx(key Key) *SendTx
- func (c *Included) MustState(key Key) *State
- func (c *Included) MustStateV2(key Key) *StateV2
- func (c *Included) MustTx(key Key) *Tx
- func (c *Included) MustVoteCount(key Key) *VoteCount
- func (c *Included) MustVotingAvailability(key Key) *VotingAvailability
- func (c *Included) MustVotingInfo(key Key) *VotingInfo
- func (c *Included) MustVotingPredict(key Key) *VotingPredict
- func (c *Included) MustVotingPredictResp(key Key) *VotingPredictResp
- func (c *Included) UnmarshalJSON(data []byte) error
- type InternalError
- type Key
- type Links
- type NotAllowedError
- type NotFoundError
- type Options
- type ParsedVotingWhiteData
- type ParsedVotingWhitelistData
- type ParsedWhiteListDataWithMetadata
- type ProposalInfo
- type ProposalInfoAttributes
- type ProposalInfoAttributesMetadata
- type ProposalInfoListResponse
- type ProposalInfoResponse
- type Relation
- type RelationCollection
- type Resource
- type ResourceType
- type SendTx
- type SendTxAttributes
- type SendTxListRequest
- type SendTxRequest
- type State
- type StateAttributes
- type StateListResponse
- type StateResponse
- type StateV2
- type StateV2Attributes
- type StateV2ListResponse
- type StateV2Response
- type Tx
- type TxAttributes
- type TxListResponse
- type TxResponse
- type VoteCount
- type VoteCountAttributes
- type VoteCountListResponse
- type VoteCountResponse
- type VotingAvailability
- type VotingAvailabilityAttributes
- type VotingAvailabilityListResponse
- type VotingAvailabilityResponse
- type VotingInfo
- type VotingInfoAttributes
- type VotingInfoAttributesInfo
- type VotingInfoAttributesMetadata
- type VotingInfoConfig
- type VotingInfoContractInfo
- type VotingInfoListResponse
- type VotingInfoResponse
- type VotingParsedWhiteListDataWithMetadata
- type VotingPredict
- type VotingPredictAttributes
- type VotingPredictListRequest
- type VotingPredictRequest
- type VotingPredictResp
- type VotingPredictRespAttributes
- type VotingPredictRespListResponse
- type VotingPredictRespResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadRequestError ¶ added in v0.4.0
type Details ¶
type Details json.RawMessage
func (Details) MarshalJSON ¶
MarshalJSON - casts Details to []byte
func (*Details) UnmarshalJSON ¶
UnmarshalJSON - casts data to Details
type ForbiddenError ¶ added in v0.4.0
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) MarshalJSON ¶
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
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
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
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 ¶
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
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 ¶
UnmarshalJSON - unmarshal array of json objects into include collection
type InternalError ¶ added in v0.4.0
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 ¶
type NotAllowedError ¶ added in v0.4.0
type NotFoundError ¶ added in v0.4.0
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 RelationCollection ¶
func (RelationCollection) MarshalJSON ¶
func (r RelationCollection) MarshalJSON() ([]byte, error)
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 SendTxListRequest ¶ added in v0.4.0
type SendTxRequest ¶ added in v0.4.0
type State ¶ added in v0.3.4
type State struct {
Key
Attributes StateAttributes `json:"attributes"`
}
type StateAttributes ¶ added in v0.3.4
type StateListResponse ¶ added in v0.3.4
type StateResponse ¶ added in v0.3.4
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 StateV2Response ¶ added in v0.5.1
type Tx ¶
type Tx struct {
Key
Attributes TxAttributes `json:"attributes"`
}
type TxAttributes ¶
type TxAttributes struct {
TxHash string `json:"tx_hash"`
}
type TxListResponse ¶
type TxResponse ¶
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 VoteCountResponse ¶ added in v0.4.0
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 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"`
}
Source Files
¶
- db.go
- flag.go
- included.go
- links.go
- model_bad_request_error.go
- model_details.go
- model_forbidden_error.go
- model_internal_error.go
- model_key.go
- model_not_allowed_error.go
- model_not_found_error.go
- model_options.go
- model_parsed_voting_white_data.go
- model_parsed_voting_whitelist_data.go
- model_parsed_white_list_data_with_metadata.go
- model_proposal_info.go
- model_proposal_info_attributes.go
- model_proposal_info_attributes_metadata.go
- model_relation.go
- model_relation_collection.go
- model_resource_type.go
- model_send_tx.go
- model_send_tx_attributes.go
- model_state.go
- model_state_attributes.go
- model_state_v2.go
- model_state_v2_attributes.go
- model_tx.go
- model_tx_attributes.go
- model_vote_count.go
- model_vote_count_attributes.go
- model_voting_availability.go
- model_voting_availability_attributes.go
- model_voting_info.go
- model_voting_info_attributes.go
- model_voting_info_attributes_info.go
- model_voting_info_attributes_metadata.go
- model_voting_info_config.go
- model_voting_info_contract_info.go
- model_voting_parsed_white_list_data_with_metadata.go
- model_voting_predict.go
- model_voting_predict_attributes.go
- model_voting_predict_resp.go
- model_voting_predict_resp_attributes.go