Submit the transaction
The SDK submits the signed transaction along with the submission token, then waits for confirmation. The server validates the signature and broadcasts to Solana via priority lanes for fastest block inclusion.
Submission Process
Section titled “Submission Process”After signing your transaction, you submit it along with the submissionToken from the build step. The server validates everything and broadcasts to Solana.
Endpoint
Section titled “Endpoint”POST /v1/tx/submitRequest Body
Section titled “Request Body”{ "submissionToken": "txn_173_abcd1234ef567890", "signedTransaction": "BASE64_WIRE_SIGNED_TRANSACTION"}What Happens Server-Side
Section titled “What Happens Server-Side”When you submit a transaction:
- Message validation: The server verifies that the signed transaction’s message bytes match the originally-built transaction. This prevents tampering.
- Priority submission: The transaction is broadcast to Solana with priority fee optimization for fast inclusion.
- Confirmation waiting: The server waits for the transaction to reach “confirmed” status on-chain.
- Result parsing: Trade amounts and other details are extracted from the confirmed transaction.
What You Get Back
Section titled “What You Get Back”signature: The transaction signature - use this to view on Solscan or other block explorersstatus: Should be"confirmed"tradeResult: Actual on-chain input/output amounts (may benullif parsing wasn’t available in time)estimates: Fallback iftradeResultis null
For complete API reference, see: POST /v1/tx/submit.
Code Examples
Section titled “Code Examples”import axios from 'axios';
const API_KEY = 'api_your_key_here';const API_BASE_URL = 'https://api.darkfibre.dev/v1';
const api = axios.create({ baseURL: API_BASE_URL, headers: { 'Authorization': `Bearer ${API_KEY}` }, timeout: 30000,});
async function submitTransaction( submissionToken: string, signedTransaction: string) { const response = await api.post('/tx/submit', { submissionToken, signedTransaction, });
const { signature, status, tradeResult, priorityCost } = response.data.data;
console.log('Transaction signature:', signature); console.log('Status:', status); console.log('Solscan:', `https://solscan.io/tx/${signature}`);
if (tradeResult) { console.log('Input amount:', tradeResult.inputAmount); console.log('Output amount:', tradeResult.outputAmount); }
return response.data.data;}
// Example usage (after building and signing)const submissionToken = 'txn_173_abcd1234ef567890';const signedTransaction = 'BASE64_WIRE_SIGNED_TRANSACTION';
submitTransaction(submissionToken, signedTransaction) .catch(console.error);import requests
API_KEY = "api_your_key_here"API_BASE_URL = "https://api.darkfibre.dev/v1"
def submit_transaction(submission_token: str, signed_transaction: str): response = requests.post( f"{API_BASE_URL}/tx/submit", headers={"Authorization": f"Bearer {API_KEY}"}, json={ "submissionToken": submission_token, "signedTransaction": signed_transaction, }, timeout=30, ) response.raise_for_status()
data = response.json()["data"]
print(f"Transaction signature: {data['signature']}") print(f"Status: {data['status']}") print(f"Solscan: https://solscan.io/tx/{data['signature']}")
if data.get("tradeResult"): print(f"Input amount: {data['tradeResult']['inputAmount']}") print(f"Output amount: {data['tradeResult']['outputAmount']}")
return data
# Example usage (after building and signing)submission_token = "txn_173_abcd1234ef567890"signed_transaction = "BASE64_WIRE_SIGNED_TRANSACTION"
submit_transaction(submission_token, signed_transaction)curl -X POST https://api.darkfibre.dev/v1/tx/submit \ -H "Authorization: Bearer api_your_key_here" \ -H "Content-Type: application/json" \ -d '{ "submissionToken": "txn_173_abcd1234ef567890", "signedTransaction": "BASE64_WIRE_SIGNED_TRANSACTION" }'