Hey everyone! I’m working on a project with two contracts on the NEAR testnet: one for minting NFTs and another for a marketplace. I’ve got the minting part working fine using the /sign_url API, but I’m stuck on the listing process.
I want to create a transaction link that lets users list their NFTs for sale, similar to how other platforms do it. The problem is, I’m not sure what payload I need to send to the /sign_url API to generate this listing link.
Here’s what I’ve done so far:
nft_contract = 'my-nft-token.testnet'
marketplace_contract = 'my-nft-market.testnet'
# This part works for minting
mint_payload = {
'token_id': 'cool-nft-123',
'metadata': { 'title': 'My Cool NFT' },
'receiver_id': 'user.testnet'
}
# But what should the listing payload look like?
listing_payload = {
# ... ?
}
Can anyone help me figure out the correct payload structure for listing an NFT? I’m testing on the testnet, by the way. Thanks in advance for any tips or examples!
hey ray84! i’m also working on some NFT stuff and saw your question. creating a listing for NFTs can be tricky, right?
have you looked into the nft_approve method? i think that might be what you need for the listing process. from what i remember, you’d need to call this on the NFT contract to give permission to the marketplace.
maybe try something like this for your listing_payload:
listing_payload = {
'token_id': 'cool-nft-123',
'account_id': 'my-nft-market.testnet',
'msg': '{\"sale_conditions\":\"10000000000000000000000000\"}' # 10 NEAR in yoctoNEAR
}
the ‘msg’ part is where you’d put the sale price and any other listing details. the format might vary depending on your specific marketplace contract though.
have you tried anything like this yet? what happened when you did? i’m really curious to see how your project turns out!
yo ray84, i’ve dealt with this before. for listing, you gotta use the nft_approve method on your NFT contract. it lets the marketplace handle the sale.
Certainly, I can provide some insights on creating a sale listing for NFTs on a custom NEAR marketplace.
For the listing process, you’ll need to use the nft_approve method on your NFT contract. This grants permission to the marketplace to handle the sale. Your listing_payload should look something like this:
The ‘msg’ field is crucial here. It contains the sale price in yoctoNEAR (10 NEAR in this example). You might need to adjust the exact structure based on your specific marketplace contract implementation.
Remember to ensure your marketplace contract has a corresponding method to handle this approval and create the listing. Test thoroughly on the testnet before going live. Good luck with your project!