├── README.md └── list-nft.js /README.md: -------------------------------------------------------------------------------- 1 | jump 2 | -------------------------------------------------------------------------------- /list-nft.js: -------------------------------------------------------------------------------- 1 | import { ArchwayClient } from '@archwayhq/arch3.js'; 2 | import { SigningArchwayClient } from '@archwayhq/arch3.js'; 3 | import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing'; 4 | import { GasPrice, calculateFee } from "@cosmjs/stargate"; 5 | 6 | const network = { 7 | chainId: 'constantine-3', 8 | endpoint: 'https://rpc.constantine.archway.tech', 9 | prefix: 'archway', 10 | }; 11 | 12 | const mnemonic = 'core wear goose congress elephant afraid amazing diet holiday crush better expect provide envelope involve slide hotel prepare dad zoo fatal media cute already'; 13 | const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { prefix: network.prefix }); 14 | const accounts = await wallet.getAccounts(); 15 | const client = await SigningArchwayClient.connectWithSigner(network.endpoint, wallet); 16 | 17 | const marketContractAddress = 'archway1cwx58k4xew5zrc4zqs888w58fhckvn09ryh02qx03dv83g8d6fyq6kcl3s'; 18 | const contractAddress = 'archway1xlu0usjnk99kczu9f7kahdj05j4aq9q6glevvm8uwm8e3nr6z99snxqlh8'; // collection address 19 | 20 | const listNftMsg = `{"sell":{"token":{"native":{"denom":"aconst"}},"amount":"100"}}`; 21 | 22 | console.log(listNftMsg); 23 | 24 | const gasPrice = GasPrice.fromString("1000000000000aconst"); 25 | const token_id = 8; 26 | const { transactionHash } = await client.execute( 27 | accounts[0].address, 28 | contractAddress, 29 | { 30 | send_nft: { 31 | contract: marketContractAddress, 32 | token_id: token_id.toString(), 33 | msg: Buffer.from(listNftMsg).toString("base64") 34 | } 35 | }, 36 | calculateFee(500000, gasPrice), 37 | "" 38 | ); 39 | 40 | console.log(transactionHash); --------------------------------------------------------------------------------