types

package
v0.0.0-...-a1d3391 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JackaklEncoding

func JackaklEncoding() *moduletestutil.TestEncodingConfig

func NewInstantiateMsgWithChannelInitOptions

func NewInstantiateMsgWithChannelInitOptions(
	admin *string, connectionId string, counterpartyConnectionId string,
	counterpartyPortId *string, txEncoding *string,
) string

NewInstantiateMsgWithChannelInitOptions creates a new InstantiateMsg with channel init options.

Types

type BankCosmosMsg

type BankCosmosMsg struct {
	Send *BankSendCosmosMsg `json:"send,omitempty"`
}

type BankSendCosmosMsg

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

type ChannelOpenInitOptions

type ChannelOpenInitOptions struct {
	// The connection id on this chain.
	ConnectionId string `json:"connection_id"`
	// The counterparty connection id on the counterparty chain.
	CounterpartyConnectionId string `json:"counterparty_connection_id"`
	// The optional counterparty port id.
	CounterpartyPortId *string `json:"counterparty_port_id,omitempty"`
	// The optional tx encoding.
	TxEncoding *string `json:"tx_encoding,omitempty"`
}

type Coin

type Coin struct {
	Denom  string `json:"denom"`
	Amount string `json:"amount"`
}

type Contract

type Contract struct {
	Address string
	CodeID  string
	Chain   *cosmos.CosmosChain
}

func NewContract

func NewContract(address string, codeId string, chain *cosmos.CosmosChain) Contract

NewContract creates a new Contract instance

func (*Contract) ExecAnyMsg

func (c *Contract) ExecAnyMsg(ctx context.Context, callerKeyName string, execMsg string, extraExecTxArgs ...string) error

ExecAnyMsg executes the contract with the given exec message.

func (*Contract) Port

func (c *Contract) Port() string

type ContractCallbackCounter

type ContractCallbackCounter struct {
	Success uint64 `json:"success"`
	Error   uint64 `json:"error"`
	Timeout uint64 `json:"timeout"`
}

ContractCallbackCounter is used to represent the callback counter in the contract's storage

type ContractChannelState

type ContractChannelState struct {
	Channel       CwIbcChannel `json:"channel"`
	ChannelStatus string       `json:"channel_status"`
}

ContractChannelState is used to represent the channel state in the contract's storage

func (*ContractChannelState) IsOpen

func (c *ContractChannelState) IsOpen() bool

IsOpen returns true if the channel is open

type ContractCosmosMsg

type ContractCosmosMsg struct {
	Stargate     *StargateCosmosMsg     `json:"stargate,omitempty"`
	Bank         *BankCosmosMsg         `json:"bank,omitempty"`
	IBC          *IbcCosmosMsg          `json:"ibc,omitempty"`
	Staking      *StakingCosmosMsg      `json:"staking,omitempty"`
	Distribution *DistributionCosmosMsg `json:"distribution,omitempty"`
	Gov          *GovCosmosMsg          `json:"gov,omitempty"`
	Wasm         *WasmCosmosMsg         `json:"wasm,omitempty"`
}

func NewCosmosMsgWithBankSend

func NewCosmosMsgWithBankSend(toAddress string, amount []Coin) *ContractCosmosMsg

NewCosmosMsgWithBankSend creates a new CosmosMsg with a Bank message

func NewCosmosMsgWithIbcTransfer

func NewCosmosMsgWithIbcTransfer(channelID string, toAddress string, amount Coin) *ContractCosmosMsg

NewCosmosMsgWithIbcTransfer creates a new CosmosMsg with an IBC transfer message

func NewCosmosMsgWithStargate

func NewCosmosMsgWithStargate(typeUrl string, value []byte) *ContractCosmosMsg

NewCosmosMsgWithStargate creates a new CosmosMsg with a Stargate message

type ContractIcaInfo

type ContractIcaInfo struct {
	IcaAddress string `json:"ica_address"`
	ChannelID  string `json:"channel_id"`
}

ContractIcaInfo is used to represent the ICA info in the contract's state

type ContractState

