Documentation ¶
Index ¶
- Constants
- type AllBalancesQuery
- type AllBalancesResponse
- type AllDelegationsQuery
- type AllDelegationsResponse
- type AllValidatorsQuery
- type AllValidatorsResponse
- type BalanceQuery
- type BalanceResponse
- type BankQuery
- type BaseEnv
- type BlockInfo
- type BondedDenomResponse
- type CanonicalAddress
- type ChannelQuery
- type ChannelResponse
- type Coin
- type Coins
- type ContractInfo
- type ContractInfoQuery
- type ContractInfoResponse
- type ContractKey
- type ContractQueryResponse
- type CosmosMsgVersion
- type Delegation
- type DelegationQuery
- type DelegationResponse
- type Delegations
- type DistQuery
- type Env
- type ExceededRecursionLimit
- type FullDelegation
- type GenericErr
- type GovQuery
- type HandleType
- type HumanAddress
- type IBCChannel
- type IBCChannelOpenMsg
- type IBCChannels
- type IBCEndpoint
- type IBCEndpoints
- type IBCOpenInit
- type IBCOpenTry
- type IBCOrder
- type IBCQuery
- type InvalidBase64
- type InvalidRequest
- type InvalidResponse
- type InvalidUtf8
- type ListChannelsQuery
- type ListChannelsResponse
- type MessageInfo
- type MintQuery
- type MintingBondedRatioQuery
- type MintingBondedRatioResponse
- type MintingInflationQuery
- type MintingInflationResponse
- type NoSuchContract
- type NotFound
- type OutOfGasError
- type ParseErr
- type PortIDQuery
- type PortIDResponse
- type Proposal
- type ProposalsQuery
- type ProposalsResponse
- type Querier
- type QuerierResult
- type QueryRequest
- type QueryResponse
- type RawQuery
- type RewardCoins
- type Rewards
- type RewardsQuery
- type RewardsResponse
- type SerializeErr
- type SmartQuery
- type StakingQuery
- type StargateQuery
- type StdError
- type SystemError
- type TransactionInfo
- type Unauthorized
- type UnbondingDelegationsResponse
- type UnbondingDeletionsQuery
- type Underflow
- type Unknown
- type UnsupportedRequest
- type Validator
- type ValidatorQuery
- type ValidatorResponse
- type Validators
- type ValidatorsQuery
- type ValidatorsResponse
- type VerificationInfo
- type WasmQuery
Constants ¶
const Ordered = "ORDER_ORDERED"
const Unordered = "ORDER_UNORDERED"
These are the only two valid values for IbcOrder
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllBalancesQuery ¶
type AllBalancesQuery struct {
Address string `json:"address"`
}
type AllBalancesResponse ¶
type AllBalancesResponse struct {
Amount Coins `json:"amount"`
}
AllBalancesResponse is the expected response to AllBalancesQuery
type AllDelegationsQuery ¶
type AllDelegationsQuery struct {
Delegator string `json:"delegator"`
}
type AllDelegationsResponse ¶
type AllDelegationsResponse struct {
Delegations Delegations `json:"delegations"`
}
AllDelegationsResponse is the expected response to AllDelegationsQuery
type AllValidatorsQuery ¶
type AllValidatorsQuery struct{}
type AllValidatorsResponse ¶
type AllValidatorsResponse struct {
Validators Validators `json:"validators"`
}
AllValidatorsResponse is the expected response to AllValidatorsQuery
type BalanceQuery ¶
type BalanceResponse ¶
type BalanceResponse struct {
Amount Coin `json:"amount"`
}
BalanceResponse is the expected response to BalanceQuery
type BankQuery ¶
type BankQuery struct { Balance *BalanceQuery `json:"balance,omitempty"` AllBalances *AllBalancesQuery `json:"all_balances,omitempty"` }
type BondedDenomResponse ¶
type BondedDenomResponse struct {
Denom string `json:"denom"`
}
type CanonicalAddress ¶
type CanonicalAddress = []byte
CanonicalAddress uses standard base64 encoding, just use it as a label for developers
type ChannelQuery ¶
type ChannelResponse ¶
type ChannelResponse struct { // may be empty if there is no matching channel Channel *IBCChannel `json:"channel,omitempty"` }
type Coin ¶
type Coin struct { Denom string `json:"denom"` // type, eg. "ATOM" Amount string `json:"amount"` // string encoing of decimal value, eg. "12.3456" }
Coin is a string representation of the sdk.Coin type (more portable than sdk.Int)
type Coins ¶
type Coins []Coin
Coins handles properly serializing empty amounts
func (Coins) MarshalJSON ¶
MarshalJSON ensures that we get [] for empty arrays
func (*Coins) UnmarshalJSON ¶
UnmarshalJSON ensures that we get [] for empty arrays
type ContractInfo ¶
type ContractInfo struct { // binary encoding of sdk.AccAddress of the contract, to be used when sending messages Address HumanAddress `json:"address"` }
type ContractInfoQuery ¶
type ContractInfoQuery struct { // Bech32 encoded sdk.AccAddress of the contract ContractAddr string `json:"contract_addr"` }
type ContractInfoResponse ¶
type ContractKey ¶
type ContractKey string
type ContractQueryResponse ¶
type ContractQueryResponse struct {
Query *QueryResponse `json:"query,omitempty"`
}
type CosmosMsgVersion ¶
type CosmosMsgVersion int
const ( CosmosMsgVersionV010 CosmosMsgVersion = iota CosmosMsgVersionV1 )
type Delegation ¶
type DelegationQuery ¶
type DelegationResponse ¶
type DelegationResponse struct {
Delegation *FullDelegation `json:"delegation,omitempty"`
}
DelegationResponse is the expected response to DelegationsQuery
type Delegations ¶
type Delegations []Delegation
func (Delegations) MarshalJSON ¶
func (d Delegations) MarshalJSON() ([]byte, error)
MarshalJSON ensures that we get [] for empty arrays
func (*Delegations) UnmarshalJSON ¶
func (d *Delegations) UnmarshalJSON(data []byte) error
UnmarshalJSON ensures that we get [] for empty arrays
type DistQuery ¶
type DistQuery struct {
Rewards *RewardsQuery `json:"rewards,omitempty"`
}
type Env ¶
type Env struct { Block BlockInfo `json:"block"` Message MessageInfo `json:"message"` Contract ContractInfo `json:"contract"` Key ContractKey `json:"contract_key"` QueryDepth uint32 `json:"query_depth"` Transaction *TransactionInfo `json:"transaction,omitempty"` }
Env defines the state of the blockchain environment this contract is running in. This must contain only trusted data - nothing from the Tx itself that has not been verfied (like Signer).
Env are json encoded to a byte slice before passing to the wasm contract.
type ExceededRecursionLimit ¶
type ExceededRecursionLimit struct{}
func (ExceededRecursionLimit) Error ¶
func (e ExceededRecursionLimit) Error() string
type FullDelegation ¶
type GenericErr ¶
type GenericErr struct {
Msg string `json:"msg,omitempty"`
}
func (GenericErr) Error ¶
func (e GenericErr) Error() string
type GovQuery ¶
type GovQuery struct {
Proposals *ProposalsQuery `json:"proposals,omitempty"`
}
type HandleType ¶
type HandleType int
const ( HandleTypeExecute HandleType = iota HandleTypeReply HandleTypeIbcChannelOpen HandleTypeIbcChannelConnect HandleTypeIbcChannelClose HandleTypeIbcPacketReceive HandleTypeIbcPacketAck HandleTypeIbcPacketTimeout )
type HumanAddress ¶
type HumanAddress = string
HumanAddress is a printable (typically bech32 encoded) address string. Just use it as a label for developers.
type IBCChannel ¶
type IBCChannel struct { Endpoint IBCEndpoint `json:"endpoint"` CounterpartyEndpoint IBCEndpoint `json:"counterparty_endpoint"` Order IBCOrder `json:"order"` Version string `json:"version"` ConnectionID string `json:"connection_id"` }
type IBCChannelOpenMsg ¶
type IBCChannelOpenMsg struct { OpenInit *IBCOpenInit `json:"open_init,omitempty"` OpenTry *IBCOpenTry `json:"open_try,omitempty"` }
type IBCChannels ¶
type IBCChannels []IBCChannel
IBCChannels must JSON encode empty array as [] (not null) for consistency with Rust parser
func (IBCChannels) MarshalJSON ¶
func (e IBCChannels) MarshalJSON() ([]byte, error)
MarshalJSON ensures that we get [] for empty arrays
func (*IBCChannels) UnmarshalJSON ¶
func (e *IBCChannels) UnmarshalJSON(data []byte) error
UnmarshalJSON ensures that we get [] for empty arrays
type IBCEndpoint ¶
type IBCEndpoints ¶
type IBCEndpoints []IBCEndpoint
IBCEndpoints must JSON encode empty array as [] (not null) for consistency with Rust parser
func (IBCEndpoints) MarshalJSON ¶
func (e IBCEndpoints) MarshalJSON() ([]byte, error)
MarshalJSON ensures that we get [] for empty arrays
func (*IBCEndpoints) UnmarshalJSON ¶
func (e *IBCEndpoints) UnmarshalJSON(data []byte) error
UnmarshalJSON ensures that we get [] for empty arrays
type IBCOpenInit ¶
type IBCOpenInit struct {
Channel IBCChannel `json:"channel"`
}
func (*IBCOpenInit) ToMsg ¶
func (m *IBCOpenInit) ToMsg() IBCChannelOpenMsg
type IBCOpenTry ¶
type IBCOpenTry struct { Channel IBCChannel `json:"channel"` CounterpartyVersion string `json:"counterparty_version"` }
func (*IBCOpenTry) ToMsg ¶
func (m *IBCOpenTry) ToMsg() IBCChannelOpenMsg
type IBCOrder ¶
type IBCOrder = string
TODO: test what the sdk Order.String() represents and how to parse back Proto files: https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/core/channel/v1/channel.proto#L69-L80 Auto-gen code: https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/x/ibc/core/04-channel/types/channel.pb.go#L70-L101
type IBCQuery ¶
type IBCQuery struct { PortID *PortIDQuery `json:"port_id,omitempty"` ListChannels *ListChannelsQuery `json:"list_channels,omitempty"` Channel *ChannelQuery `json:"channel,omitempty"` }
IBCQuery defines a query request from the contract into the chain. This is the counterpart of [IbcQuery](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L61-L83).
type InvalidBase64 ¶
type InvalidBase64 struct {
Msg string `json:"msg,omitempty"`
}
func (InvalidBase64) Error ¶
func (e InvalidBase64) Error() string
type InvalidRequest ¶
func (InvalidRequest) Error ¶
func (e InvalidRequest) Error() string
type InvalidResponse ¶
func (InvalidResponse) Error ¶
func (e InvalidResponse) Error() string
type InvalidUtf8 ¶
type InvalidUtf8 struct {
Msg string `json:"msg,omitempty"`
}
func (InvalidUtf8) Error ¶
func (e InvalidUtf8) Error() string
type ListChannelsQuery ¶
type ListChannelsQuery struct { // optional argument PortID string `json:"port_id,omitempty"` }
ListChannelsQuery is an IBCQuery that lists all channels that are bound to a given port. If `PortID` is unset, this list all channels bound to the contract's port. Returns a `ListChannelsResponse`. This is the counterpart of [IbcQuery::ListChannels](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L70-L73).
type ListChannelsResponse ¶
type ListChannelsResponse struct {
Channels IBCChannels `json:"channels"`
}
type MessageInfo ¶
type MessageInfo struct { // binary encoding of sdk.AccAddress executing the contract Sender HumanAddress `json:"sender"` // amount of funds send to the contract along with this message SentFunds Coins `json:"sent_funds"` }
type MintQuery ¶
type MintQuery struct { Inflation *MintingInflationQuery `json:"inflation,omitempty"` BondedRatio *MintingBondedRatioQuery `json:"bonded_ratio,omitempty"` }
type MintingBondedRatioQuery ¶
type MintingBondedRatioQuery struct{}
type MintingBondedRatioResponse ¶
type MintingBondedRatioResponse struct {
BondedRatio string `json:"bonded_ratio"`
}
type MintingInflationQuery ¶
type MintingInflationQuery struct{}
type MintingInflationResponse ¶
type MintingInflationResponse struct {
InflationRate string `json:"inflation_rate"`
}
type NoSuchContract ¶
type NoSuchContract struct {
Addr string `json:"addr,omitempty"`
}
func (NoSuchContract) Error ¶
func (e NoSuchContract) Error() string
type OutOfGasError ¶
type OutOfGasError struct{}
func (OutOfGasError) Error ¶
func (o OutOfGasError) Error() string
type PortIDQuery ¶
type PortIDQuery struct{}
type PortIDResponse ¶
type PortIDResponse struct {
PortID string `json:"port_id"`
}
type Proposal ¶
type Proposal struct { ProposalID uint64 `json:"id" yaml:"id"` // ID of the proposal VotingStartTime uint64 `json:"voting_start_time" yaml:"voting_start_time"` // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached VotingEndTime uint64 `json:"voting_end_time" yaml:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied }
type ProposalsQuery ¶
type ProposalsQuery struct{}
type ProposalsResponse ¶
type ProposalsResponse struct {
Proposals []Proposal `json:"proposals,omitempty"`
}
DelegationResponse is the expected response to DelegationsQuery
func (ProposalsResponse) MarshalJSON ¶
func (d ProposalsResponse) MarshalJSON() ([]byte, error)
MarshalJSON ensures that we get [] for empty arrays
func (*ProposalsResponse) UnmarshalJSON ¶
func (d *ProposalsResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON ensures that we get [] for empty arrays
type QuerierResult ¶
type QuerierResult struct { Ok *QueryResponse `json:"Ok,omitempty"` Err *SystemError `json:"Err,omitempty"` }
This is a 2-level result
func RustQuery ¶
func RustQuery(querier Querier, binRequest []byte, queryDepth uint32, gasLimit uint64) QuerierResult
this is a thin wrapper around the desired Go API to give us types closer to Rust FFI
func ToQuerierResult ¶
func ToQuerierResult(response []byte, err error) QuerierResult
type QueryRequest ¶
type QueryRequest struct { Bank *BankQuery `json:"bank,omitempty"` Custom json.RawMessage `json:"custom,omitempty"` Staking *StakingQuery `json:"staking,omitempty"` Wasm *WasmQuery `json:"wasm,omitempty"` Dist *DistQuery `json:"dist,omitempty"` Mint *MintQuery `json:"mint,omitempty"` Gov *GovQuery `json:"gov,omitempty"` IBC *IBCQuery `json:"ibc,omitempty"` Stargate *StargateQuery `json:"stargate,omitempty"` }
QueryRequest is an rust enum and only (exactly) one of the fields should be set Should we do a cleaner approach in Go? (type/data?)
type QueryResponse ¶
type RawQuery ¶
type RawQuery struct { // Bech32 encoded sdk.AccAddress of the contract ContractAddr string `json:"contract_addr"` Key []byte `json:"key"` }
RawQuery response is raw bytes ([]byte)
type RewardCoins ¶
type RewardCoins []Coin
func (RewardCoins) MarshalJSON ¶
func (d RewardCoins) MarshalJSON() ([]byte, error)
MarshalJSON ensures that we get [] for empty arrays
func (*RewardCoins) UnmarshalJSON ¶
func (d *RewardCoins) UnmarshalJSON(data []byte) error
UnmarshalJSON ensures that we get [] for empty arrays
type Rewards ¶
type Rewards struct { Validator string `json:"validator_address"` Reward RewardCoins `json:"reward"` }
type RewardsQuery ¶
type RewardsQuery struct {
Delegator string `json:"delegator"`
}
type RewardsResponse ¶
type RewardsResponse struct { Rewards []Rewards `json:"rewards,omitempty"` Total RewardCoins `json:"total,omitempty"` }
DelegationResponse is the expected response to DelegationsQuery
type SerializeErr ¶
type SerializeErr struct { Source string `json:"source,omitempty"` Msg string `json:"msg,omitempty"` }
func (SerializeErr) Error ¶
func (e SerializeErr) Error() string
type SmartQuery ¶
type SmartQuery struct { // Bech32 encoded sdk.AccAddress of the contract ContractAddr string `json:"contract_addr"` Msg []byte `json:"msg"` }
SmartQuery response is raw bytes ([]byte)
type StakingQuery ¶
type StakingQuery struct { Validators *ValidatorsQuery `json:"validators,omitempty"` AllDelegations *AllDelegationsQuery `json:"all_delegations,omitempty"` Delegation *DelegationQuery `json:"delegation,omitempty"` UnBondingDelegations *UnbondingDeletionsQuery `json:"unbonding_delegations,omitempty"` BondedDenom *struct{} `json:"bonded_denom,omitempty"` AllValidators *AllValidatorsQuery `json:"all_validators,omitempty"` Validator *ValidatorQuery `json:"validator,omitempty"` }
type StargateQuery ¶
type StargateQuery struct { // this is the fully qualified service path used for routing, // eg. custom/cosmos_sdk.x.bank.v1.Query/QueryBalance Path string `json:"path"` // this is the expected protobuf message type (not any), binary encoded Data []byte `json:"data"` }
StargateQuery is encoded the same way as abci_query, with path and protobuf encoded request data. The format is defined in [ADR-21](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-021-protobuf-query-encoding.md). The response is protobuf encoded data directly without a JSON response wrapper. The caller is responsible for compiling the proper protobuf definitions for both requests and responses.
type StdError ¶
type StdError struct { GenericErr *GenericErr `json:"generic_err,omitempty"` InvalidBase64 *InvalidBase64 `json:"invalid_base64,omitempty"` InvalidUtf8 *InvalidUtf8 `json:"invalid_utf8,omitempty"` NotFound *NotFound `json:"not_found,omitempty"` ParseErr *ParseErr `json:"parse_err,omitempty"` SerializeErr *SerializeErr `json:"serialize_err,omitempty"` Underflow *Underflow `json:"underflow,omitempty"` }
StdError captures all errors returned from the Rust code as StdError. Exactly one of the fields should be set.
func ToStdError ¶
ToStdError will convert the given error to an StdError. This is important to returning any Go error back to Rust.
If it is already StdError, return self. If it is an error, which could be a sub-field of StdError, embed it. If it is anything else, convert it to a GenericErr.
type SystemError ¶
type SystemError struct { InvalidRequest *InvalidRequest `json:"invalid_request,omitempty"` InvalidResponse *InvalidResponse `json:"invalid_response,omitempty"` NoSuchContract *NoSuchContract `json:"no_such_contract,omitempty"` Unknown *Unknown `json:"unknown,omitempty"` UnsupportedRequest *UnsupportedRequest `json:"unsupported_request,omitempty"` ExceededRecursionLimit *ExceededRecursionLimit `json:"exceeded_recursion_limit,omitempty"` }
SystemError captures all errors returned from the Rust code as SystemError. Exactly one of the fields should be set.
func ToSystemError ¶
func ToSystemError(err error) *SystemError
ToSystemError will try to convert the given error to an SystemError. This is important to returning any Go error back to Rust.
If it is already StdError, return self. If it is an error, which could be a sub-field of StdError, embed it. If it is anything else, **return nil**
This may return nil on an unknown error, whereas ToStdError will always create a valid error type.
func (SystemError) Error ¶
func (a SystemError) Error() string
type TransactionInfo ¶
type TransactionInfo struct { // Position of this transaction in the block. // The first transaction has index 0 // // Along with BlockInfo.Height, this allows you to get a unique // transaction identifier for the chain for future queries Index uint32 `json:"index"` }
type Unauthorized ¶
type Unauthorized struct{}
func (Unauthorized) Error ¶
func (e Unauthorized) Error() string
type UnbondingDelegationsResponse ¶
type UnbondingDelegationsResponse struct {
Delegations Delegations `json:"delegations"`
}
type UnbondingDeletionsQuery ¶
type UnbondingDeletionsQuery struct {
Delegator string `json:"delegator"`
}
type Underflow ¶
type UnsupportedRequest ¶
type UnsupportedRequest struct {
Kind string `json:"kind,omitempty"`
}
func (UnsupportedRequest) Error ¶
func (e UnsupportedRequest) Error() string
type ValidatorQuery ¶
type ValidatorQuery struct { /// Address is the validator's address (e.g. cosmosvaloper1...) Address string `json:"address"` }
type ValidatorResponse ¶
type ValidatorResponse struct {
Validator *Validator `json:"validator"` // serializes to `null` when unset which matches Rust's Option::None serialization
}
ValidatorResponse is the expected response to ValidatorQuery
type Validators ¶
type Validators []Validator
TODO: Validators must JSON encode empty array as []
func (Validators) MarshalJSON ¶
func (v Validators) MarshalJSON() ([]byte, error)
MarshalJSON ensures that we get [] for empty arrays
func (*Validators) UnmarshalJSON ¶
func (v *Validators) UnmarshalJSON(data []byte) error
UnmarshalJSON ensures that we get [] for empty arrays
type ValidatorsQuery ¶
type ValidatorsQuery struct{}
type ValidatorsResponse ¶
type ValidatorsResponse struct {
Validators Validators `json:"validators"`
}
ValidatorsResponse is the expected response to ValidatorsQuery
type VerificationInfo ¶
type WasmQuery ¶
type WasmQuery struct { Smart *SmartQuery `json:"smart,omitempty"` Raw *RawQuery `json:"raw,omitempty"` ContractInfo *ContractInfoQuery `json:"contract_info,omitempty"` }