types

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	ERC20          = "xerc20"
	CW20           = "xcw20"
	TYPE_SEPARATOR = ":"
)

Variables

View Source
var (
	ErrErc20Transfer    = sdkerrors.Register(banktypes.ModuleName, 1001, "fail to transfer erc20")
	ErrErc20Balance     = sdkerrors.Register(banktypes.ModuleName, 1002, "fail to query balance erc20")
	ErrErc20TotalSupply = sdkerrors.Register(banktypes.ModuleName, 1003, "fail to query total supply erc20")
)

Functions

func GetErc20Method

func GetErc20Method(name MethodErc20) string

func NewCw20Coin

func NewCw20Coin(contractAddress string, amount sdkmath.Int) sdk.Coin

func NewErc20Coin

func NewErc20Coin(contractAddress string, amount sdkmath.Int) sdk.Coin

Types

type Addr

type Addr string

A human readable address.

In Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.

This type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.

This type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.

type AllAccountsResponse

type AllAccountsResponse struct {
	Accounts []string `json:"accounts"`
}

type AllAllowancesResponse

type AllAllowancesResponse struct {
	Allowances []AllowanceInfo `json:"allowances"`
}

type AllSpenderAllowancesResponse

type AllSpenderAllowancesResponse struct {
	Allowances []SpenderAllowanceInfo `json:"allowances"`
}

type AllowanceInfo

type AllowanceInfo struct {
	Allowance Uint128    `json:"allowance"`
	Expires   Expiration `json:"expires"`
	Spender   string     `json:"spender"`
}

type AllowanceResponse

type AllowanceResponse struct {
	Allowance Uint128    `json:"allowance"`
	Expires   Expiration `json:"expires"`
}

type BalanceResponse

type BalanceResponse struct {
	Balance Uint128 `json:"balance"`
}

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 Cw20Coin

type Cw20Coin struct {
	Address string  `json:"address"`
	Amount  Uint128 `json:"amount"`
}

type DownloadLogoResponse

type DownloadLogoResponse struct {
	MimeType string `json:"mime_type"`
	Data     Binary `json:"data"`
}

When we download an embedded logo, we get this response type. We expect a SPA to be able to accept this info and display it.

type EmbeddedLogo struct {
	// Store the Logo as an SVG file. The content must conform to the spec at https://en.wikipedia.org/wiki/Scalable_Vector_Graphics (The contract should do some light-weight sanity-check validation)
	Svg *EmbeddedLogo_Svg `json:"svg,omitempty"`
	// Store the Logo as a PNG file. This will likely only support up to 64x64 or so within the 5KB limit.
	Png *EmbeddedLogo_Png `json:"png,omitempty"`
}

This is used to store the logo on the blockchain in an accepted format. Enforce maximum size of 5KB on all variants.

type EmbeddedLogo_Png

type EmbeddedLogo_Png Binary

type EmbeddedLogo_Svg

type EmbeddedLogo_Svg Binary

type EvmKeeper

type EvmKeeper interface {
	statedb.Keeper
	ApplyMessage(ctx sdk.Context, stateDB *statedb.StateDB, msg core.Message, tracer *tracing.Hooks, commit bool, callFromPrecompile bool, internal bool) (*evmtypes.MsgEthereumTxResponse, error)
	EstimateGas(c context.Context, req *evmtypes.EthCallRequest) (*evmtypes.EstimateGasResponse, error)
	GetNonce(ctx sdk.Context, addr common.Address) uint64
	CallEVM(
		ctx sdk.Context,
		stateDB *statedb.StateDB,
		abi abi.ABI,
		from, contract common.Address,
		commit bool,
		callFromPrecompile bool,
		gasCap *big.Int,
		method string,
		args ...interface{},
	) (*evmtypes.MsgEthereumTxResponse, error)
}

type ExecuteMsg

