RPC Proxy
The Slipstream SDK proxies Solana RPC methods and provides transaction/bundle simulation, so you can query chain state and simulate without a separate RPC connection. Costs 1 token per call.
Generic RPC Call
Pass any Solana RPC method name and params directly.
Generic RPC — Rust
1use serde_json::json;
2
3let response = client.rpc("getBalance", json!(["YOUR_WALLET_ADDRESS"])).await?;
4if let Some(result) = response.result {
5 println!("Balance: {}", result);
6}
7if let Some(err) = response.error {
8 println!("RPC error {}: {}", err.code, err.message);
9}Generic RPC — TypeScript
1const response = await client.rpc("getBalance", ["YOUR_WALLET_ADDRESS"]);
2console.log("Balance:", response.result);Generic RPC — Python
1response = await client.rpc("getBalance", ["YOUR_WALLET_ADDRESS"])
2print(f"Balance: {response.result}")Common Methods
Any standard Solana JSON-RPC method can be called through rpc(). Common examples:
1// Get balance
2let bal = client.rpc("getBalance", json!(["WALLET_ADDRESS"])).await?;
3
4// Get latest blockhash
5let bh = client.rpc("getLatestBlockhash", json!([])).await?;
6
7// Get slot
8let slot = client.rpc("getSlot", json!([])).await?;
9
10// Get account info
11let acct = client.rpc("getAccountInfo", json!(["ACCOUNT_ADDRESS"])).await?;
12
13// Get transaction
14let tx = client.rpc("getTransaction", json!(["SIGNATURE"])).await?;
15
16// Get signature statuses
17let statuses = client.rpc("getSignatureStatuses", json!([["SIG1", "SIG2"]])).await?;Transaction Simulation
Simulate a transaction before submitting.
Simulate TX — Rust
1let sim = client.simulate_transaction(&tx_bytes).await?;
2if let Some(err) = &sim.err {
3 println!("Simulation failed: {:?}", err);
4}
5println!("CUs consumed: {}", sim.units_consumed);
6for log in &sim.logs {
7 println!(" {}", log);
8}
9if let Some(return_data) = &sim.return_data {
10 println!("Return data: {:?}", return_data);
11}Simulate TX — TypeScript
1const sim = await client.simulateTransaction(txBytes);
2if (sim.err) console.log("Simulation failed:", sim.err);
3console.log("CUs consumed:", sim.unitsConsumed);
4sim.logs.forEach(log => console.log(" ", log));Simulate TX — Python
1sim = await client.simulate_transaction(tx_bytes)
2if sim.err:
3 print(f"Simulation failed: {sim.err}")
4print(f"CUs consumed: {sim.units_consumed}")
5for log in sim.logs:
6 print(f" {log}")Bundle Simulation
Simulate all transactions in a bundle. Costs 1 token per transaction.
Simulate Bundle — Rust
1let results = client.simulate_bundle(&[tx1_bytes, tx2_bytes]).await?;
2for (i, sim) in results.iter().enumerate() {
3 println!("TX {}: {} CUs, err={:?}", i, sim.units_consumed, sim.err);
4}Simulate Bundle — TypeScript
1const results = await client.simulateBundle([tx1Bytes, tx2Bytes]);
2results.forEach((sim, i) => {
3 console.log(`TX ${i}: ${sim.unitsConsumed} CUs, err=${sim.err}`);
4});Simulate Bundle — Python
1results = await client.simulate_bundle([tx1_bytes, tx2_bytes])
2for i, sim in enumerate(results):
3 print(f"TX {i}: {sim.units_consumed} CUs, err={sim.err}")SimulationResult Fields
| Field | Type | Description |
|---|---|---|
err | any? | Error if simulation failed |
logs | string[] | Program logs |
units_consumed | number | Compute units consumed |
return_data | any? | Return data from program |
RpcResponse Fields
| Field | Type | Description |
|---|---|---|
jsonrpc | string | JSON-RPC version |
id | any | Request ID |
result | any? | Successful result |
error | RpcError? | Error with code, message, data |
Next Steps
- Transactions — Submit transactions
- Bundles — Atomic bundles with simulation
- Billing & Tokens — Token pricing details