List a single NFT For Sale on Ethereum
Listing a single NFT, for sale, to be sold on Ethereum requires firstly that the NFT exist and that the initiator of the transaction is the owner of the NFT.
await api.send.listEthereumNftForSale(nftId);
important
You can get the VL_GATEWAY_URL and Relayer 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);
// 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.listEthereumNftForSale(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://VL_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 ethereum transaction hash.
- 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://VL-GATEWAY-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 VL to list your NFT for sale.
tip
You can query the state of your transaction here using the returned request id.