I successfully created a frontend application that can mint NFTs using the /sign_url API endpoint. The minting process works perfectly and I can see all created tokens in my testnet wallet.
Now I need help with the marketplace listing feature. I want to create transaction URLs that allow users to list their NFTs for sale, similar to how other NEAR marketplaces work.
I’m trying to use the same /sign_url endpoint to generate listing transactions, but I’m not sure what parameters to include in the request payload. What should the transaction structure look like for listing an NFT on the marketplace contract?
Here’s an example of my current minting request structure:
you gotta approve the nft contract first, then hit your marketplace. do nft_approve with your marketplace as spender, then call list_nft (or whatever you named it). be sure to include price and expiration time in args. also, don’t forget the storage deposit - 0.1 NEAR should be enough.
Hey Ray84! This is really interesting - I’ve been working with NEAR marketplaces too and hit similar questions.
Before we get into transaction structure, what’s your marketplace contract setup like? Are you doing direct sales or auctions? The payload changes quite a bit based on your approach.
Also, did you set up the approval mechanism between your NFT and marketplace contracts yet? That usually needs to happen before you can list anything.
Most marketplace implementations I’ve seen call something like nft_on_approve or list_token on the marketplace contract, but it really depends on how you built your smart contract methods.
What methods did you implement in my-market-contract.testnet? Following any specific standard like NEP-171 marketplace patterns?
I’d love to help once I know more about your contract structure. There are several ways to do this and the transaction payload looks completely different for direct sales vs auctions vs more complex listing setups.
Btw, your minting setup looks solid! Gas and deposit amounts seem good for testnet.
Hit this same issue 6 months back building my NEAR marketplace. Listing’s different from minting - you need two separate transactions, can’t bundle it like create_token. First call nft_approve on your NFT contract with the marketplace as approved account. Second transaction hits your marketplace’s listing method (create_listing or whatever you called it). Your marketplace payload needs NFT contract address, token_id, price in yoctoNEAR, plus any sale conditions. Budget about 0.01 NEAR for storage deposit. The tricky bit’s the approval callback - your marketplace needs proper nft_on_approve implementation to receive approval and create listing atomically. Skip this and users get approved but can’t list, which sucks for UX. What’s your marketplace contract interface look like? That’ll determine your exact args structure.