type ExecuteMsg struct {
	// Transfer is a base message to move tokens to another account without triggering actions
	Transfer *ExecuteMsg_Transfer `json:"transfer,omitempty"`
	// Burn is a base message to destroy tokens forever
	Burn *ExecuteMsg_Burn `json:"burn,omitempty"`
	// Send is a base message to transfer tokens to a contract and trigger an action on the receiving contract.
	Send *ExecuteMsg_Send `json:"send,omitempty"`
	// Only with "approval" extension. Allows spender to access an additional amount tokens from the owner's (env.sender) account. If expires is Some(), overwrites current allowance expiration with this one.
	IncreaseAllowance *ExecuteMsg_IncreaseAllowance `json:"increase_allowance,omitempty"`
	// Only with "approval" extension. Lowers the spender's access of tokens from the owner's (env.sender) account by amount. If expires is Some(), overwrites current allowance expiration with this one.
	DecreaseAllowance *ExecuteMsg_DecreaseAllowance `json:"decrease_allowance,omitempty"`
	// Only with "approval" extension. Transfers amount tokens from owner -> recipient if `env.sender` has sufficient pre-approval.
	TransferFrom *ExecuteMsg_TransferFrom `json:"transfer_from,omitempty"`
	// Only with "approval" extension. Sends amount tokens from owner -> contract if `env.sender` has sufficient pre-approval.
	SendFrom *ExecuteMsg_SendFrom `json:"send_from,omitempty"`
	// Only with "approval" extension. Destroys tokens forever
	BurnFrom *ExecuteMsg_BurnFrom `json:"burn_from,omitempty"`
	// Only with the "mintable" extension. If authorized, creates amount new tokens and adds to the recipient balance.
	Mint *ExecuteMsg_Mint `json:"mint,omitempty"`
	// Only with the "mintable" extension. The current minter may set a new minter. Setting the minter to None will remove the token's minter forever.
	UpdateMinter *ExecuteMsg_UpdateMinter `json:"update_minter,omitempty"`
	// Only with the "marketing" extension. If authorized, updates marketing metadata. Setting None/null for any of these will leave it unchanged. Setting Some("") will clear this field on the contract storage
	UpdateMarketing *ExecuteMsg_UpdateMarketing `json:"update_marketing,omitempty"`
	UploadLogo *ExecuteMsg_UploadLogo `json:"upload_logo,omitempty"`
}

type ExecuteMsg_Burn

type ExecuteMsg_Burn struct {
	Amount Uint128 `json:"amount"`
}

type ExecuteMsg_BurnFrom

type ExecuteMsg_BurnFrom struct {
	Amount Uint128 `json:"amount"`
	Owner  string  `json:"owner"`
}

type ExecuteMsg_DecreaseAllowance

type ExecuteMsg_DecreaseAllowance struct {
	Amount  Uint128     `json:"amount"`
	Expires *Expiration `json:"expires,omitempty"`
	Spender string      `json:"spender"`
}

type ExecuteMsg_IncreaseAllowance

type ExecuteMsg_IncreaseAllowance struct {
	Amount  Uint128     `json:"amount"`
	Expires *Expiration `json:"expires,omitempty"`
	Spender string      `json:"spender"`
}

type ExecuteMsg_Mint

type ExecuteMsg_Mint struct {
	Amount    Uint128 `json:"amount"`
	Recipient string  `json:"recipient"`
}

type ExecuteMsg_Send

type ExecuteMsg_Send struct {
	Contract string  `json:"contract"`
	Msg      Binary  `json:"msg"`
	Amount   Uint128 `json:"amount"`
}

type ExecuteMsg_SendFrom

type ExecuteMsg_SendFrom struct {
	Owner    string  `json:"owner"`
	Amount   Uint128 `json:"amount"`
	Contract string  `json:"contract"`
	Msg      Binary  `json:"msg"`
}

type ExecuteMsg_Transfer

type ExecuteMsg_Transfer struct {
	Amount    Uint128 `json:"amount"`
	Recipient string  `json:"recipient"`
}

type ExecuteMsg_TransferFrom

type ExecuteMsg_TransferFrom struct {
	Amount    Uint128 `json:"amount"`
	Owner     string  `json:"owner"`
	Recipient string  `json:"recipient"`
}

type ExecuteMsg_UpdateMarketing

type ExecuteMsg_UpdateMarketing struct {
	// The address (if any) who can update this data structure
	Marketing *string `json:"marketing,omitempty"`
	// A URL pointing to the project behind this token.
	Project *string `json:"project,omitempty"`
	// A longer description of the token and it's utility. Designed for tooltips or such
	Description *string `json:"description,omitempty"`
}

