Mint a single NFT
Mint a single new NFT on the Voucher Ledger.
await api.send.mintSingleNft(externalRef, royalties, t1AdminName);
important
You can get the VL_GATEWAY_URL for all networks here.
- Example
- Example Result
- JSON-RPC
- JSON-RPC Output
const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const VL_GATEWAY_URL = "https://gateway.testnet.voucherledger.com";
const singleUserOptions = {
suri: "0x5392ca60a61aea99fce14358798de93c1bc11c3696a905718738c71fae539c24", // this is from the generated example account
setupMode: SetupMode.SingleUser,
signingMode: SigningMode.SuriBased,
};
const avnSdk = new AvnApi(VL_GATEWAY_URL, singleUserOptions);
// follow the link above to learn about EXTERNAL_REF
const EXTERNAL_REF = "https://5DA/gxV";
// 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.mintSingleNft(
EXTERNAL_REF,
ROYALTIES,
T1_ADMIN_NAME
);
// Returns a request id
console.log(request_id);
}
(async () => {
await main();
})();
You have now successfully submitted a transaction to the VL to mint an NFT.
Response: f1710fe7-141f-43c1-b1bb-6ec33d9b3e9a
REQUEST
POST https://VL_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.
- externalRef [required] - a unique string representing the NFT's external reference.
- 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.
- 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://VL_GATEWAY_URL/send \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer <awtToken>" \
-d '{"jsonrpc":"2.0", "method":"proxyMintSingleNft", "params":{"relayer":"5Fb...ryTh", "user":"5DAgx...DdMr", "payer":"5DAg...JDdMr", "externalRef":"my-unique-ref-2022-01-18T10:32:45.199Z", "royalties": [{"recipient_t1_address":"0xf...10Ec03", "rate": {"parts_per_million":"10000"}}], "t1Authority":"0xd6a...453e", "proxySignature":"0xd4d20c5be0943cd1e784b7d83f7bf69d1c2419411c1b6b6d60c1e6d2c636742c30f44100d0fe24717104cad467890272d47a36f8daf497ebd2ec3ed106c58d8f", "feePaymentSignature":"0x4e4ec2190d44765d1b5fa88f6aabbf87744ef964c171f0ec48763fcfbc99e47e9b0ccd633403f75068604cf3b94336c7e93a56b13a0973d181432d381b5b0f8a", "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"
}
tip
You can query the state of your transaction here using the returned request id.