sendBundle
Submit one to four signed transactions as one bundle for delivery through block engines.
x-api-key<token>Send the SWQoS API key in this header. See the authentication reference for compatibility forms and precedence.
One JSON object using the shared request conventions. Submit one to four fully signed transactions in execution order, each with a distinct first signature. Each member must meet the size limits; the bundle must satisfy the tip and rate rules. Bundles have no preflight simulation.
Control accounts
SWQoS recognizes these base58 address prefixes among a transaction's static keys:
| Control | Recognized when |
|---|---|
jitodontfront | Any static account address starts with it, or the first account of the first Compute Budget instruction starts with it |
dontfront | The first account of the first Compute Budget instruction starts with it |
dontbund1e | The first account of the first Compute Budget instruction starts with it |
A transaction carrying any recognized control must be first, and at most one member may carry controls. With dontbund1e, later members may call only the System, Compute Budget and Memo programs, and the Token Program for Transfer and TransferChecked, as in a token tip.
A violation returns bundle_control with a zero based index and a rule of first_only, one_only or default_programs_only. Controls can narrow which engines can accept the bundle and raise the minimum tip. SWQoS checks them at admission only; they do not govern transactions submitted outside your bundle.
application/json- body
jsonrpc*"2.0""2.0"id?||Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.
method*"sendBundle""sendBundle"params*array<array<>|>The array of transactions followed by an optional options object.
1 <= items <= 2Returns a 64 character lowercase hex bundle ID after accepting the bundle for delivery. Confirm each signature through your Solana RPC provider. SWQoS has no bundle status method, and its bundle ID cannot query a block engine's status.
Refusals with HTTP 200, by error.data.reason:
invalid_request: invalid call.bundle_size: outside 1 to 4 transactions;countandlimit.malformed: invalid member, repeated signature (duplicate_signature), tip sum overflow (tip_overflow) or paid tip above 2 SOL (tip_too_large);indexidentifies a repeated or invalid member.too_large: member exceeds a size limit;indexidentifies it.unsigned: member is unsigned;indexidentifies it.signature_count: member signature mismatch;indexidentifies it.bundle_control: control account rule broken;indexandrule.missing_tip: below your or the engine minimum;minimumapplies.credit_exhausted: declared tip credit unavailable.
application/json- response
jsonrpc*"2.0""2.0"result*stringSHA-256 of the members' first signatures, concatenated in order as raw 64-byte values. Not a block engine's status id.
^[0-9a-f]{64}$64 <= length <= 64id*||Optional request id, echoed exactly in the response. Null when absent or refused before the id could be read.
// Builds on the example project (/reference/json-rpc#example-project).
use base64::{Engine, prelude::BASE64_STANDARD};
use serde_json::json;
use swqos_examples::swqos::{Result, SwqosError, call};
#[tokio::main]
async fn main() -> Result<()> {
let mut transactions = Vec::new();
for file in std::env::args().skip(1) {
transactions.push(BASE64_STANDARD.encode(tokio::fs::read(file).await?));
}
match call::<String>(
"sendBundle",
Some(json!([transactions, { "encoding": "base64" }])),
)
.await
{
Ok(bundle_id) => println!("accepted {bundle_id}"),
Err(error) => {
let rejection = error
.downcast_ref::<SwqosError>()
.and_then(|error| error.rejection.as_ref());
if let Some(rejection) = rejection {
eprintln!("{} {}", rejection.reason, rejection.message);
} else {
return Err(error);
}
}
}
Ok(())
}Rust (bundle ID)
// Builds on the example project (/reference/json-rpc#example-project).
use std::fmt::Write;
use sha2::{Digest, Sha256};
use solana_transaction::versioned::VersionedTransaction;
use crate::swqos::Result;
pub fn bundle_id(wire_transactions: &[Vec<u8>]) -> Result<String> {
let mut hash = Sha256::new();
for wire in wire_transactions {
let transaction: VersionedTransaction = wincode::deserialize(wire)?;
let signature = transaction
.signatures
.first()
.ok_or("transaction has no signature")?;
hash.update(signature.as_ref());
}
let mut id = String::with_capacity(64);
for byte in hash.finalize() {
write!(&mut id, "{byte:02x}")?;
}
Ok(id)
}{
"jsonrpc": "2.0",
"result": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"id": 1
}