type ExecuteMsg_UpdateMinter

type ExecuteMsg_UpdateMinter struct {
	NewMinter *string `json:"new_minter,omitempty"`
}
type ExecuteMsg_UploadLogo Logo

type Expiration

type Expiration struct {
	// AtHeight will expire when `env.block.height` >= height
	AtHeight *Expiration_AtHeight `json:"at_height,omitempty"`
	// AtTime will expire when `env.block.time` >= time
	AtTime *Expiration_AtTime `json:"at_time,omitempty"`
	// Never will never expire. Used to express the empty variant
	Never *Expiration_Never `json:"never,omitempty"`
}

Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)

type Expiration_AtHeight

type Expiration_AtHeight int

type Expiration_AtTime

type Expiration_AtTime Timestamp

type Expiration_Never

type Expiration_Never struct{}

type InstantiateMarketingInfo

type InstantiateMarketingInfo struct {
	Marketing   *string `json:"marketing,omitempty"`
	Project     *string `json:"project,omitempty"`
	Description *string `json:"description,omitempty"`
}

type InstantiateMsg

type InstantiateMsg struct {
	Symbol          string                    `json:"symbol"`
	Decimals        int                       `json:"decimals"`
	InitialBalances []Cw20Coin                `json:"initial_balances"`
	Marketing       *InstantiateMarketingInfo `json:"marketing,omitempty"`
	Mint            *MinterResponse           `json:"mint,omitempty"`
	Name            string                    `json:"name"`
}
type Logo struct {
	// A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL.
	Url *Logo_Url `json:"url,omitempty"`
	// Logo content stored on the blockchain. Enforce maximum size of 5KB on all variants
	Embedded *Logo_Embedded `json:"embedded,omitempty"`
}

This is used for uploading logo data, or setting it in InstantiateData

type LogoInfo

type LogoInfo interface {
	Implements_LogoInfo()
}

This is used to display logo info, provide a link or inform there is one that can be downloaded from the blockchain itself

type LogoInfo_Embedded

type LogoInfo_Embedded string
const LogoInfo_Embedded_Value LogoInfo_Embedded = "embedded"

There is an embedded logo on the chain, make another call to download it.

func (*LogoInfo_Embedded) Implements_LogoInfo

func (*LogoInfo_Embedded) Implements_LogoInfo()

type LogoInfo_Url

type LogoInfo_Url string

func (*LogoInfo_Url) Implements_LogoInfo

func (*LogoInfo_Url) Implements_LogoInfo()

type Logo_Embedded

type Logo_Embedded EmbeddedLogo

type Logo_Url

type Logo_Url string

type MarketingInfoResponse

type MarketingInfoResponse struct {
	// A URL pointing to the project behind this token.
	Project *string `json:"project,omitempty"`
	// A longer description of the token and it's utility. Designed for tooltips or such
	Description *string `json:"description,omitempty"`
	Logo *LogoInfo `json:"logo,omitempty"`
	// The address (if any) who can update this data structure
	Marketing *Addr `json:"marketing,omitempty"`
}

type MethodErc20

type MethodErc20 string
const (
	Allowance    MethodErc20 = "allowance"
	Approve      MethodErc20 = "approve"
	BalanceOf    MethodErc20 = "balanceOf"
	TotalSupply  MethodErc20 = "totalSupply"
	Transfer     MethodErc20 = "transfer"
	TransferFrom MethodErc20 = "transferFrom"
)

type MinterResponse

type MinterResponse struct {
	// cap is a hard cap on total supply that can be achieved by minting. Note that this refers to total_supply. If None, there is unlimited cap.
	Cap    *Uint128 `json:"cap,omitempty"`
	Minter string   `json:"minter"`
}

type MinterResponse_2

type MinterResponse_2 struct {
	// cap is a hard cap on total supply that can be achieved by minting. Note that this refers to total_supply. If None, there is unlimited cap.
	Cap    *Uint128 `json:"cap,omitempty"`
	Minter string   `json:"minter"`
}

type QueryMsg

