@gabox-labs/sdk 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/generated/events/drawResolved.ts","../../src/generated/events/packBought.ts","../../src/generated/events/poolCreated.ts","../../src/generated/events/prizesFunded.ts","../../src/generated/events/randomnessRetried.ts","../../src/generated/events/tokensSold.ts","../../src/generated/errors/gabox.ts","../../src/generated/index.ts"],"sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBooleanDecoder, getBooleanEncoder, getBytesDecoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\n\nexport const DRAW_RESOLVED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([127, 177, 62, 146, 164, 90, 185, 218]);\n\nexport function getDrawResolvedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(DRAW_RESOLVED_EVENT_DISCRIMINATOR); }\n\nexport type DrawResolvedEvent = { pool: Address; seq: bigint; purchaser: Address; amount: bigint; randomness: ReadonlyUint8Array; timedOut: boolean; };\n\nexport type DrawResolvedEventArgs = { pool: Address; seq: number | bigint; purchaser: Address; amount: number | bigint; randomness: ReadonlyUint8Array; timedOut: boolean; };\n\n/** Gets the encoder for {@link DrawResolvedEventArgs} event data. */\nexport function getDrawResolvedEventEncoder(): FixedSizeEncoder<DrawResolvedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['seq', getU64Encoder()], ['purchaser', getAddressEncoder()], ['amount', getU64Encoder()], ['randomness', fixEncoderSize(getBytesEncoder(), 32)], ['timedOut', getBooleanEncoder()]]), [getConstantEncoder(DRAW_RESOLVED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link DrawResolvedEvent} event data. */\nexport function getDrawResolvedEventDecoder(): FixedSizeDecoder<DrawResolvedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['seq', getU64Decoder()], ['purchaser', getAddressDecoder()], ['amount', getU64Decoder()], ['randomness', fixDecoderSize(getBytesDecoder(), 32)], ['timedOut', getBooleanDecoder()]]), [getConstantDecoder(DRAW_RESOLVED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link DrawResolvedEvent} event data. */\nexport function getDrawResolvedEventCodec(): FixedSizeCodec<DrawResolvedEventArgs, DrawResolvedEvent> {\n return combineCodec(getDrawResolvedEventEncoder(), getDrawResolvedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link DrawResolvedEvent} event data. */\nexport function parseDrawResolvedEvent(data: ReadonlyUint8Array | Uint8Array): DrawResolvedEvent {\n if (containsBytes(data, DRAW_RESOLVED_EVENT_DISCRIMINATOR, 0)) { return getDrawResolvedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"DrawResolvedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\nimport { getPrizeDecoder, getPrizeEncoder, type Prize, type PrizeArgs } from '../types';\n\nexport const PACK_BOUGHT_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([220, 208, 74, 75, 42, 144, 231, 69]);\n\nexport function getPackBoughtEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(PACK_BOUGHT_EVENT_DISCRIMINATOR); }\n\nexport type PackBoughtEvent = { pool: Address; seq: bigint; purchaser: Address; venue: Address; quoteMint: Address; tokensBought: bigint;\n/** Quote token the venue charged for the pack. */\nquoteDebit: bigint;\n/** Lamports the venue call itself spent, which is venue account rent. */\nnativeDebit: bigint; vrfNativeDebit: bigint; totalNativeDebit: bigint; prizes: Array<Prize>; };\n\nexport type PackBoughtEventArgs = { pool: Address; seq: number | bigint; purchaser: Address; venue: Address; quoteMint: Address; tokensBought: number | bigint;\n/** Quote token the venue charged for the pack. */\nquoteDebit: number | bigint;\n/** Lamports the venue call itself spent, which is venue account rent. */\nnativeDebit: number | bigint; vrfNativeDebit: number | bigint; totalNativeDebit: number | bigint; prizes: Array<PrizeArgs>; };\n\n/** Gets the encoder for {@link PackBoughtEventArgs} event data. */\nexport function getPackBoughtEventEncoder(): FixedSizeEncoder<PackBoughtEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['seq', getU64Encoder()], ['purchaser', getAddressEncoder()], ['venue', getAddressEncoder()], ['quoteMint', getAddressEncoder()], ['tokensBought', getU64Encoder()], ['quoteDebit', getU64Encoder()], ['nativeDebit', getU64Encoder()], ['vrfNativeDebit', getU64Encoder()], ['totalNativeDebit', getU64Encoder()], ['prizes', getArrayEncoder(getPrizeEncoder(), { size: 8 })]]), [getConstantEncoder(PACK_BOUGHT_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link PackBoughtEvent} event data. */\nexport function getPackBoughtEventDecoder(): FixedSizeDecoder<PackBoughtEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['seq', getU64Decoder()], ['purchaser', getAddressDecoder()], ['venue', getAddressDecoder()], ['quoteMint', getAddressDecoder()], ['tokensBought', getU64Decoder()], ['quoteDebit', getU64Decoder()], ['nativeDebit', getU64Decoder()], ['vrfNativeDebit', getU64Decoder()], ['totalNativeDebit', getU64Decoder()], ['prizes', getArrayDecoder(getPrizeDecoder(), { size: 8 })]]), [getConstantDecoder(PACK_BOUGHT_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link PackBoughtEvent} event data. */\nexport function getPackBoughtEventCodec(): FixedSizeCodec<PackBoughtEventArgs, PackBoughtEvent> {\n return combineCodec(getPackBoughtEventEncoder(), getPackBoughtEventDecoder());\n}\n\n/** Parses the provided bytes into {@link PackBoughtEvent} event data. */\nexport function parsePackBoughtEvent(data: ReadonlyUint8Array | Uint8Array): PackBoughtEvent {\n if (containsBytes(data, PACK_BOUGHT_EVENT_DISCRIMINATOR, 0)) { return getPackBoughtEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"PackBoughtEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\nimport { getTierDecoder, getTierEncoder, type Tier, type TierArgs } from '../types';\n\nexport const POOL_CREATED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([202, 44, 41, 88, 104, 220, 157, 82]);\n\nexport function getPoolCreatedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(POOL_CREATED_EVENT_DISCRIMINATOR); }\n\nexport type PoolCreatedEvent = { pool: Address; mint: Address; creator: Address; packTokens: bigint; tiers: Array<Tier>; seedTokens: bigint; extraSeedTokens: bigint; quoteMint: Address;\n/** Quote token the seed buy spent. */\nseedQuoteAmount: bigint;\n/** Lamports the seed buy spent, which is venue account rent, not price. */\nseedNativeDebit: bigint; };\n\nexport type PoolCreatedEventArgs = { pool: Address; mint: Address; creator: Address; packTokens: number | bigint; tiers: Array<TierArgs>; seedTokens: number | bigint; extraSeedTokens: number | bigint; quoteMint: Address;\n/** Quote token the seed buy spent. */\nseedQuoteAmount: number | bigint;\n/** Lamports the seed buy spent, which is venue account rent, not price. */\nseedNativeDebit: number | bigint; };\n\n/** Gets the encoder for {@link PoolCreatedEventArgs} event data. */\nexport function getPoolCreatedEventEncoder(): FixedSizeEncoder<PoolCreatedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['mint', getAddressEncoder()], ['creator', getAddressEncoder()], ['packTokens', getU64Encoder()], ['tiers', getArrayEncoder(getTierEncoder(), { size: 8 })], ['seedTokens', getU64Encoder()], ['extraSeedTokens', getU64Encoder()], ['quoteMint', getAddressEncoder()], ['seedQuoteAmount', getU64Encoder()], ['seedNativeDebit', getU64Encoder()]]), [getConstantEncoder(POOL_CREATED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link PoolCreatedEvent} event data. */\nexport function getPoolCreatedEventDecoder(): FixedSizeDecoder<PoolCreatedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['mint', getAddressDecoder()], ['creator', getAddressDecoder()], ['packTokens', getU64Decoder()], ['tiers', getArrayDecoder(getTierDecoder(), { size: 8 })], ['seedTokens', getU64Decoder()], ['extraSeedTokens', getU64Decoder()], ['quoteMint', getAddressDecoder()], ['seedQuoteAmount', getU64Decoder()], ['seedNativeDebit', getU64Decoder()]]), [getConstantDecoder(POOL_CREATED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link PoolCreatedEvent} event data. */\nexport function getPoolCreatedEventCodec(): FixedSizeCodec<PoolCreatedEventArgs, PoolCreatedEvent> {\n return combineCodec(getPoolCreatedEventEncoder(), getPoolCreatedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link PoolCreatedEvent} event data. */\nexport function parsePoolCreatedEvent(data: ReadonlyUint8Array | Uint8Array): PoolCreatedEvent {\n if (containsBytes(data, POOL_CREATED_EVENT_DISCRIMINATOR, 0)) { return getPoolCreatedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"PoolCreatedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\n\nexport const PRIZES_FUNDED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([188, 129, 185, 44, 234, 71, 53, 60]);\n\nexport function getPrizesFundedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(PRIZES_FUNDED_EVENT_DISCRIMINATOR); }\n\nexport type PrizesFundedEvent = { pool: Address; funder: Address; amount: bigint; };\n\nexport type PrizesFundedEventArgs = { pool: Address; funder: Address; amount: number | bigint; };\n\n/** Gets the encoder for {@link PrizesFundedEventArgs} event data. */\nexport function getPrizesFundedEventEncoder(): FixedSizeEncoder<PrizesFundedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['funder', getAddressEncoder()], ['amount', getU64Encoder()]]), [getConstantEncoder(PRIZES_FUNDED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link PrizesFundedEvent} event data. */\nexport function getPrizesFundedEventDecoder(): FixedSizeDecoder<PrizesFundedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['funder', getAddressDecoder()], ['amount', getU64Decoder()]]), [getConstantDecoder(PRIZES_FUNDED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link PrizesFundedEvent} event data. */\nexport function getPrizesFundedEventCodec(): FixedSizeCodec<PrizesFundedEventArgs, PrizesFundedEvent> {\n return combineCodec(getPrizesFundedEventEncoder(), getPrizesFundedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link PrizesFundedEvent} event data. */\nexport function parsePrizesFundedEvent(data: ReadonlyUint8Array | Uint8Array): PrizesFundedEvent {\n if (containsBytes(data, PRIZES_FUNDED_EVENT_DISCRIMINATOR, 0)) { return getPrizesFundedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"PrizesFundedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\n\nexport const RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([243, 30, 148, 22, 14, 127, 52, 140]);\n\nexport function getRandomnessRetriedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR); }\n\nexport type RandomnessRetriedEvent = { pool: Address; seq: bigint; attempt: number; };\n\nexport type RandomnessRetriedEventArgs = { pool: Address; seq: number | bigint; attempt: number; };\n\n/** Gets the encoder for {@link RandomnessRetriedEventArgs} event data. */\nexport function getRandomnessRetriedEventEncoder(): FixedSizeEncoder<RandomnessRetriedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['seq', getU64Encoder()], ['attempt', getU8Encoder()]]), [getConstantEncoder(RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link RandomnessRetriedEvent} event data. */\nexport function getRandomnessRetriedEventDecoder(): FixedSizeDecoder<RandomnessRetriedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['seq', getU64Decoder()], ['attempt', getU8Decoder()]]), [getConstantDecoder(RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link RandomnessRetriedEvent} event data. */\nexport function getRandomnessRetriedEventCodec(): FixedSizeCodec<RandomnessRetriedEventArgs, RandomnessRetriedEvent> {\n return combineCodec(getRandomnessRetriedEventEncoder(), getRandomnessRetriedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link RandomnessRetriedEvent} event data. */\nexport function parseRandomnessRetriedEvent(data: ReadonlyUint8Array | Uint8Array): RandomnessRetriedEvent {\n if (containsBytes(data, RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR, 0)) { return getRandomnessRetriedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"RandomnessRetriedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\n\nexport const TOKENS_SOLD_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([217, 83, 68, 137, 134, 225, 94, 45]);\n\nexport function getTokensSoldEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(TOKENS_SOLD_EVENT_DISCRIMINATOR); }\n\nexport type TokensSoldEvent = { pool: Address; seller: Address; venue: Address; quoteMint: Address; amount: bigint; quoteProceeds: bigint; nativeDebit: bigint; };\n\nexport type TokensSoldEventArgs = { pool: Address; seller: Address; venue: Address; quoteMint: Address; amount: number | bigint; quoteProceeds: number | bigint; nativeDebit: number | bigint; };\n\n/** Gets the encoder for {@link TokensSoldEventArgs} event data. */\nexport function getTokensSoldEventEncoder(): FixedSizeEncoder<TokensSoldEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['seller', getAddressEncoder()], ['venue', getAddressEncoder()], ['quoteMint', getAddressEncoder()], ['amount', getU64Encoder()], ['quoteProceeds', getU64Encoder()], ['nativeDebit', getU64Encoder()]]), [getConstantEncoder(TOKENS_SOLD_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link TokensSoldEvent} event data. */\nexport function getTokensSoldEventDecoder(): FixedSizeDecoder<TokensSoldEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['seller', getAddressDecoder()], ['venue', getAddressDecoder()], ['quoteMint', getAddressDecoder()], ['amount', getU64Decoder()], ['quoteProceeds', getU64Decoder()], ['nativeDebit', getU64Decoder()]]), [getConstantDecoder(TOKENS_SOLD_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link TokensSoldEvent} event data. */\nexport function getTokensSoldEventCodec(): FixedSizeCodec<TokensSoldEventArgs, TokensSoldEvent> {\n return combineCodec(getTokensSoldEventEncoder(), getTokensSoldEventDecoder());\n}\n\n/** Parses the provided bytes into {@link TokensSoldEvent} event data. */\nexport function parseTokensSoldEvent(data: ReadonlyUint8Array | Uint8Array): TokensSoldEvent {\n if (containsBytes(data, TOKENS_SOLD_EVENT_DISCRIMINATOR, 0)) { return getTokensSoldEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"TokensSoldEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { isProgramError, type Address, type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, type SolanaError } from '@solana/kit';\nimport { GABOX_PROGRAM_ADDRESS } from '../programs';\n\n/** Arithmetic: Arithmetic overflow or inconsistent accounting */\nexport const GABOX_ERROR__ARITHMETIC = 0x1770; // 6000\n/** InvalidDistribution: Invalid prize distribution */\nexport const GABOX_ERROR__INVALID_DISTRIBUTION = 0x1771; // 6001\n/** UnfundedExpectation: Expected token award exceeds tokens purchased */\nexport const GABOX_ERROR__UNFUNDED_EXPECTATION = 0x1772; // 6002\n/** UnsupportedMint: Mint must have 6 decimals and no mint or freeze authority */\nexport const GABOX_ERROR__UNSUPPORTED_MINT = 0x1773; // 6003\n/** InsolventInventory: Prize inventory does not cover reservations */\nexport const GABOX_ERROR__INSOLVENT_INVENTORY = 0x1774; // 6004\n/** PrizeCapChanged: Top prize is below the signed minimum; refresh the offer */\nexport const GABOX_ERROR__PRIZE_CAP_CHANGED = 0x1775; // 6005\n/** PackTooSmall: A pack pays zero tokens on some tier */\nexport const GABOX_ERROR__PACK_TOO_SMALL = 0x1776; // 6006\n/** JackpotBelowOnePack: The largest tier must pay at least one pack */\nexport const GABOX_ERROR__JACKPOT_BELOW_ONE_PACK = 0x1777; // 6007\n/** InvalidVenue: Incorrect trade program, account order, or token binding */\nexport const GABOX_ERROR__INVALID_VENUE = 0x1778; // 6008\n/** IncorrectTokenDelta: Trade did not move the exact token amount */\nexport const GABOX_ERROR__INCORRECT_TOKEN_DELTA = 0x1779; // 6009\n/** SlippageExceeded: Spend exceeds the signed limit */\nexport const GABOX_ERROR__SLIPPAGE_EXCEEDED = 0x177a; // 6010\n/** RetryTooSoon: Retry interval has not elapsed */\nexport const GABOX_ERROR__RETRY_TOO_SOON = 0x177b; // 6011\n/** RetryUnavailable: Retry limit reached or draw expired */\nexport const GABOX_ERROR__RETRY_UNAVAILABLE = 0x177c; // 6012\n/** NotExpired: Oracle timeout has not elapsed */\nexport const GABOX_ERROR__NOT_EXPIRED = 0x177d; // 6013\n/** ZeroAmount: Amount must be positive */\nexport const GABOX_ERROR__ZERO_AMOUNT = 0x177e; // 6014\n/** InvalidLaunch: LaunchLab create instruction is malformed or missing before this instruction */\nexport const GABOX_ERROR__INVALID_LAUNCH = 0x177f; // 6015\n/** InvalidQuote: Quote mint or quote token program is unsupported */\nexport const GABOX_ERROR__INVALID_QUOTE = 0x1780; // 6016\n/** WalletActivityMismatch: Wallet activity account belongs to a different wallet */\nexport const GABOX_ERROR__WALLET_ACTIVITY_MISMATCH = 0x1781; // 6017\n\nexport type GaboxError = typeof GABOX_ERROR__ARITHMETIC | typeof GABOX_ERROR__INCORRECT_TOKEN_DELTA | typeof GABOX_ERROR__INSOLVENT_INVENTORY | typeof GABOX_ERROR__INVALID_DISTRIBUTION | typeof GABOX_ERROR__INVALID_LAUNCH | typeof GABOX_ERROR__INVALID_QUOTE | typeof GABOX_ERROR__INVALID_VENUE | typeof GABOX_ERROR__JACKPOT_BELOW_ONE_PACK | typeof GABOX_ERROR__NOT_EXPIRED | typeof GABOX_ERROR__PACK_TOO_SMALL | typeof GABOX_ERROR__PRIZE_CAP_CHANGED | typeof GABOX_ERROR__RETRY_TOO_SOON | typeof GABOX_ERROR__RETRY_UNAVAILABLE | typeof GABOX_ERROR__SLIPPAGE_EXCEEDED | typeof GABOX_ERROR__UNFUNDED_EXPECTATION | typeof GABOX_ERROR__UNSUPPORTED_MINT | typeof GABOX_ERROR__WALLET_ACTIVITY_MISMATCH | typeof GABOX_ERROR__ZERO_AMOUNT;\n\nlet gaboxErrorMessages: Record<GaboxError, string> | undefined;\nif (process.env['NODE_ENV'] !== 'production') {\n gaboxErrorMessages = { [GABOX_ERROR__ARITHMETIC]: `Arithmetic overflow or inconsistent accounting`, [GABOX_ERROR__INCORRECT_TOKEN_DELTA]: `Trade did not move the exact token amount`, [GABOX_ERROR__INSOLVENT_INVENTORY]: `Prize inventory does not cover reservations`, [GABOX_ERROR__INVALID_DISTRIBUTION]: `Invalid prize distribution`, [GABOX_ERROR__INVALID_LAUNCH]: `LaunchLab create instruction is malformed or missing before this instruction`, [GABOX_ERROR__INVALID_QUOTE]: `Quote mint or quote token program is unsupported`, [GABOX_ERROR__INVALID_VENUE]: `Incorrect trade program, account order, or token binding`, [GABOX_ERROR__JACKPOT_BELOW_ONE_PACK]: `The largest tier must pay at least one pack`, [GABOX_ERROR__NOT_EXPIRED]: `Oracle timeout has not elapsed`, [GABOX_ERROR__PACK_TOO_SMALL]: `A pack pays zero tokens on some tier`, [GABOX_ERROR__PRIZE_CAP_CHANGED]: `Top prize is below the signed minimum; refresh the offer`, [GABOX_ERROR__RETRY_TOO_SOON]: `Retry interval has not elapsed`, [GABOX_ERROR__RETRY_UNAVAILABLE]: `Retry limit reached or draw expired`, [GABOX_ERROR__SLIPPAGE_EXCEEDED]: `Spend exceeds the signed limit`, [GABOX_ERROR__UNFUNDED_EXPECTATION]: `Expected token award exceeds tokens purchased`, [GABOX_ERROR__UNSUPPORTED_MINT]: `Mint must have 6 decimals and no mint or freeze authority`, [GABOX_ERROR__WALLET_ACTIVITY_MISMATCH]: `Wallet activity account belongs to a different wallet`, [GABOX_ERROR__ZERO_AMOUNT]: `Amount must be positive` };\n}\n\nexport function getGaboxErrorMessage(code: GaboxError): string {\n if (process.env['NODE_ENV'] !== 'production') {\n return (gaboxErrorMessages as Record<GaboxError, string>)[code];\n }\n\n return 'Error message not available in production bundles.';\n}\n\nexport function isGaboxError<TProgramErrorCode extends GaboxError>(\n error: unknown,\n transactionMessage: { instructions: Record<number, { programAddress: Address }> },\n code?: TProgramErrorCode,\n): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> & Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {\n return isProgramError<TProgramErrorCode>(error, transactionMessage, GABOX_PROGRAM_ADDRESS, code);\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nexport * from './accounts';\nexport * from './errors';\nexport * from './events';\nexport * from './instructions';\nexport * from './pdas';\nexport * from './programs';\nexport * from './types';"],"mappings":";;;;;;;;;;;AAUA,MAAa,oCAAwD,IAAI,WAAW;CAAC;CAAK;CAAK;CAAI;CAAK;CAAK;CAAI;CAAK;AAAG,CAAC;AAE1H,SAAgB,yCAA6D;CAAE,OAAO,eAAe,gBAAgB,GAAG,CAAC,CAAC,CAAC,OAAO,iCAAiC;AAAG;;AAOtK,SAAgB,8BAAuE;CACnF,OAAO,uBAAuB,iBAAiB;EAAC,CAAC,QAAQ,kBAAkB,CAAC;EAAG,CAAC,OAAO,cAAc,CAAC;EAAG,CAAC,aAAa,kBAAkB,CAAC;EAAG,CAAC,UAAU,cAAc,CAAC;EAAG,CAAC,cAAc,eAAe,gBAAgB,GAAG,EAAE,CAAC;EAAG,CAAC,YAAY,kBAAkB,CAAC;CAAC,CAAC,GAAG,CAAC,mBAAmB,iCAAiC,CAAC,CAAC;AACjU;;AAGA,SAAgB,8BAAmE;CAC/E,OAAO,uBAAuB,iBAAiB;EAAC,CAAC,QAAQ,kBAAkB,CAAC;EAAG,CAAC,OAAO,cAA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AEhD,MAAa,iCAAiC;;AAE9C,MAAa,8BAA8B;;AAE3C,MAAa,sCAAsC;;AAEnD,MAAa,6BAA6B;;AAE1C,MAAa,qCAAqC;;AAElD,MAAa,iCAAiC;;AAE9C,MAAa,8BAA8B;;AAE3C,MAAa,iCAAiC;;AAE9C,MAAa,2BAA2B;;AAExC,MAAa,2BAA2B;;AAExC,MAAa,8BAA8B;;AAE3C,MAAa,6BAA6B;;AAE1C,MAAa,wCAAwC;AAIrD,IAAI;AACJ,IAAI,QAAQ,IAAI,gBAAgB,cAC9B,qBAAqB;EAAG,0BAA0B;EAAmD,qCAAqC;EAA8C,mCAAmC;EAAgD,oCAAoC;EAA+B,8BAA8B;EAAiF,6BAA6B;EAAqD,6BAA6B;EAA6D,sCAAsC;EAAgD,2BAA2B;EAAmC,8BAA8B;EAAyC,iCAAiC;EAA6D,8BAA8B;EAAmC,iCAAiC;EAAwC,iCAAiC;EAAmC,oCAAoC;EAAkD,gCAAgC;EAA8D,wCAAwC;EAA0D,2BAA2B;AAA0B;AAG77C,SAAgB,qBAAqB,MAA0B;CAC7D,IAAI,QAAQ,IAAI,gBAAgB,cAC9B,OAAQ,mBAAkD;CAG5D,OAAO;AACT;AAEA,SAAgB,aACZ,OACA,oBACA,MACmI;CACrI,OAAO,eAAkC,OAAO,oBAAoB,uBAAuB,IAAI;AACjG"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/generated/types/packResult.ts","../../src/generated/types/prize.ts","../../src/generated/events/drawResolved.ts","../../src/generated/events/packsBought.ts","../../src/generated/events/poolCreated.ts","../../src/generated/events/prizeClaimed.ts","../../src/generated/events/prizesFunded.ts","../../src/generated/events/randomnessRetried.ts","../../src/generated/events/tokensSold.ts","../../src/generated/errors/gabox.ts","../../src/generated/index.ts"],"sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';\n\n/**\n * One pack's outcome inside a settled batch: the tier it landed on and the\n * tokens it pays.\n */\nexport type PackResult = { tier: number; amount: bigint; };\n\nexport type PackResultArgs = { tier: number; amount: number | bigint; };\n\nexport function getPackResultEncoder(): FixedSizeEncoder<PackResultArgs> {\n return getStructEncoder([['tier', getU8Encoder()], ['amount', getU64Encoder()]]);\n}\n\nexport function getPackResultDecoder(): FixedSizeDecoder<PackResult> {\n return getStructDecoder([['tier', getU8Decoder()], ['amount', getU64Decoder()]]);\n}\n\nexport function getPackResultCodec(): FixedSizeCodec<PackResultArgs, PackResult> {\n return combineCodec(getPackResultEncoder(), getPackResultDecoder());\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';\n\nexport type Prize = { amount: bigint; tickets: number; };\n\nexport type PrizeArgs = { amount: number | bigint; tickets: number; };\n\nexport function getPrizeEncoder(): FixedSizeEncoder<PrizeArgs> {\n return getStructEncoder([['amount', getU64Encoder()], ['tickets', getU32Encoder()]]);\n}\n\nexport function getPrizeDecoder(): FixedSizeDecoder<Prize> {\n return getStructDecoder([['amount', getU64Decoder()], ['tickets', getU32Decoder()]]);\n}\n\nexport function getPrizeCodec(): FixedSizeCodec<PrizeArgs, Prize> {\n return combineCodec(getPrizeEncoder(), getPrizeDecoder());\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBooleanDecoder, getBooleanEncoder, getBytesDecoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type Address, type Codec, type Decoder, type Encoder, type ReadonlyUint8Array } from '@solana/kit';\nimport { getPackResultDecoder, getPackResultEncoder, type PackResult, type PackResultArgs } from '../types';\n\nexport const DRAW_RESOLVED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([127, 177, 62, 146, 164, 90, 185, 218]);\n\nexport function getDrawResolvedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(DRAW_RESOLVED_EVENT_DISCRIMINATOR); }\n\nexport type DrawResolvedEvent = { pool: Address; draw: Address; purchaser: Address; seqStart: bigint; count: number; total: bigint; randomness: ReadonlyUint8Array; timedOut: boolean;\n/**\n * True when the tokens reached the purchaser in the same instruction.\n * False when they wait in the vault for a claim.\n */\npaid: boolean; results: Array<PackResult>; };\n\nexport type DrawResolvedEventArgs = { pool: Address; draw: Address; purchaser: Address; seqStart: number | bigint; count: number; total: number | bigint; randomness: ReadonlyUint8Array; timedOut: boolean;\n/**\n * True when the tokens reached the purchaser in the same instruction.\n * False when they wait in the vault for a claim.\n */\npaid: boolean; results: Array<PackResultArgs>; };\n\n/** Gets the encoder for {@link DrawResolvedEventArgs} event data. */\nexport function getDrawResolvedEventEncoder(): Encoder<DrawResolvedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['draw', getAddressEncoder()], ['purchaser', getAddressEncoder()], ['seqStart', getU64Encoder()], ['count', getU8Encoder()], ['total', getU64Encoder()], ['randomness', fixEncoderSize(getBytesEncoder(), 32)], ['timedOut', getBooleanEncoder()], ['paid', getBooleanEncoder()], ['results', getArrayEncoder(getPackResultEncoder())]]), [getConstantEncoder(DRAW_RESOLVED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link DrawResolvedEvent} event data. */\nexport function getDrawResolvedEventDecoder(): Decoder<DrawResolvedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['draw', getAddressDecoder()], ['purchaser', getAddressDecoder()], ['seqStart', getU64Decoder()], ['count', getU8Decoder()], ['total', getU64Decoder()], ['randomness', fixDecoderSize(getBytesDecoder(), 32)], ['timedOut', getBooleanDecoder()], ['paid', getBooleanDecoder()], ['results', getArrayDecoder(getPackResultDecoder())]]), [getConstantDecoder(DRAW_RESOLVED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link DrawResolvedEvent} event data. */\nexport function getDrawResolvedEventCodec(): Codec<DrawResolvedEventArgs, DrawResolvedEvent> {\n return combineCodec(getDrawResolvedEventEncoder(), getDrawResolvedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link DrawResolvedEvent} event data. */\nexport function parseDrawResolvedEvent(data: ReadonlyUint8Array | Uint8Array): DrawResolvedEvent {\n if (containsBytes(data, DRAW_RESOLVED_EVENT_DISCRIMINATOR, 0)) { return getDrawResolvedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"DrawResolvedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\nimport { getPrizeDecoder, getPrizeEncoder, type Prize, type PrizeArgs } from '../types';\n\nexport const PACKS_BOUGHT_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([44, 243, 223, 11, 90, 23, 184, 47]);\n\nexport function getPacksBoughtEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(PACKS_BOUGHT_EVENT_DISCRIMINATOR); }\n\nexport type PacksBoughtEvent = { pool: Address; draw: Address; purchaser: Address; seqStart: bigint; count: number; venue: Address; quoteMint: Address; tokensBought: bigint;\n/** Quote token the venue charged for the whole batch. */\nquoteDebit: bigint;\n/** Lamports the venue call itself spent, which is venue account rent. */\nnativeDebit: bigint; vrfNativeDebit: bigint; totalNativeDebit: bigint;\n/** `vault - reserved` before this purchase, the snapshot settlement uses. */\nfreeSnapshot: bigint;\n/** What this purchase added to `pool.reserved`. */\nreserved: bigint;\n/**\n * The first pack's table. Later packs' tables follow from the outcomes\n * before them.\n */\nfirstPrizes: Array<Prize>; };\n\nexport type PacksBoughtEventArgs = { pool: Address; draw: Address; purchaser: Address; seqStart: number | bigint; count: number; venue: Address; quoteMint: Address; tokensBought: number | bigint;\n/** Quote token the venue charged for the whole batch. */\nquoteDebit: number | bigint;\n/** Lamports the venue call itself spent, which is venue account rent. */\nnativeDebit: number | bigint; vrfNativeDebit: number | bigint; totalNativeDebit: number | bigint;\n/** `vault - reserved` before this purchase, the snapshot settlement uses. */\nfreeSnapshot: number | bigint;\n/** What this purchase added to `pool.reserved`. */\nreserved: number | bigint;\n/**\n * The first pack's table. Later packs' tables follow from the outcomes\n * before them.\n */\nfirstPrizes: Array<PrizeArgs>; };\n\n/** Gets the encoder for {@link PacksBoughtEventArgs} event data. */\nexport function getPacksBoughtEventEncoder(): FixedSizeEncoder<PacksBoughtEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['draw', getAddressEncoder()], ['purchaser', getAddressEncoder()], ['seqStart', getU64Encoder()], ['count', getU8Encoder()], ['venue', getAddressEncoder()], ['quoteMint', getAddressEncoder()], ['tokensBought', getU64Encoder()], ['quoteDebit', getU64Encoder()], ['nativeDebit', getU64Encoder()], ['vrfNativeDebit', getU64Encoder()], ['totalNativeDebit', getU64Encoder()], ['freeSnapshot', getU64Encoder()], ['reserved', getU64Encoder()], ['firstPrizes', getArrayEncoder(getPrizeEncoder(), { size: 8 })]]), [getConstantEncoder(PACKS_BOUGHT_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link PacksBoughtEvent} event data. */\nexport function getPacksBoughtEventDecoder(): FixedSizeDecoder<PacksBoughtEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['draw', getAddressDecoder()], ['purchaser', getAddressDecoder()], ['seqStart', getU64Decoder()], ['count', getU8Decoder()], ['venue', getAddressDecoder()], ['quoteMint', getAddressDecoder()], ['tokensBought', getU64Decoder()], ['quoteDebit', getU64Decoder()], ['nativeDebit', getU64Decoder()], ['vrfNativeDebit', getU64Decoder()], ['totalNativeDebit', getU64Decoder()], ['freeSnapshot', getU64Decoder()], ['reserved', getU64Decoder()], ['firstPrizes', getArrayDecoder(getPrizeDecoder(), { size: 8 })]]), [getConstantDecoder(PACKS_BOUGHT_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link PacksBoughtEvent} event data. */\nexport function getPacksBoughtEventCodec(): FixedSizeCodec<PacksBoughtEventArgs, PacksBoughtEvent> {\n return combineCodec(getPacksBoughtEventEncoder(), getPacksBoughtEventDecoder());\n}\n\n/** Parses the provided bytes into {@link PacksBoughtEvent} event data. */\nexport function parsePacksBoughtEvent(data: ReadonlyUint8Array | Uint8Array): PacksBoughtEvent {\n if (containsBytes(data, PACKS_BOUGHT_EVENT_DISCRIMINATOR, 0)) { return getPacksBoughtEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"PacksBoughtEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\nimport { getTierDecoder, getTierEncoder, type Tier, type TierArgs } from '../types';\n\nexport const POOL_CREATED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([202, 44, 41, 88, 104, 220, 157, 82]);\n\nexport function getPoolCreatedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(POOL_CREATED_EVENT_DISCRIMINATOR); }\n\nexport type PoolCreatedEvent = { pool: Address; mint: Address; creator: Address; packTokens: bigint; tiers: Array<Tier>; seedTokens: bigint; extraSeedTokens: bigint; quoteMint: Address;\n/** Quote token the seed buy spent. */\nseedQuoteAmount: bigint;\n/** Lamports the seed buy spent, which is venue account rent, not price. */\nseedNativeDebit: bigint; };\n\nexport type PoolCreatedEventArgs = { pool: Address; mint: Address; creator: Address; packTokens: number | bigint; tiers: Array<TierArgs>; seedTokens: number | bigint; extraSeedTokens: number | bigint; quoteMint: Address;\n/** Quote token the seed buy spent. */\nseedQuoteAmount: number | bigint;\n/** Lamports the seed buy spent, which is venue account rent, not price. */\nseedNativeDebit: number | bigint; };\n\n/** Gets the encoder for {@link PoolCreatedEventArgs} event data. */\nexport function getPoolCreatedEventEncoder(): FixedSizeEncoder<PoolCreatedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['mint', getAddressEncoder()], ['creator', getAddressEncoder()], ['packTokens', getU64Encoder()], ['tiers', getArrayEncoder(getTierEncoder(), { size: 8 })], ['seedTokens', getU64Encoder()], ['extraSeedTokens', getU64Encoder()], ['quoteMint', getAddressEncoder()], ['seedQuoteAmount', getU64Encoder()], ['seedNativeDebit', getU64Encoder()]]), [getConstantEncoder(POOL_CREATED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link PoolCreatedEvent} event data. */\nexport function getPoolCreatedEventDecoder(): FixedSizeDecoder<PoolCreatedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['mint', getAddressDecoder()], ['creator', getAddressDecoder()], ['packTokens', getU64Decoder()], ['tiers', getArrayDecoder(getTierDecoder(), { size: 8 })], ['seedTokens', getU64Decoder()], ['extraSeedTokens', getU64Decoder()], ['quoteMint', getAddressDecoder()], ['seedQuoteAmount', getU64Decoder()], ['seedNativeDebit', getU64Decoder()]]), [getConstantDecoder(POOL_CREATED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link PoolCreatedEvent} event data. */\nexport function getPoolCreatedEventCodec(): FixedSizeCodec<PoolCreatedEventArgs, PoolCreatedEvent> {\n return combineCodec(getPoolCreatedEventEncoder(), getPoolCreatedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link PoolCreatedEvent} event data. */\nexport function parsePoolCreatedEvent(data: ReadonlyUint8Array | Uint8Array): PoolCreatedEvent {\n if (containsBytes(data, POOL_CREATED_EVENT_DISCRIMINATOR, 0)) { return getPoolCreatedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"PoolCreatedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\n\nexport const PRIZE_CLAIMED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([213, 150, 192, 76, 199, 33, 212, 38]);\n\nexport function getPrizeClaimedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(PRIZE_CLAIMED_EVENT_DISCRIMINATOR); }\n\nexport type PrizeClaimedEvent = { pool: Address; draw: Address; purchaser: Address; amount: bigint; payer: Address; destination: Address; };\n\nexport type PrizeClaimedEventArgs = { pool: Address; draw: Address; purchaser: Address; amount: number | bigint; payer: Address; destination: Address; };\n\n/** Gets the encoder for {@link PrizeClaimedEventArgs} event data. */\nexport function getPrizeClaimedEventEncoder(): FixedSizeEncoder<PrizeClaimedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['draw', getAddressEncoder()], ['purchaser', getAddressEncoder()], ['amount', getU64Encoder()], ['payer', getAddressEncoder()], ['destination', getAddressEncoder()]]), [getConstantEncoder(PRIZE_CLAIMED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link PrizeClaimedEvent} event data. */\nexport function getPrizeClaimedEventDecoder(): FixedSizeDecoder<PrizeClaimedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['draw', getAddressDecoder()], ['purchaser', getAddressDecoder()], ['amount', getU64Decoder()], ['payer', getAddressDecoder()], ['destination', getAddressDecoder()]]), [getConstantDecoder(PRIZE_CLAIMED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link PrizeClaimedEvent} event data. */\nexport function getPrizeClaimedEventCodec(): FixedSizeCodec<PrizeClaimedEventArgs, PrizeClaimedEvent> {\n return combineCodec(getPrizeClaimedEventEncoder(), getPrizeClaimedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link PrizeClaimedEvent} event data. */\nexport function parsePrizeClaimedEvent(data: ReadonlyUint8Array | Uint8Array): PrizeClaimedEvent {\n if (containsBytes(data, PRIZE_CLAIMED_EVENT_DISCRIMINATOR, 0)) { return getPrizeClaimedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"PrizeClaimedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\n\nexport const PRIZES_FUNDED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([188, 129, 185, 44, 234, 71, 53, 60]);\n\nexport function getPrizesFundedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(PRIZES_FUNDED_EVENT_DISCRIMINATOR); }\n\nexport type PrizesFundedEvent = { pool: Address; funder: Address; amount: bigint; };\n\nexport type PrizesFundedEventArgs = { pool: Address; funder: Address; amount: number | bigint; };\n\n/** Gets the encoder for {@link PrizesFundedEventArgs} event data. */\nexport function getPrizesFundedEventEncoder(): FixedSizeEncoder<PrizesFundedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['funder', getAddressEncoder()], ['amount', getU64Encoder()]]), [getConstantEncoder(PRIZES_FUNDED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link PrizesFundedEvent} event data. */\nexport function getPrizesFundedEventDecoder(): FixedSizeDecoder<PrizesFundedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['funder', getAddressDecoder()], ['amount', getU64Decoder()]]), [getConstantDecoder(PRIZES_FUNDED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link PrizesFundedEvent} event data. */\nexport function getPrizesFundedEventCodec(): FixedSizeCodec<PrizesFundedEventArgs, PrizesFundedEvent> {\n return combineCodec(getPrizesFundedEventEncoder(), getPrizesFundedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link PrizesFundedEvent} event data. */\nexport function parsePrizesFundedEvent(data: ReadonlyUint8Array | Uint8Array): PrizesFundedEvent {\n if (containsBytes(data, PRIZES_FUNDED_EVENT_DISCRIMINATOR, 0)) { return getPrizesFundedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"PrizesFundedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\n\nexport const RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([243, 30, 148, 22, 14, 127, 52, 140]);\n\nexport function getRandomnessRetriedEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR); }\n\nexport type RandomnessRetriedEvent = { pool: Address; draw: Address; seqStart: bigint; attempt: number; };\n\nexport type RandomnessRetriedEventArgs = { pool: Address; draw: Address; seqStart: number | bigint; attempt: number; };\n\n/** Gets the encoder for {@link RandomnessRetriedEventArgs} event data. */\nexport function getRandomnessRetriedEventEncoder(): FixedSizeEncoder<RandomnessRetriedEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['draw', getAddressEncoder()], ['seqStart', getU64Encoder()], ['attempt', getU8Encoder()]]), [getConstantEncoder(RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link RandomnessRetriedEvent} event data. */\nexport function getRandomnessRetriedEventDecoder(): FixedSizeDecoder<RandomnessRetriedEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['draw', getAddressDecoder()], ['seqStart', getU64Decoder()], ['attempt', getU8Decoder()]]), [getConstantDecoder(RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link RandomnessRetriedEvent} event data. */\nexport function getRandomnessRetriedEventCodec(): FixedSizeCodec<RandomnessRetriedEventArgs, RandomnessRetriedEvent> {\n return combineCodec(getRandomnessRetriedEventEncoder(), getRandomnessRetriedEventDecoder());\n}\n\n/** Parses the provided bytes into {@link RandomnessRetriedEvent} event data. */\nexport function parseRandomnessRetriedEvent(data: ReadonlyUint8Array | Uint8Array): RandomnessRetriedEvent {\n if (containsBytes(data, RANDOMNESS_RETRIED_EVENT_DISCRIMINATOR, 0)) { return getRandomnessRetriedEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"RandomnessRetriedEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { combineCodec, containsBytes, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBytesEncoder, getConstantDecoder, getConstantEncoder, getHiddenPrefixDecoder, getHiddenPrefixEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type ReadonlyUint8Array } from '@solana/kit';\n\nexport const TOKENS_SOLD_EVENT_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([217, 83, 68, 137, 134, 225, 94, 45]);\n\nexport function getTokensSoldEventDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode(TOKENS_SOLD_EVENT_DISCRIMINATOR); }\n\nexport type TokensSoldEvent = { pool: Address; seller: Address; venue: Address; quoteMint: Address; amount: bigint; quoteProceeds: bigint; nativeDebit: bigint; };\n\nexport type TokensSoldEventArgs = { pool: Address; seller: Address; venue: Address; quoteMint: Address; amount: number | bigint; quoteProceeds: number | bigint; nativeDebit: number | bigint; };\n\n/** Gets the encoder for {@link TokensSoldEventArgs} event data. */\nexport function getTokensSoldEventEncoder(): FixedSizeEncoder<TokensSoldEventArgs> {\n return getHiddenPrefixEncoder(getStructEncoder([['pool', getAddressEncoder()], ['seller', getAddressEncoder()], ['venue', getAddressEncoder()], ['quoteMint', getAddressEncoder()], ['amount', getU64Encoder()], ['quoteProceeds', getU64Encoder()], ['nativeDebit', getU64Encoder()]]), [getConstantEncoder(TOKENS_SOLD_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the decoder for {@link TokensSoldEvent} event data. */\nexport function getTokensSoldEventDecoder(): FixedSizeDecoder<TokensSoldEvent> {\n return getHiddenPrefixDecoder(getStructDecoder([['pool', getAddressDecoder()], ['seller', getAddressDecoder()], ['venue', getAddressDecoder()], ['quoteMint', getAddressDecoder()], ['amount', getU64Decoder()], ['quoteProceeds', getU64Decoder()], ['nativeDebit', getU64Decoder()]]), [getConstantDecoder(TOKENS_SOLD_EVENT_DISCRIMINATOR)]);\n}\n\n/** Gets the codec for {@link TokensSoldEvent} event data. */\nexport function getTokensSoldEventCodec(): FixedSizeCodec<TokensSoldEventArgs, TokensSoldEvent> {\n return combineCodec(getTokensSoldEventEncoder(), getTokensSoldEventDecoder());\n}\n\n/** Parses the provided bytes into {@link TokensSoldEvent} event data. */\nexport function parseTokensSoldEvent(data: ReadonlyUint8Array | Uint8Array): TokensSoldEvent {\n if (containsBytes(data, TOKENS_SOLD_EVENT_DISCRIMINATOR, 0)) { return getTokensSoldEventDecoder().decode(data); }\n throw new Error('The provided data does not match the \"TokensSoldEvent\" event discriminators.');\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { isProgramError, type Address, type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, type SolanaError } from '@solana/kit';\nimport { GABOX_PROGRAM_ADDRESS } from '../programs';\n\n/** Arithmetic: Arithmetic overflow or inconsistent accounting */\nexport const GABOX_ERROR__ARITHMETIC = 0x1770; // 6000\n/** InvalidDistribution: Invalid prize distribution */\nexport const GABOX_ERROR__INVALID_DISTRIBUTION = 0x1771; // 6001\n/** UnfundedExpectation: Expected token award exceeds tokens purchased */\nexport const GABOX_ERROR__UNFUNDED_EXPECTATION = 0x1772; // 6002\n/** UnsupportedMint: Mint must have 6 decimals and no mint or freeze authority */\nexport const GABOX_ERROR__UNSUPPORTED_MINT = 0x1773; // 6003\n/** InsolventInventory: Prize inventory does not cover reservations */\nexport const GABOX_ERROR__INSOLVENT_INVENTORY = 0x1774; // 6004\n/** PrizeCapChanged: Top prize is below the signed minimum; refresh the offer */\nexport const GABOX_ERROR__PRIZE_CAP_CHANGED = 0x1775; // 6005\n/** PackTooSmall: A pack pays zero tokens on some tier */\nexport const GABOX_ERROR__PACK_TOO_SMALL = 0x1776; // 6006\n/** JackpotBelowOnePack: The largest tier must pay at least one pack */\nexport const GABOX_ERROR__JACKPOT_BELOW_ONE_PACK = 0x1777; // 6007\n/** InvalidVenue: Incorrect trade program, account order, or token binding */\nexport const GABOX_ERROR__INVALID_VENUE = 0x1778; // 6008\n/** IncorrectTokenDelta: Trade did not move the exact token amount */\nexport const GABOX_ERROR__INCORRECT_TOKEN_DELTA = 0x1779; // 6009\n/** SlippageExceeded: Spend exceeds the signed limit */\nexport const GABOX_ERROR__SLIPPAGE_EXCEEDED = 0x177a; // 6010\n/** RetryTooSoon: Retry interval has not elapsed */\nexport const GABOX_ERROR__RETRY_TOO_SOON = 0x177b; // 6011\n/** RetryUnavailable: Retry limit reached or draw expired */\nexport const GABOX_ERROR__RETRY_UNAVAILABLE = 0x177c; // 6012\n/** NotExpired: Oracle timeout has not elapsed */\nexport const GABOX_ERROR__NOT_EXPIRED = 0x177d; // 6013\n/** ZeroAmount: Amount must be positive */\nexport const GABOX_ERROR__ZERO_AMOUNT = 0x177e; // 6014\n/** InvalidLaunch: LaunchLab create instruction is malformed or missing before this instruction */\nexport const GABOX_ERROR__INVALID_LAUNCH = 0x177f; // 6015\n/** InvalidQuote: Quote mint or quote token program is unsupported */\nexport const GABOX_ERROR__INVALID_QUOTE = 0x1780; // 6016\n/** WalletActivityMismatch: Wallet activity account belongs to a different wallet */\nexport const GABOX_ERROR__WALLET_ACTIVITY_MISMATCH = 0x1781; // 6017\n/** TooManyPacks: A purchase opens at most MAX_BATCH_SIZE packs */\nexport const GABOX_ERROR__TOO_MANY_PACKS = 0x1782; // 6018\n/** DrawAlreadySettled: The draw's outcome is already fixed */\nexport const GABOX_ERROR__DRAW_ALREADY_SETTLED = 0x1783; // 6019\n/** DrawNotSettled: The draw's outcome is not fixed yet */\nexport const GABOX_ERROR__DRAW_NOT_SETTLED = 0x1784; // 6020\n/** DrawExpired: Delivery is closed for this draw; only expiry remains */\nexport const GABOX_ERROR__DRAW_EXPIRED = 0x1785; // 6021\n/** WrongDraw: The callback's sequence number does not match this draw */\nexport const GABOX_ERROR__WRONG_DRAW = 0x1786; // 6022\n/** WrongTokenAccount: Not the purchaser's coin account */\nexport const GABOX_ERROR__WRONG_TOKEN_ACCOUNT = 0x1787; // 6023\n/** WrongDestination: The destination must be the purchaser's own account for this coin */\nexport const GABOX_ERROR__WRONG_DESTINATION = 0x1788; // 6024\n\nexport type GaboxError = typeof GABOX_ERROR__ARITHMETIC | typeof GABOX_ERROR__DRAW_ALREADY_SETTLED | typeof GABOX_ERROR__DRAW_EXPIRED | typeof GABOX_ERROR__DRAW_NOT_SETTLED | typeof GABOX_ERROR__INCORRECT_TOKEN_DELTA | typeof GABOX_ERROR__INSOLVENT_INVENTORY | typeof GABOX_ERROR__INVALID_DISTRIBUTION | typeof GABOX_ERROR__INVALID_LAUNCH | typeof GABOX_ERROR__INVALID_QUOTE | typeof GABOX_ERROR__INVALID_VENUE | typeof GABOX_ERROR__JACKPOT_BELOW_ONE_PACK | typeof GABOX_ERROR__NOT_EXPIRED | typeof GABOX_ERROR__PACK_TOO_SMALL | typeof GABOX_ERROR__PRIZE_CAP_CHANGED | typeof GABOX_ERROR__RETRY_TOO_SOON | typeof GABOX_ERROR__RETRY_UNAVAILABLE | typeof GABOX_ERROR__SLIPPAGE_EXCEEDED | typeof GABOX_ERROR__TOO_MANY_PACKS | typeof GABOX_ERROR__UNFUNDED_EXPECTATION | typeof GABOX_ERROR__UNSUPPORTED_MINT | typeof GABOX_ERROR__WALLET_ACTIVITY_MISMATCH | typeof GABOX_ERROR__WRONG_DESTINATION | typeof GABOX_ERROR__WRONG_DRAW | typeof GABOX_ERROR__WRONG_TOKEN_ACCOUNT | typeof GABOX_ERROR__ZERO_AMOUNT;\n\nlet gaboxErrorMessages: Record<GaboxError, string> | undefined;\nif (process.env['NODE_ENV'] !== 'production') {\n gaboxErrorMessages = { [GABOX_ERROR__ARITHMETIC]: `Arithmetic overflow or inconsistent accounting`, [GABOX_ERROR__DRAW_ALREADY_SETTLED]: `The draw's outcome is already fixed`, [GABOX_ERROR__DRAW_EXPIRED]: `Delivery is closed for this draw; only expiry remains`, [GABOX_ERROR__DRAW_NOT_SETTLED]: `The draw's outcome is not fixed yet`, [GABOX_ERROR__INCORRECT_TOKEN_DELTA]: `Trade did not move the exact token amount`, [GABOX_ERROR__INSOLVENT_INVENTORY]: `Prize inventory does not cover reservations`, [GABOX_ERROR__INVALID_DISTRIBUTION]: `Invalid prize distribution`, [GABOX_ERROR__INVALID_LAUNCH]: `LaunchLab create instruction is malformed or missing before this instruction`, [GABOX_ERROR__INVALID_QUOTE]: `Quote mint or quote token program is unsupported`, [GABOX_ERROR__INVALID_VENUE]: `Incorrect trade program, account order, or token binding`, [GABOX_ERROR__JACKPOT_BELOW_ONE_PACK]: `The largest tier must pay at least one pack`, [GABOX_ERROR__NOT_EXPIRED]: `Oracle timeout has not elapsed`, [GABOX_ERROR__PACK_TOO_SMALL]: `A pack pays zero tokens on some tier`, [GABOX_ERROR__PRIZE_CAP_CHANGED]: `Top prize is below the signed minimum; refresh the offer`, [GABOX_ERROR__RETRY_TOO_SOON]: `Retry interval has not elapsed`, [GABOX_ERROR__RETRY_UNAVAILABLE]: `Retry limit reached or draw expired`, [GABOX_ERROR__SLIPPAGE_EXCEEDED]: `Spend exceeds the signed limit`, [GABOX_ERROR__TOO_MANY_PACKS]: `A purchase opens at most MAX_BATCH_SIZE packs`, [GABOX_ERROR__UNFUNDED_EXPECTATION]: `Expected token award exceeds tokens purchased`, [GABOX_ERROR__UNSUPPORTED_MINT]: `Mint must have 6 decimals and no mint or freeze authority`, [GABOX_ERROR__WALLET_ACTIVITY_MISMATCH]: `Wallet activity account belongs to a different wallet`, [GABOX_ERROR__WRONG_DESTINATION]: `The destination must be the purchaser's own account for this coin`, [GABOX_ERROR__WRONG_DRAW]: `The callback's sequence number does not match this draw`, [GABOX_ERROR__WRONG_TOKEN_ACCOUNT]: `Not the purchaser's coin account`, [GABOX_ERROR__ZERO_AMOUNT]: `Amount must be positive` };\n}\n\nexport function getGaboxErrorMessage(code: GaboxError): string {\n if (process.env['NODE_ENV'] !== 'production') {\n return (gaboxErrorMessages as Record<GaboxError, string>)[code];\n }\n\n return 'Error message not available in production bundles.';\n}\n\nexport function isGaboxError<TProgramErrorCode extends GaboxError>(\n error: unknown,\n transactionMessage: { instructions: Record<number, { programAddress: Address }> },\n code?: TProgramErrorCode,\n): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> & Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {\n return isProgramError<TProgramErrorCode>(error, transactionMessage, GABOX_PROGRAM_ADDRESS, code);\n}","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nexport * from './accounts';\nexport * from './errors';\nexport * from './events';\nexport * from './instructions';\nexport * from './pdas';\nexport * from './programs';\nexport * from './types';"],"mappings":";;;;;;;;;;;AAkBA,SAAgB,uBAAyD;CACrE,OAAO,iBAAiB,CAAC,CAAC,QAAQ,aAAa,CAAC,GAAG,CAAC,UAAU,cAAc,CAAC,CAAC,CAAC;AACnF;AAEA,SAAgB,uBAAqD;CACjE,OAAO,iBAAiB,CAAC,CAAC,QAAQ,aAAa,CAAC,GAAG,CAAC,UAAU,cAAc,CAAC,CAAC,CAAC;AACnF;AAEA,SAAgB,qBAAiE;CAC7E,OAAO,aAAa,qBAAqB,GAAG,qBAAqB,CAAC;AACtE;;;;;;;;;;ACdA,SAAgB,kBAA+C;CAC3D,OAAO,iBAAiB,CAAC,CAAC,UAAU,cAAc,CAAC,GAAG,CAAC,WAAW,cAAc,CAAC,CAAC,CAAC;AACvF;AAEA,SAAgB,kBAA2C;CACvD,OAAO,iBAAiB,CAAC,CAAC,UAAU,cAAc,CAAC,GAAG,CAAC,WAAW,cAAc,CAAC,CAAC,CAAC;AACvF;AAEA,SAAgB,gBAAkD;CAC9D,OAAO,aAAa,gBAAgB,GAAG,gBAAgB,CAAC;AAC5D;;;;;;;;;;ACbA,MAAa,oCAAwD,IAAI,WAAW;CAAC;CAAK;CAAK;CAAI;CAAK;CAAK;CAAI;CAAK;AAAG,CAAC;AAE1H,SAAgB,yCAA6D;CAAE,OAAO,eAAe,gBAAgB,GAAG,CAAC,CAAC,CAAC,OAAO,iCAAiC;AAAG;;AAiBtK,SAAgB,8BAA8D;CAC1E,OAAO,uBAAuB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;AAEhD,MAAa,iCAAiC;AAI9C,IAAI;AACJ,IAAI,QAAQ,IAAI,gBAAgB,cAC9B,qBAAqB;EAAG,0BAA0B;EAAmD,oCAAoC;EAAwC,4BAA4B;EAA0D,gCAAgC;EAAwC,qCAAqC;EAA8C,mCAAmC;EAAgD,oCAAoC;EAA+B,8BAA8B;EAAiF,6BAA6B;EAAqD,6BAA6B;EAA6D,sCAAsC;EAAgD,2BAA2B;EAAmC,8BAA8B;EAAyC,iCAAiC;EAA6D,8BAA8B;EAAmC,iCAAiC;EAAwC,iCAAiC;EAAmC,8BAA8B;EAAkD,oCAAoC;EAAkD,gCAAgC;EAA8D,wCAAwC;EAA0D,iCAAiC;EAAsE,0BAA0B;EAA4D,mCAAmC;EAAqC,2BAA2B;AAA0B;AAG5/D,SAAgB,qBAAqB,MAA0B;CAC7D,IAAI,QAAQ,IAAI,gBAAgB,cAC9B,OAAQ,mBAAkD;CAG5D,OAAO;AACT;AAEA,SAAgB,aACZ,OACA,oBACA,MACmI;CACrI,OAAO,eAAkC,OAAO,oBAAoB,uBAAuB,IAAI;AACjG"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DRAW_DISCRIMINATOR, Draw, DrawResolvedEvent, POOL_DISCRIMINATOR, PackBoughtEvent, Pool, PoolCreatedEvent, PrizesFundedEvent, RandomnessRetriedEvent, TokensSoldEvent, WALLET_ACTIVITY_DISCRIMINATOR, WalletActivity, decodeDraw, decodePool, decodeWalletActivity, findActivityPda, findDrawPda, findIdentityPda, findPoolPda, t as index_d_exports } from "./generated/index.js";
1
+ import { DRAW_DISCRIMINATOR, Draw, DrawResolvedEvent, POOL_DISCRIMINATOR, PacksBoughtEvent, Pool, PoolCreatedEvent, PrizeClaimedEvent, PrizesFundedEvent, RandomnessRetriedEvent, TokensSoldEvent, WALLET_ACTIVITY_DISCRIMINATOR, WalletActivity, decodeDraw, decodePool, decodeWalletActivity, findActivityPda, findDrawPda, findIdentityPda, findPoolPda, t as index_d_exports } from "./generated/index.js";
2
2
  import { Cr as createClient, Dr as RouteMode, Er as Route, Or as RouteProvider, Rn as ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Sr as clusterNamedBy, Tr as websocketUrlFor, _r as DEVNET_WS, br as GaboxRpcSubscriptions, ct as buildMessage, fr as WSOL_MINT, gr as DEVNET_HTTP, gt as VenueKind, hr as Cluster, ht as ResolvedVenue, lr as TOKEN_PROGRAM_ADDRESS, lt as withRemainingAccounts, mr as ClientConfig, nr as PLATFORM_ADMIN, ot as BuildOptions, pr as CLUSTER_ENDPOINTS, sr as SYSTEM_PROGRAM_ADDRESS, st as GaboxTransactionMessage, t as index_d_exports$1, tr as METAPLEX_PROGRAM_ADDRESS, vr as GaboxClient, wn as LAUNCH_DECIMALS, wr as defaultRoute, xr as assertClusterUrl, yr as GaboxRpc } from "./index-CQcBMEah.js";
3
3
  import { Address, AddressesByLookupTableAddress, Instruction, InstructionWithData, ProgramDerivedAddress, ReadonlyUint8Array, TransactionSigner } from "@solana/kit";
4
4
  //#region src/math.d.ts
@@ -29,6 +29,22 @@ export declare const MAX_MULTIPLIER_BPS = 200000;
29
29
  export declare const TICKETS = 65536;
30
30
  /** The prize table has exactly this many slots. Unused slots are all-zero. */
31
31
  export declare const TIERS = 8;
32
+ /**
33
+ * `constants::MAX_BATCH_SIZE`. The most packs one `buy_packs` call opens. A limit per purchase,
34
+ * not on pending packs: any number of buyers and overlapping purchases are fine, because every
35
+ * pending draw carries its own reservation.
36
+ */
37
+ export declare const MAX_BATCH_SIZE = 5;
38
+ /** One pack's outcome inside a settled batch: the tier it landed on and the tokens it pays. */
39
+ export type PackResult = {
40
+ tier: number;
41
+ amount: bigint;
42
+ };
43
+ /** What a batch pays: every pack's result in order, and their sum. */
44
+ export type Settlement = {
45
+ total: bigint;
46
+ results: PackResult[];
47
+ };
32
48
  /** One row of the immutable prize table. Counts, not cumulative thresholds. */
33
49
  export type Tier = {
34
50
  /** `floor(base * multiplierBps / 10_000)` tokens. `0` only on an unused row. */
@@ -57,8 +73,12 @@ export declare class GaboxMathError extends Error {
57
73
  * passes `validateTiers`. This is only the table the Gabox app creates its pools with, and the
58
74
  * starting point for a client that has no reason to pick another one.
59
75
  *
60
- * Common 75% at 0.52x, Rare 20% at 1.2x, Epic 4% at 3x, Mythic 1% at 20x. Expected payout is
61
- * 0.9499x of a pack, so the seed is 19 packs.
76
+ * Common 80% at 0.5126x, Rare 15% at 2x, Epic 4% at 3.5x, Mythic 1% at 10x. Expected payout is
77
+ * 0.9499x of a pack. The mandatory seed is 2 packs, because `seedTokens` stops at the 3x minimum.
78
+ *
79
+ * Every win at least doubles the pack. The top tier stops at 10x, half the program's cap, so one
80
+ * hit pays 1% of the supply instead of 2%, and the vault funds the full 10x after about 140 packs
81
+ * instead of 360.
62
82
  */
63
83
  export declare const DEFAULT_TIERS: readonly Readonly<Tier>[];
64
84
  /** `math::tokens`. Floor division, and an overflow past u64 is an error, not a wrap. */
@@ -126,6 +146,45 @@ export declare function quote(base: bigint, tiers: readonly Readonly<Tier>[], in
126
146
  * A ticket past the last row returns `0`, which cannot happen for a validated table.
127
147
  */
128
148
  export declare function choose(prizes: readonly Prize[], ticket: number): bigint;
149
+ /** `count` is a `u8` the program bounds at `MAX_BATCH_SIZE`. Zero is refused before any trade. */
150
+ export declare function checkedCount(count: number): number;
151
+ /**
152
+ * `math::uncapped`. Every tier's award for this base before any inventory cap, `0n` on an unused
153
+ * row. A ticketed tier that would pay nothing is refused, the same as in `quote`.
154
+ */
155
+ export declare function uncappedAmounts(base: bigint, tiers: readonly Readonly<Tier>[]): bigint[];
156
+ /** `math::min_tier`. The ticketed tier with the smallest award. Expiry pays it for every pack. */
157
+ export declare function minTier(uncapped: readonly bigint[], tiers: readonly Readonly<Tier>[]): number;
158
+ /**
159
+ * `math::choose_index`. Which tier a 16-bit ticket lands on: the rows are consecutive ranges in
160
+ * table order. Exactly 65,536 tickets, so there is no modulo and no bias.
161
+ */
162
+ export declare function chooseIndex(tiers: readonly Readonly<Tier>[], ticket: number): number;
163
+ /**
164
+ * `math::reserve_for`. What a purchase of `count` packs adds to `pool.reserved`:
165
+ * `min(count * uncappedMax, free + count * packTokens)`. Settlement in order can never pay more
166
+ * than either bound, so this is the least reservation that keeps the vault solvent whatever the
167
+ * outcomes. With `count = 1` it is exactly the single pack's capped maximum.
168
+ */
169
+ export declare function reserveFor(count: number, packTokens: bigint, uncappedMax: bigint, free: bigint): bigint;
170
+ /**
171
+ * `math::settle_with`. Settle a batch in order from explicit tickets.
172
+ *
173
+ * Pack k's table caps every tier at what the vault can pay after packs 1..k-1 paid out, counting
174
+ * the batch's own tokens as they arrive: pack 1 sees `freeSnapshot + packTokens`, and every later
175
+ * pack sees the remainder plus one more pack. So no pack can lose its own base to an earlier pack,
176
+ * and the total never exceeds `reserveFor(...)`.
177
+ *
178
+ * With `timedOut` every pack pays its smallest tier, and `tickets` is ignored.
179
+ */
180
+ export declare function settleWith(tiers: readonly Readonly<Tier>[], packTokens: bigint, freeSnapshot: bigint, count: number, tickets: readonly number[], timedOut?: boolean): Settlement;
181
+ /**
182
+ * The top prize each pack of a purchase can still win if every pack before it won its own top
183
+ * prize: the worst case for the later packs, which is what a buyer should see next to the first
184
+ * pack's table. `caps[0]` is the first pack's capped maximum; on a deep vault every entry is the
185
+ * uncapped jackpot, on a thin one the later entries fall towards one pack.
186
+ */
187
+ export declare function perPackCaps(tiers: readonly Readonly<Tier>[], packTokens: bigint, freeSnapshot: bigint, count: number): bigint[];
129
188
  /** `math::resolve_reservation`. Release the unwon part of a maximum, keep the award reserved. */
130
189
  export declare function resolveReservation(reserved: bigint, maximum: bigint, award: bigint): bigint;
131
190
  /** The largest `multiplierBps` on any ticketed row. `0` for a table with no rows. */
@@ -141,6 +200,12 @@ export declare function averageMultiplierBps(tiers: readonly Readonly<Tier>[]):
141
200
  //#region src/accounts.d.ts
142
201
  export declare const DRAW_POOL_OFFSET = 8;
143
202
  export declare const DRAW_PURCHASER_OFFSET: number;
203
+ /**
204
+ * The `settled` byte: after pool, purchaser, nonce, bump, seq_start, count, two slots, attempts,
205
+ * eight tiers, pack_tokens, free_snapshot and reserved. `test/surface.test.ts` pins it against the
206
+ * generated encoder.
207
+ */
208
+ export declare const DRAW_SETTLED_OFFSET: number;
144
209
  export declare const POOL_CREATOR_OFFSET = 8;
145
210
  export declare const POOL_MINT_OFFSET: number;
146
211
  export declare function fetchPoolByMint(client: GaboxClient, mint: Address): Promise<Pool | null>;
@@ -148,7 +213,7 @@ export declare function fetchPoolAt(client: GaboxClient, address: Address): Prom
148
213
  export declare function fetchDraw(client: GaboxClient, address: Address): Promise<Draw | null>;
149
214
  /**
150
215
  * A wallet's lifetime pack-buying activity, or `null` before it has bought its first pack.
151
- * `buy_pack` creates this account `init_if_needed`, so a fresh wallet has none yet.
216
+ * `buy_packs` creates this account `init_if_needed`, so a fresh wallet has none yet.
152
217
  */
153
218
  export declare function fetchWalletActivity(client: GaboxClient, wallet: Address): Promise<WalletActivity | null>;
154
219
  export type PoolRecord = {
@@ -167,6 +232,12 @@ export type DrawQuery = {
167
232
  export declare function listDraws(client: GaboxClient, query?: DrawQuery): Promise<DrawRecord[]>;
168
233
  export declare const listDrawsByPool: (client: GaboxClient, pool: Address) => Promise<DrawRecord[]>;
169
234
  export declare const listDrawsByPurchaser: (client: GaboxClient, purchaser: Address) => Promise<DrawRecord[]>;
235
+ /**
236
+ * A purchaser's draws that settled without paying: the callback could not use the purchaser's coin
237
+ * account, so the tokens wait in the vault as `owed` until `claimPrize` or `claimPrizeTo` pays
238
+ * them. A pending draw is not in this list, and a paid one no longer exists.
239
+ */
240
+ export declare function fetchOwedDraws(client: GaboxClient, purchaser: Address): Promise<DrawRecord[]>;
170
241
  export declare function fetchVaultBalance(client: GaboxClient, mint: Address): Promise<bigint>;
171
242
  export type PoolInventory = {
172
243
  poolAddress: Address;
@@ -196,8 +267,17 @@ export declare const CREATE_MACHINE_COMPUTE_UNITS = 350000;
196
267
  * Measured at `178,690`, `163,686` and `157,692` on the curve, and `113,891`, `110,922` and
197
268
  * `106,387` on CPMM. The curve buy is dearer because a coin's first trade also creates the platform
198
269
  * and creator fee vaults.
270
+ *
271
+ * One figure for every `count` from 1 to `MAX_BATCH_SIZE`: a purchase of five packs is still one
272
+ * trade, one draw and one request. The per-pack work runs in the oracle's callback, on the oracle's
273
+ * own budget. The devnet end-to-end test re-measures count 1 and 5.
199
274
  */
200
275
  export declare const BUY_PACK_COMPUTE_UNITS = 235000;
276
+ /**
277
+ * `claim_prize`: create the purchaser's ATA when it is missing, one transfer, close the draw. An
278
+ * estimate until the devnet run measures it; a caller may override it.
279
+ */
280
+ export declare const CLAIM_PRIZE_COMPUTE_UNITS = 80000;
201
281
  /**
202
282
  * A WSOL wrap, a venue sale, and the WSOL close. Measured at `94,246`, `86,745` and `88,246` on the
203
283
  * curve, and `61,545`, `55,576` and `57,046` on CPMM.
@@ -241,14 +321,17 @@ export type GaboxEvent = {
241
321
  name: 'PrizesFunded';
242
322
  data: PrizesFundedEvent;
243
323
  } | {
244
- name: 'PackBought';
245
- data: PackBoughtEvent;
324
+ name: 'PacksBought';
325
+ data: PacksBoughtEvent;
246
326
  } | {
247
327
  name: 'RandomnessRetried';
248
328
  data: RandomnessRetriedEvent;
249
329
  } | {
250
330
  name: 'DrawResolved';
251
331
  data: DrawResolvedEvent;
332
+ } | {
333
+ name: 'PrizeClaimed';
334
+ data: PrizeClaimedEvent;
252
335
  } | {
253
336
  name: 'TokensSold';
254
337
  data: TokensSoldEvent;
@@ -264,7 +347,10 @@ export declare function fetchEvents(client: GaboxClient, signature: string): Pro
264
347
  export type ResolvedDraw = DrawResolvedEvent & {
265
348
  address: Address;
266
349
  };
267
- /** Poll final resolution events for one closed draw address. There is no separate Ready/claim state to poll instead. */
350
+ /**
351
+ * The `DrawResolved` event of one draw, found through the draw address's own signature history.
352
+ * `paid` says whether the tokens reached the purchaser in the callback or wait for a claim.
353
+ */
268
354
  export declare function findResolvedDraw(client: GaboxClient, address: Address): Promise<ResolvedDraw | null>;
269
355
  //#endregion
270
356
  //#region src/ids.d.ts
@@ -285,7 +371,7 @@ export declare const INSTRUCTIONS_SYSVAR: Address;
285
371
  export declare const RETRY_SLOTS = 300n;
286
372
  /** `constants.rs`. After this many slots from the purchase, anyone may expire the draw. */
287
373
  export declare const TIMEOUT_SLOTS = 216000n;
288
- /** `constants.rs`. Three requests in total, counting the one `buy_pack` makes. */
374
+ /** `constants.rs`. Three requests in total, counting the one `buy_packs` makes. */
289
375
  export declare const MAX_ATTEMPTS = 3;
290
376
  /**
291
377
  * `constants.rs`. Tokens in one pack, in base units: 1,000,000 tokens at the fixed 6 decimals, or
@@ -324,7 +410,12 @@ export type PackOffer = {
324
410
  pool: Address;
325
411
  /** The fixed token count of one pack. Every prize is a multiple of this. */
326
412
  packTokens: bigint;
327
- /** What the venue charges for `packTokens` right now, its own fees included. The pack price. */
413
+ /** How many packs this offer prices, 1 to `MAX_BATCH_SIZE`. */
414
+ count: number;
415
+ /**
416
+ * What the venue charges for `count` packs right now, its own fees included. The whole purchase
417
+ * price, in the quote token.
418
+ */
328
419
  quoteAmount: bigint;
329
420
  /** The pool's quote asset. Both venues settle in it; there is no native-SOL path. */
330
421
  quoteMint: Address;
@@ -333,8 +424,8 @@ export type PackOffer = {
333
424
  /** The quote mint's symbol, from Metaplex or Token-2022 metadata. `null` when it has none. */
334
425
  quoteSymbol: string | null;
335
426
  /**
336
- * The same pack price in lamports, through the client's route provider. Equal to `quoteAmount` on
337
- * a WSOL pool, and `null` when no route can price it.
427
+ * The same purchase price in lamports, through the client's route provider. Equal to
428
+ * `quoteAmount` on a WSOL pool, and `null` when no route can price it.
338
429
  */
339
430
  solAmount: bigint | null;
340
431
  /** What the seed cost the creator at creation, in the quote token. Display only. */
@@ -343,21 +434,33 @@ export type PackOffer = {
343
434
  seedTokens: bigint;
344
435
  /** Which venue the buy would route to right now. */
345
436
  venue: VenueKind;
346
- /** The frozen prize table this pack would get: real amounts, already capped by inventory. */
437
+ /** The first pack's prize table: real amounts, already capped by inventory. */
347
438
  prizes: Prize[];
348
- /** The top prize, after the cap. Sign `minMaximum` just below this. */
439
+ /** The first pack's top prize, after the cap. Sign `minFirstMaximum` just below this. */
349
440
  maximum: bigint;
350
- /** The smallest prize. Also what a timed-out draw pays. */
441
+ /** The first pack's smallest prize. Also what a timed-out pack pays. */
351
442
  minimum: bigint;
352
443
  /**
353
444
  * The top prize with no inventory cap: the jackpot in tokens. Equal to `maximum` unless the
354
445
  * inventory cap bites.
355
446
  */
356
447
  uncapped: bigint;
448
+ /**
449
+ * The top prize each pack can still win if every pack before it won its own top prize. One
450
+ * entry per pack; `perPackCaps[0]` equals `maximum`.
451
+ */
452
+ perPackCaps: bigint[];
453
+ /**
454
+ * What this purchase would add to `pool.reserved`:
455
+ * `min(count * uncapped, free + count * packTokens)`.
456
+ */
457
+ batchReserved: bigint;
357
458
  /** Vault balance, `pool.reserved`, and the difference. */
358
459
  inventory: bigint;
359
460
  reserved: bigint;
360
461
  free: bigint;
462
+ /** The same as `free`: the `Draw.freeSnapshot` this purchase would record. */
463
+ freeSnapshot: bigint;
361
464
  /** `pool.nextSeq === 0`. No pack has been sold yet. */
362
465
  isFirstPack: boolean;
363
466
  /**
@@ -373,6 +476,8 @@ export type PackOffer = {
373
476
  averageMultiplierBps: number;
374
477
  };
375
478
  export type GetOfferOptions = {
479
+ /** How many packs to price. Defaults to one. */
480
+ count?: number;
376
481
  /** Force a venue instead of reading the LaunchLab pool's `status`. */
377
482
  venue?: VenueKind;
378
483
  /** The buyer, when you already know it. Only changes the account list, never the numbers. */
@@ -383,7 +488,7 @@ export type GetOfferOptions = {
383
488
  * quote mint and its metadata. A non-SOL pool adds one HTTP call to the route provider for
384
489
  * `solAmount`.
385
490
  *
386
- * Throws when the coin has no pool.
491
+ * Throws when the coin has no pool, or when the curve has fewer whole packs left than `count`.
387
492
  */
388
493
  export declare function getOffer(client: GaboxClient, mint: Address, options?: GetOfferOptions): Promise<PackOffer>;
389
494
  /** The three display fields `getOffer` reads separately from the price. */
@@ -395,12 +500,12 @@ export type QuoteDisplayFields = {
395
500
  /**
396
501
  * The same computation with the reads already done. Useful when a caller holds a `ResolvedVenue`
397
502
  * and wants to re-price without touching the network. `quoteAmount` is
398
- * `venue.quoteBuy(pool.packTokens)`.
503
+ * `venue.quoteBuy(pool.packTokens * count)`.
399
504
  *
400
505
  * `display` is optional: a caller that only wants the prize numbers can leave it out, and the three
401
506
  * display fields then report the quote's own base units with no symbol and no SOL price.
402
507
  */
403
- export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint, display?: QuoteDisplayFields): PackOffer;
508
+ export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint, display?: QuoteDisplayFields, count?: number): PackOffer;
404
509
  /**
405
510
  * How short of the top prize a pool is, in tokens. `0` when it pays the whole table.
406
511
  *
@@ -413,9 +518,20 @@ export declare function seedShortfall(offer: PackOffer): bigint;
413
518
  //#region src/pdas.d.ts
414
519
  /** `["pool", mint]`. One pool per coin. */
415
520
  export declare const poolAddress: (mint: Address) => Promise<Address>;
416
- /** `["draw", pool, seq]`, with the sequence as eight little-endian bytes. */
417
- export declare const drawAddress: (pool: Address, seq: bigint) => Promise<Address>;
418
- /** The per-wallet `WalletActivity` PDA. `buy_pack` derives it from the purchaser automatically. */
521
+ /**
522
+ * `["draw", pool, purchaser, nonce]`, with the nonce as eight little-endian bytes. The buyer's
523
+ * client picks the nonce, so two buyers, or two purchases of one buyer, never name the same draw.
524
+ * The pool's sequence counter is not in the address any more; the program assigns `seqStart`
525
+ * when the purchase executes.
526
+ */
527
+ export declare const drawAddress: (pool: Address, purchaser: Address, nonce: bigint) => Promise<Address>;
528
+ /**
529
+ * A random `u64` nonce for one purchase. `buyPacks` draws one per build. A nonce that is still in
530
+ * use fails the purchase at the program; one whose draw already closed names a new draw, so a
531
+ * rebuilt transaction must never reuse the nonce of a purchase that may have landed.
532
+ */
533
+ export declare function randomNonce(): bigint;
534
+ /** The per-wallet `WalletActivity` PDA. `buy_packs` derives it from the purchaser automatically. */
419
535
  export declare const activityAddress: (wallet: Address) => Promise<Address>;
420
536
  /** `["identity"]` under Gabox. The PDA the program signs its randomness request with. */
421
537
  export declare const vrfIdentityAddress: () => Promise<Address>;
@@ -574,6 +690,32 @@ export declare function assertRouteIsSafe(route: Route, expect: {
574
690
  */
575
691
  export declare function solPriceOf(client: GaboxClient, quoteMint: Address, amount: bigint): Promise<bigint | null>;
576
692
  //#endregion
693
+ //#region src/settle.d.ts
694
+ /** `math::ticket`. Pack `k`'s 16-bit ticket for this pool and purchase. */
695
+ export declare function ticketFor(randomness: Uint8Array | ReadonlyUint8Array, pool: Address, seqStart: bigint, k: number): Promise<number>;
696
+ export type SettleInput = {
697
+ /** The pool's tier table, as the draw snapshotted it. */
698
+ tiers: readonly Readonly<Tier>[];
699
+ packTokens: bigint;
700
+ /** `vault - reserved` at purchase, before the batch's own tokens. */
701
+ freeSnapshot: bigint;
702
+ count: number;
703
+ pool: Address;
704
+ seqStart: bigint;
705
+ randomness: Uint8Array | ReadonlyUint8Array;
706
+ /** An expired draw pays every pack its smallest tier; the randomness is then all zero. */
707
+ timedOut?: boolean;
708
+ };
709
+ /** `math::settle`. What the callback paid, or owed, for this purchase. */
710
+ export declare function settle(input: SettleInput): Promise<Settlement>;
711
+ /**
712
+ * The settlement of a draw that is still on chain: settled but not yet claimed. The account alone
713
+ * carries everything, so this needs no event and no indexer. `total` equals `draw.owed`.
714
+ *
715
+ * A pending draw (`settled === false`) has no randomness yet; this throws for it.
716
+ */
717
+ export declare function settleDraw(draw: Draw): Promise<Settlement>;
718
+ //#endregion
577
719
  //#region src/tx/quoteLeg.d.ts
578
720
  /** Where the money for a purchase comes from. */
579
721
  export type PayWith = 'sol' | 'quote';
@@ -662,18 +804,22 @@ export declare function computeUnitsWithRoute(own: number, leg: QuoteLeg): numbe
662
804
  */
663
805
  export declare function routeSizeHint(cause: unknown, leg: QuoteLeg): unknown;
664
806
  //#endregion
665
- //#region src/tx/buyPack.d.ts
666
- export type BuyPackInput = {
807
+ //#region src/tx/buyPacks.d.ts
808
+ export type BuyPacksInput = {
667
809
  mint: Address;
668
810
  purchaser: TransactionSigner;
811
+ /** How many packs, 1 to `MAX_BATCH_SIZE`. */
812
+ count: number;
813
+ /** The draw's nonce. Left out, a random one is drawn. */
814
+ nonce?: bigint;
669
815
  /**
670
- * The venue slippage cap, in the pool's quote token. The transaction puts this much of the quote
671
- * token in the buyer's quote account before the buy, so it must cover the real price. Anything
672
- * left over stays there, or comes back as SOL on a WSOL pool.
816
+ * The venue slippage cap for the whole batch, in the pool's quote token. The transaction puts
817
+ * this much of the quote token in the buyer's quote account before the buy, so it must cover the
818
+ * real price. Anything left over stays there, or comes back as SOL on a WSOL pool.
673
819
  */
674
820
  maxQuoteIn: bigint;
675
- /** The floor on the top prize this pack may win. Refresh the offer if it fails. */
676
- minMaximum: bigint;
821
+ /** The floor on the first pack's top prize. Refresh the offer if it fails. */
822
+ minFirstMaximum: bigint;
677
823
  /** Caps every lamport the handler sees: venue account rent and the VRF request. */
678
824
  maxNativeDebit: bigint;
679
825
  /**
@@ -683,10 +829,26 @@ export type BuyPackInput = {
683
829
  payWith?: PayWith;
684
830
  /** Force a venue instead of reading the LaunchLab pool's `status`. */
685
831
  venue?: VenueKind;
686
- /** Pin `pool.nextSeq` to make a rebuild fail rather than buy a second pack. */
687
- seq?: bigint;
688
832
  } & Partial<BuildOptions>;
689
- export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promise<GaboxTransactionMessage>;
833
+ export type BuyPacksResult = {
834
+ message: GaboxTransactionMessage;
835
+ /** The draw this purchase opens. Watch it with `fetchDraw` and `findResolvedDraw`. */
836
+ draw: Address;
837
+ nonce: bigint;
838
+ /**
839
+ * `pool.nextSeq` when the message was built. The program assigns the real `seqStart` when the
840
+ * purchase executes, so another buyer landing first moves it; read it from `PacksBought`.
841
+ */
842
+ seqStart: bigint;
843
+ count: number;
844
+ };
845
+ export declare function buyPacks(client: GaboxClient, input: BuyPacksInput): Promise<BuyPacksResult>;
846
+ export type BuyPackInput = Omit<BuyPacksInput, 'count' | 'minFirstMaximum'> & {
847
+ /** The floor on the top prize this pack may win. Refresh the offer if it fails. */
848
+ minMaximum: bigint;
849
+ };
850
+ /** One pack: `buyPacks` with `count: 1`. Same result shape, so the draw address is known. */
851
+ export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promise<BuyPacksResult>;
690
852
  //#endregion
691
853
  //#region src/tx/createMachine.d.ts
692
854
  /** Which quote asset a new machine is priced in. Defaults to wrapped SOL. */
@@ -798,20 +960,49 @@ export type RetryDrawInput = {
798
960
  draw: Address;
799
961
  maxVrfDebit: bigint;
800
962
  } & Partial<BuildOptions>;
963
+ /** Another randomness request for a draw whose earlier attempts have not landed. Any signer. */
801
964
  export declare function retryDraw(client: GaboxClient, input: RetryDrawInput): Promise<GaboxTransactionMessage>;
802
965
  export type ExpireDrawInput = {
803
966
  payer: TransactionSigner;
804
967
  pool: Address;
805
968
  draw: Address;
806
969
  } & Partial<BuildOptions>;
970
+ /**
971
+ * Fix a timed-out purchase at every pack's smallest tier, from `TIMEOUT_SLOTS` after the purchase.
972
+ * Any signer. The purchaser's ATA address is passed whether or not the account exists: the program
973
+ * pays it if it can and owes the total otherwise.
974
+ */
807
975
  export declare function expireDraw(client: GaboxClient, input: ExpireDrawInput): Promise<GaboxTransactionMessage>;
976
+ export type ClaimPrizeInput = {
977
+ /** Any signer. Pays the transaction and, when the purchaser's ATA is missing, its rent. */
978
+ payer: TransactionSigner;
979
+ draw: Address;
980
+ } & Partial<BuildOptions>;
981
+ /** Pay an owed prize to the purchaser's coin ATA, creating it if needed. Permissionless. */
982
+ export declare function claimPrize(client: GaboxClient, input: ClaimPrizeInput): Promise<GaboxTransactionMessage>;
983
+ export type ClaimPrizeToInput = {
984
+ /** The draw's purchaser. Nobody else can redirect a prize. */
985
+ purchaser: TransactionSigner;
986
+ draw: Address;
987
+ /** Any existing classic token account for the coin that the purchaser owns. Nothing is created. */
988
+ destination: Address;
989
+ } & Partial<BuildOptions>;
990
+ /** The purchaser pays their own owed prize to a coin account they name. */
991
+ export declare function claimPrizeTo(client: GaboxClient, input: ClaimPrizeToInput): Promise<GaboxTransactionMessage>;
808
992
  export type DrawAvailability = {
809
993
  attempts: number;
994
+ /** True once the callback or an expiry fixed the outcome. `owed` is then what a claim pays. */
995
+ settled: boolean;
996
+ owed: bigint;
810
997
  slotsUntilRetry: bigint;
811
998
  slotsUntilExpiry: bigint;
999
+ /** The oracle's callback is still accepted: pending, and before the deadline. */
1000
+ canDeliver: boolean;
812
1001
  canRetry: boolean;
813
1002
  canExpire: boolean;
1003
+ canClaim: boolean;
814
1004
  };
1005
+ /** What can still happen to a draw, or `null` when it is closed. */
815
1006
  export declare function drawAvailability(client: GaboxClient, address: Address): Promise<DrawAvailability | null>;
816
1007
  //#endregion
817
1008
  //#region src/tx/fundPrizes.d.ts
@@ -874,5 +1065,5 @@ export type OracleAccounts = {
874
1065
  */
875
1066
  export declare function oracleAccounts(): Promise<OracleAccounts>;
876
1067
  //#endregion
877
- export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, BuildOptions, CLUSTER_ENDPOINTS, ClientConfig, Cluster, DEVNET_HTTP, DEVNET_WS, DRAW_DISCRIMINATOR, type Draw, GaboxClient, GaboxRpc, GaboxRpcSubscriptions, GaboxTransactionMessage, LAUNCH_DECIMALS, METAPLEX_PROGRAM_ADDRESS, PLATFORM_ADMIN, POOL_DISCRIMINATOR, type Pool, Route, RouteMode, RouteProvider, SYSTEM_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, WALLET_ACTIVITY_DISCRIMINATOR, WSOL_MINT, type WalletActivity, assertClusterUrl, buildMessage, clusterNamedBy, createClient, decodeDraw, decodePool, decodeWalletActivity, defaultRoute, findActivityPda, findDrawPda, findIdentityPda, findPoolPda, index_d_exports as generated, index_d_exports$1 as raydium, websocketUrlFor, withRemainingAccounts };
1068
+ export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, BuildOptions, CLUSTER_ENDPOINTS, ClientConfig, Cluster, DEVNET_HTTP, DEVNET_WS, DRAW_DISCRIMINATOR, type Draw, type DrawResolvedEvent, GaboxClient, GaboxRpc, GaboxRpcSubscriptions, GaboxTransactionMessage, LAUNCH_DECIMALS, METAPLEX_PROGRAM_ADDRESS, PLATFORM_ADMIN, POOL_DISCRIMINATOR, type PacksBoughtEvent, type Pool, type PoolCreatedEvent, type PrizeClaimedEvent, type PrizesFundedEvent, type RandomnessRetriedEvent, Route, RouteMode, RouteProvider, SYSTEM_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, type TokensSoldEvent, WALLET_ACTIVITY_DISCRIMINATOR, WSOL_MINT, type WalletActivity, assertClusterUrl, buildMessage, clusterNamedBy, createClient, decodeDraw, decodePool, decodeWalletActivity, defaultRoute, findActivityPda, findDrawPda, findIdentityPda, findPoolPda, index_d_exports as generated, index_d_exports$1 as raydium, websocketUrlFor, withRemainingAccounts };
878
1069
  //# sourceMappingURL=index.d.ts.map