Transfer a single NFT
Transfer ownership of an NFT purchased in FIAT to another account on the Aventus network.
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.transferFiatNft(recipientAvnAddress, nftId);
- Example
- Example Result
- JSON-RPC
- JSON-RPC Output
const AVN_API = require("avn-api");
const AVN_GATEWAY_URL = "<node_url>";
const options = {
suri: "<account_suri>",
};
const API = new AVN_API(AVN_GATEWAY_URL, options);
// replace with the nftID of the NFT you're trying to list.
const NFT_ID = "0xcd...f6";
//This can be the address or public key.
const RECIPIENT_ADDRESS = "5Fb...yTh";
async function main() {
await api.init();
let result = await api.send.transferFiatNft(RECIPIENT_ADDRESS, NFT_ID);
// Returns a request id
console.log(result);
}
(async () => {
await main();
})();
You have now successfully submitted a transaction to the AVN to transfer NFT.
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.
- nftId [required] - a string representing the NFT ID (32 bytes) to check for nonce.
- recipient [required] - a hex string representing the recipient's public key.
- nonce [required] - string integer value of the current proxy nonce of type 'nft'
- 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":"proxyTransferFiatNft", "params":{"relayer":"5FbUQ2kJWLo...Gyu6UoZaryTh", "user":"5DAgxVxKmn...rSVJDdMr", "payer":"5DAgxVxKmn...rSVJDdMr", "nftId":"0x3044598a96da039d27802b300ba6197d6a023752efaccf598e62516f6ee7587c", "recipient":"5FgyNN84CzQfwHBUJWvQkr36hiQYEXjDhcUYVx9tCTdgqosF", "nonce":"10", "proxySignature":"0xaa3b454549de3a941e19...d5912f83b1e0c43083b1103f9655c52290221bf590facd9e99a839cafc383c30567055a56c97c8a", "feePaymentSignature":"0x500da1ab75346f...6acd0be0ca93da71bbe55d11f8df8f64f3b99c2c47a053495bf6eb842ecc4fbfad6b87", "paymentNonce":"212"}, "id":1}'
result - a request ID that can be queried for the transaction's status
{
"jsonrpc": "2.0",
"id": 1,
"result": "5415c92b-57a5-46f7-ba79-57176afb2510"
}
You can query the state of your transaction here using the returned request id.
Production Example
Multiple NFTs have changed ownership on the AVN, and HERE is a link to the AVN Explorer that provides more detail on a transferred NFT. Click on the Advanced tab on the page to view more details on the transaction.