Transfer a single ETH-Bought NFT
Transfer a single Aventus NFT, bought with ETH, using it's Ethereum transaction hash. 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.transferEthereumNft(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 list.
const ethereumTransactionHash = "0xcd591...72f6";
async function main() {
await avnSdk.init();
const api = await avnSdk.apis();
let request_id = await api.send.transferEthereumNft(ethereumTransactionHash);
// Returns a request id
console.log(request_id);
}
(async () => {
await main();
})();
You have now successfully submitted a transaction to the AVN to transfer an 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.
- ethereumTransactionHash [required] - a string representing the ethereum transaction hash.
- 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", "ethereumTransactionHash":"0x3044598a96da039d27802b300ba6197d6a023752efaccf598e62516f6ee7587c", "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.