Tournament Builder

Tournament Transaction Submission#

Submitting Signed Transactions#

Endpoint: POST /tournaments/submit-tx

CRITICAL: This endpoint is required to complete all Tournament operations. Each transaction-generating endpoint (tournament creation, registration, adding participants, settlement) returns an unsigned transaction that must be signed and submitted using this endpoint.

Request Parameters:

  • transaction (string): Hex-encoded signed transaction
  • signatures (string[], optional): Array of additional signatures to add to the transaction

Response:

  • txHash (string): Transaction hash of the successfully submitted transaction

Transactions must be properly signed before submission. Unsigned or improperly signed transactions will be rejected by the Cardano network.

Technical Notes:

  • All tournament operations follow a two-step process:
    1. Generate an unsigned transaction using one of the endpoints
    2. Sign the transaction and submit it using this endpoint
  • Multiple signatures can be combined in a single submission
  • The transaction hash returned can be used to track the transaction on the blockchain

Example (Node.js with fetch):

async function submitTransaction(signedTransaction) {
  const apiUrl = 'https://preprod.api.ada-anvil.app/v2/services/tournaments/submit-tx';
  
  const requestData = {
    transaction: signedTransaction,
    // Optional additional signatures
    // signatures: ["signature1", "signature2"]
  };
  
  const response = await fetch(apiUrl, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(requestData),
  });
  
  const data = await response.json();
  console.log(`Transaction submitted successfully with hash: ${data.txHash}`);
  
  return data.txHash;
}

For more details on transaction creation, signing, and the complete Anvil API transaction process, see the Transaction Overview documentation.