Create NFT Batch
Create a batch of NFTs on the Aventus network.
Creating a batch of NFTs doesn't mint all the total number of NFTs indicated for this batch via the totalSupply
variable. It simply instructs the blockchain that you will be minting multiple NFTs that should be linked together as part of a batch, and the blockchain should not allow minting a higher number of NFTs than specified at creation.
This page is kept simple to show the function signature and how it can be used. To understand the various variable names and their constraints, HERE is an explainer. For a further deep-dive into how the Aventus Network supports NFTs, check this out.
await api.send.createNftBatch(totalSupply, royalties, T1_ADMIN_NAME);
- 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);
// number of nfts available to mint in this batch
const TOTAL_SUPPLY = 5;
// follow the link above to learn about T1_ADMIN_NAME
const T1_ADMIN_NAME = "0x1a2...b3c";
//see next page for more info on Royalties.
const ROYALTIES = [];
async function main() {
await avnSdk.init();
const api = await avnSdk.apis();
let request_id = await api.send.createNftBatch(
TOTAL_SUPPLY,
ROYALTIES,
T1_ADMIN_NAME
);
// Returns a request id
console.log(request_id);
}
(async () => {
await main();
})();
You have now successfully submitted a transaction to the AVN to create a batch of NFTs.
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's SS58 address
- user [required] - a string representing the user's SS58 address
- payer [required] - a string representing the payer's SS58 address
- totalSupply [required] - string integer value of the number of NFTs in the batch
- royalties [optional] - an array of royalty rates with percentages set in parts per million accepts empty array if no royalties
- t1Authority [required] - a hex string representing the 20 byte Ethereum address of the relevant authority
- nonce [required] - string integer value of the current proxy nonce of type 'batch'
- 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":"proxyCreateNftBatch", "params":{"relayer":"5FbUQ2kJWLoqH...F3TeGyu6UoZaryTh", "user":"5DAgxVxKmn...rSVJDdMr", "payer":"5DAgxVxKmn...rSVJDdMr", "totalSupply":"1234", "royalties": [{"recipient_t1_address":"0xf8f77379A1C6b5CA66702b5943c5b229E310Ec03", "rate": {"parts_per_million":"10000"}}], "t1Authority":"0xd6ae8250b8348c94847280928c79fb3b63ca453e", "nonce":"10", "proxySignature":"0xd4d20c5be0943...636742c30f44100d0fe24717104cad467890272d47a36f8daf497ebd2ec3ed106c58d8f", "feePaymentSignature":"0x4e4ec2190d44765d1...99e47e9b0ccd633403f75068604cf3b94336c7e93a56b13a0973d181432d381b5b0f8a", "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.