-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
50 lines (40 loc) · 1.38 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const { Client, Wallet, convertStringToHex } = require('xrpl');
async function mintNFT(index) {
// Connect to the XRPL Mainnet
const xrplClient = new Client('wss://s1.ripple.com');
await xrplClient.connect();
if (index === 2223) {
return console.log('Mint Ended');
}
try {
const issuerWallet = Wallet.fromSeed('sn6kaC7eCAFfp9qX3PLndrq3EU2k8', {
masterAddress: "r9FA7ujRpQyKEkbFG4LznukQHVWmSUJ9t9"
});
// Get the issuer account's address
const issuerAddress = issuerWallet.address;
// Build the transaction
const metadataURI = 'ipfs://bafybeiauojqkucr2ko5dehsz7pu3ayttaqybkfgmgowmk445sirknpnhte/' + (index) + '.json';
const transactionBlob = {
TransactionType: "NFTokenMint",
Account: issuerAddress,
TransferFee: 10000,
NFTokenTaxon: 0,
Flags: 9,
URI: convertStringToHex(metadataURI),
};
console.log(issuerAddress);
console.log("Minting " + index + " NFT");
// Sign the transaction with the issuer account's secret
const signedTx = await xrplClient.submitAndWait(transactionBlob, {
wallet: issuerWallet
});
console.log(index + ' NFT minted successfully!');
console.log("Transaction hash : " + signedTx.result.hash);
await mintNFT(index + 1);
} catch (error) {
console.error('Error minting NFT:', error);
} finally {
xrplClient.disconnect();
}
}
mintNFT(2222);