This page describes the flow in putting an item up for sale on the market.
Flow
Context
To be able to sell items on the market, Venly takes the item for sale into custody. This means that Venly moves the NFT from the seller's address to a Venly-owned and managed wallet. At the end of a sale, Venly will correctly move the NFT to the buyers wallet, or return the NFT to the senders wallet when no sale is made.
To be able to move the NFT (from seller's wallet, to in custody, to the buyer's wallet), Venly needs an approval on the (blockchain) contract. So, before an item can be put on the market, an approval and signature flow needs to be done by the seller.
Detailed Steps
1. Create and configure your offer
In the first step you create the Offer that you want to put on sale. Use the Create offer endpoint.
In the offer you have to configure the:
The NFT that you want to put on sale
The type of the offer: SALE or AUCTION
The (starting-)price of the offer
(optional) the amount of items for sale in case of fungible items
(optional) a specific end date
(optional) making the offer private (unlisted on the market)
Once created, you will receive an Offer with state NEW (see Offer states for reference).
Example
Request: Create Offer
POST https://api.venly.market/offers{"type":"SALE","nft": {"tokenId":"13","address":"0x225f099870ea881f2165a475c2696ecb2d21d0c3","chain":"BSC" },"sellerAddress":"0x5CF94a2ff1e4B283eb051BB059182F6c32F7D184","privateOffer":false,"price":10,"endDate":"2022-09-02T11:40:22.147Z"}
Response: Create Offer
{"success":true,"result": {"id":"1fd99c92-abe4-4ac9-8eac-03233e998768","nft": {"id":"13","address":"0x225f099870ea881f2165a475c2696ecb2d21d0c3","chain":"BSC","name":"Swordquest House","description":"A fantastic house branded after your favorite Atari game!!", "imageUrl": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/ATA+4+Swordquest+House.jpg",
"url":"https://alphaverse.com/atari/", "imagePreviewUrl": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/ATA+4+Swordquest+House.jpg",
"imageThumbnailUrl": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/ATA+4+Swordquest+House.jpg",
"animationUrls": [],"fungible":false,"attributes": [ {"type":"system","name":"tokenTypeId","value":"13" }, {"type":"property","name":"maxSupply","value":"200" } ],"contract": {"chain":"BSC","address":"0x225f099870ea881f2165a475c2696ecb2d21d0c3","count":0,"name":"AlphaVerse / Atari AlphaVerse", "description": "Atari AlphaVerse is a metaverse, part of the AlphaVerse, offering whole experience around the Atari brand.",
"symbol":"ATAR","url":"https://alphaverse.com/atari/", "imageUrl": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/Logo+Atari-AlphaVerse.png",
"media": [ {"type":"image", "value": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/Logo+Atari-AlphaVerse.png"
} ],"verified":false,"premium":false,"categories": [] },"collectionIdentifier":"3876696d-b953-483c-89ff-ca41f0b2abe9" },"sellerId":"4917b6fa-2657-4bdd-b8e8-fa5dd8bd4057","sellerNickname":"Unknown","sellerAddress":"0x5cf94a2ff1e4b283eb051bb059182f6c32f7d184","startDate":"2022-06-02T11:43:16.207344Z","endDate":"2022-09-02T11:40:22.147000Z","type":"SALE","status":"NEW", "dataToSign": "1fd99c92-abe4-4ac9-8eac-03233e998768_0x5cf94a2ff1e4b283eb051bb059182f6c32f7d184_0xfCAFfcc7d5e04e6CD016357846570095c3595CE3_13",
"createdOn":"2022-06-02T11:43:16.208429Z","createdBy":"4917b6fa-2657-4bdd-b8e8-fa5dd8bd4057","modifiedOn":"2022-06-02T11:43:16.208429Z","modifiedBy":"4917b6fa-2657-4bdd-b8e8-fa5dd8bd4057","signed":false,"currency":"USDC","privateOffer":false,"seller": {"id":"4917b6fa-2657-4bdd-b8e8-fa5dd8bd4057","nickname":"Unknown" },"amountPurchased":0,"amountReimbursed":0,"amountTerminated":0,"price":10,"amount":1,"remainingAmount":1,"minBuyAmount":1 }}
2. Retrieve preparation information
The next step in putting your item on sale is for Venly to take the item in custody. To do this, Venly needs approval on the contract of the NFT. This means that a contract call needs to be done.
There are currently however a lot of different ways to get approval on a collection or NFT. This depends on the NFT-ERC standard, the chain, etc.
The help determine which contract call needs to be done. You can call the Get prepared Approve Tx endpoint. This will give all the information needed to execute the necessary contract call.
Moreover, it will also determine if an actual contract call needs to be executed. Some NFT-contracts allow for meta transactions. A meta-transaction allows Venly to perform the contract call itself. This has as advantage that Venly performs the approval-contract call and pays for the necessary GAS-fees. Read more about meta-transactions.
If no meta transaction can be done, it is the user itself that has to execute the approval-contract call. This means that the user needs to pay for the GAS-fees and therefore also needs to have enough ETH, HBAR, BSC, ... to execute the approval-call.
signableMessages
A meta-transaction can be done and Venly will pay the GAS-fee for the approval-transaction. The user only needs to sign a data-object.
approvalPreparationTransactions
The contract of the NFT does not allow meta-transactions. The user therefore has to execute the approval-contract call themselves and pay for the necessary GAS-fees.
empty
An approval on the collection was already given in the past. It does not need to be done again. You can immediately go to step 5
Example
Request: Prepare Information
GET https://api.venly.market/offers/03262eaa-8817-4785-817f-523359a526c9/preparation/transactions?walletId=:walletId
The message that needs to be signed can be found in the response of the preparation call.
For example: in the respons of the preparation call you will find:
"signableMessages": [ { ...} ]
The entire message block needs to be passed in to the Signatures API (the content of signableMessages). You now use this information to sign a EIP712 message:
{
"pincode": 121212,
"signatureRequest":
{
"type": "EIP712",
... HERE COMES THE CONTENT OF "SIGNABLEMESSAGES" ...
}
}
4b. Approve the meta transaction on the market
To move forward, the market also needs to know the parameters of the contract call.
Execute the (meta) tx Approval call with the r , s, v and signature you got as response of the signature-call (Step 4a). Note that for a meta-transaction the signature parameter that you get as response of the signing step, needs to be transmitted as the functionSignature parameter in the tx-approval step
Warning: functionSignature should be extracted from the message that was signed, not the signature of the message itself.
See Retrieve Preparation Information -> Response: Prepare information -> result.signableMessages.[].data.message.functionsignature).
Response: Send approval
{"success":true,"result": {"id":"1fd99c92-abe4-4ac9-8eac-03233e998768","nft": {"id":"13","address":"0x225f099870ea881f2165a475c2696ecb2d21d0c3","chain":"BSC","name":"Swordquest House","description":"A fantastic house branded after your favorite Atari game!!", "imageUrl": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/ATA+4+Swordquest+House.jpg",
"url":"https://alphaverse.com/atari/", "imagePreviewUrl": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/ATA+4+Swordquest+House.jpg",
"imageThumbnailUrl": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/ATA+4+Swordquest+House.jpg",
"animationUrls": [],"fungible":false,"attributes": [ {"type":"system","name":"tokenTypeId","value":"13" }, {"type":"property","name":"maxSupply","value":"200" } ],"contract": {"chain":"BSC","address":"0x225f099870ea881f2165a475c2696ecb2d21d0c3","count":0,"name":"AlphaVerse / Atari AlphaVerse", "description": "Atari AlphaVerse is a metaverse, part of the AlphaVerse, offering whole experience around the Atari brand.",
"symbol":"ATAR","url":"https://alphaverse.com/atari/", "imageUrl": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/Logo+Atari-AlphaVerse.png",
"media": [ {"type":"image", "value": "https://storage-qa.venly.io/applications/05a51091-54b8-43aa-9c12-142e2b3d9c04/Logo+Atari-AlphaVerse.png"
} ],"verified":false,"premium":false,"categories": [] },"collectionIdentifier":"3876696d-b953-483c-89ff-ca41f0b2abe9" },"sellerId":"4917b6fa-2657-4bdd-b8e8-fa5dd8bd4057","sellerNickname":"Unknown","sellerAddress":"0x5cf94a2ff1e4b283eb051bb059182f6c32f7d184","startDate":"2022-06-02T11:43:16.207344Z","endDate":"2022-09-02T11:40:22.147000Z","type":"SALE","status":"NEW", "dataToSign": "1fd99c92-abe4-4ac9-8eac-03233e998768_0x5cf94a2ff1e4b283eb051bb059182f6c32f7d184_0xfCAFfcc7d5e04e6CD016357846570095c3595CE3_13",
"txApprove":"0xcf02dfb5699b011b8f3e40cf09cd71fc91e496057c4d2944ef640a894102076a","createdOn":"2022-06-02T11:43:16.208429Z","createdBy":"4917b6fa-2657-4bdd-b8e8-fa5dd8bd4057","modifiedOn":"2022-06-02T11:43:16.368041Z","modifiedBy":"4917b6fa-2657-4bdd-b8e8-fa5dd8bd4057","signed":false,"currency":"USDC","privateOffer":false,"seller": {"id":"4917b6fa-2657-4bdd-b8e8-fa5dd8bd4057","nickname":"Unknown" },"amountPurchased":0,"amountReimbursed":0,"amountTerminated":0,"price":10,"amount":1,"remainingAmount":1,"minBuyAmount":1 }}
5. Take NFT into custody
By now, Venly has all information to take the NFT into custody. However, to be sure that the user is really requesting a specific NFT to be put on sale, an extra signature is needed.
5a. Sign the offer data
Perform the signature call to sign the Offer.dataToSign data. Or use the Widget to perform this action.
5b. Send the signature to the offer
Perform the Update offer: signature call to update the Offer and let Venly take the NFT into custody.
The status of the Offer will change to INITIATING_OFFER. When the NFT is taken into custody, the Offer will have status READY and is available on the marketplace!