└── nft.js /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 contractAddress = 'archway15y2rtn48nm0483umghatyj48n8fs6lrwj7t5q2lpl7apzdtmx37qg6j8wc'; // collection address 18 | 19 | 20 | let metadata = { 21 | 'link': '123', 22 | 'some_attributes': { 23 | 'attribute': 'value' 24 | } 25 | } 26 | 27 | let tokens = []; 28 | 29 | for (let i = 1; i < 10; i++) { 30 | tokens.push({ 31 | "token_id": i.toString(), 32 | "owner": accounts[0].address, 33 | "token_uri": "https://ik.imagekit.io/fmivn9lzw/1_C_FB4vklOD.png", 34 | "extension": JSON.stringify(metadata) 35 | }); 36 | } 37 | 38 | const mintNftMsg = { 39 | "batch_mint": { 40 | "tokens": tokens 41 | } 42 | }; 43 | 44 | const gasPrice = GasPrice.fromString("1000000000000aconst"); 45 | 46 | const { transactionHash } = await client.execute( 47 | accounts[0].address, 48 | contractAddress, 49 | mintNftMsg, 50 | calculateFee(500000, gasPrice), 51 | "" 52 | ); 53 | 54 | console.log(transactionHash); --------------------------------------------------------------------------------