GLAMIDL Reference
GLAM ProtocolProduction

jupiter_swap_v2

Executes a Jupiter swap for vault-held assets under GLAM policies and delegate permissions.

Handler narrative

  1. Load the GLAM state or program account required by the instruction and verify the signer.
  2. Validate swap policy, requested route, slippage, and allowed assets, then execute the Jupiter route instructions under GLAM authorization.

Required conditions

  • The submitted accounts must match the declared account list, signer requirements, writable requirements, fixed program addresses, and account relationships shown below.
  • The GLAM state account is the source of truth for owner, enabled integrations, delegate permissions, policies, assets, borrowable assets, timelock settings, mint linkage, and pricing records.
  • The vault account must be the PDA controlled by the core protocol program and derived conceptually from the state account; instructions use it as the vault authority for SOL, token accounts, and external positions.
  • Owner-level actions must be signed by the state owner unless the instruction is explicitly an integration callback, mint-authority callback, delegate action, or emergency access update.

Accounts

AccountRoleDescription
glam_statewritableState account owned by the GLAM Protocol program; it records vault configuration, policies, and pricing records.
glam_vaultwritableVault account controlled by the GLAM Protocol program; conceptually derived from the state account and used as the vault authority.
glam_signersigner, writableCalling authority. It must be the owner or a delegate with the explicit permission required by this instruction.
cpi_programread-onlyExternal program invoked by this instruction.
input_stake_pooloptionalInstruction-specific account supplied by the caller or SDK.
output_stake_pooloptionalInstruction-specific account supplied by the caller or SDK.
glam_configoptionalGlobal GLAM configuration account for fee and asset/oracle metadata.
sol_usd_oracleoptionalPricing or oracle account used to calculate value for the instruction.
input_token_oracleoptionalPricing or oracle account used to calculate value for the instruction.
output_token_oracleoptionalPricing or oracle account used to calculate value for the instruction.

Arguments

ArgumentTypeNotes
skip_quote_price_checkboolIf true, bypasses the oracle quote-price check; this should only be used by a signer with the required permission.
databytesSerialized Jupiter V2 route instruction data forwarded to Jupiter after GLAM swap policy and permission checks.

Policy & permissions

  • Enable native JupiterSwap access on GLAM Protocol. Protocol bitflag: 0b00000100.
  • Delegate permission depends on route intent: SwapAny, SwapLST, or SwapAllowlisted.

TypeScript SDK usage

await glamClient.jupiterSwap.swapV2({
  quoteParams,
  skipQuotePriceCheck: false,
  trackingAccount,
});

Cross-instruction constraints

  • No additional cross-instruction constraint is documented beyond account initialization, authority checks, and policy validation.