Confirm a fusion transaction
const url = 'https://foxleague.ai/api/fusion/confirm';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"burned_nonces":[1],"tx_hash":"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/fusion/confirm \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "burned_nonces": [ 1 ], "tx_hash": "example" }'Confirms a fusion you signed on chain so the app can show the new card. The server reads the transaction:
- not successful:
confirmed: falsewith the messageTransaction status: <status>; - successful and already processed:
confirmed: true,indexed: true,Fusion processed; - successful and not processed yet:
confirmed: true,indexed: false,Fusion confirmed: processing within 15 seconds.
Who: a signed-in player; the transaction must come from the session wallet.
Rate limit: one fusion per wallet per fusion cooldown (GET /api/fusion/can-fuse shows the time left).
Refusals:
A fusion takes at most 3 different card nonces.:burned_noncesnames more than 3 cards or one card twice.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 server cannot read the chain right now.Could not check your transaction on chain. Please try again in a moment.: the transaction could not be read in time.Transaction sender does not match your wallet: another wallet sent it.Transaction was not sent to the game contract: it is not a fusion call to the game contract.Fusion didn't go through: the transaction reverted on chain, so your input players are safe and were not consumed. You can simply try again.: the fusion failed on chain.Your fusion is being finalized on-chain. This can take a couple of minutes. Your new player will appear automatically; no action needed.: the new card is not visible on chain yet; it appears without another call.Fusion cooldown active: <d>d <h>h remaining: the fusion is not processed yet and your wallet’s last fusion is still inside the cooldown.Fusion cooldown active: the same, when the time of your last fusion cannot be read.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”A fusion transaction to confirm.
object
The NFT nonces of the three cards you fused. Optional.
The hash of your fusion transaction, 64 hexadecimal characters.
Example generated
{ "burned_nonces": [ 1 ], "tx_hash": "example"}Responses
Section titled “ Responses ”Success or a refusal: read success (the refusals are in the description).
object
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.
The answer. Present when success is true.
object
true when the transaction succeeded on chain.
true when the game has already processed the fusion.
The outcome in plain words.
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": { "confirmed": true, "indexed": false, "message": "Fusion confirmed: processing within 15 seconds" }, "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.