types

package
v2.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 50

Documentation

Index

Constants

View Source
const (
	Unordered = "ORDER_UNORDERED"
	Ordered   = "ORDER_ORDERED"
)

These are the only two valid values for IbcOrder

View Source
const (
	UnsetVoteOption voteOption = iota // The default value. We never return this in any valid instance (see toVoteOption).
	Yes
	No
	Abstain
	NoWithVeto
)
View Source
const (
	UnsetReplyOn replyOn = iota // The default value. We never return this in any valid instance (see toReplyOn).
	ReplyAlways
	ReplySuccess
	ReplyError
	ReplyNever
)
View Source
const ChecksumLen = 32

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 Array[Coin] `json:"amount"`
}

AllBalancesResponse is the expected response to AllBalancesQuery

type AllDelegationsQuery

type AllDelegationsQuery struct {
	Delegator string `json:"delegator"`
}

type AllDelegationsResponse

type AllDelegationsResponse struct {
	Delegations Array[Delegation] `json:"delegations"`
}

AllDelegationsResponse is the expected response to AllDelegationsQuery

type AllDenomMetadataQuery

type AllDenomMetadataQuery struct {
	// Pagination is an optional argument.
	// Default pagination will be used if this is omitted
	Pagination *PageRequest `json:"pagination,omitempty"`
}

type AllDenomMetadataResponse

type AllDenomMetadataResponse struct {
	Metadata []DenomMetadata `json:"metadata"`
	// NextKey is the key to be passed to PageRequest.key to
	// query the next page most efficiently. It will be empty if
	// there are no more results.
	NextKey []byte `json:"next_key,omitempty"`
}

type AllValidatorsQuery

type AllValidatorsQuery struct{}

type AllValidatorsResponse

type AllValidatorsResponse struct {
	Validators Array[Validator] `json:"validators"`
}

AllValidatorsResponse is the expected response to AllValidatorsQuery

type AnalysisReport

type AnalysisReport struct {
	HasIBCEntryPoints    bool
	RequiredCapabilities string
	Entrypoints          []string
}

Contains static analysis info of the contract (the Wasm code to be precise). This type is returned by VM.AnalyzeCode().

type AnyMsg

type AnyMsg struct {
	TypeURL string `json:"type_url"`
	Value   []byte `json:"value"`
}

AnyMsg is encoded the same way as a protobof [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)

type Array

type Array[C any] []C

Array is a wrapper around a slice that ensures that we get "[]" JSON for nil values. When unmarshaling, we get an empty slice for "[]" and "null".

This is needed for fields that are "Vec<C>" on the Rust side because `null` values will result in an error there. Using this on a field with an "Option<Vec<C>>" type on the Rust side would never result in a "None" value on the Rust side, making the "Option" pointless.

func (Array[C]) MarshalJSON

func (a Array[C]) MarshalJSON() ([]byte, error)

MarshalJSON ensures that we get "[]" for nil arrays

func (*Array[C]) UnmarshalJSON

func (a *Array[C]) UnmarshalJSON(data []byte) error

UnmarshalJSON ensures that we get an empty slice for "[]" and "null"

type BalanceQuery

type BalanceQuery struct {
	Address string `json:"address"`
	Denom   string `json:"denom"`
}

type BalanceResponse

type BalanceResponse struct {
	Amount Coin `json:"amount"`
}

BalanceResponse is the expected response to BalanceQuery

type BankMsg

type BankMsg struct {
	Send *SendMsg `json:"send,omitempty"`
	Burn *BurnMsg `json:"burn,omitempty"`
}

type BankQuery

type BankQuery struct {
	Supply           *SupplyQuery           `json:"supply,omitempty"`
	Balance          *BalanceQuery          `json:"balance,omitempty"`
	AllBalances      *AllBalancesQuery      `json:"all_balances,omitempty"`
	DenomMetadata    *DenomMetadataQuery    `json:"denom_metadata,omitempty"`
	AllDenomMetadata *AllDenomMetadataQuery `json:"all_denom_metadata,omitempty"`
}

type BlockInfo

type BlockInfo struct {
	// block height this transaction is executed
	Height uint64 `json:"height"`
	// time in nanoseconds since unix epoch. Uses Uint64 to ensure JavaScript compatibility.
	Time    Uint64 `json:"time"`
	ChainID string `json:"chain_id"`
}

type BondedDenomResponse

type BondedDenomResponse struct {
	Denom string `json:"denom"`
}

type BurnMsg

type BurnMsg struct {
	Amount Array[Coin] `json:"amount"`
}

BurnMsg will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.

type CanonicalAddress

type CanonicalAddress = []byte

CanonicalAddress uses standard base64 encoding, just use it as a label for developers

type CanonicalizeAddressFunc

type CanonicalizeAddressFunc func(string) ([]byte, uint64, error)

CanonicalizeAddressFunc is a type for functions that convert a human readable address (typically bech32) to a canonical address (bytes).

type ChannelQuery

type ChannelQuery struct {
	// optional argument
	PortID    string `json:"port_id,omitempty"`
	ChannelID string `json:"channel_id"`
}

type ChannelResponse

type ChannelResponse struct {
	// may be empty if there is no matching channel
	Channel *IBCChannel `json:"channel,omitempty"`
}

type Checksum

type Checksum []byte

Checksum represents a hash of the Wasm bytecode that serves as an ID. Must be generated from this library. The length of a checksum must always be ChecksumLen.

func ForceNewChecksum

func ForceNewChecksum(input string) Checksum

ForceNewChecksum creates a Checksum instance from a hex string. It panics in case the input is invalid.

func (Checksum) MarshalJSON

func (cs Checksum) MarshalJSON() ([]byte, error)

func (*Checksum) UnmarshalJSON

func (cs *Checksum) UnmarshalJSON(input []byte) error

type ClearAdminMsg

