This feature is accessible via sendOptimizedTransaction method. Gateway delivers transactions simultaneously across multiple delivery methods, maximizing transaction success rates. Effortlessly switch between delivery channels from your dashboard—no code changes or redeployments required.

Delivery Method Override

You can override default delivery methods set via your API key by explicitly specifying them in the request body.

Supported Encoding Formats

Transactions are accepted in both base64 and base58 encoding formats.
base58 is being deprecated from Solana and could be removed as an acceptable encoding in the future. It it advised to use base64

Request and Response Structure

Provide the optimized response obtained from optimizedTransaction in the request body.

Request Example

import {
  getBase64Encoder,
  getTransactionDecoder,
  getBase64EncodedWireTransaction
} from "@solana/kit";

// Continued from `optimizeTransaction`...
const optimizedTxString = optimizeBody.result[0].transaction;
const optimizedTx = getTransactionDecoder()
    .decode(getBase64Encoder().encode(optimizedTxString));

const signedTx = await signTransaction([keyPair], optimizedTx);

const deliveryResponse = await fetch(`${GATEWAY_URL}/mainnet?apiKey=${apiKey}`, {
  method: 'POST',
  body: JSON.stringify({
    id: "test-id",
    jsonrpc: "2.0",
    method: "sendOptimizedTransaction",
    params: {
      transactions: [
        {
          params: [getBase64EncodedWireTransaction(signedTx)],
        },
      ],
      deliveryMethods: [
        /* Optionally override delivery methods */
        {
          type: "rpc",
          url: rpcEndpoint,
        },
      ]
    }
  }),
  headers: {'Content-Type': 'application/json'}
});

Response Example

The response contains results from each delivery method indexed using its URL.
type DeliveryResultItem = {
  result?: string; // Transaction signature
  transactionId?: string;
  deliveryMethod: {
    type: "rpc" | "jito";
    url: string;
  };
  error?: {
    code: string;
    message: string;
  };
  tipTransactionId?: string;
  bundleId?: string | null;
};

type DeliveryResult = Record<string, DeliveryResultItem[]>;
{
  "jsonrpc": "2.0",
  "id": "test-id",
  "result": {
    "https://api.mainnet-beta.solana.com/": [
      {
        "result": "E7oKpwds2h4xxcrGoccrizTEVWvgu6k8u...",
        "transactionId": "E7oKpwds2h4xxcrGoccrizTEVWvgu6k8u...",
        "deliveryMethod": {
          "type": "rpc",
          "url": "https://api.mainnet-beta.solana.com/"
        }
      }
    ],
    "https://mainnet.helius-rpc.com/?api-key={}": [
      {
        "error": {
          "code": "DELIVERY_FAILED",
          "message": "sendTransactionsViaRpc failed: Invalid response from https://mainnet.helius-rpc.com/?api-key={}"
        },
        "deliveryMethod": {
          "type": "rpc",
          "url": "https://mainnet.helius-rpc.com/?api-key={}"
        }
      }
    ]
  }
}
In this example:
  • Responses are indexed by delivery method URLs.
  • Each URL contains an array of results (one per transaction).
  • Each result includes either a result field with the transaction signature or an error field with error details.
  • The deliveryMethod field identifies the method used.