Account Fetching
Load the exact workflow state your next curve, AMM, migration, or fee action needs.
SDK
Load workflow state, not random accounts
The account surface is organized around the next action you want to perform. Instead of manually fetching and decoding several accounts, load the state bundle that already matches the builder or preview you plan to use next.
import { DumpsterClient } from '@dumpster-cash/dumpster-sdk';
const client = new DumpsterClient(connection);Shared config
These calls return the shared protocol config objects:
const global = await client.accounts.fetchGlobal();
const feeConfig = await client.accounts.fetchFeeConfig();
const globalConfig = await client.accounts.fetchGlobalConfig();For creation previews, load the Curve configuration pair in one request:
const { global, feeConfig, slot } = await client.accounts.fetchCurveConfig();This returns Global and FeeConfig from one context-bearing RPC response. It uses the Connection's commitment behavior and validates required owners, non-executable status, minimum layout length and discriminators. Missing, malformed or incorrectly sized responses throw. It does not fetch a Curve or invent its creator; use newBondingCurve(global, intendedCreator) for a fresh-curve estimate.
These readers decode stored state; they do not certify launch readiness. global.initialized records singleton initialization, not valid launch parameters. The program checks those parameters when create executes.
The FeeConfig decoder requires the account layout containing curveFees and accepts supported trailing allocation. Global rejects data below its IDL-defined minimum while accepting trailing allocation. See Curve fees.
Raw Global/GlobalConfig reads can return an empty recipient list. Recipient selection is a separate operation with its own empty-selection errors; successful decoding is not proof that a fee destination exists.
global.poolMigrationFee is the current shared migration fee, not a coin's launch-time snapshot. Changing it can affect existing coins; launch reserve settings do not replace a curve's stored state. See migration funding limits.
Curve trading state
Load this bundle before a curve preview or a curve trade:
const state = await client.accounts.fetchCurveTradeState(mint, wallet.publicKey);It returns:
globalfeeConfigbondingCurvebondingCurveAccountInfouserAtaassociatedUserAccountInfoslot
The required Global, FeeConfig and Curve accounts are fetched together in one RPC response and checked for owner, non-executable status, minimum length and discriminator. Use that bundle together rather than mixing it with a separate configuration cache. The slot identifies the observation, not a guarantee about future state or a pinned slot for later requests.
Without a user, the reader does not request an ATA and the optional ATA fields are undefined. With a user, an absent requested ATA is null; returned raw ATA data is not a validated wallet balance. RPC and validation failures throw. A failed refresh must make the quote unavailable even if your query cache retains earlier data.
Pass that state to:
client.preview.curveBuy(...)client.preview.curveSell(...)client.curve.buildBuyExactOut(...)
The reader does not select a recipient. A preview can succeed while a trade builder rejects missing recipient configuration; neither result guarantees later execution.
Migration state
Load curve accounting, configuration and canonical-pool evidence together.
const state = await client.accounts.fetchMigrationState(mint);The result contains mint, global, feeConfig, bondingCurve, bondingCurveAccountInfo, poolAddress and pool. The reader derives the canonical index-zero pool and fetches all four accounts in one RPC batch. It uses the connection's commitment, or confirmed when none is configured.
| Curve accounting | pool | Meaning |
|---|---|---|
| Not complete | null | Still in the curve lifecycle. |
| Complete, not settled | null | Normal migration checks may proceed. |
| Settled | Validated Pool | Canonical migration evidence. |
| Settled | null | Settlement without a canonical pool; not proof of historical withdrawal. |
pool: null means RPC absence or a non-executable, System-owned empty account at the canonical address, including ordinary lamport prefunding. Missing curve/configuration, invalid account owners or typed data, invalid pool identity, contradictory curve/pool state, and RPC failures throw. Failures never become an absent pool.
Pool validation checks immutable identity and bump, not current coin creator, balances or LP supply. This reader does not fetch token custody accounts or calculate account-creation rent. The snapshot does not guarantee later transaction success or sufficient migration funding. Use fetchCurveTradeState for ordinary curve buys and sells; those reads do not depend on pool availability.
AMM trade state
Load this bundle before DumpsterSwap buys and sells:
const state = await client.accounts.fetchSwapTradeState(pool, wallet.publicKey);It already resolves:
- base and quote token programs
- protocol fee recipient
- protocol fee ATA
- user base and quote ATAs
Unlike the raw config reader, this bundle selects a protocol recipient and throws if no active Swap entry exists. It does not establish transaction readiness. See fee selection.
AMM liquidity state
Load this bundle before LP deposits and withdrawals:
const state = await client.accounts.fetchPoolLiquidityState(pool, wallet.publicKey);It adds the user's LP ATA to the rest of the pool state.
Creator fee state
Load this when you need current claimable creator balances:
const curveOnly = await client.accounts.fetchCreatorFeeState(wallet.publicKey);
const curveAndSwap = await client.accounts.fetchCreatorFeeState(
wallet.publicKey,
quoteMint,
);Pass the quote mint when you want both the curve-side GOR balance and the AMM-side quote-token balance.