Skip to content

Confirm a stat sync transaction

POST
/api/sync/confirm
curl --request POST \
--url https://foxleague.ai/api/sync/confirm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "nonces": [ 1 ], "tx_hash": "example", "wallet_address": "example" }'

Checks your sync transaction on chain and, when it succeeded, records the synced values of the listed cards. The server waits a short time for the transaction to become final. Confirming the same hash again answers success without changing anything.

Who: a signed-in player; wallet_address must be the session’s wallet.

Refusals:

  • Wallet address mismatch: wallet_address is not the session’s wallet.
  • The chain cannot be read right now. Please try again in a moment.: the chain cannot be read right now.
  • Chain is temporarily unavailable. Please retry shortly.: the chain cannot be reached right now.
  • Could not check your transaction on chain. Please try again in a moment.: the transaction could not be read.
  • Transaction reverted on chain: <reason>: the contract rejected the sync.
  • nonces list is required and cannot be empty: nonces is empty.
  • Transaction sender does not match your wallet: the transaction was sent by another wallet.
  • Transaction was not sent to the sync contract: the transaction was not sent to your own address.
  • Transaction is not a stat-sync call to the game contract. Refresh your team and sync again. If your wallet was debited, contact support with this tx hash.: the transaction is not a sync built by GET /api/sync/prepare.
  • Transaction paid <paid> but syncing <count> player(s) costs <expected> FOXSY. Refresh your team and sync again. If your wallet was debited, contact support with this tx hash.: the fee paid is lower than the sync of the listed cards costs; <paid> reads like 20 FOXSY.
  • Could not record the sync confirmation. Refresh and retry.: the confirmation could not be saved. Try again.
  • Transaction still pending. Try again in a few seconds: the transaction is not final yet.
  • Transaction failed: <reason>: the transaction failed on chain.
  • Unexpected TX status: <status>: the chain reports an unknown status.
Media type application/json

The sync transaction to confirm.

object
nonces
required

The card nonces from the prepare answer.

Array<integer>
tx_hash
required

The sync transaction hash: 64 hexadecimal characters.

string
wallet_address
required

Your wallet address. It must be the session’s wallet.

string
Example generated
{
"nonces": [
1
],
"tx_hash": "example",
"wallet_address": "example"
}

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

Media type application/json
object
code

A machine-readable reason next to error, set only where the caller must act differently. tx_pending: the payment was not refused but could not be verified yet; keep the transaction hash and confirm again with the same hash, never pay twice.

string | null
data

The answer. Present when success is true.

object
confirmed
required

true when the sync transaction is confirmed.

boolean
players_synced
required

How many of the listed cards now have no unsynced changes.

integer
error

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

string | null
success
required

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

boolean
Example
{
"data": {
"confirmed": true,
"players_synced": 2
},
"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