Mint a Batch of ETH-Bought NFTs
Mint a batch of NFTs on the Aventus network.
Minting from a batch of NFTs has a different flow from minting a single NFT. To mint a single NFT, please follow the steps here. The main difference between minting single and batch NFTs is when you mint an NFT from a batch, the batch abstraction must already exist to allow the NFT to be minted from within that batch. This is a cross-chain transaction given that it requires communication between the Aventus parachain and the Ethereum blockchain during the lifecycle of the transaction.
await api.send.mintEthereumBatchNft(ethereumTransactionHash);
You can get the AVN_GATEWAY_URL for all networks here.
- Example
- Example Result
- JSON-RPC
- JSON-RPC Output
const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "https://gateway.testnet.aventus.network";
const singleUserOptions = {
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24", // this is from the generated example account
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};
const avnSdk = new AvnApi(AVN_GATEWAY_URL, singleUserOptions);
// replace with the ethereum transaction hash of the NFT you're trying to mint.
const ethereumTransactionHash = "0xcd591...72f6";
async function main() {
await avnSdk.init();
const api = await avnSdk.apis();
let request_id = await api.send.mintEthereumBatchNft(ethereumTransactionHash);
// Returns a request id
console.log(request_id);
}
(async () => {
await main();
})();
You have now successfully submitted a transaction to the AVN to mint an NFT from a previously created batch.
f1710fe7-141f-43c1-b1bb-6ec33d9b3e9a
REQUEST
POST https://AVN_GATEWAY_URL/send
HEADERS
Content-Type: application/json
Authorization': bearer <awtToken>
REQUEST PARAMS
- relayer [required] - a string representing the relayer.
- user [required] - a string representing the user's SS58 address.
- payer [required] - a string representing the payer's SS58 address.
- ethereumTransactionHash [required] - A string representing the ethereum transaction hash.
- proxySignature [required] - a proof signed by the user allowing the transaction to be proxied.
- feePaymentSignature [required] - a proof signed by the payer allowing the relayer fees to be paid.
- paymentNonce [required] - string integer value of the current payment nonce of the payer.
JSON-RPC Example
curl https://AVN-API-URL/send \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"proxyMintBatchNft", "params":{"relayer":"5FbUQ2kJWLoqHuSTSNNqBwKwdQnBVe4HF3TeGyu6UoZaryTh", "user":"5DAgxVxKmn...irSVJDdMr", "payer":"5DAgxVxKmn...irSVJDdMr", "batchId": "0x2c94a703a7b01f0c2d1eed5ccf82b9cbadd0bdd5e4e5283ddf01b249586181c2", "index": "23", "owner":"5DAgxVxKmn...irSVJDdMr", "externalRef":"my-unique-ref-2022-01-18T10:32:45.199Z", "proxySignature":"0xd4d20c5be0943cd1e784b7d83f7bf69...100d0fe24717104cad467890272d47a36f8daf497ebd2ec3ed106c58d8f", "feePaymentSignature":"0x4e4ec2190d44765d1b5fa88f6...ccd633403f75068604cf3b94336c7e93a56b13a0973d181432d381b5b0f8a", "paymentNonce":"201"}, "id":1}'
result - a request ID that can be queried for the transaction's status
{
"jsonrpc": "2.0",
"id": 1,
"result": "a3ef1c40-c1be-4beb-9953-357d0ab504a9"
}
You can query the state of your transaction here using the returned request id.
Production Example
Multiple NFTs have been minted on the AVN and HERE is a link to the AVN Explorer that provides more detail on the minted NFT. Click on the Advanced tab on the page to view more details on the transaction.