Transaction Building
Fetch state, preview the action, build instructions, and assemble an unsigned transaction with compute budget controls.
SDK
Build unsigned transactions explicitly
The SDK helps you assemble instructions and unsigned transactions. It does not try to own wallet sending. That keeps the SDK useful in apps, scripts, bots, and backends.
Recommended sequence
Load the state you need
Fetch the exact curve or pool state for the action.
Preview the action
Preview the action to compute outputs, fees, and price impact.
Build the instructions
Build the protocol instructions from the fresh state and preview result.
Assemble the unsigned transaction
Assemble the unsigned transaction with the fee payer and compute settings you want.
Sign and submit with your wallet layer
The SDK intentionally stops at unsigned transaction assembly.
Example: build a curve buy transaction
import { DumpsterClient } from '@dumpster-cash/dumpster-sdk';
import BN from 'bn.js';
const client = new DumpsterClient(connection);
const gorAmount = new BN(1_000_000_000);
const state = await client.accounts.fetchCurveTradeState(mint, wallet.publicKey);
const preview = client.preview.curveBuy({
feeConfig: state.feeConfig,
bondingCurve: state.bondingCurve,
amountInGor: gorAmount,
});
if (preview.amountOutTokens.isZero()) throw new Error('Budget buys no tokens');
const instructions = await client.curve.buildBuyExactOut({
global: state.global,
bondingCurve: state.bondingCurve,
associatedUserAccountInfo: state.associatedUserAccountInfo ?? null,
mint,
user: wallet.publicKey,
amount: preview.amountOutTokens,
gorAmount: preview.amountInGor,
slippage: 1,
});
const tx = await client.tx.buildTransaction(instructions, {
feePayer: wallet.publicKey,
computeUnits: 300_000,
priorityFeeMicrolamports: 10_000,
});Pass actual quoted spend, not the original budget, to the buy builder. The preview can leave a remainder when the next token is unaffordable or sale inventory is exhausted. The builder adds the chosen percentage slippage allowance; network costs and account deposits are extra. A quote with no token output is not a buy instruction.
Add compute budget without building the transaction yet
If you only want to prepend compute budget instructions:
const instructionsWithBudget = client.tx.withComputeBudget(instructions, {
computeUnits: 300_000,
priorityFeeMicrolamports: 10_000,
});Creator handovers
The default builders derive the canonical pool and fixed swap accounts without RPC. The program decides whether a settled curve requires pool synchronization; callers do not pass a migration boolean or choose a placeholder.
const transfer = await client.curve.buildTransferCreator({
mint,
creator: wallet.publicKey,
newCreator,
});
const setCreator = await client.curve.buildSetCreator({
mint,
setCreatorAuthority: adminPublicKey,
newCreator,
});These are separate alternatives, not instructions to combine. Voluntary transfer requires the current creator's signature; administrative assignment requires the configured authority. Existing accrued fee claims remain with the old creator.
For a migrated pool, voluntary transfer requires the pool and curve to agree on the current recipient. CreatorMismatch (6024) requires designated-authority reconciliation from trusted history, not an automatic retry choosing one value. Administrative assignment can synchronize disagreeing records to the same nondefault target, including when that target already matches one record. Both paths validate authorization and the required accounts before accepting a fully unchanged no-op.
The on-chain Swap instruction is for authenticated program synchronization, not a separate wallet handover.
The explicit buildTransferCreatorWithPool variant rejects any address other than this mint's canonical pool. Use matching SDK and program versions. Builders remain offline and unsigned; they do not confirm that a handover or administrative repair succeeded.
Extra signers
Two important flows return or require extra signers:
- token creation -> the mint keypair must sign
- migration -> the returned temporary LP keypair must sign
Make sure your wallet or signing layer receives those signers when you submit.