cw721

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 20 Imported by: 1

README


title: Non-Fungible Token Convert between coswasm and cosmos native nft category: IBC/APP requires: 25, 26,721 kind: instantiation author: uptsmart uptsmart@163.com created: 2022-03-04 modified: 2025-03-06

Abstract

Coswasm and Cosmos are two different blockchain technologies, and conversion between them involves different protocols and bridging mechanisms. In this case, the conversion from Coswasm to Cosmos native NFT can realize the transfer of NFT issued on the Ethereum blockchain to the Cosmos blockchain for circulation and transactions. This conversion function can help NFT holders transfer their assets from one blockchain to another for better market liquidity and wider usage scenarios.

When performing this conversion, a corresponding bridge protocol or cross-chain interaction protocol needs to be used to establish the connection between the Coswasm and the Cosmos blockchain. Once this connection is established, NFT holders can transfer their assets between the two blockchains through specific operations. This conversion function can help expand the coverage of the NFT market, promote cross-chain transactions and interoperability, and improve the liquidity and use value of NFT.

Desired Properties

  • Preservation of non-fungibility (i.e., only one instance of any token is live across all the IBC-connected blockchains).
  • Permissionless token transfers, no need to whitelist connections, modules, or classIds.
  • Symmetric (all chains implement the same logic, no in-protocol differentiation of hubs & zones).

Technical Specification

Data Structures

Convert from cosmos NFT to Coswasm CW721 asset
// MsgConvertNFT defines a Msg to convert a native Cosmos nft to a CW721 token
message MsgConvertNFT {
  // nft classID to cnvert to CW721
  string class_id = 1;
  // nftID to cnvert to CW721
  repeated string nft_ids = 2;
  // recipient hex address to receive CW721 token
  string receiver = 3;
  // cosmos bech32 address from the owner of the given Cosmos coins
  string sender = 4;
  // CW721 token contract address registered in a token pair
  string contract_address = 5;
  // CW721 token id registered in a token pair
  repeated string token_ids = 6;
}

classId is a required field that MUST never be empty, it uniquely identifies the class/collection/contract which the tokens being transferred belong to in the sending chain. In the case of an ERC-1155 compliant smart contract, for example, this could be a string representation of the top 128 bits of the token ID.

nft_ids array is a required field that MUST have a size greater than zero and hold non-empty entries that uniquely identify tokens (of the given class) that are being transferred. In the case of an ERC-1155 compliant smart contract, for example, a nft_ids could be a string representation of the bottom 128 bits of the token ID.

receiver recipient hex address to receive CW721 token.

sender CW721 token contract address registered in a token pair.

contract_address CW721 token contract address registered in a token pair.

token_ids CW721 token id registered in a token pair.

Convert from Coswasm CW721 to cosmos NFT asset
// MsgConvertCW721 defines a Msg to convert a CW721 token to a native Cosmos
// nft.
message MsgConvertCW721 {
  // CW721 token contract address registered in a token pair
  string contract_address = 1;
  // tokenID to convert
  repeated string token_ids = 2;
  // bech32 address to receive native Cosmos coins
  string receiver = 3;
  // sender hex address from the owner of the given CW721 tokens
  string sender = 4;
  // nft classID to cnvert to CW721
  string class_id = 5;
  // nftID to cnvert to CW721
  repeated string nft_ids = 6;
}

contract_address CW721 token contract address registered in a token pair.

token_ids CW721 token contract address registered in a token pair.

receiver bech32 address to receive native Cosmos coins.

sender sender hex address from the owner of the given CW721 tokens.

class_id is a required field that MUST never be empty, it uniquely identifies the class/collection/contract which the tokens being transferred belong to in the sending chain. In the case of an ERC-1155 compliant smart contract, for example, this could be a string representation of the top 128 bits of the token ID.

nft_ids array is a required field that MUST have a size greater than zero and hold non-empty entries that uniquely identify tokens (of the given class) that are being transferred. In the case of an ERC-1155 compliant smart contract, for example, a cosmos_token_ids could be a string representation of the bottom 128 bits of the token ID.

technical documentation

Backwards Compatibility

Not applicable.

All content herein is licensed under Apache 2.0.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState

ExportGenesis export module status

func InitGenesis

func InitGenesis(
	ctx sdk.Context,
	k keeper.Keeper,
	accountKeeper authkeeper.AccountKeeper,
	data types.GenesisState,
)

InitGenesis import module genesis

func NewHandler

func NewHandler(server types.MsgServer) func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error)

NewHandler defines the cw721 module handler instance

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

func NewAppModule

func NewAppModule(
	k keeper.Keeper,
	ak authkeeper.AccountKeeper,
) AppModule

NewAppModule creates a new AppModule Object

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(_ sdk.Context)

func (AppModule) EndBlock

func (am AppModule) EndBlock(_ sdk.Context) []abci.ValidatorUpdate

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage

func (AppModule) GenerateGenesisState

func (am AppModule) GenerateGenesisState(input *module.SimulationState)

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate

func (AppModule) IsAppModule added in v1.0.6

func (am AppModule) IsAppModule()

IsAppModule implements the appmodule.AppModule interface.

func (AppModule) IsOnePerModuleType added in v1.0.6

func (am AppModule) IsOnePerModuleType()

IsOnePerModuleType implements the depinject.OnePerModuleType interface.

func (AppModule) Name

func (AppModule) Name() string

func (AppModule) NewHandler

func (am AppModule) NewHandler() func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error)

func (AppModule) ProposalContents

func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent

func (AppModule) QuerierRoute

func (am AppModule) QuerierRoute() string

func (AppModule) RandomizedParams

func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.Params

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

func (AppModule) RegisterServices

func (am AppModule) RegisterServices(cfg module.Configurator)

func (AppModule) RegisterStoreDecoder

func (am AppModule) RegisterStoreDecoder(decoderRegistry simtypes.StoreDecoderRegistry)

func (AppModule) WeightedOperations

func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation

type AppModuleBasic

type AppModuleBasic struct{}

app module Basics object

func (AppModuleBasic) ConsensusVersion

func (AppModuleBasic) ConsensusVersion() uint64

ConsensusVersion returns the consensus state-breaking version for the module.

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the erc20 module.

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns no root query command for the erc20 module.

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the root tx command for the erc20 module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

func (AppModuleBasic) RegisterGRPCGatewayRoutes

func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *runtime.ServeMux)

func (AppModuleBasic) RegisterInterfaces

func (AppModuleBasic) RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry)

RegisterInterfaces registers interfaces and implementations of the erc20 module.

func (AppModuleBasic) RegisterLegacyAminoCodec

func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec performs a no-op as the erc20 doesn't support Amino encoding

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router)

RegisterRESTRoutes performs a no-op as the erc20 module doesn't expose REST endpoints

func (AppModuleBasic) ValidateGenesis

func (b AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error

Directories

Path Synopsis
client
cli
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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