type ContractState struct {
	Admin   string          `json:"admin"`
	IcaInfo ContractIcaInfo `json:"ica_info"`
}

ContractState is used to represent its state in Contract's storage

type CwIbcChannel

type CwIbcChannel struct {
	Endpoint             CwIbcEndpoint `json:"endpoint"`
	CounterpartyEndpoint CwIbcEndpoint `json:"counterparty_endpoint"`
	// Order is either "ORDER_UNORDERED" or "ORDER_ORDERED"
	Order        string `json:"order"`
	Version      string `json:"version"`
	ConnectionID string `json:"connection_id"`
}

CwIbcChannel is the channel defined in CosmWasm

type CwIbcEndpoint

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

CwIbcEndpoint is the endpoint of a channel defined in CosmWasm

type DistributionCosmosMsg

type DistributionCosmosMsg struct {
	SetWithdrawAddress      *DistributionSetWithdrawAddressCosmosMsg      `json:"set_withdraw_address,omitempty"`
	WithdrawDelegatorReward *DistributionWithdrawDelegatorRewardCosmosMsg `json:"withdraw_delegator_reward,omitempty"`
	FundCommunityPool       *DistributionFundCommunityPoolCosmosMsg       `json:"fund_community_pool,omitempty"`
}

type DistributionFundCommunityPoolCosmosMsg

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

type DistributionSetWithdrawAddressCosmosMsg

type DistributionSetWithdrawAddressCosmosMsg struct {
	Address string `json:"address"`
}

type DistributionWithdrawDelegatorRewardCosmosMsg

type DistributionWithdrawDelegatorRewardCosmosMsg struct {
	Validator string `json:"validator"`
}

type EncodingConfig

type EncodingConfig struct {
	InterfaceRegistry types.InterfaceRegistry
	Codec             codec.Codec
	TxConfig          client.TxConfig
	Amino             *codec.LegacyAmino
}

EncodingConfig specifies the concrete encoding types to use for a given app. This is provided for compatibility between protobuf and amino implementations.

func JackalEncoding

func JackalEncoding() EncodingConfig

junoEncoding registers the Juno specific module codecs so that the associated types and msgs will be supported when writing to the blocksdb sqlite database.

func MakeTestEncodingConfig

func MakeTestEncodingConfig() EncodingConfig

type ExecuteMsg

type ExecuteMsg struct {
	CreateChannel         *ExecuteMsg_CreateChannel         `json:"create_channel,omitempty"`
	CreateTransferChannel *ExecuteMsg_CreateTransferChannel `json:"create_transfer_channel,omitempty"`
	SendCosmosMsgs        *ExecuteMsg_SendCosmosMsgs        `json:"send_cosmos_msgs,omitempty"`
	SendCustomIcaMessages *ExecuteMsg_SendCustomIcaMessages `json:"send_custom_ica_messages,omitempty"`
	UpdateCallbackAddress *ExecuteMsg_UpdateCallbackAddress `json:"update_callback_address,omitempty"`
}

ExecuteMsg is the message to execute cw-ica-controller

func NewExecuteMsg_SendCosmosMsgs_FromProto

func NewExecuteMsg_SendCosmosMsgs_FromProto(msgs []proto.Message, memo *string, timeout *uint64, typeURL string) ExecuteMsg

NewExecuteMsg_SendCosmosMsgs_FromProto creates a new ExecuteMsg_SendCosmosMsgs.

func NewExecuteMsg_SendCustomIcaMessages_FromProto

func NewExecuteMsg_SendCustomIcaMessages_FromProto(cdc codec.BinaryCodec, msgs []proto.Message, encoding string, memo *string, timeout *uint64) ExecuteMsg

NewExecuteMsg_SendCustomIcaMessages_FromProto creates a new ExecuteMsg_SendCustomIcaMessages.

func (*ExecuteMsg) ToString

func (m *ExecuteMsg) ToString() string

ToString returns a string representation of the message

type ExecuteMsg_CreateChannel