type ClearAdminMsg struct {
	// ContractAddr is the sdk.AccAddress of the target contract.
	ContractAddr string `json:"contract_addr"`
}

ClearAdminMsg is the Go counterpart of WasmMsg::ClearAdmin (https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta5/packages/std/src/results/cosmos_msg.rs#L158-L160).

type CloseChannelMsg

type CloseChannelMsg struct {
	ChannelID string `json:"channel_id"`
}

type CodeInfoQuery

type CodeInfoQuery struct {
	CodeID uint64 `json:"code_id"`
}

type CodeInfoResponse

type CodeInfoResponse struct {
	CodeID  uint64 `json:"code_id"`
	Creator string `json:"creator"`
	// Checksum is the hash of the Wasm blob. This field must always be set to a 32 byte value.
	// Everything else is considered a bug.
	Checksum Checksum `json:"checksum"`
}

type Coin

type Coin struct {
	Denom  string `json:"denom"`  // type, eg. "ATOM"
	Amount string `json:"amount"` // string encoding of decimal value, eg. "12.3456"
}

Coin is a string representation of the sdk.Coin type (more portable than sdk.Int)

func NewCoin

func NewCoin(amount uint64, denom string) Coin

type ContractInfo

type ContractInfo struct {
	// Bech32 encoded 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 ContractInfoResponse struct {
	CodeID  uint64 `json:"code_id"`
	Creator string `json:"creator"`
	// Set to the admin who can migrate contract, if any
	Admin  string `json:"admin,omitempty"`
	Pinned bool   `json:"pinned"`
	// Set if the contract is IBC enabled
	IBCPort string `json:"ibc_port,omitempty"`
}

type ContractResult

type ContractResult struct {
	Ok  *Response `json:"ok,omitempty"`
	Err string    `json:"error,omitempty"`
}

ContractResult is the raw response from the instantiate/execute/migrate calls. This is mirrors Rust's ContractResult<Response>.

func (*ContractResult) SubMessages

func (r *ContractResult) SubMessages() []SubMsg

type CosmosMsg

type CosmosMsg struct {
	Bank         *BankMsg         `json:"bank,omitempty"`
	Custom       json.RawMessage  `json:"custom,omitempty"`
	Distribution *DistributionMsg `json:"distribution,omitempty"`
	Gov          *GovMsg          `json:"gov,omitempty"`
	IBC          *IBCMsg          `json:"ibc,omitempty"`
	Staking      *StakingMsg      `json:"staking,omitempty"`
	Any          *AnyMsg          `json:"any,omitempty"`
	Wasm         *WasmMsg         `json:"wasm,omitempty"`
}

CosmosMsg is an rust enum and only (exactly) one of the fields should be set Should we do a cleaner approach in Go? (type/data?)

func (*CosmosMsg) UnmarshalJSON

func (m *CosmosMsg) UnmarshalJSON(data []byte) error

type DecCoin

type DecCoin struct {
	// An amount in the base denom of the distributed token.
	//
	// Some chains have chosen atto (10^-18) for their token's base denomination. If we used `Decimal` here, we could only store 340282366920938463463.374607431768211455atoken which is 340.28 TOKEN.
	Amount string `json:"amount"`
	Denom  string `json:"denom"`
}

A coin type with decimal amount. Modeled after the Cosmos SDK's DecCoin type. However, in contrast to the Cosmos SDK the `amount` string MUST always have a dot at JSON level, see <https://github.com/cosmos/cosmos-sdk/issues/10863>. Also if Cosmos SDK choses to migrate away from fixed point decimals (as shown [here](https://github.com/cosmos/cosmos-sdk/blob/v0.47.4/x/group/internal/math/dec.go#L13-L21) and discussed [here](https://github.com/cosmos/cosmos-sdk/issues/11783)), wasmd needs to truncate the decimal places to 18.

DecCoin: (https://github.com/cosmos/cosmos-sdk/blob/v0.47.4/proto/cosmos/base/v1beta1/coin.proto#L28-L38)

type DelegateMsg

type DelegateMsg struct {
	Validator string `json:"validator"`
	Amount    Coin   `json:"amount"`
}

type Delegation

type Delegation struct {
	Delegator string `json:"delegator"`
	Validator string `json:"validator"`
	Amount    Coin   `json:"amount"`
}

type DelegationQuery

type DelegationQuery struct {
	Delegator string `json:"delegator"`
	Validator string `json:"validator"`
}

type DelegationResponse

type DelegationResponse struct {
	Delegation *FullDelegation `json:"delegation,omitempty"`
}

DelegationResponse is the expected response to Array[Delegation]Query

type DelegationRewardsQuery

type DelegationRewardsQuery struct {
	DelegatorAddress string `json:"delegator_address"`
	ValidatorAddress string `json:"validator_address"`
}

type DelegationTotalRewardsQuery

type DelegationTotalRewardsQuery struct {
	DelegatorAddress string `json:"delegator_address"`
}

type DelegatorReward

type DelegatorReward struct {
	Reward           []DecCoin `json:"reward"`
	ValidatorAddress string    `json:"validator_address"`
}

type DelegatorValidatorsQuery

type DelegatorValidatorsQuery struct {
	DelegatorAddress string `json:"delegator_address"`
}

type DelegatorWithdrawAddressQuery

type DelegatorWithdrawAddressQuery struct {
	DelegatorAddress string `json:"delegator_address"`
}

type DelegatorWithdrawAddressResponse

type DelegatorWithdrawAddressResponse struct {
	WithdrawAddress string `json:"withdraw_address"`
}

type DenomMetadata

type DenomMetadata struct {
	Description string `json:"description"`
	// DenomUnits represents the list of DenomUnits for a given coin
	DenomUnits []DenomUnit `json:"denom_units"`
	// Base represents the base denom (should be the DenomUnit with exponent = 0).
	Base string `json:"base"`
	// Display indicates the suggested denom that should be
	// displayed in clients.
	Display string `json:"display"`
	// Name defines the name of the token (eg: Cosmos Atom)
	//
	// Since: cosmos-sdk 0.43
	Name string `json:"name"`
	// Symbol is the token symbol usually shown on exchanges (eg: ATOM). This can
	// be the same as the display.
	//
	// Since: cosmos-sdk 0.43
	Symbol string `json:"symbol"`
	// URI to a document (on or off-chain) that contains additional information. Optional.
	//
	// Since: cosmos-sdk 0.46
	URI string `json:"uri"`
	// URIHash is a sha256 hash of a document pointed by URI. It's used to verify that
	// the document didn't change. Optional.
	//
	// Since: cosmos-sdk 0.46
	URIHash string `json:"uri_hash"`
}

Replicating the cosmos-sdk bank module Metadata type

type DenomMetadataQuery

type DenomMetadataQuery struct {
	Denom string `json:"denom"`
}

type DenomMetadataResponse

type DenomMetadataResponse struct {
	Metadata DenomMetadata `json:"metadata"`
}

type DenomUnit

type DenomUnit struct {
	// Denom represents the string name of the given denom unit (e.g uatom).
	Denom string `json:"denom"`
	// Exponent represents power of 10 exponent that one must
	// raise the base_denom to in order to equal the given DenomUnit's denom
	// 1 denom = 10^exponent base_denom
	// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
	// exponent = 6, thus: 1 atom = 10^6 uatom).
	Exponent uint32 `json:"exponent"`
	// Aliases is a list of string aliases for the given denom
	Aliases []string `json:"aliases"`
}

Replicating the cosmos-sdk bank module DenomUnit type

type DistributionMsg

type DistributionMsg struct {
	SetWithdrawAddress      *SetWithdrawAddressMsg      `json:"set_withdraw_address,omitempty"`
	WithdrawDelegatorReward *WithdrawDelegatorRewardMsg `json:"withdraw_delegator_reward,omitempty"`
	FundCommunityPool       *FundCommunityPoolMsg       `json:"fund_community_pool,omitempty"`
}

type Env

type Env struct {
	Block       BlockInfo        `json:"block"`
	Transaction *TransactionInfo `json:"transaction"`
	Contract    ContractInfo     `json:"contract"`
}

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 Event

type Event struct {
	Type       string                `json:"type"`
	Attributes Array[EventAttribute] `json:"attributes"`
}

type EventAttribute

type EventAttribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

EventAttribute

type ExecuteMsg

type ExecuteMsg struct {
	// ContractAddr is the sdk.AccAddress of the contract, which uniquely defines
	// the contract ID and instance ID. The sdk module should maintain a reverse lookup table.
	ContractAddr string `json:"contract_addr"`
	// Msg is assumed to be a json-encoded message, which will be passed directly
	// as `userMsg` when calling `Handle` on the above-defined contract
	Msg []byte `json:"msg"`
	// Send is an optional amount of coins this contract sends to the called contract
	Funds Array[Coin] `json:"funds"`
}

ExecuteMsg is used to call another defined contract on this chain. The calling contract requires the callee to be defined beforehand, and the address should have been defined in initialization. And we assume the developer tested the ABIs and coded them together.

Since a contract is immutable once it is deployed, we don't need to transform this. If it was properly coded and worked once, it will continue to work throughout upgrades.

type Fraction

type Fraction struct {
	Numerator   int64
	Denominator int64
}

func (Fraction) Floor

func (f Fraction) Floor() int64

func (*Fraction) Mul

func (f *Fraction) Mul(m int64) Fraction

type FullDelegation

type FullDelegation struct {
	Delegator          string      `json:"delegator"`
	Validator          string      `json:"validator"`
	Amount             Coin        `json:"amount"`
	AccumulatedRewards Array[Coin] `json:"accumulated_rewards"`
	CanRedelegate      Coin        `json:"can_redelegate"`
}

type FundCommunityPoolMsg

type FundCommunityPoolMsg struct {
	// Amount is the list of coins to be send to the community pool
	Amount Array[Coin] `json:"amount"`
}

FundCommunityPoolMsg is translated to a [MsgFundCommunityPool](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#LL69C1-L76C2). `depositor` is automatically filled with the current contract's address

type Gas

type Gas = uint64

type GasMeter

type GasMeter interface {
	GasConsumed() Gas
}

GasMeter is a read-only version of the sdk gas meter It is a copy of an interface declaration from cosmos-sdk https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34

type GasReport

type GasReport struct {
	Limit          uint64
	Remaining      uint64
	UsedExternally uint64
	UsedInternally uint64
}

func EmptyGasReport

func EmptyGasReport(limit uint64) GasReport

type GoAPI

type GoAPI struct {
	HumanizeAddress     HumanizeAddressFunc
	CanonicalizeAddress CanonicalizeAddressFunc
	ValidateAddress     ValidateAddressFunc
}

type GovMsg

type GovMsg struct {
	// This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.
	Vote *VoteMsg `json:"vote,omitempty"`
	/// This maps directly to [MsgVoteWeighted](https://github.com/cosmos/cosmos-sdk/blob/v0.45.8/proto/cosmos/gov/v1beta1/tx.proto#L66-L78) in the Cosmos SDK with voter set to the contract address.
	VoteWeighted *VoteWeightedMsg `json:"vote_weighted,omitempty"`
}

type GrpcQuery

type GrpcQuery struct {
	// The expected protobuf message type (not [Any](https://protobuf.dev/programming-guides/proto3/#any)), binary encoded
	Data []byte `json:"data"`
	// The fully qualified endpoint path used for routing.
	// It follows the format `/service_path/method_name`,
	// eg. "/cosmos.authz.v1beta1.Query/Grants"
	Path string `json:"path"`
}

GrpcQuery queries the chain using a grpc query. This allows to query information that is not exposed in our API. The chain needs to allowlist the supported queries.

The returned data is protobuf encoded. The protobuf type depends on the query.

type HumanAddress

type HumanAddress = string

HumanAddress is a printable (typically bech32 encoded) address string. Just use it as a label for developers.

type HumanizeAddressFunc

type HumanizeAddressFunc func([]byte) (string, uint64, error)

HumanizeAddressFunc is a type for functions that convert a canonical address (bytes) to a human readable address (typically bech32).

type IBC3ChannelOpenResponse

type IBC3ChannelOpenResponse struct {
	Version string `json:"version"`
}

IBC3ChannelOpenResponse is version negotiation data for the handshake

type IBCAcknowledgement

type IBCAcknowledgement struct {
	Data []byte `json:"data"`
}

type IBCBasicResponse

type IBCBasicResponse struct {
	// Messages comes directly from the contract and is its request for action.
	// If the ReplyOn value matches the result, the runtime will invoke this
	// contract's `reply` entry point after execution. Otherwise, this is all
	// "fire and forget".
	Messages []SubMsg `json:"messages"`
	// attributes for a log event to return over abci interface
	Attributes []EventAttribute `json:"attributes"`
	// custom events (separate from the main one that contains the attributes
	// above)
	Events []Event `json:"events"`
}

IBCBasicResponse defines the return value on a successful processing. This is the counterpart of [IbcBasicResponse](https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/ibc.rs#L194-L216).

type IBCBasicResult

type IBCBasicResult struct {
	Ok  *IBCBasicResponse `json:"ok,omitempty"`
	Err string            `json:"error,omitempty"`
}

This is the return value for the majority of the ibc handlers. That are able to dispatch messages / events on their own, but have no meaningful return value to the calling code.

Callbacks that have return values (like ibc_receive_packet) or that cannot redispatch messages (like ibc_channel_open) will use other Response types

func (*IBCBasicResult) SubMessages

func (r *IBCBasicResult) SubMessages() []SubMsg

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 IBCChannelCloseMsg

type IBCChannelCloseMsg struct {
	CloseInit    *IBCCloseInit    `json:"close_init,omitempty"`
	CloseConfirm *IBCCloseConfirm `json:"close_confirm,omitempty"`
}

func (IBCChannelCloseMsg) GetChannel

func (msg IBCChannelCloseMsg) GetChannel() IBCChannel

GetChannel returns the IBCChannel in this message.

type IBCChannelConnectMsg

type IBCChannelConnectMsg struct {
	OpenAck     *IBCOpenAck     `json:"open_ack,omitempty"`
	OpenConfirm *IBCOpenConfirm `json:"open_confirm,omitempty"`
}

func (IBCChannelConnectMsg) GetChannel

func (msg IBCChannelConnectMsg) GetChannel() IBCChannel

GetChannel returns the IBCChannel in this message.

func (IBCChannelConnectMsg) GetCounterVersion

func (msg IBCChannelConnectMsg) GetCounterVersion() (ver string, ok bool)

GetCounterVersion checks if the message has a counterparty version and returns it if so.

type IBCChannelOpenMsg

type IBCChannelOpenMsg struct {
	OpenInit *IBCOpenInit `json:"open_init,omitempty"`
	OpenTry  *IBCOpenTry  `json:"open_try,omitempty"`
}

func (IBCChannelOpenMsg) GetChannel

func (msg IBCChannelOpenMsg) GetChannel() IBCChannel

GetChannel returns the IBCChannel in this message.

func (IBCChannelOpenMsg) GetCounterVersion

func (msg IBCChannelOpenMsg) GetCounterVersion() (ver string, ok bool)

GetCounterVersion checks if the message has a counterparty version and returns it if so.

type IBCChannelOpenResult

type IBCChannelOpenResult struct {
	Ok  *IBC3ChannelOpenResponse `json:"ok,omitempty"`
	Err string                   `json:"error,omitempty"`
}

IBCChannelOpenResult is the raw response from the ibc_channel_open call. This is mirrors Rust's ContractResult<()>. Check if Err == "" to see if this is success On Success, IBCV3ChannelOpenResponse *may* be set if the contract is ibcv3 compatible and wishes to define a custom version in the handshake.

type IBCCloseConfirm

type IBCCloseConfirm struct {
	Channel IBCChannel `json:"channel"`
}

func (*IBCCloseConfirm) ToMsg

type IBCCloseInit

type IBCCloseInit struct {
	Channel IBCChannel `json:"channel"`
}

func (*IBCCloseInit) ToMsg

func (m *IBCCloseInit) ToMsg() IBCChannelCloseMsg

type IBCEndpoint

type IBCEndpoint struct {
	PortID    string `json:"port_id"`
	ChannelID string `json:"channel_id"`
}

type IBCMsg

type IBCMsg struct {
	Transfer     *TransferMsg     `json:"transfer,omitempty"`
	SendPacket   *SendPacketMsg   `json:"send_packet,omitempty"`
	CloseChannel *CloseChannelMsg `json:"close_channel,omitempty"`
}

type IBCOpenAck

type IBCOpenAck struct {
	Channel             IBCChannel `json:"channel"`
	CounterpartyVersion string     `json:"counterparty_version"`
}

func (*IBCOpenAck) ToMsg

func (m *IBCOpenAck) ToMsg() IBCChannelConnectMsg

type IBCOpenConfirm

type IBCOpenConfirm struct {
	Channel IBCChannel `json:"channel"`
}

func (*IBCOpenConfirm) ToMsg

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 IBCPacket

type IBCPacket struct {
	Data     []byte      `json:"data"`
	Src      IBCEndpoint `json:"src"`
	Dest     IBCEndpoint `json:"dest"`
	Sequence uint64      `json:"sequence"`
	Timeout  IBCTimeout  `json:"timeout"`
}

type IBCPacketAckMsg

type IBCPacketAckMsg struct {
	Acknowledgement IBCAcknowledgement `json:"acknowledgement"`
	OriginalPacket  IBCPacket          `json:"original_packet"`
	Relayer         string             `json:"relayer"`
}

type IBCPacketReceiveMsg

type IBCPacketReceiveMsg struct {
	Packet  IBCPacket `json:"packet"`
	Relayer string    `json:"relayer"`
}

type IBCPacketTimeoutMsg

type IBCPacketTimeoutMsg struct {
	Packet  IBCPacket `json:"packet"`
	Relayer string    `json:"relayer"`
}

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 IBCReceiveResponse

type IBCReceiveResponse struct {
	// Acknowledgement is binary encoded data to be returned to calling chain as the acknowledgement.
	// If this field is nil, no acknowledgement must be written. For contracts before CosmWasm 2.0, this
	// was always a non-nil value. See also https://github.com/CosmWasm/cosmwasm/pull/1892.
	Acknowledgement []byte `json:"acknowledgement"`
	// Messages comes directly from the contract and is it's request for action.
	// If the ReplyOn value matches the result, the runtime will invoke this
	// contract's `reply` entry point after execution. Otherwise, this is all
	// "fire and forget".
	Messages   []SubMsg         `json:"messages"`
	Attributes []EventAttribute `json:"attributes"`
	// custom events (separate from the main one that contains the attributes
	// above)
	Events []Event `json:"events"`
}

IBCReceiveResponse defines the return value on packet response processing. This "success" case should be returned even in application-level errors, Where the Acknowledgement bytes contain an encoded error message to be returned to the calling chain. (Returning IBCReceiveResult::Err will abort processing of this packet and not inform the calling chain). This is the counterpart of (IbcReceiveResponse)(https://github.com/CosmWasm/cosmwasm/blob/v0.15.0/packages/std/src/ibc.rs#L247-L267).

type IBCReceiveResult

type IBCReceiveResult struct {
	Ok  *IBCReceiveResponse `json:"ok,omitempty"`
	Err string              `json:"error,omitempty"`
}

This is the return value for the majority of the ibc handlers. That are able to dispatch messages / events on their own, but have no meaningful return value to the calling code.

Callbacks that have return values (like receive_packet) or that cannot redispatch messages (like the handshake callbacks) will use other Response types

func (*IBCReceiveResult) SubMessages

func (r *IBCReceiveResult) SubMessages() []SubMsg

type IBCTimeout

type IBCTimeout struct {
	Block *IBCTimeoutBlock `json:"block"`
	// Nanoseconds since UNIX epoch
	Timestamp uint64 `json:"timestamp,string,omitempty"`
}

IBCTimeout is the timeout for an IBC packet. At least one of block and timestamp is required.

type IBCTimeoutBlock

type IBCTimeoutBlock struct {
	// the version that the client is currently on
	// (eg. after reseting the chain this could increment 1 as height drops to 0)
	Revision uint64 `json:"revision"`
	// block height after which the packet times out.
	// the height within the given revision
	Height uint64 `json:"height"`
}

IBCTimeoutBlock Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)

func (IBCTimeoutBlock) IsZero

func (t IBCTimeoutBlock) IsZero() bool

type Instantiate2Msg

type Instantiate2Msg struct {
	// CodeID is the reference to the wasm byte code as used by the Cosmos-SDK
	CodeID uint64 `json:"code_id"`
	// Msg is assumed to be a json-encoded message, which will be passed directly
	// as `userMsg` when calling `Instantiate` on a new contract with the above-defined CodeID
	Msg []byte `json:"msg"`
	// Send is an optional amount of coins this contract sends to the called contract
	Funds Array[Coin] `json:"funds"`
	// Label is optional metadata to be stored with a contract instance.
	Label string `json:"label"`
	// Admin (optional) may be set here to allow future migrations from this address
	Admin string `json:"admin,omitempty"`
	Salt  []byte `json:"salt"`
}

Instantiate2Msg will create a new contract instance from a previously uploaded CodeID using the predictable address derivation.

type InstantiateMsg

type InstantiateMsg struct {
	// CodeID is the reference to the wasm byte code as used by the Cosmos-SDK
	CodeID uint64 `json:"code_id"`
	// Msg is assumed to be a json-encoded message, which will be passed directly
	// as `userMsg` when calling `Instantiate` on a new contract with the above-defined CodeID
	Msg []byte `json:"msg"`
	// Send is an optional amount of coins this contract sends to the called contract
	Funds Array[Coin] `json:"funds"`
	// Label is optional metadata to be stored with a contract instance.
	Label string `json:"label"`
	// Admin (optional) may be set here to allow future migrations from this address
	Admin string `json:"admin,omitempty"`
}

InstantiateMsg will create a new contract instance from a previously uploaded CodeID. This allows one contract to spawn "sub-contracts".

type Int64

type Int64 int64

Int64 is a wrapper for int64, but it is marshalled to and from JSON as a string

func (Int64) MarshalJSON

func (i Int64) MarshalJSON() ([]byte, error)

func (*Int64) UnmarshalJSON

func (i *Int64) UnmarshalJSON(data []byte) error

type InvalidRequest

type InvalidRequest struct {
	Err     string `json:"error"`
	Request []byte `json:"request"`
}

func (InvalidRequest) Error

func (e InvalidRequest) Error() string

type InvalidResponse

type InvalidResponse struct {
	Err      string `json:"error"`
	Response []byte `json:"response"`
}

func (InvalidResponse) Error

func (e InvalidResponse) Error() string

type Iterator

type Iterator interface {
	// Domain returns the start (inclusive) and end (exclusive) limits of the iterator.
	// CONTRACT: start, end readonly []byte
	Domain() (start []byte, end []byte)

	// Valid returns whether the current iterator is valid. Once invalid, the Iterator remains
	// invalid forever.
	Valid() bool

	// Next moves the iterator to the next key in the database, as defined by order of iteration.
	// If Valid returns false, this method will panic.
	Next()

	// Key returns the key at the current position. Panics if the iterator is invalid.
	// CONTRACT: key readonly []byte
	Key() (key []byte)

	// Value returns the value at the current position. Panics if the iterator is invalid.
	// CONTRACT: value readonly []byte
	Value() (value []byte)

	// Error returns the last error encountered by the iterator, if any.
	Error() error

	// Close closes the iterator, releasing any allocated resources.
	Close() error
}

Iterator represents an iterator over a domain of keys. Callers must call Close when done. No writes can happen to a domain while there exists an iterator over it, some backends may take out database locks to ensure this will not happen.

Callers must make sure the iterator is valid before calling any methods on it, otherwise these methods will panic. This is in part caused by most backend databases using this convention.

As with DB, keys and values should be considered read-only, and must be copied before they are modified.

Typical usage:

var itr Iterator = ... defer itr.Close()

for ; itr.Valid(); itr.Next() {
  k, v := itr.Key(); itr.Value()
  ...
}

if err := itr.Error(); err != nil {
  ...
}

Copied from https://github.com/tendermint/tm-db/blob/v0.6.7/types.go#L121

type KVStore

type KVStore interface {
	Get(key []byte) []byte
	Set(key, value []byte)
	Delete(key []byte)

	// Iterator over a domain of keys in ascending order. End is exclusive.
	// Start must be less than end, or the Iterator is invalid.
	// Iterator must be closed by caller.
	// To iterate over entire domain, use store.Iterator(nil, nil)
	Iterator(start, end []byte) Iterator

	// ReverseIterator iterator over a domain of keys in descending order. End is exclusive.
	// Start must be less than end, or the Iterator is invalid.
	// Iterator must be closed by caller.
	ReverseIterator(start, end []byte) Iterator
}

KVStore copies a subset of types from cosmos-sdk We may wish to make this more generic sometime in the future, but not now https://github.com/cosmos/cosmos-sdk/blob/bef3689245bab591d7d169abd6bea52db97a70c7/store/types/store.go#L170

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 Array[IBCChannel] `json:"channels"`
}

type MessageInfo

type MessageInfo struct {
	// Bech32 encoded sdk.AccAddress executing the contract
	Sender HumanAddress `json:"sender"`
	// Amount of funds send to the contract along with this message
	Funds Array[Coin] `json:"funds"`
}

type Metrics

type Metrics struct {
	HitsPinnedMemoryCache     uint32
	HitsMemoryCache           uint32
	HitsFsCache               uint32
	Misses                    uint32
	ElementsPinnedMemoryCache uint64
	ElementsMemoryCache       uint64
	// Cumulative size of all elements in pinned memory cache (in bytes)
	SizePinnedMemoryCache uint64
	// Cumulative size of all elements in memory cache (in bytes)
	SizeMemoryCache uint64
}

type MigrateMsg

type MigrateMsg struct {
	// ContractAddr is the sdk.AccAddress of the target contract, to migrate.
	ContractAddr string `json:"contract_addr"`
	// NewCodeID is the reference to the wasm byte code for the new logic to migrate to
	NewCodeID uint64 `json:"new_code_id"`
	// Msg is assumed to be a json-encoded message, which will be passed directly
	// as `userMsg` when calling `Migrate` on the above-defined contract
	Msg []byte `json:"msg"`
}

MigrateMsg will migrate an existing contract from it's current wasm code (logic) to another previously uploaded wasm code. It requires the calling contract to be listed as "admin" of the contract to be migrated.

type MsgResponse

type MsgResponse struct {
	TypeURL string `json:"type_url"`
	Value   []byte `json:"value"`
}

type NoSuchCode

type NoSuchCode struct {
	CodeID uint64 `json:"code_id,omitempty"`
}

func (NoSuchCode) Error

func (e NoSuchCode) Error() string

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 PageRequest

type PageRequest struct {
	// Key is a value returned in PageResponse.next_key to begin
	// querying the next page most efficiently. Only one of offset or key
	// should be set.
	Key []byte `json:"key"`
	// Limit is the total number of results to be returned in the result page.
	// If left empty it will default to a value to be set by each app.
	Limit uint32 `json:"limit"`
	// Reverse is set to true if results are to be returned in the descending order.
	Reverse bool `json:"reverse"`
}

Simplified version of the cosmos-sdk PageRequest type

type PortIDQuery

type PortIDQuery struct{}

type PortIDResponse

type PortIDResponse struct {
	PortID string `json:"port_id"`
}

type Querier

type Querier interface {
	// Query takes a query request, performs the query and returns the response.
	// It takes a gas limit measured in [CosmWasm gas] (aka. wasmvm gas) to ensure
	// the query does not consume more gas than the contract execution has left.
	//
	// [CosmWasm gas]: https://github.com/CosmWasm/cosmwasm/blob/v1.3.1/docs/GAS.md
	Query(request QueryRequest, gasLimit uint64) ([]byte, error)
	// GasConsumed returns the gas that was consumed by the querier during its entire
	// lifetime or by the context in which it was executed in. The absolute gas values
	// must not be used directly as it is undefined what is included in this value. Instead
	// wasmvm will call GasConsumed before and after the query and use the difference
	// as the query's gas usage.
	// Like the gas limit above, this is measured in [CosmWasm gas] (aka. wasmvm gas).
	//
	// [CosmWasm gas]: https://github.com/CosmWasm/cosmwasm/blob/v1.3.1/docs/GAS.md
	GasConsumed() uint64
}

Querier is a thing that allows the contract to query information from the environment it is executed in. This is typically used to query a different contract or another module in a Cosmos blockchain.

Queries are performed synchronously, i.e. the original caller is blocked until the query response is returned.

type QuerierResult

type QuerierResult struct {
	Ok  *QueryResult `json:"ok,omitempty"`
	Err *SystemError `json:"error,omitempty"`
}

This is a 2-level result

func RustQuery

func RustQuery(querier Querier, binRequest []byte, 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"`
	IBC          *IBCQuery          `json:"ibc,omitempty"`
	Staking      *StakingQuery      `json:"staking,omitempty"`
	Distribution *DistributionQuery `json:"distribution,omitempty"`
	Stargate     *StargateQuery     `json:"stargate,omitempty"`
	Grpc         *GrpcQuery         `json:"grpc,omitempty"`
	Wasm         *WasmQuery         `json:"wasm,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 QueryResult

type QueryResult queryResultImpl

QueryResult is the Go counterpart of `ContractResult<Binary>`. The JSON annotations are used for deserializing directly. There is a custom serializer below.

func (QueryResult) MarshalJSON

func (q QueryResult) MarshalJSON() ([]byte, error)

A custom serializer that allows us to map QueryResult instances to the Rust enum `ContractResult<Binary>`

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 RedelegateMsg

type RedelegateMsg struct {
	SrcValidator string `json:"src_validator"`
	DstValidator string `json:"dst_validator"`
	Amount       Coin   `json:"amount"`
}

type Reply

type Reply struct {
	// The amount of gas used by the submessage, measured in [Cosmos SDK gas](https://github.com/CosmWasm/cosmwasm/blob/main/docs/GAS.md).
	GasUsed uint64 `json:"gas_used"`
	// The ID that the contract set when emitting the `SubMsg`. Use this to identify which submessage triggered the `reply`.
	ID     uint64       `json:"id"`
	Result SubMsgResult `json:"result"`
	// Some arbitrary data that the contract set when emitting the `SubMsg`.
	// This is just passed into the `reply` entry point and is not stored to state.
	//
	// Unset/nil/null cannot be differentiated from empty data.
	//
	// On chains running CosmWasm 1.x this field is never filled.
	Payload []byte `json:"payload"`
}

The result object returned to `reply`. We always get the ID from the submessage back and then must handle success and error cases ourselves.

type Response

type Response struct {
	// Messages comes directly from the contract and is its request for action.
	// If the ReplyOn value matches the result, the runtime will invoke this
	// contract's `reply` entry point after execution. Otherwise, this is all
	// "fire and forget".
	Messages []SubMsg `json:"messages"`
	// base64-encoded bytes to return as ABCI.Data field
	Data []byte `json:"data"`
	// attributes for a log event to return over abci interface
	Attributes []EventAttribute `json:"attributes"`
	// custom events (separate from the main one that contains the attributes
	// above)
	Events []Event `json:"events"`
}

Response defines the return value on a successful instantiate/execute/migrate. This is the counterpart of Response(https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta1/packages/std/src/results/response.rs#L73-L88)

type SendMsg

type SendMsg struct {
	ToAddress string      `json:"to_address"`
	Amount    Array[Coin] `json:"amount"`
}

SendMsg contains instructions for a Cosmos-SDK/SendMsg It has a fixed interface here and should be converted into the proper SDK format before dispatching

type SendPacketMsg

type SendPacketMsg struct {
	ChannelID string     `json:"channel_id"`
	Data      []byte     `json:"data"`
	Timeout   IBCTimeout `json:"timeout"`
}

type SetWithdrawAddressMsg

type SetWithdrawAddressMsg struct {
	// Address contains the `delegator_address` of a MsgSetWithdrawAddress
	Address string `json:"address"`
}

SetWithdrawAddressMsg is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.

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 StakingMsg

type StakingMsg struct {
	Delegate   *DelegateMsg   `json:"delegate,omitempty"`
	Undelegate *UndelegateMsg `json:"undelegate,omitempty"`
	Redelegate *RedelegateMsg `json:"redelegate,omitempty"`
}

type StakingQuery

type StakingQuery struct {
	AllValidators  *AllValidatorsQuery  `json:"all_validators,omitempty"`
	Validator      *ValidatorQuery      `json:"validator,omitempty"`
	AllDelegations *AllDelegationsQuery `json:"all_delegations,omitempty"`
	Delegation     *DelegationQuery     `json:"delegation,omitempty"`
	BondedDenom    *struct{}            `json:"bonded_denom,omitempty"`
}

type StargateQuery

type StargateQuery struct {
	// The expected protobuf message type (not [Any](https://protobuf.dev/programming-guides/proto3/#any)), binary encoded
	Data []byte `json:"data"`
	// The fully qualified endpoint path used for routing.
	// It follows the format `/service_path/method_name`,
	// eg. "/cosmos.authz.v1beta1.Query/Grants"
	Path string `json:"path"`
}

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 supposed to always be protobuf encoded data, but is JSON encoded on some chains. The caller is responsible for compiling the proper type definitions for both requests and responses.

type SubMsg

type SubMsg struct {
	// An arbitrary ID chosen by the contract.
	// This is typically used to match `Reply`s in the `reply` entry point to the submessage.
	ID  uint64    `json:"id"`
	Msg CosmosMsg `json:"msg"`
	// Some arbitrary data that the contract can set in an application specific way.
	// This is just passed into the `reply` entry point and is not stored to state.
	// Any encoding can be used. If `id` is used to identify a particular action,
	// the encoding can also be different for each of those actions since you can match `id`
	// first and then start processing the `payload`.
	//
	// The environment restricts the length of this field in order to avoid abuse. The limit
	// is environment specific and can change over time. The initial default is 128 KiB.
	//
	// Unset/nil/null cannot be differentiated from empty data.
	//
	// On chains running CosmWasm 1.x this field will be ignored.
	Payload []byte `json:"payload"`
	// Gas limit measured in [Cosmos SDK gas](https://github.com/CosmWasm/cosmwasm/blob/main/docs/GAS.md).
	//
	// Setting this to `None` means unlimited. Then the submessage execution can consume all gas of
	// the current execution context.
	GasLimit *uint64 `json:"gas_limit,omitempty"`
	ReplyOn  replyOn `json:"reply_on"`
}

SubMsg wraps a CosmosMsg with some metadata for handling replies (ID) and optionally limiting the gas usage (GasLimit)

type SubMsgResponse

type SubMsgResponse struct {
	Events       Array[Event]       `json:"events"`
	Data         []byte             `json:"data,omitempty"`
	MsgResponses Array[MsgResponse] `json:"msg_responses"`
}

SubMsgResponse contains information we get back from a successful sub message execution, with full Cosmos SDK events. This mirrors Rust's SubMsgResponse.

type SubMsgResult

type SubMsgResult struct {
	Ok  *SubMsgResponse `json:"ok,omitempty"`
	Err string          `json:"error,omitempty"`
}

SubMsgResult is the raw response we return from wasmd after executing a SubMsg. This mirrors Rust's SubMsgResult.

type SupplyQuery

type SupplyQuery struct {
	Denom string `json:"denom"`
}

type SupplyResponse

type SupplyResponse struct {
	Amount Coin `json:"amount"`
}

SupplyResponse is the expected response to SupplyQuery

type SystemError

type SystemError struct {
	InvalidRequest     *InvalidRequest     `json:"invalid_request,omitempty"`
	InvalidResponse    *InvalidResponse    `json:"invalid_response,omitempty"`
	NoSuchContract     *NoSuchContract     `json:"no_such_contract,omitempty"`
	NoSuchCode         *NoSuchCode         `json:"no_such_code,omitempty"`
	Unknown            *Unknown            `json:"unknown,omitempty"`
	UnsupportedRequest *UnsupportedRequest `json:"unsupported_request,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 TransferMsg

type TransferMsg struct {
	ChannelID string     `json:"channel_id"`
	ToAddress string     `json:"to_address"`
	Amount    Coin       `json:"amount"`
	Timeout   IBCTimeout `json:"timeout"`
	Memo      string     `json:"memo,omitempty"`
}

type UFraction

type UFraction struct {
	Numerator   uint64
	Denominator uint64
}

func (UFraction) Floor

func (f UFraction) Floor() uint64

func (*UFraction) Mul

func (f *UFraction) Mul(m uint64) UFraction

type Uint64

type Uint64 uint64

Uint64 is a wrapper for uint64, but it is marshalled to and from JSON as a string

func (Uint64) MarshalJSON

func (u Uint64) MarshalJSON() ([]byte, error)

func (*Uint64) UnmarshalJSON

func (u *Uint64) UnmarshalJSON(data []byte) error

type UndelegateMsg

type UndelegateMsg struct {
	Validator string `json:"validator"`
	Amount    Coin   `json:"amount"`
}

type Unknown

type Unknown struct{}

func (Unknown) Error

func (e Unknown) Error() string

type UnsupportedRequest

type UnsupportedRequest struct {
	Kind string `json:"kind,omitempty"`
}

func (UnsupportedRequest) Error

func (e UnsupportedRequest) Error() string

type UpdateAdminMsg

type UpdateAdminMsg struct {
	// ContractAddr is the sdk.AccAddress of the target contract.
	ContractAddr string `json:"contract_addr"`
	// Admin is the sdk.AccAddress of the new admin.
	Admin string `json:"admin"`
}

UpdateAdminMsg is the Go counterpart of WasmMsg::UpdateAdmin (https://github.com/CosmWasm/cosmwasm/blob/v0.14.0-beta5/packages/std/src/results/cosmos_msg.rs#L158-L160).

type ValidateAddressFunc

type ValidateAddressFunc func(string) (uint64, error)

ValidateAddressFunc is a type for functions that validate a human readable address (typically bech32).

type Validator

type Validator struct {
	Address string `json:"address"`
	// decimal string, eg "0.02"
	Commission string `json:"commission"`
	// decimal string, eg "0.02"
	MaxCommission string `json:"max_commission"`
	// decimal string, eg "0.02"
	MaxChangeRate string `json:"max_change_rate"`
}

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 VoteMsg

type VoteMsg struct {
	ProposalId uint64 `json:"proposal_id"`
	// Option is the vote option.
	//
	// This used to be called "vote", but was changed for consistency with Cosmos SDK.
	// The old name is still supported for backwards compatibility.
	Option voteOption `json:"option"`
}

func (*VoteMsg) UnmarshalJSON

func (m *VoteMsg) UnmarshalJSON(data []byte) error

type VoteWeightedMsg

type VoteWeightedMsg struct {
	ProposalId uint64               `json:"proposal_id"`
	Options    []WeightedVoteOption `json:"options"`
}

type WasmMsg

type WasmMsg struct {
	Execute      *ExecuteMsg      `json:"execute,omitempty"`
	Instantiate  *InstantiateMsg  `json:"instantiate,omitempty"`
	Instantiate2 *Instantiate2Msg `json:"instantiate2,omitempty"`
	Migrate      *MigrateMsg      `json:"migrate,omitempty"`
	UpdateAdmin  *UpdateAdminMsg  `json:"update_admin,omitempty"`
	ClearAdmin   *ClearAdminMsg   `json:"clear_admin,omitempty"`
}

type WasmQuery

type WasmQuery struct {
	Smart        *SmartQuery        `json:"smart,omitempty"`
	Raw          *RawQuery          `json:"raw,omitempty"`
	ContractInfo *ContractInfoQuery `json:"contract_info,omitempty"`
	CodeInfo     *CodeInfoQuery     `json:"code_info,omitempty"`
}

type WeightedVoteOption

type WeightedVoteOption struct {
	Option voteOption `json:"option"`
	// Weight is a Decimal string, e.g. "0.25" for 25%
	Weight string `json:"weight"`
}

type WithdrawDelegatorRewardMsg

type WithdrawDelegatorRewardMsg struct {
	// Validator contains `validator_address` of a MsgWithdrawDelegatorReward
	Validator string `json:"validator"`
}

WithdrawDelegatorRewardMsg is translated to a [MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.

Jump to

Keyboard shortcuts

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