Skip to content

Get the signed terms again to pay an authorized challenge

POST
/api/tournaments/challenges/{id}/authorization
curl --request POST \
--url https://foxleague.ai/api/tournaments/challenges/1/authorization \
--header 'Authorization: Bearer <token>'

“Pay now” for a challenge or tournament you authorized and have not paid yet. While a wallet can still meet its expiry, it answers the SAME signed terms POST /api/tournaments/challenges/authorize answered for it, with the seconds left in expires_in_seconds: build the createAndJoin transaction from them exactly as answered, pay, then call POST /api/tournaments/challenges/{id}/confirm. Nothing is signed or written by this call.

When it is already paid and open (or moved on in any other way), the answer has its state (open, cancelled, …) and its tournament_id, with nothing to sign: read the challenge again. Once a wallet can no longer meet the expiry, the chain is read first, as POST /api/tournaments/challenges/{id}/confirm without a hash reads it: a payment of yours that landed opens it: the answer is then open.

Who: the player who authorized it. Anyone else is answered Tournament not found.

Refusals:

  • The time to pay this challenge has run out. Unless a payment of yours lands, nothing is charged and it is removed on its own within about <minutes> minutes. A payment that lands opens it instead. You can create a new challenge now. (or in <N>s; tournament for a tournament), with code challenge_payment_window_closed: a wallet can no longer meet the expiry and the chain holds no payment of yours. The minutes follow the check that removes an unpaid one: two clean reads of the chain, one interval apart.
  • The chain could not be read; nothing was charged twice. Please retry in a moment.: once the time to pay has run out the chain is read first: it could not be read.
  • Tournament not found: no authorized challenge or tournament of yours has this id.
  • The one-signature challenge flow is not available right now. Create the challenge the usual way. / The one-signature flow is not available for tournaments right now. Create the tournament the usual way.: the flow is switched off. Asked only while it can still be paid; the chain is read first, so a payment of yours that landed is answered open instead.
  • Challenges are paused on chain right now. Nothing was charged; please try again later. / Paid tournaments are paused on chain right now. Nothing was charged; please try again later.: the tournaments contract is paused. Asked the same way: only while it can still be paid, after the chain read.
  • Chain is temporarily unavailable. Please retry shortly.: the server cannot reach the chain right now.
  • The chain clock could not be read. Please retry in a moment.: the expiry is chain time and the chain time could not be read.
id
required
integer format: int64

The challenge id answered by the authorize call.

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
allowed_wallets
required

The allowed wallets, in the exact order to send them: you first, then the challenged player for a targeted challenge. For a tournament: none when it is public, you and your invited teams (in account order) when it is private.

Array<string>
entry_fee_atomic
required

The exact amount the transaction must carry, in FOXSY atomic units, as a decimal string.

string
entry_fee_foxsy
required

The entry fee in whole FOXSY.

integer format: int64
expires_in_seconds
required

Seconds left on expiry at the time of this answer, by chain time. In a pending refusal: the seconds to wait before a different challenge or tournament can start.

integer format: int64
expiry
required

Chain time in seconds up to and including which the contract accepts the signature.

integer format: int64
foxsy_token_id
required

The FOXSY token to pay with.

string
gas_limit
required

The gas limit to send the transaction with. One figure for a challenge; for a tournament it grows with the allowed wallets.

integer format: int64
max_entries
required

The seat cap to send: 2 for a challenge, the tournament’s max_teams for a tournament.

integer format: int64
sc_address
required

The tournaments contract to send the transaction to.

string
signature_hex
required

The server’s 64-byte signature of the terms, as hexadecimal.

string
state
required

authorized: sign and pay with the fields below. pending (inside a refusal with code challenge_authorization_pending): a previous authorization of yours can still land; tournament_id is that challenge or tournament and expires_in_seconds the seconds to wait before a different one can start. Any other value is the status of a previous challenge or tournament of yours that turned out paid (open): nothing to sign, go to tournament_id.

string
tournament_id
required

The id of the challenge or tournament: the first argument of the transaction and the id to confirm.

integer format: int64
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
{
"success": true,
"data": {
"state": "authorized",
"tournament_id": 1908,
"entry_fee_atomic": "1000000000000000000000",
"entry_fee_foxsy": 1000,
"max_entries": 2,
"allowed_wallets": [
"erd1creator000000000000000000000000000000000000000000000000000",
"erd1target0000000000000000000000000000000000000000000000000000"
],
"expiry": 1792300600,
"signature_hex": "abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab",
"sc_address": "erd1qqqqqqqqqqqqqpgqfw3nadv3z7hj6c2x7alndtw03y5ang43utesz8nmg9",
"foxsy_token_id": "FOXSY-abc123",
"gas_limit": 15200000,
"expires_in_seconds": 412
}
}

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 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 generated
{
"code": "example",
"data": "example",
"error": "example",
"success": true
}