types

package
v0.0.0-...-133f676 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitOutpostWithOwner

func InitOutpostWithOwner(
	admin *string, connectionId string, counterpartyConnectionId string,
	counterpartyPortId *string, txEncoding *string, owner *string,
) string

InitOutpostWithOwner creates a new InstantiateMsg with channel init options and an owner for the outpost

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.

func NewInstantiateMsgWithOutpostAddress

func NewInstantiateMsgWithOutpostAddress(
	storageOutpostAddress *string,
) string

NewInstantiateMsgWithOutpostAddress creates a new InstantiateMsg with the outpost address NOTE: The admin is set in the outer wasm.Instantiate protobuf msg, not the json msg

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 Binary

type Binary string

Binary is a wrapper around Vec<u8> to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.

This is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>. See also <https://github.com/CosmWasm/cosmwasm/blob/main/docs/MESSAGE_TYPES.md>.

type Callback

type Callback struct {
	// The address of the contract that we will call back
	Contract string `json:"contract,omitempty"`
	// The msg we will make the above contract execute
	Msg Binary `json:"msg,omitempty"`
	/// The owner of the outpost
	OutpostOwner string `json:"outpost_owner,omitempty"`
}

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 ChannelStatus

type ChannelStatus string

Status is the status of an IBC channel.

const (
	// Uninitialized is the default state of the channel.
	ChannelStatus_StateUninitializedUnspecified ChannelStatus = "STATE_UNINITIALIZED_UNSPECIFIED"
	// Init is the state of the channel when it is created.
	ChannelStatus_StateInit ChannelStatus = "STATE_INIT"
	// TryOpen is the state of the channel when it is trying to open.
	ChannelStatus_StateTryopen ChannelStatus = "STATE_TRYOPEN"
	// Open is the state of the channel when it is open.
	ChannelStatus_StateOpen ChannelStatus = "STATE_OPEN"
	// Closed is the state of the channel when it is closed.
	ChannelStatus_StateClosed ChannelStatus = "STATE_CLOSED"
	// The channel has just accepted the upgrade handshake attempt and is flushing in-flight packets. Added in `ibc-go` v8.1.0.
	ChannelStatus_StateFlushing ChannelStatus = "STATE_FLUSHING"
	// The channel has just completed flushing any in-flight packets. Added in `ibc-go` v8.1.0.
	ChannelStatus_StateFlushcomplete ChannelStatus = "STATE_FLUSHCOMPLETE"
)

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) MigrateMsg

func (c *Contract) MigrateMsg(ctx context.Context, callerKeyName string, codeID string, migrateMsg string, extraExecTxArgs ...string) error

MigrateMsg performs contract migration

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 {
	SetDataAfterMigration *ExecuteMsg_SetDataAfterMigration `json:"set_data_after_migration,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"`
	CreateChannel         *ExecuteMsg_CreateChannel         `json:"create_channel,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_SetDataAfterMigration

type ExecuteMsg_SetDataAfterMigration struct {
	Data string `json:"data,omitempty"`
}

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 GetNoteRequest

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

GetNoteRequest is the struct for the GetNote query

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) Migrate

func (c *IcaContract) Migrate(ctx context.Context, callerKeyName string, codeID string, msg MigrateMsg, 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 ChannelStatus `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"`
	// The callback information to be used
	Callback *Callback `json:"callback,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

func (*MigrateMsg) ToString

func (m *MigrateMsg) ToString() string

ToString returns a string representation of the message

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"`
	GetMigrationData *struct{}       `json:"get_migration_data,omitempty"`
	Ownership        *struct{}       `json:"ownership,omitempty"`
	GetNote          *GetNoteRequest `json:"get_note,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"`
}

Directories

Path Synopsis
Code generated by github.com/srdtrk/go-codegen, DO NOT EDIT.
Code generated by github.com/srdtrk/go-codegen, DO NOT EDIT.
Code generated by github.com/srdtrk/go-codegen, DO NOT EDIT.
Code generated by github.com/srdtrk/go-codegen, DO NOT EDIT.

Jump to

Keyboard shortcuts

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