Skip to content

Composable Instructions

Venum's key differentiator: you get an unsigned transaction you can inspect and modify before signing, not an auto-submitted opaque blob.

Why this matters

Aggregators typically hand you a fully serialized transaction — you sign their blob as-is. Composing on top (your own fee transfer, a CPI into your protocol, account creation/closing, a memo, a Jito tip) means either decompiling their transaction or asking for a separate instructions endpoint and reassembling it yourself. Adding a platform fee usually means onboarding to the aggregator's referral program: a referral account plus a fee token account per fee mint, with fees accruing in accounts you then have to claim.

Venum keeps the transaction open and gives you a native integrator-fee parameter, so neither composition nor monetization requires extra plumbing.

Venum's Approach

The /v1/swap/build endpoint returns an unsigned VersionedTransaction that you can deserialize, inspect, and extend before signing:

javascript
// Build the transaction — returns base64-encoded unsigned TX
const { transaction } = await fetch('https://api.venum.dev/v1/swap/build', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY },
  body: JSON.stringify({
    inputMint: 'SOL',
    outputMint: 'USDC',
    amount: '1000000000',
    userPublicKey: wallet.publicKey.toString(),
  }),
}).then(r => r.json());

// Deserialize, modify, sign, submit
const tx = VersionedTransaction.deserialize(Buffer.from(transaction, 'base64'));
tx.sign([wallet]);

const { signature } = await fetch('https://api.venum.dev/v1/send', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY },
  body: JSON.stringify({ transaction: Buffer.from(tx.serialize()).toString('base64') }),
}).then(r => r.json());

Adding your own wallet/platform fee? Venum doesn't manage integrator fees — compose your own output-token transfer into the transaction (this guide shows how). You control the rate and the destination, with no referral program or per-mint claim accounts to manage.

Use Cases

  • dApps — Compose swap with your protocol's CPI
  • Wallets — Bundle swap with account creation / closing
  • Trading bots — Combine swap with Jito tip instruction
  • Aggregators — Multi-hop through different DEXes in one TX

Note: /v1/swap/build returns a compiled VersionedTransaction. To insert instructions you decompile its message (resolving any address-lookup-table keys), splice in your instruction, and recompile — not a one-line array push.