Documentation
¶
Index ¶
- Constants
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NormalizeCW721Address(addr string) (string, error)
- func WrapWasmKeeper(k *wasmkeeper.Keeper) types.WasmKeeper
- type AllNftAccess
- type AllNftData
- type AllNftInfo
- type ContractInfo
- type ContractInfoData
- type GenesisExportError
- type GenesisExportIssue
- type GenesisExportIssueKind
- 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, cwContractAddress string, cwTokenId 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) DeletePairPerTokenState(ctx sdk.Context, pair types.TokenPair)
- 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) ExportIssues(ctx sdk.Context) []GenesisExportIssue
- func (k Keeper) ExportNFTUIDPairs(ctx sdk.Context) ([]types.NFTUIDPair, error)
- func (k Keeper) ExportNFTUIDPairsWithReport(ctx sdk.Context) ([]types.NFTUIDPair, []GenesisExportIssue)
- func (k Keeper) ExportRefundReceivers(ctx sdk.Context) ([]types.RefundReceiver, error)
- func (k Keeper) ExportRefundReceiversWithReport(ctx sdk.Context) ([]types.RefundReceiver, []GenesisExportIssue)
- 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, cwContractAddress string, cwTokenId 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) GetPairByCW721(ctx sdk.Context, contract string) (types.TokenPair, error)
- func (k Keeper) GetPairByClass(ctx sdk.Context, classID 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) GetTokenPairsWithReport(ctx sdk.Context) ([]types.TokenPair, []GenesisExportIssue)
- 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) QueryCW721TokenOwner(ctx sdk.Context, contractAddress string, tokenId string) (string, 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, cwContractAddress string, cwTokenId string, cwReceiver string)
- func (k Keeper) SetGenesisNFTUIDPair(ctx sdk.Context, pair types.NFTUIDPair)
- func (k Keeper) SetGenesisRefundReceiver(ctx sdk.Context, receiver types.RefundReceiver)
- 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, ...) error
- 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) error
- func (k Keeper) SetWasmCode(ctx sdk.Context, account string, codeId uint64)
- 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 TransferNftData
- type TransferNftInfo
Constants ¶
const MaxReportedExportIssues = 20
MaxReportedExportIssues caps how many individual records are spelled out in the error message. Every issue is still counted.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶ added in v0.4.0
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func NormalizeCW721Address ¶ added in v0.5.0
NormalizeCW721Address returns the canonical bech32 form of a CW721 contract address. Bech32 decodes identically from its all-lowercase and all-uppercase spellings, so the same contract can be presented under multiple alias strings. Every KV key derived from a CW721 address (token pair maps, token UIDs, refund receivers) MUST use the canonical re-encoded form, otherwise:
- the same contract can be registered twice under case aliases;
- lookups with a differently-cased address miss the stored pair;
- exported genesis fails validation, because genesis duplicate detection is case-insensitive (strings.ToLower) while runtime keys are not.
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 GenesisExportError ¶ added in v0.5.0
type GenesisExportError struct {
Module string
Issues []GenesisExportIssue
}
GenesisExportError reports state that a genesis file cannot represent. The error-returning accessors (ExportNFTUIDPairs, ExportRefundReceivers) return it through issuesToError when the live store is damaged.
The Cosmos SDK module interface (AppModule.ExportGenesis(ctx, cdc) json.RawMessage) has no error channel, so the module-level ExportGenesis cannot surface it and degrades-and-reports instead; Error() is what spells out the actionable list of damaged keys, capped at MaxReportedExportIssues.
func (*GenesisExportError) Error ¶ added in v0.5.0
func (e *GenesisExportError) Error() string
type GenesisExportIssue ¶ added in v0.5.0
type GenesisExportIssue struct {
Kind GenesisExportIssueKind
Key string
Detail string
}
GenesisExportIssue is one state record that cannot be exported faithfully. Key carries the store key so an operator can point at the exact record.
func MergeExportIssues ¶ added in v0.5.0
func MergeExportIssues(groups ...[]GenesisExportIssue) []GenesisExportIssue
MergeExportIssues flattens the per-store issue lists into one list so every caller reports them in the same order instead of re-implementing the append.
func (GenesisExportIssue) String ¶ added in v0.5.0
func (i GenesisExportIssue) String() string
type GenesisExportIssueKind ¶ added in v0.5.0
type GenesisExportIssueKind string
GenesisExportIssueKind classifies one reason why a genesis export could not represent the live store faithfully.
const ( // GenesisExportIssueTokenPairCorrupt means a registered TokenPair record // could not be decoded. GenesisExportIssueTokenPairCorrupt GenesisExportIssueKind = "token_pair_corrupt" //nolint:gosec // G101 false positive: the identifier name contains "Token"; the value is a non-secret issue-kind code. // GenesisExportIssueUIDIndexBackward means a reverse (nftUID -> tokenUID) // index entry has no matching forward entry. GenesisExportIssueUIDIndexBackward GenesisExportIssueKind = "nft_uid_index_reverse_without_forward" // GenesisExportIssueUIDIndexForward means a forward (tokenUID -> nftUID) // index entry has no matching reverse entry. GenesisExportIssueUIDIndexForward GenesisExportIssueKind = "nft_uid_index_forward_without_reverse" // GenesisExportIssueRefundKeyOrphan means a refund receiver record does not // belong to any registered contract. GenesisExportIssueRefundKeyOrphan GenesisExportIssueKind = "refund_key_orphaned" // GenesisExportIssueUIDIndexUnregisteredPair means a bidirectional // conversion binding is internally consistent but its contract/class no // longer resolve to a registered token pair, so the import side would // reject it (ValidateGenesisPairs) and InitGenesis would panic. The export // drops and reports it instead. GenesisExportIssueUIDIndexUnregisteredPair GenesisExportIssueKind = "nft_uid_index_unregistered_pair" )
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) DeletePairPerTokenState ¶ added in v0.5.0
DeletePairPerTokenState removes the bidirectional NFT UID index entries and IBC refund receivers that belong to pair, so a removed token pair cannot leave orphans that make ExportGenesis fail (mirrors the erc721 keeper).
Symmetry note: unlike erc721 there is currently no production path that removes a cw721 token pair (CW721 contracts cannot self-destruct and no message deletes a pair), so today this helper has no live caller. It exists so any future pair-removal path (or governance purge message) cleans the per-token state in exactly the same way as erc721 instead of leaving orphaned UID/refund records behind.
Commit semantics: Cosmos SDK state is per-transaction — a write made on a handler path that returns an error is rolled back by baseapp. Callers must therefore only invoke this on paths that end in success.
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) ExportIssues ¶ added in v0.5.0
func (k Keeper) ExportIssues(ctx sdk.Context) []GenesisExportIssue
ExportIssues aggregates every degradation the genesis export can report, without requiring the caller to build the genesis state first. The app-level diagnostics report uses it to describe a degraded export without a second full export pass.
func (Keeper) ExportNFTUIDPairs ¶ added in v0.5.0
ExportNFTUIDPairs returns every per-token conversion binding and verifies the bidirectional index is internally consistent (forward[x]=y must imply reverse[y]=x). A mismatch means the live store is corrupt; failing the export loudly is preferable to baking the corruption into a genesis file.
func (Keeper) ExportNFTUIDPairsWithReport ¶ added in v0.5.0
func (k Keeper) ExportNFTUIDPairsWithReport(ctx sdk.Context) ([]types.NFTUIDPair, []GenesisExportIssue)
ExportNFTUIDPairsWithReport collects every damaged index entry instead of aborting on the first one, so the fail-closed export can report the complete repair list in one pass.
A binding is exported only if the import side would accept it: types.ValidateGenesisPairs requires the token UID and the NFT UID to resolve to the same registered token pair, and InitGenesis panics on the same condition. A consistent binding can still outlive its pair -- a pair record that no longer decodes is dropped from the exported TokenPairs, and a removed pair's index entries are swept best-effort -- so emitting them verbatim produced a genesis that failed its own validation: an unusable backup exactly when it is needed. Such bindings are dropped AND reported: dropping is the only importable option (nothing this validation rejects can survive an InitGenesis), and the dropped record stays visible in <home>/export-issues.json so it can be repaired out of band. The live chain is untouched either way -- this is purely about producing a genesis that can be read back.
func (Keeper) ExportRefundReceivers ¶ added in v0.5.0
ExportRefundReceivers returns every recorded IBC refund receiver. Refund store keys are "<contractAddress><tokenID>" concatenations; the contract part is recovered by matching against the registered pair contracts, which is lossless for any address format. CW721 contracts are bech32: matching is case-insensitive (all-lowercase and all-uppercase encodings are the same address), and the exact stored prefix bytes are returned so re-import reproduces the original key. Orphaned records fail the export instead of being dropped.
func (Keeper) ExportRefundReceiversWithReport ¶ added in v0.5.0
func (k Keeper) ExportRefundReceiversWithReport(ctx sdk.Context) ([]types.RefundReceiver, []GenesisExportIssue)
ExportRefundReceiversWithReport exports every refund receiver and reports (rather than aborts on) the orphaned keys, so the fail-closed caller can print the full repair list at once.
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 looks up a token pair by class id first, then by CW721 contract. Class ids and contract addresses are distinct namespaces: a class-path caller (ConvertNFT) must use GetPairByClass so a denom whose id equals a contract address cannot resolve to that contract's pair.
func (Keeper) GetPairByCW721 ¶ added in v0.5.0
GetPairByCW721 resolves a pair exclusively from the CW721 contract map.
func (Keeper) GetPairByClass ¶ added in v0.5.0
GetPairByClass resolves a pair exclusively from the class-id map.
func (Keeper) GetTokenPair ¶
GetTokenPair - get registered token pair from the identifier
func (Keeper) GetTokenPairID ¶
GetTokenPairID returns the pair id from a class id or a CW721 contract. The maps are distinct namespaces: class is tried first so a denom whose id equals a contract address cannot steal that contract's pair on the class path.
func (Keeper) GetTokenPairs ¶
GetTokenPairs - get all registered token tokenPairs
Corrupt records are skipped here and reported through GetTokenPairsWithReport: this accessor is reachable from the gRPC query path, where a panic would take the node's query handler down, and it is no longer the genesis-export entry point (ExportGenesis fails closed on the report).
func (Keeper) GetTokenPairsWithReport ¶ added in v0.5.0
GetTokenPairsWithReport returns every decodable token pair plus the list of records that could not be decoded. Damaged records are never dropped silently: the caller decides whether to abort (genesis export does) or to continue with the healthy subset.
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) QueryCW721TokenOwner ¶ added in v0.5.0
func (k Keeper) QueryCW721TokenOwner( ctx sdk.Context, contractAddress string, tokenId string, ) (string, error)
QueryCW721TokenOwner returns the current owner of a CW721 token.
It is used by the IBC refund path to decide whether the module account still escrows the token: a token that is no longer owned by the module must be skipped instead of refunded, otherwise the refund aborts the IBC callback and the packet can never be finalized.
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.
The refund is gated on the module account still owning the CW721 token; a token that was already refunded, never escrowed, or moved elsewhere is skipped with an event instead of an error (an error would abort the IBC callback and strand the packet forever). Mirrors x/erc721.
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, cwContractAddress string, cwTokenId string, cwReceiver string)
SetCwAddressByContractTokenId
func (Keeper) SetGenesisNFTUIDPair ¶ added in v0.5.0
func (k Keeper) SetGenesisNFTUIDPair(ctx sdk.Context, pair types.NFTUIDPair)
SetGenesisNFTUIDPair restores one bidirectional conversion binding during InitGenesis, writing both directions of the runtime index.
func (Keeper) SetGenesisRefundReceiver ¶ added in v0.5.0
func (k Keeper) SetGenesisRefundReceiver(ctx sdk.Context, receiver types.RefundReceiver)
SetGenesisRefundReceiver restores one IBC refund receiver during InitGenesis under the exact store key it was exported from.
func (Keeper) SetNFTPairByClassNFTID ¶
func (Keeper) SetNFTPairByContractTokenID ¶
func (Keeper) SetNFTPairs ¶
func (k Keeper) SetNFTPairs(ctx sdk.Context, contractAddress string, tokenID string, classID string, nftID string) error
SetNFTPairs atomically binds a CW721 (contract, tokenID) to a Cosmos NFT (classID, nftID) in both directions, enforcing a strict one-to-one invariant forward[x]=y ⟺ reverse[y]=x. If either side already points to a different partner the call fails, mirroring x/erc721.
func (Keeper) SetNFTUIDPairByNFTUID ¶
func (Keeper) SetNFTUIDPairByTokenUID ¶
func (Keeper) SetTokenPair ¶
SetTokenPair stores a token pair SetTokenPair stores a token pair. A protobuf marshal failure is surfaced to the caller instead of being swallowed: silently dropping the write would leave the token pair unregistered while later lookups assume it exists.
func (Keeper) SetWasmCode ¶
SetWasmCode stores a WasmCode
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 registered token pair (and therefore the CW721 contract) for the given class id. Port and channel are accepted for API / IBC-voucher compatibility, but the pair registry is keyed by class id, so the lookup resolves on ClassId alone. A missing pair is reported as NotFound — it must never return an empty "success" response, which used to silently hide the contract address from clients.
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.
The 1→2 migration is intentionally a no-op: the cw721 module store layout did not change between its version-1 and version-2 states — only the module ConsensusVersion was bumped (alongside the params handling moving to authority-based management, which the v0.4.0 upgrade handler performs). The registration exists so a chain whose on-chain module version map still records cw721 v1 can advance through RunMigrations without failing. Keep it registered; never delete it while any chain can still hold module version 1.
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"}}