type QueryMsg struct {
	// Returns the current balance of the given address, 0 if unset.
	Balance *QueryMsg_Balance `json:"balance,omitempty"`
	// Returns metadata on the contract - name, decimals, supply, etc.
	TokenInfo *QueryMsg_TokenInfo `json:"token_info,omitempty"`
	// Only with "mintable" extension. Returns who can mint and the hard cap on maximum tokens after minting.
	Minter *QueryMsg_Minter `json:"minter,omitempty"`
	// Only with "allowance" extension. Returns how much spender can use from owner account, 0 if unset.
	Allowance *QueryMsg_Allowance `json:"allowance,omitempty"`
	// Only with "enumerable" extension (and "allowances") Returns all allowances this owner has approved. Supports pagination.
	AllAllowances *QueryMsg_AllAllowances `json:"all_allowances,omitempty"`
	// Only with "enumerable" extension (and "allowances") Returns all allowances this spender has been granted. Supports pagination.
	AllSpenderAllowances *QueryMsg_AllSpenderAllowances `json:"all_spender_allowances,omitempty"`
	// Only with "enumerable" extension Returns all accounts that have balances. Supports pagination.
	AllAccounts *QueryMsg_AllAccounts `json:"all_accounts,omitempty"`
	// Only with "marketing" extension Returns more metadata on the contract to display in the client: - description, logo, project url, etc.
	MarketingInfo *QueryMsg_MarketingInfo `json:"marketing_info,omitempty"`
	DownloadLogo *QueryMsg_DownloadLogo `json:"download_logo,omitempty"`
}

type QueryMsg_AllAccounts

type QueryMsg_AllAccounts struct {
	Limit      *int    `json:"limit,omitempty"`
	StartAfter *string `json:"start_after,omitempty"`
}

type QueryMsg_AllAllowances

type QueryMsg_AllAllowances struct {
	Limit      *int    `json:"limit,omitempty"`
	Owner      string  `json:"owner"`
	StartAfter *string `json:"start_after,omitempty"`
}

type QueryMsg_AllSpenderAllowances

type QueryMsg_AllSpenderAllowances struct {
	Limit      *int    `json:"limit,omitempty"`
	Spender    string  `json:"spender"`
	StartAfter *string `json:"start_after,omitempty"`
}

type QueryMsg_Allowance

type QueryMsg_Allowance struct {
	Owner   string `json:"owner"`
	Spender string `json:"spender"`
}

type QueryMsg_Balance

type QueryMsg_Balance struct {
	Address string `json:"address"`
}
type QueryMsg_DownloadLogo struct{}

type QueryMsg_MarketingInfo

type QueryMsg_MarketingInfo struct{}

type QueryMsg_Minter

type QueryMsg_Minter struct{}

type QueryMsg_TokenInfo

type QueryMsg_TokenInfo struct{}

type SpenderAllowanceInfo

type SpenderAllowanceInfo struct {
	Allowance Uint128    `json:"allowance"`
	Expires   Expiration `json:"expires"`
	Owner     string     `json:"owner"`
}

type Timestamp

type Timestamp Uint64

A point in time in nanosecond precision.

This type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.

## Examples

``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);

let ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```

type TokenInfoResponse

type TokenInfoResponse struct {
	Decimals    int     `json:"decimals"`
	Name        string  `json:"name"`
	Symbol      string  `json:"symbol"`
	TotalSupply Uint128 `json:"total_supply"`
}

type TokenType

type TokenType int
const (
	Cosmos TokenType = iota
	Erc20
	Cw20
)

func ParseDenom

func ParseDenom(denom string) (TokenType, string)

type Uint64

type Uint64 string

A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.

Examples

Use `from` to create instances of this and `u64` to get the value out:

``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);

let b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```

type Uint128

type Uint128 string

A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.

Examples

Use `from` to create instances of this and `u128` to get the value out:

``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);

let b = Uint128::from(42u64); assert_eq!(b.u128(), 42);

let c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```

type WasmKeeper

type WasmKeeper interface {
	QuerySmart(ctx context.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error)
}

type WasmMsgServer

type WasmMsgServer interface {
	ExecuteContract(ctx context.Context, msg *wasmtypes.MsgExecuteContract) (*wasmtypes.MsgExecuteContractResponse, error)
}

Jump to

Keyboard shortcuts

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