type ExecuteMsg_CreateChannel struct {
	// The options to initialize the IBC channel.
	// If not specified, the options specified in the contract instantiation are used.
	ChannelOpenInitOptions *ChannelOpenInitOptions `json:"channel_open_init_options,omitempty"`
}

`CreateChannel` makes the contract submit a stargate MsgChannelOpenInit to the chain. This is a wrapper around [`options::ChannelOpenInitOptions`] and thus requires the same fields. If not specified, then the options specified in the contract instantiation are used.

type ExecuteMsg_CreateTransferChannel

type ExecuteMsg_CreateTransferChannel struct {
	// The connection id on this chain.
	ConnectionId string `json:"connection_id"`
	// The counterparty connection id on the counterparty chain.
	CounterpartyConnectionId string `json:"counterparty_connection_id"`
	// The optional counterparty port id.
	CounterpartyPortId *string `json:"counterparty_port_id,omitempty"`
	// The optional tx encoding.
	TxEncoding *string `json:"tx_encoding,omitempty"`
}

`CreateTransferChannel` is opening a transfer channel for development purposees only. Not using ChannelOpenInitOptions

type ExecuteMsg_SendCosmosMsgs

type ExecuteMsg_SendCosmosMsgs struct {
	// The stargate messages to convert and send to the ICA host.
	Messages []ContractCosmosMsg `json:"messages"`
	// Optional memo to include in the ibc packet.
	PacketMemo *string `json:"packet_memo,omitempty"`
	// Optional timeout in seconds to include with the ibc packet.
	// If not specified, the [default timeout](crate::ibc::types::packet::DEFAULT_TIMEOUT_SECONDS) is used.
	TimeoutSeconds *uint64 `json:"timeout_seconds,omitempty"`
}

`SendCosmosMsgs` converts the provided array of [`CosmosMsg`] to an ICA tx and sends them to the ICA host. [`CosmosMsg::Stargate`] and [`CosmosMsg::Wasm`] are only supported if the [`TxEncoding`](crate::ibc::types::metadata::TxEncoding) is [`TxEncoding::Protobuf`](crate::ibc::types::metadata::TxEncoding).

**This is the recommended way to send messages to the ICA host.**

type ExecuteMsg_SendCustomIcaMessages

type ExecuteMsg_SendCustomIcaMessages struct {
	Messages string `json:"messages"`
	// Optional memo to include in the ibc packet.
	PacketMemo *string `json:"packet_memo,omitempty"`
	// Optional timeout in seconds to include with the ibc packet.
	// If not specified, the [default timeout](crate::ibc::types::packet::DEFAULT_TIMEOUT_SECONDS) is used.
	TimeoutSeconds *uint64 `json:"timeout_seconds,omitempty"`
}

`SendCustomIcaMessages` sends custom messages from the ICA controller to the ICA host.

type ExecuteMsg_UpdateCallbackAddress

type ExecuteMsg_UpdateCallbackAddress struct {
	/// The new callback address. If not specified, then no callbacks are sent.
	CallbackAddress *string `json:"callback_address,omitempty"`
}

`UpdateCallbackAddress` updates the contract callback address.

type GovCosmosMsg

type GovCosmosMsg struct {
	Vote         *GovVoteCosmosMsg         `json:"vote,omitempty"`
	VoteWeighted *GovVoteWeightedCosmosMsg `json:"vote_weighted,omitempty"`
}

type GovVoteCosmosMsg

type GovVoteCosmosMsg struct {
	ProposalID uint64 `json:"proposal_id"`
	Vote       string `json:"vote"`
}

type GovVoteWeightedCosmosMsg

type GovVoteWeightedCosmosMsg struct {
	ProposalID uint64                  `json:"proposal_id"`
	Options    []GovVoteWeightedOption `json:"options"`
}

type GovVoteWeightedOption

type GovVoteWeightedOption struct {
	Option string `json:"option"`
	Weight string `json:"weight"`
}

type IbcCosmosMsg

type IbcCosmosMsg struct {
	Transfer *IbcTransferCosmosMsg `json:"transfer,omitempty"`
}

type IbcTransferCosmosMsg

