Documentation
¶
Index ¶
- func BytesToUint64(byteArr []byte) uint64
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func Uint64ToBytes(n uint64) []byte
- func WrapWasmKeeper(k *wasmkeeper.Keeper) types.WasmKeeper
- type AllNftAccess
- type AllNftData
- type AllNftInfo
- type ContractInfo
- type ContractInfoData
- type InstantiateInfo
- type Keeper
- func (k Keeper) ConvertCW721(goCtx context.Context, msg *types.MsgConvertCW721) (*types.MsgConvertCW721Response, error)
- func (k Keeper) ConvertNFT(goCtx context.Context, msg *types.MsgConvertNFT) (*types.MsgConvertNFTResponse, error)
- func (k Keeper) CreateNFTClass(ctx sdk.Context, msg *types.MsgConvertCW721) error
- func (k Keeper) DeleteCW721Map(ctx sdk.Context, cw721 string)
- func (k Keeper) DeleteCwAddressByContractTokenId(ctx sdk.Context, evmContractAddress string, evmTokenId string)
- func (k Keeper) DeleteNFTPairByNFTID(ctx sdk.Context, classID string, nftID string)
- func (k Keeper) DeleteNFTPairByTokenID(ctx sdk.Context, contractAddress string, tokenID string)
- func (k Keeper) DeleteNFTUIDPairByNFTUID(ctx sdk.Context, nftUID string)
- func (k Keeper) DeleteNFTUIDPairByTokenUID(ctx sdk.Context, tokenUID string)
- func (k Keeper) DeleteTokenPair(ctx sdk.Context, tokenPair types.TokenPair)
- func (k Keeper) DeployCW721Contract(ctx sdk.Context, msg *types.MsgConvertNFT) (string, error)
- func (k Keeper) ExecWasmMsg(ctx sdk.Context, execMsg *wasmtypes.MsgExecuteContract) (*wasmtypes.MsgExecuteContractResponse, error)
- func (k Keeper) GetAccountKeeper() types.AccountKeeper
- func (k Keeper) GetCW721Map(ctx sdk.Context, cw721 string) []byte
- func (k Keeper) GetClassIDAndNFTID(ctx sdk.Context, msg *types.MsgConvertCW721) (string, []string, error)
- func (k Keeper) GetClassMap(ctx sdk.Context, classID string) []byte
- func (k Keeper) GetContractAddressAndTokenIds(ctx sdk.Context, msg *types.MsgConvertNFT) (string, []string, error)
- func (k Keeper) GetCwAddressByContractTokenId(ctx sdk.Context, evmContractAddress string, evmTokenId string) []byte
- func (k Keeper) GetEnableCw721(ctx sdk.Context) bool
- func (k Keeper) GetEnableEVMHook(ctx sdk.Context) bool
- func (k Keeper) GetNFTKeeper() collectionkeeper.Keeper
- func (k Keeper) GetNFTPairByClassNFTID(ctx sdk.Context, classID string, nftID string) []byte
- func (k Keeper) GetNFTPairByContractTokenID(ctx sdk.Context, contractAddress string, tokenID string) []byte
- func (k Keeper) GetNFTUIDPairByTokenUID(ctx sdk.Context, tokenUID string) []byte
- func (k Keeper) GetPair(ctx sdk.Context, token string) (types.TokenPair, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetTokenPair(ctx sdk.Context, id []byte) (types.TokenPair, bool)
- func (k Keeper) GetTokenPairID(ctx sdk.Context, token string) []byte
- func (k Keeper) GetTokenPairs(ctx sdk.Context) []types.TokenPair
- func (k Keeper) GetTokenUIDPairByNFTUID(ctx sdk.Context, nftUID string) []byte
- func (k Keeper) GetWasmCode(ctx sdk.Context, account string) []byte
- func (k Keeper) GetWasmCodeID(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetWasmKeeper() types.WasmKeeper
- func (k Keeper) InstantiateWasmContract(ctx sdk.Context, senderAddr string, codeId uint64, label string, name string, ...) (string, error)
- func (k Keeper) IsCW721Registered(ctx sdk.Context, cw721 string) bool
- func (k Keeper) IsClassRegistered(ctx sdk.Context, classID string) bool
- func (k Keeper) IsTokenPairRegistered(ctx sdk.Context, id []byte) bool
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintCw721(ctx sdk.Context, contractAddress string, tokenId string, owner string, ...) (*wasmtypes.MsgExecuteContractResponse, error)
- func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) QueryCW721(ctx sdk.Context, contractAddress string) (types.CW721Data, error)
- func (k Keeper) QueryCW721AllNftInfo(ctx sdk.Context, contractAddress string, tokenId string) (AllNftInfo, error)
- func (k Keeper) QueryCW721Token(ctx sdk.Context, contract common.Address) (types.CW721TokenData, error)
- func (k Keeper) QueryClassEnhance(ctx sdk.Context, contract common.Address) (types.ClassEnhance, error)
- func (k Keeper) QueryNFTEnhance(ctx sdk.Context, contract common.Address, tokenID string) (types.NFTEnhance, error)
- func (k Keeper) QueryWasmState(ctx sdk.Context, req *wasmtypes.QuerySmartContractStateRequest) (*wasmtypes.QuerySmartContractStateResponse, error)
- func (k Keeper) RefundPacketToken(ctx sdk.Context, data ibcnfttransfertypes.NonFungibleTokenPacketData) error
- func (k Keeper) RegisterCW721(ctx sdk.Context, msg *types.MsgConvertCW721) (*types.TokenPair, error)
- func (k Keeper) RegisterNFT(ctx sdk.Context, msg *types.MsgConvertNFT) (*types.TokenPair, error)
- func (k Keeper) SetCW721Map(ctx sdk.Context, cw721 string, id []byte)
- func (k Keeper) SetClassMap(ctx sdk.Context, classID string, id []byte)
- func (k Keeper) SetCwAddressByContractTokenId(ctx sdk.Context, evmContractAddress string, evmTokenId string, ...)
- func (k Keeper) SetNFTPairByClassNFTID(ctx sdk.Context, classID string, nftID string, contractAddress string, ...)
- func (k Keeper) SetNFTPairByContractTokenID(ctx sdk.Context, contractAddress string, tokenID string, classID string, ...)
- func (k Keeper) SetNFTPairs(ctx sdk.Context, contractAddress string, tokenID string, classID string, ...)
- func (k Keeper) SetNFTUIDPairByNFTUID(ctx sdk.Context, nftUID string, tokenUID string)
- func (k Keeper) SetNFTUIDPairByTokenUID(ctx sdk.Context, tokenUID string, nftUID string)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- func (k Keeper) SetTokenPair(ctx sdk.Context, tokenPair types.TokenPair)
- func (k Keeper) SetWasmCode(ctx sdk.Context, account string, codeId uint64)
- func (k Keeper) ToggleConversion(ctx sdk.Context, token string) (types.TokenPair, error)
- func (k Keeper) TokenPair(c context.Context, req *types.QueryTokenPairRequest) (*types.QueryTokenPairResponse, error)
- func (k Keeper) TokenPairs(c context.Context, req *types.QueryTokenPairsRequest) (*types.QueryTokenPairsResponse, error)
- func (k Keeper) TransferCW721(goCtx context.Context, msg *types.MsgTransferCW721) (*types.MsgTransferCW721Response, error)
- func (k Keeper) TransferCw721(ctx sdk.Context, contractAddress string, tokenId string, recipient string, ...) (*wasmtypes.MsgExecuteContractResponse, error)
- func (k Keeper) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
- func (k Keeper) WasmContract(c context.Context, req *types.QueryWasmAddressRequest) (*types.QueryWasmContractResponse, error)
- type Migrator
- type MintInfo
- type MintInfoData
- type Result
- type TransferNftData
- type TransferNftInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToUint64 ¶ added in v0.4.0
func NewMsgServerImpl ¶ added in v0.4.0
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func Uint64ToBytes ¶ added in v0.4.0
func WrapWasmKeeper ¶ added in v0.4.0
func WrapWasmKeeper(k *wasmkeeper.Keeper) types.WasmKeeper
WrapWasmKeeper adapts wasmd's keeper to the cw721 WasmKeeper interface.
Types ¶
type AllNftAccess ¶
type AllNftAccess struct {
Owner string `json:"owner"`
}
type AllNftData ¶
type AllNftData struct {
TokenUri string `json:"token_uri"`
Extension interface{} `json:"extension"`
}
type AllNftInfo ¶
type AllNftInfo struct {
Access AllNftAccess `json:"access"`
Info AllNftData `json:"info"`
}
type ContractInfo ¶
type ContractInfo struct {
Data ContractInfoData `json:"data"`
}
ContractInfo {"data":{"name":"uptick test collection","symbol":"uptick-test-01"}}
type ContractInfoData ¶
type InstantiateInfo ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper is the x/cw721 keeper
func NewKeeper ¶
func NewKeeper( storeKey storetypes.StoreKey, cdc codec.BinaryCodec, accountKeeper types.AccountKeeper, nftKeeper collectionkeeper.Keeper, wasmKeeper types.WasmKeeper, ibcTransferKeeper types.IBCNFTTransferKeeper, ) Keeper
NewKeeper creates a new Keeper
func (Keeper) ConvertCW721 ¶
func (k Keeper) ConvertCW721( goCtx context.Context, msg *types.MsgConvertCW721, ) ( *types.MsgConvertCW721Response, error, )
ConvertCW721 converts CW721 tokens into native Cosmos nft for both Cosmos-native and CW721 TokenPair Owners
func (Keeper) ConvertNFT ¶
func (k Keeper) ConvertNFT( goCtx context.Context, msg *types.MsgConvertNFT, ) ( *types.MsgConvertNFTResponse, error, )
ConvertNFT ConvertCoin converts native Cosmos nft into CW721 tokens for both Cosmos-native and CW721 TokenPair Owners
func (Keeper) CreateNFTClass ¶
CreateNFTClass generates the metadata to represent the CW721 token .
func (Keeper) DeleteCW721Map ¶
DeleteCW721Map deletes the token pair id for the given address
func (Keeper) DeleteCwAddressByContractTokenId ¶
func (Keeper) DeleteNFTPairByNFTID ¶
func (Keeper) DeleteNFTPairByTokenID ¶
func (Keeper) DeleteNFTUIDPairByNFTUID ¶
func (Keeper) DeleteNFTUIDPairByTokenUID ¶
func (Keeper) DeleteTokenPair ¶
DeleteTokenPair removes a token pair.
func (Keeper) DeployCW721Contract ¶ added in v0.4.0
DeployCW721Contract instantiates a CW721 contract with the cw721 module account as admin and minter, using a previously stored wasm code ID.
func (Keeper) ExecWasmMsg ¶
func (k Keeper) ExecWasmMsg( ctx sdk.Context, execMsg *wasmtypes.MsgExecuteContract) (*wasmtypes.MsgExecuteContractResponse, error)
ExecWasmMsg exec the contract and get the result
func (Keeper) GetAccountKeeper ¶ added in v0.4.0
func (k Keeper) GetAccountKeeper() types.AccountKeeper
GetAccountKeeper returns the account keeper
func (Keeper) GetCW721Map ¶
GetCW721Map returns the token pair id for the given address
func (Keeper) GetClassIDAndNFTID ¶
func (k Keeper) GetClassIDAndNFTID(ctx sdk.Context, msg *types.MsgConvertCW721) (string, []string, error)
GetClassIDAndNFTID resolves class ID and NFT IDs from a MsgConvertCW721, using saved mappings or generating new IDs as needed.
func (Keeper) GetClassMap ¶
GetClassMap returns the token pair id for the given class
func (Keeper) GetContractAddressAndTokenIds ¶
func (k Keeper) GetContractAddressAndTokenIds(ctx sdk.Context, msg *types.MsgConvertNFT) (string, []string, error)
GetContractAddressAndTokenIds resolves the contract address and token IDs from a MsgConvertNFT, using saved mappings or generating new IDs as needed.
func (Keeper) GetCwAddressByContractTokenId ¶
func (Keeper) GetEnableCw721 ¶ added in v0.4.0
GetEnableCw721 returns the EnableCw721 param
func (Keeper) GetEnableEVMHook ¶ added in v0.4.0
GetEnableEVMHook returns the EnableEVMHook param
func (Keeper) GetNFTKeeper ¶ added in v0.4.0
func (k Keeper) GetNFTKeeper() collectionkeeper.Keeper
GetNFTKeeper returns the nft keeper
func (Keeper) GetNFTPairByClassNFTID ¶
func (Keeper) GetNFTPairByContractTokenID ¶
func (Keeper) GetNFTUIDPairByTokenUID ¶
func (Keeper) GetPair ¶
GetPair checks that:
- the global parameter for cw721 conversion is enabled
- minting is enabled for the given (cw721,nft) token pair
func (Keeper) GetTokenPair ¶
GetTokenPair - get registered token pair from the identifier
func (Keeper) GetTokenPairID ¶
GetTokenPairID returns the pair id from either of the registered tokens.
func (Keeper) GetTokenPairs ¶
GetTokenPairs - get all registered token tokenPairs
func (Keeper) GetTokenUIDPairByNFTUID ¶
func (Keeper) GetWasmCode ¶
GetWasmCode stores a WasmCode
func (Keeper) GetWasmCodeID ¶ added in v0.4.0
GetWasmCodeID returns the stored CW721 wasm code ID used for auto-instantiate. It looks up the module account first, then the module name as a fallback key.
func (Keeper) GetWasmKeeper ¶ added in v0.4.0
func (k Keeper) GetWasmKeeper() types.WasmKeeper
GetWasmKeeper returns the CosmWasm surface used by this module.
func (Keeper) InstantiateWasmContract ¶
func (k Keeper) InstantiateWasmContract( ctx sdk.Context, senderAddr string, codeId uint64, label string, name string, symbol string, minter string, ) (string, error)
InstantiateWasmContract creates and deploys an CW721 contract on the EVM with the cw721 module account as owner.
func (Keeper) IsCW721Registered ¶
IsCW721Registered check if registered CW721 token is registered
func (Keeper) IsClassRegistered ¶
IsClassRegistered check if registered nft class is registered
func (Keeper) IsTokenPairRegistered ¶
IsTokenPairRegistered - check if registered token tokenPair is registered
func (Keeper) MintCw721 ¶
func (k Keeper) MintCw721( ctx sdk.Context, contractAddress string, tokenId string, owner string, tokenUri string, ) (*wasmtypes.MsgExecuteContractResponse, error)
MintCw721 mints a CW721 token. The execute sender is the module minter; owner is the recipient of the newly minted token.
func (Keeper) Params ¶
func (k Keeper) Params( c context.Context, _ *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error)
Params returns the cw721 module params.
func (Keeper) QueryCW721 ¶
QueryCW721 returns the data of a deployed CW721 contract
func (Keeper) QueryCW721AllNftInfo ¶
func (k Keeper) QueryCW721AllNftInfo( ctx sdk.Context, contractAddress string, tokenId string, ) (AllNftInfo, error)
QueryCW721AllNftInfo returns the owner of given tokenID QueryCW721TokenOwner -> QueryCW721TokenOwner
func (Keeper) QueryCW721Token ¶
func (k Keeper) QueryCW721Token( ctx sdk.Context, contract common.Address, ) (types.CW721TokenData, error)
QueryCW721Token returns the data of a CW721 token TODO
func (Keeper) QueryClassEnhance ¶
func (k Keeper) QueryClassEnhance( ctx sdk.Context, contract common.Address, ) (types.ClassEnhance, error)
QueryClassEnhance returns the data of a deployed CW721 contract TODO
func (Keeper) QueryNFTEnhance ¶
func (k Keeper) QueryNFTEnhance( ctx sdk.Context, contract common.Address, tokenID string, ) (types.NFTEnhance, error)
QueryNFTEnhance returns the data of a deployed CW721 contract TODO
func (Keeper) QueryWasmState ¶
func (k Keeper) QueryWasmState( ctx sdk.Context, req *wasmtypes.QuerySmartContractStateRequest) (*wasmtypes.QuerySmartContractStateResponse, error)
QueryWasmState for query (rsp *types.QuerySmartContractStateResponse, err error) func (q grpcQuerier) SmartContractState(c context.Context, req *types.QuerySmartContractStateRequest) (rsp *types.QuerySmartContractStateResponse, err error) {
func (Keeper) RefundPacketToken ¶
func (k Keeper) RefundPacketToken( ctx sdk.Context, data ibcnfttransfertypes.NonFungibleTokenPacketData, ) error
RefundPacketToken handles the IBC packet timeout/failure for CW721 transfers. It reverses the conversion: returns the CW721 to its original owner, cleans up token pair mappings, and burns the native NFT returned to the module account. This function should be called by the host chain's IBC middleware OnTimeoutPacket handler.
func (Keeper) RegisterCW721 ¶
func (k Keeper) RegisterCW721(ctx sdk.Context, msg *types.MsgConvertCW721) (*types.TokenPair, error)
RegisterCW721 creates a Cosmos coin and registers the token pair between the nft and the CW721
func (Keeper) RegisterNFT ¶
RegisterNFT deploys an cw721 contract and creates the token pair for the existing cosmos coin
func (Keeper) SetCW721Map ¶
SetCW721Map sets the token pair id for the given address
func (Keeper) SetClassMap ¶
SetClassMap sets the token pair id for the classID
func (Keeper) SetCwAddressByContractTokenId ¶
func (k Keeper) SetCwAddressByContractTokenId(ctx sdk.Context, evmContractAddress string, evmTokenId string, evmAddress string)
SetCwAddressByContractTokenId
func (Keeper) SetNFTPairByClassNFTID ¶
func (Keeper) SetNFTPairByContractTokenID ¶
func (Keeper) SetNFTPairs ¶
func (Keeper) SetNFTUIDPairByNFTUID ¶
func (Keeper) SetNFTUIDPairByTokenUID ¶
func (Keeper) SetTokenPair ¶
SetTokenPair stores a token pair
func (Keeper) SetWasmCode ¶
SetWasmCode stores a WasmCode
func (Keeper) ToggleConversion ¶
ToggleConversion toggles conversion for a given token pair
func (Keeper) TokenPair ¶
func (k Keeper) TokenPair( c context.Context, req *types.QueryTokenPairRequest, ) (*types.QueryTokenPairResponse, error)
TokenPair returns a given registered token pair.
func (Keeper) TokenPairs ¶
func (k Keeper) TokenPairs( c context.Context, req *types.QueryTokenPairsRequest, ) (*types.QueryTokenPairsResponse, error)
TokenPairs returns all registered token pairs.
func (Keeper) TransferCW721 ¶
func (k Keeper) TransferCW721( goCtx context.Context, msg *types.MsgTransferCW721, ) ( *types.MsgTransferCW721Response, error, )
TransferCW721 converts CW721 tokens into native Cosmos nft for both Cosmos-native and CW721 TokenPair Owners and transfer through IBC
func (Keeper) TransferCw721 ¶
func (k Keeper) TransferCw721( ctx sdk.Context, contractAddress string, tokenId string, recipient string, sender string, ) (*wasmtypes.MsgExecuteContractResponse, error)
TransferCw721 the contract and get the result
func (Keeper) UpdateParams ¶ added in v0.4.0
func (k Keeper) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
UpdateParams updates cw721 params. Authority must be the gov module account.
func (Keeper) WasmContract ¶
func (k Keeper) WasmContract( c context.Context, req *types.QueryWasmAddressRequest, ) (*types.QueryWasmContractResponse, error)
WasmContract returns the cw721 module params.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func (Migrator) GetParams ¶ added in v0.4.0
GetParams returns the cw721 module params - used for migration
func (Migrator) Migrate1to2 ¶ added in v0.4.0
Migrate1to2 migrates the store from version 1 to 2
type MintInfo ¶
type MintInfo struct {
Mint MintInfoData `json:"mint"`
}
MintInfo {"mint":{"token_id":"abc126","owner":"uptick100s3yp8l3atuuvx98jmftttxzy4ee5mg2n79fx","token_uri":"http://test.com"}}
type MintInfoData ¶
type TransferNftData ¶
type TransferNftInfo ¶
type TransferNftInfo struct {
TransferNft TransferNftData `json:"transfer_nft"`
}
TransferNftInfo {"transfer_nft":{"recipient":"uptick1n3t0zuwq4u47ke48qm3pfhj96f4ujhs70f52sg","token_id":"abc123"}}