Record a purchase you made on chain
const url = 'https://foxleague.ai/api/marketplace/sold';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"nonce":1,"tx_hash":"example","wallet_address":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://foxleague.ai/api/marketplace/sold \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "nonce": 1, "tx_hash": "example", "wallet_address": "example" }'Records a marketplace purchase you signed on chain, so the card moves to your roster at once. The buyer is the session wallet. The server waits for the transaction to be final and checks it: a successful marketplaceBuy from you to the marketplace contract, paying at least the listing’s price, that moved this card. It then records the sale, removes the listing and gives you the card.
A transaction already recorded answers success: true again and changes nothing. A purchase seen on chain is recorded even without this call.
Who: a signed-in player, the buyer.
Refusals:
Chain is temporarily unavailable. Please retry shortly.: the server cannot read the chain right now.Listing not found: no listing for thisnonceand no sale recorded for this transaction.Cannot buy your own listing: the listing is yours.Another marketplace transaction of your wallet is being checked: please wait a few seconds and retry: another record of your wallet (a listing, a sale or a cancel) is reading its transaction right now; send this one once it has answered.Transaction <status> on chain: cannot confirm marketplace sale: the transaction failed on chain.Your payment isn't confirmed on chain yet, but it may still settle. Please retry the marketplace sale in a moment.: the transaction is not final yet.Transaction was rejected on chain (<reason>) and refunded: marketplace sale not confirmed: the contract refused it.Transaction sender does not match your wallet: another wallet sent it.Transaction was not sent to the marketplace sale contract: it is not a call to the marketplace contract.Transaction is not a marketplace sale call: it calls another function.Payment (<paid> FOXSY) is less than required (<price> FOXSY): the transaction paid less than the price.Transaction does not match this listing: please retry the purchase: the transaction did not move this card or its move is not visible yet: retry in a moment.Transaction verification failed. Please try again later: the transaction could not be read.Chain verification unavailable: the server has no chain connection.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”A purchase you signed on chain.
object
The NFT nonce of the card you bought.
The hash of your purchase transaction, 64 hexadecimal characters.
Your wallet. Not read: the buyer is the session wallet.
Example generated
{ "nonce": 1, "tx_hash": "example", "wallet_address": "example"}Responses
Section titled “ Responses ”Success or a refusal: read success (the refusals are in the description).
The answer of a request that returns no data. POST /api/tournaments/{id}/delete answers its refusals with it: success is false and error says why.
object
A machine-readable reason next to error, set only where the caller must act differently.
Always null on success: the route returns no data.
Why the request was refused, in plain words. Present when success is false.
true when the request did what it asked. false is a refusal: read error.
Example
{ "data": null, "success": true}No valid session. The body is plain text: Missing Authorization header, Invalid Authorization format, Invalid session token or Session expired or invalid. Sign in again.
Example
Session expired or invalidThe body does not match the request schema, for example a tx_hash that is not 64 hexadecimal characters. The body is plain text.
A database read or write failed. The body is empty.