type IbcTransferCosmosMsg struct {
	ChannelID string `json:"channel_id"`
	ToAddress string `json:"to_address"`
	Amount    Coin   `json:"amount"`
}

type IcaContract

type IcaContract struct {
	Contract
	IcaAddress string
}

func NewIcaContract

func NewIcaContract(contract Contract) *IcaContract

func StoreAndInstantiateNewIcaContract

func StoreAndInstantiateNewIcaContract(
	ctx context.Context, chain *cosmos.CosmosChain,
	callerKeyName, fileName string,
) (*IcaContract, error)

StoreAndInstantiateNewIcaContract stores the contract code and instantiates a new contract as the caller. Returns a new Contract instance.

func (*IcaContract) Execute

func (c *IcaContract) Execute(ctx context.Context, callerKeyName string, msg ExecuteMsg, extraExecTxArgs ...string) error

func (*IcaContract) QueryCallbackCounter

func (c *IcaContract) QueryCallbackCounter(ctx context.Context) (*IcaContractCallbackCounter, error)

QueryCallbackCounter queries the callback counter stored in the contract

func (*IcaContract) QueryChannelState

func (c *IcaContract) QueryChannelState(ctx context.Context) (*IcaContractChannelState, error)

QueryChannelState queries the channel state stored in the contract

func (*IcaContract) QueryContractState

func (c *IcaContract) QueryContractState(ctx context.Context) (*IcaContractState, error)

QueryContractState queries the contract's state

func (*IcaContract) QueryOwnership

func (c *IcaContract) QueryOwnership(ctx context.Context) (*OwnershipQueryResponse, error)

QueryOwnership queries the owner of the contract

func (*IcaContract) SetIcaAddress

func (c *IcaContract) SetIcaAddress(icaAddress string)

type IcaContractCallbackCounter

type IcaContractCallbackCounter struct {
	Success uint64 `json:"success"`
	Error   uint64 `json:"error"`
	Timeout uint64 `json:"timeout"`
}

ContractCallbackCounter is used to represent the callback counter in the contract's storage

type IcaContractChannelState

type IcaContractChannelState struct {
	Channel       CwIbcChannel `json:"channel"`
	ChannelStatus string       `json:"channel_status"`
}

ContractChannelState is used to represent the channel state in the contract's storage

func (*IcaContractChannelState) IsOpen

func (c *IcaContractChannelState) IsOpen() bool

IsOpen returns true if the channel is open

type IcaContractIcaInfo

type IcaContractIcaInfo struct {
	IcaAddress string `json:"ica_address"`
	ChannelID  string `json:"channel_id"`
}

IcaContractIcaInfo is used to represent the ICA info in the contract's state

type IcaContractState

type IcaContractState struct {
	IcaInfo              IcaContractIcaInfo `json:"ica_info"`
	AllowChannelOpenInit bool               `json:"allow_channel_open_init"`
}

IcaContractState is used to represent its state in Contract's storage

type InstantiateMsg

type InstantiateMsg struct {
	// The admin address. If not specified, the sender is the admin.
	Owner *string `json:"owner,omitempty"`
	// The options to initialize the IBC channel upon contract instantiation.
	// If not specified, the IBC channel is not initialized, and the relayer must.
	ChannelOpenInitOptions ChannelOpenInitOptions `json:"channel_open_init_options"`
	// The contract address that the channel and packet lifecycle callbacks are sent to.
	// If not specified, then no callbacks are sent.
	SendCallbacksTo *string `json:"send_callbacks_to,omitempty"`
}

InstantiateMsg is the message to instantiate cw-ica-controller

func (*InstantiateMsg) ToString

func (m *InstantiateMsg) ToString() string

ToString returns a string representation of the message

type MigrateMsg

type MigrateMsg = struct{}

MigrateMsg is the message to migrate cw-ica-controller

type OwnershipQueryResponse

type OwnershipQueryResponse struct {
	// The current owner of the contract.
	// This contract must have an owner.
	Owner string `json:"owner"`
	// The pending owner of the contract if one exists.
	PendingOwner *string `json:"pending_owner"`
	// The height at which the pending owner offer expires.
	// Not sure how to represent this, so we'll just use a raw message
	PendingExpiry *json.RawMessage `json:"pending_expiry"`
}

