Skip to main content

createReallocOrderbookAccountInstruction

Builds a raw instruction to reallocate the orderbook account to accommodate more offers or data. This instruction increases the size of the orderbook account when needed.
This instruction can be called by anyone who is willing to pay for the additional rent. It does not require admin authority.

Usage

import { createReallocOrderbookAccountInstruction } from "@exponent-labs/exponent-sdk/client/orderbook";
import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY } from "@solana/web3.js";

const ix = createReallocOrderbookAccountInstruction(
  {
    payer: payerPublicKey,
    orderbook: orderbookAddress,
    vault: vaultAddress,
    systemProgram: SystemProgram.programId,
    rent: SYSVAR_RENT_PUBKEY,
  },
  {
    seedId: 0,
  }
);

Accounts

NameTypeSignerWritableDescription
payerPublicKeyYesYesAccount paying for reallocation
orderbookPublicKeyNoYesOrderbook account to reallocate
vaultPublicKeyNoNoAssociated vault account
systemProgramPublicKeyNoNoSystem program
rentPublicKeyNoNoRent sysvar

Args

NameTypeDescription
seedIdnumber (u32)Seed identifier for the orderbook account

Returns

TransactionInstruction — a transaction instruction ready to be added to a transaction.

Notes

  • The payer will be charged the additional rent required for the increased account size
  • This instruction is typically needed when the orderbook reaches capacity for storing offers
  • The reallocation follows account reallocation rules and rent-exempt requirements
  • Anyone can call this instruction, making it a permissionless way to ensure orderbook capacity