Skip to content

Record a purchase you made on chain

POST
/api/marketplace/sold
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 this nonce and 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.
Media type application/json

A purchase you signed on chain.

object
nonce
required

The NFT nonce of the card you bought.

integer format: int64
tx_hash
required

The hash of your purchase transaction, 64 hexadecimal characters.

string
wallet_address
required

Your wallet. Not read: the buyer is the session wallet.

string
Example generated
{
"nonce": 1,
"tx_hash": "example",
"wallet_address": "example"
}

Success or a refusal: read success (the refusals are in the description).

Media type application/json

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
code

A machine-readable reason next to error, set only where the caller must act differently.

string
data

Always null on success: the route returns no data.

error

Why the request was refused, in plain words. Present when success is false.

string
success
required

true when the request did what it asked. false is a refusal: read error.

boolean
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.

Media type text/plain
string
Example
Session expired or invalid

The 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.