OwnershipQueryResponse is the response type for the OwnershipQueryMsg

type QueryMsg

type QueryMsg struct {
	GetChannel       *struct{} `json:"get_channel,omitempty"`
	GetContractState *struct{} `json:"get_contract_state,omitempty"`
	Ownership        *struct{} `json:"ownership,omitempty"`
}

QueryMsg is the message to query cw-ica-controller

func (*QueryMsg) ToString

func (m *QueryMsg) ToString() string

ToString returns a string representation of the message

type QueryResponse

type QueryResponse[T any] struct {
	Response json.RawMessage `json:"data"`
}

QueryResponse is used to represent the response of a query. It may contain different types of data, so we need to unmarshal it

func (QueryResponse[T]) GetResp

func (qr QueryResponse[T]) GetResp() (T, error)

GetResp unmarshals the response to a T

type StakingCosmosMsg

type StakingCosmosMsg struct {
	Delegate   *StakingDelegateCosmosMsg   `json:"delegate,omitempty"`
	Undelegate *StakingUndelegateCosmosMsg `json:"undelegate,omitempty"`
	Redelegate *StakingRedelegateCosmosMsg `json:"redelegate,omitempty"`
}

type StakingDelegateCosmosMsg

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

type StakingRedelegateCosmosMsg

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

type StakingUndelegateCosmosMsg

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

type StargateCosmosMsg

type StargateCosmosMsg struct {
	// Proto Any type URL
	TypeUrl string `json:"type_url"`
	// Base64 encoded bytes
	Value string `json:"value"`
}

type WasmClearAdminCosmosMsg

type WasmClearAdminCosmosMsg struct {
	ContractAddr string `json:"contract_addr"`
}

type WasmCosmosMsg

type WasmCosmosMsg struct {
	Execute      *WasmExecuteCosmosMsg      `json:"execute,omitempty"`
	Instantiate  *WasmInstantiateCosmosMsg  `json:"instantiate,omitempty"`
	Instantiate2 *WasmInstantiate2CosmosMsg `json:"instantiate2,omitempty"`
	Migrate      *WasmMigrateCosmosMsg      `json:"migrate,omitempty"`
	UpdateAdmin  *WasmUpdateAdminCosmosMsg  `json:"update_admin,omitempty"`
	ClearAdmin   *WasmClearAdminCosmosMsg   `json:"clear_admin,omitempty"`
}

type WasmExecuteCosmosMsg

type WasmExecuteCosmosMsg struct {
	ContractAddr string `json:"contract_addr"`
	// base64 encoded bytes
	Msg   string `json:"msg"`
	Funds []Coin `json:"funds"`
}

type WasmInstantiate2CosmosMsg

type WasmInstantiate2CosmosMsg struct {
	Admin  string `json:"admin"`
	CodeID uint64 `json:"code_id"`
	// base64 encoded bytes
	Msg   string `json:"msg"`
	Funds []Coin `json:"funds"`
	Label string `json:"label"`
	// base64 encoded bytes
	Salt string `json:"salt"`
}

type WasmInstantiateCosmosMsg

type WasmInstantiateCosmosMsg struct {
	Admin  string `json:"admin"`
	CodeID uint64 `json:"code_id"`
	// base64 encoded bytes
	Msg   string `json:"msg"`
	Funds []Coin `json:"funds"`
	Label string `json:"label"`
}

type WasmMigrateCosmosMsg

type WasmMigrateCosmosMsg struct {
	ContractAddr string `json:"contract_addr"`
	NewCodeID    uint64 `json:"new_code_id"`
	// base64 encoded bytes
	Msg string `json:"msg"`
}

type WasmUpdateAdminCosmosMsg

type WasmUpdateAdminCosmosMsg struct {
	ContractAddr string `json:"contract_addr"`
	Admin        string `json:"admin"`
}

Jump to

Keyboard shortcuts

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