List a single NFT Open For Sale
Listing a single NFT for sale requires firstly that the NFT exist and that the initiator of the transaction is the owner of the NFT.
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.listFiatNftForSale(nftId);
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 nftID of the NFT you're trying to list.
const NFT_ID = "0xcd5...2f6";
async function main() {
await avnSdk.init();
const api = await avnSdk.apis();
let request_id = await api.send.listFiatNftForSale(NFT_ID);
// Returns a request id
console.log(request_id);
}
(async () => {
await main();
})();
Response: f1710fe7-141f-43c1-b1bb-6ec33d9b3e9a
Lists an NFT as open for sale in a particular market
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.
- market [required] - an integer enum representing the market to list the NFT on (1 = Ethereum, 2 = Fiat).
- 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":"proxyListNftOpenForSale", "params":{"relayer":"5FbUQ2kJWLoq...eGyu6UoZaryTh", "user":"5DAgxVxKmn...rSVJDdMr", "payer":"5DAgxVxKmn...rSVJDdMr", "nftId":"0x2c94a703a7b01f0c2d1eed5ccf82b9cbadd0bdd5e4e5283ddf01b249586181c2", "market": 2, "nonce":"10","proxySignature":"0xc695f01932ce42204d9a01...7e42dc372d29fbb2d0d303d4b5d184fbe294ce5e06c93d9771a56cfe7533e0cdb488", "feePaymentSignature":"0x02529e00606006ef98d70e8c3...0f4c5260dde125da581b772909b5ed2756b83c71a5ef6568a36a79ab565cd158e", "paymentNonce":"205"}, "id":1}'
result - a request ID that can be queried for the transaction's status
{
"jsonrpc": "2.0",
"id": 1,
"result": "04a3eae5-54e7-4708-9bf9-a172f06453f7"
}
You have now successfully submitted a transaction to the AVN to list your NFT for sale.
You can query the state of your transaction here using the returned request id.
Production Example
Multiple NFTs have been listed for sale on the AVN in either Ether or FIAT currency, and HERE is a link to the AVN Explorer that provides more detail on a listed NFT in FIAT. Click on the Advanced tab on the page to view more details on the transaction.