@gabox-labs/sdk 0.8.0 → 0.9.0
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.
- package/CHANGELOG.md +39 -0
- package/README.md +63 -22
- package/dist/{gabox-DGTCh34U.js → gabox-CuyJYmrS.js} +669 -309
- package/dist/gabox-CuyJYmrS.js.map +1 -0
- package/dist/generated/index.d.ts +458 -92
- package/dist/generated/index.js +214 -54
- package/dist/generated/index.js.map +1 -1
- package/dist/index.d.ts +216 -29
- package/dist/index.js +182 -40
- package/dist/index.js.map +1 -1
- package/dist/raydium/index.js +1 -1
- package/dist/{raydium-DIF1WOvI.js → raydium-DXUJ-g1p.js} +219 -45
- package/dist/raydium-DXUJ-g1p.js.map +1 -0
- package/llms.txt +4 -0
- package/package.json +1 -1
- package/skills/gabox-sdk/SKILL.md +21 -13
- package/skills/gabox-sdk/references/api.md +42 -18
- package/dist/gabox-DGTCh34U.js.map +0 -1
- package/dist/raydium-DIF1WOvI.js.map +0 -1
|
@@ -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;A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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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index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DRAW_DISCRIMINATOR, Draw, DrawResolvedEvent, POOL_DISCRIMINATOR,
|
|
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. */
|
|
@@ -126,6 +142,45 @@ export declare function quote(base: bigint, tiers: readonly Readonly<Tier>[], in
|
|
|
126
142
|
* A ticket past the last row returns `0`, which cannot happen for a validated table.
|
|
127
143
|
*/
|
|
128
144
|
export declare function choose(prizes: readonly Prize[], ticket: number): bigint;
|
|
145
|
+
/** `count` is a `u8` the program bounds at `MAX_BATCH_SIZE`. Zero is refused before any trade. */
|
|
146
|
+
export declare function checkedCount(count: number): number;
|
|
147
|
+
/**
|
|
148
|
+
* `math::uncapped`. Every tier's award for this base before any inventory cap, `0n` on an unused
|
|
149
|
+
* row. A ticketed tier that would pay nothing is refused, the same as in `quote`.
|
|
150
|
+
*/
|
|
151
|
+
export declare function uncappedAmounts(base: bigint, tiers: readonly Readonly<Tier>[]): bigint[];
|
|
152
|
+
/** `math::min_tier`. The ticketed tier with the smallest award. Expiry pays it for every pack. */
|
|
153
|
+
export declare function minTier(uncapped: readonly bigint[], tiers: readonly Readonly<Tier>[]): number;
|
|
154
|
+
/**
|
|
155
|
+
* `math::choose_index`. Which tier a 16-bit ticket lands on: the rows are consecutive ranges in
|
|
156
|
+
* table order. Exactly 65,536 tickets, so there is no modulo and no bias.
|
|
157
|
+
*/
|
|
158
|
+
export declare function chooseIndex(tiers: readonly Readonly<Tier>[], ticket: number): number;
|
|
159
|
+
/**
|
|
160
|
+
* `math::reserve_for`. What a purchase of `count` packs adds to `pool.reserved`:
|
|
161
|
+
* `min(count * uncappedMax, free + count * packTokens)`. Settlement in order can never pay more
|
|
162
|
+
* than either bound, so this is the least reservation that keeps the vault solvent whatever the
|
|
163
|
+
* outcomes. With `count = 1` it is exactly the single pack's capped maximum.
|
|
164
|
+
*/
|
|
165
|
+
export declare function reserveFor(count: number, packTokens: bigint, uncappedMax: bigint, free: bigint): bigint;
|
|
166
|
+
/**
|
|
167
|
+
* `math::settle_with`. Settle a batch in order from explicit tickets.
|
|
168
|
+
*
|
|
169
|
+
* Pack k's table caps every tier at what the vault can pay after packs 1..k-1 paid out, counting
|
|
170
|
+
* the batch's own tokens as they arrive: pack 1 sees `freeSnapshot + packTokens`, and every later
|
|
171
|
+
* pack sees the remainder plus one more pack. So no pack can lose its own base to an earlier pack,
|
|
172
|
+
* and the total never exceeds `reserveFor(...)`.
|
|
173
|
+
*
|
|
174
|
+
* With `timedOut` every pack pays its smallest tier, and `tickets` is ignored.
|
|
175
|
+
*/
|
|
176
|
+
export declare function settleWith(tiers: readonly Readonly<Tier>[], packTokens: bigint, freeSnapshot: bigint, count: number, tickets: readonly number[], timedOut?: boolean): Settlement;
|
|
177
|
+
/**
|
|
178
|
+
* The top prize each pack of a purchase can still win if every pack before it won its own top
|
|
179
|
+
* prize: the worst case for the later packs, which is what a buyer should see next to the first
|
|
180
|
+
* pack's table. `caps[0]` is the first pack's capped maximum; on a deep vault every entry is the
|
|
181
|
+
* uncapped jackpot, on a thin one the later entries fall towards one pack.
|
|
182
|
+
*/
|
|
183
|
+
export declare function perPackCaps(tiers: readonly Readonly<Tier>[], packTokens: bigint, freeSnapshot: bigint, count: number): bigint[];
|
|
129
184
|
/** `math::resolve_reservation`. Release the unwon part of a maximum, keep the award reserved. */
|
|
130
185
|
export declare function resolveReservation(reserved: bigint, maximum: bigint, award: bigint): bigint;
|
|
131
186
|
/** The largest `multiplierBps` on any ticketed row. `0` for a table with no rows. */
|
|
@@ -141,6 +196,12 @@ export declare function averageMultiplierBps(tiers: readonly Readonly<Tier>[]):
|
|
|
141
196
|
//#region src/accounts.d.ts
|
|
142
197
|
export declare const DRAW_POOL_OFFSET = 8;
|
|
143
198
|
export declare const DRAW_PURCHASER_OFFSET: number;
|
|
199
|
+
/**
|
|
200
|
+
* The `settled` byte: after pool, purchaser, nonce, bump, seq_start, count, two slots, attempts,
|
|
201
|
+
* eight tiers, pack_tokens, free_snapshot and reserved. `test/surface.test.ts` pins it against the
|
|
202
|
+
* generated encoder.
|
|
203
|
+
*/
|
|
204
|
+
export declare const DRAW_SETTLED_OFFSET: number;
|
|
144
205
|
export declare const POOL_CREATOR_OFFSET = 8;
|
|
145
206
|
export declare const POOL_MINT_OFFSET: number;
|
|
146
207
|
export declare function fetchPoolByMint(client: GaboxClient, mint: Address): Promise<Pool | null>;
|
|
@@ -148,7 +209,7 @@ export declare function fetchPoolAt(client: GaboxClient, address: Address): Prom
|
|
|
148
209
|
export declare function fetchDraw(client: GaboxClient, address: Address): Promise<Draw | null>;
|
|
149
210
|
/**
|
|
150
211
|
* A wallet's lifetime pack-buying activity, or `null` before it has bought its first pack.
|
|
151
|
-
* `
|
|
212
|
+
* `buy_packs` creates this account `init_if_needed`, so a fresh wallet has none yet.
|
|
152
213
|
*/
|
|
153
214
|
export declare function fetchWalletActivity(client: GaboxClient, wallet: Address): Promise<WalletActivity | null>;
|
|
154
215
|
export type PoolRecord = {
|
|
@@ -167,6 +228,12 @@ export type DrawQuery = {
|
|
|
167
228
|
export declare function listDraws(client: GaboxClient, query?: DrawQuery): Promise<DrawRecord[]>;
|
|
168
229
|
export declare const listDrawsByPool: (client: GaboxClient, pool: Address) => Promise<DrawRecord[]>;
|
|
169
230
|
export declare const listDrawsByPurchaser: (client: GaboxClient, purchaser: Address) => Promise<DrawRecord[]>;
|
|
231
|
+
/**
|
|
232
|
+
* A purchaser's draws that settled without paying: the callback could not use the purchaser's coin
|
|
233
|
+
* account, so the tokens wait in the vault as `owed` until `claimPrize` or `claimPrizeTo` pays
|
|
234
|
+
* them. A pending draw is not in this list, and a paid one no longer exists.
|
|
235
|
+
*/
|
|
236
|
+
export declare function fetchOwedDraws(client: GaboxClient, purchaser: Address): Promise<DrawRecord[]>;
|
|
170
237
|
export declare function fetchVaultBalance(client: GaboxClient, mint: Address): Promise<bigint>;
|
|
171
238
|
export type PoolInventory = {
|
|
172
239
|
poolAddress: Address;
|
|
@@ -196,8 +263,17 @@ export declare const CREATE_MACHINE_COMPUTE_UNITS = 350000;
|
|
|
196
263
|
* Measured at `178,690`, `163,686` and `157,692` on the curve, and `113,891`, `110,922` and
|
|
197
264
|
* `106,387` on CPMM. The curve buy is dearer because a coin's first trade also creates the platform
|
|
198
265
|
* and creator fee vaults.
|
|
266
|
+
*
|
|
267
|
+
* One figure for every `count` from 1 to `MAX_BATCH_SIZE`: a purchase of five packs is still one
|
|
268
|
+
* trade, one draw and one request. The per-pack work runs in the oracle's callback, on the oracle's
|
|
269
|
+
* own budget. The devnet end-to-end test re-measures count 1 and 5.
|
|
199
270
|
*/
|
|
200
271
|
export declare const BUY_PACK_COMPUTE_UNITS = 235000;
|
|
272
|
+
/**
|
|
273
|
+
* `claim_prize`: create the purchaser's ATA when it is missing, one transfer, close the draw. An
|
|
274
|
+
* estimate until the devnet run measures it; a caller may override it.
|
|
275
|
+
*/
|
|
276
|
+
export declare const CLAIM_PRIZE_COMPUTE_UNITS = 80000;
|
|
201
277
|
/**
|
|
202
278
|
* A WSOL wrap, a venue sale, and the WSOL close. Measured at `94,246`, `86,745` and `88,246` on the
|
|
203
279
|
* curve, and `61,545`, `55,576` and `57,046` on CPMM.
|
|
@@ -241,14 +317,17 @@ export type GaboxEvent = {
|
|
|
241
317
|
name: 'PrizesFunded';
|
|
242
318
|
data: PrizesFundedEvent;
|
|
243
319
|
} | {
|
|
244
|
-
name: '
|
|
245
|
-
data:
|
|
320
|
+
name: 'PacksBought';
|
|
321
|
+
data: PacksBoughtEvent;
|
|
246
322
|
} | {
|
|
247
323
|
name: 'RandomnessRetried';
|
|
248
324
|
data: RandomnessRetriedEvent;
|
|
249
325
|
} | {
|
|
250
326
|
name: 'DrawResolved';
|
|
251
327
|
data: DrawResolvedEvent;
|
|
328
|
+
} | {
|
|
329
|
+
name: 'PrizeClaimed';
|
|
330
|
+
data: PrizeClaimedEvent;
|
|
252
331
|
} | {
|
|
253
332
|
name: 'TokensSold';
|
|
254
333
|
data: TokensSoldEvent;
|
|
@@ -264,7 +343,10 @@ export declare function fetchEvents(client: GaboxClient, signature: string): Pro
|
|
|
264
343
|
export type ResolvedDraw = DrawResolvedEvent & {
|
|
265
344
|
address: Address;
|
|
266
345
|
};
|
|
267
|
-
/**
|
|
346
|
+
/**
|
|
347
|
+
* The `DrawResolved` event of one draw, found through the draw address's own signature history.
|
|
348
|
+
* `paid` says whether the tokens reached the purchaser in the callback or wait for a claim.
|
|
349
|
+
*/
|
|
268
350
|
export declare function findResolvedDraw(client: GaboxClient, address: Address): Promise<ResolvedDraw | null>;
|
|
269
351
|
//#endregion
|
|
270
352
|
//#region src/ids.d.ts
|
|
@@ -285,7 +367,7 @@ export declare const INSTRUCTIONS_SYSVAR: Address;
|
|
|
285
367
|
export declare const RETRY_SLOTS = 300n;
|
|
286
368
|
/** `constants.rs`. After this many slots from the purchase, anyone may expire the draw. */
|
|
287
369
|
export declare const TIMEOUT_SLOTS = 216000n;
|
|
288
|
-
/** `constants.rs`. Three requests in total, counting the one `
|
|
370
|
+
/** `constants.rs`. Three requests in total, counting the one `buy_packs` makes. */
|
|
289
371
|
export declare const MAX_ATTEMPTS = 3;
|
|
290
372
|
/**
|
|
291
373
|
* `constants.rs`. Tokens in one pack, in base units: 1,000,000 tokens at the fixed 6 decimals, or
|
|
@@ -324,7 +406,12 @@ export type PackOffer = {
|
|
|
324
406
|
pool: Address;
|
|
325
407
|
/** The fixed token count of one pack. Every prize is a multiple of this. */
|
|
326
408
|
packTokens: bigint;
|
|
327
|
-
/**
|
|
409
|
+
/** How many packs this offer prices, 1 to `MAX_BATCH_SIZE`. */
|
|
410
|
+
count: number;
|
|
411
|
+
/**
|
|
412
|
+
* What the venue charges for `count` packs right now, its own fees included. The whole purchase
|
|
413
|
+
* price, in the quote token.
|
|
414
|
+
*/
|
|
328
415
|
quoteAmount: bigint;
|
|
329
416
|
/** The pool's quote asset. Both venues settle in it; there is no native-SOL path. */
|
|
330
417
|
quoteMint: Address;
|
|
@@ -333,8 +420,8 @@ export type PackOffer = {
|
|
|
333
420
|
/** The quote mint's symbol, from Metaplex or Token-2022 metadata. `null` when it has none. */
|
|
334
421
|
quoteSymbol: string | null;
|
|
335
422
|
/**
|
|
336
|
-
* The same
|
|
337
|
-
* a WSOL pool, and `null` when no route can price it.
|
|
423
|
+
* The same purchase price in lamports, through the client's route provider. Equal to
|
|
424
|
+
* `quoteAmount` on a WSOL pool, and `null` when no route can price it.
|
|
338
425
|
*/
|
|
339
426
|
solAmount: bigint | null;
|
|
340
427
|
/** What the seed cost the creator at creation, in the quote token. Display only. */
|
|
@@ -343,21 +430,33 @@ export type PackOffer = {
|
|
|
343
430
|
seedTokens: bigint;
|
|
344
431
|
/** Which venue the buy would route to right now. */
|
|
345
432
|
venue: VenueKind;
|
|
346
|
-
/** The
|
|
433
|
+
/** The first pack's prize table: real amounts, already capped by inventory. */
|
|
347
434
|
prizes: Prize[];
|
|
348
|
-
/** The top prize, after the cap. Sign `
|
|
435
|
+
/** The first pack's top prize, after the cap. Sign `minFirstMaximum` just below this. */
|
|
349
436
|
maximum: bigint;
|
|
350
|
-
/** The smallest prize. Also what a timed-out
|
|
437
|
+
/** The first pack's smallest prize. Also what a timed-out pack pays. */
|
|
351
438
|
minimum: bigint;
|
|
352
439
|
/**
|
|
353
440
|
* The top prize with no inventory cap: the jackpot in tokens. Equal to `maximum` unless the
|
|
354
441
|
* inventory cap bites.
|
|
355
442
|
*/
|
|
356
443
|
uncapped: bigint;
|
|
444
|
+
/**
|
|
445
|
+
* The top prize each pack can still win if every pack before it won its own top prize. One
|
|
446
|
+
* entry per pack; `perPackCaps[0]` equals `maximum`.
|
|
447
|
+
*/
|
|
448
|
+
perPackCaps: bigint[];
|
|
449
|
+
/**
|
|
450
|
+
* What this purchase would add to `pool.reserved`:
|
|
451
|
+
* `min(count * uncapped, free + count * packTokens)`.
|
|
452
|
+
*/
|
|
453
|
+
batchReserved: bigint;
|
|
357
454
|
/** Vault balance, `pool.reserved`, and the difference. */
|
|
358
455
|
inventory: bigint;
|
|
359
456
|
reserved: bigint;
|
|
360
457
|
free: bigint;
|
|
458
|
+
/** The same as `free`: the `Draw.freeSnapshot` this purchase would record. */
|
|
459
|
+
freeSnapshot: bigint;
|
|
361
460
|
/** `pool.nextSeq === 0`. No pack has been sold yet. */
|
|
362
461
|
isFirstPack: boolean;
|
|
363
462
|
/**
|
|
@@ -373,6 +472,8 @@ export type PackOffer = {
|
|
|
373
472
|
averageMultiplierBps: number;
|
|
374
473
|
};
|
|
375
474
|
export type GetOfferOptions = {
|
|
475
|
+
/** How many packs to price. Defaults to one. */
|
|
476
|
+
count?: number;
|
|
376
477
|
/** Force a venue instead of reading the LaunchLab pool's `status`. */
|
|
377
478
|
venue?: VenueKind;
|
|
378
479
|
/** The buyer, when you already know it. Only changes the account list, never the numbers. */
|
|
@@ -383,7 +484,7 @@ export type GetOfferOptions = {
|
|
|
383
484
|
* quote mint and its metadata. A non-SOL pool adds one HTTP call to the route provider for
|
|
384
485
|
* `solAmount`.
|
|
385
486
|
*
|
|
386
|
-
* Throws when the coin has no pool
|
|
487
|
+
* Throws when the coin has no pool, or when the curve has fewer whole packs left than `count`.
|
|
387
488
|
*/
|
|
388
489
|
export declare function getOffer(client: GaboxClient, mint: Address, options?: GetOfferOptions): Promise<PackOffer>;
|
|
389
490
|
/** The three display fields `getOffer` reads separately from the price. */
|
|
@@ -395,12 +496,12 @@ export type QuoteDisplayFields = {
|
|
|
395
496
|
/**
|
|
396
497
|
* The same computation with the reads already done. Useful when a caller holds a `ResolvedVenue`
|
|
397
498
|
* and wants to re-price without touching the network. `quoteAmount` is
|
|
398
|
-
* `venue.quoteBuy(pool.packTokens)`.
|
|
499
|
+
* `venue.quoteBuy(pool.packTokens * count)`.
|
|
399
500
|
*
|
|
400
501
|
* `display` is optional: a caller that only wants the prize numbers can leave it out, and the three
|
|
401
502
|
* display fields then report the quote's own base units with no symbol and no SOL price.
|
|
402
503
|
*/
|
|
403
|
-
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint, display?: QuoteDisplayFields): PackOffer;
|
|
504
|
+
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint, display?: QuoteDisplayFields, count?: number): PackOffer;
|
|
404
505
|
/**
|
|
405
506
|
* How short of the top prize a pool is, in tokens. `0` when it pays the whole table.
|
|
406
507
|
*
|
|
@@ -413,9 +514,20 @@ export declare function seedShortfall(offer: PackOffer): bigint;
|
|
|
413
514
|
//#region src/pdas.d.ts
|
|
414
515
|
/** `["pool", mint]`. One pool per coin. */
|
|
415
516
|
export declare const poolAddress: (mint: Address) => Promise<Address>;
|
|
416
|
-
/**
|
|
417
|
-
|
|
418
|
-
|
|
517
|
+
/**
|
|
518
|
+
* `["draw", pool, purchaser, nonce]`, with the nonce as eight little-endian bytes. The buyer's
|
|
519
|
+
* client picks the nonce, so two buyers, or two purchases of one buyer, never name the same draw.
|
|
520
|
+
* The pool's sequence counter is not in the address any more; the program assigns `seqStart`
|
|
521
|
+
* when the purchase executes.
|
|
522
|
+
*/
|
|
523
|
+
export declare const drawAddress: (pool: Address, purchaser: Address, nonce: bigint) => Promise<Address>;
|
|
524
|
+
/**
|
|
525
|
+
* A random `u64` nonce for one purchase. `buyPacks` draws one per build. A nonce that is still in
|
|
526
|
+
* use fails the purchase at the program; one whose draw already closed names a new draw, so a
|
|
527
|
+
* rebuilt transaction must never reuse the nonce of a purchase that may have landed.
|
|
528
|
+
*/
|
|
529
|
+
export declare function randomNonce(): bigint;
|
|
530
|
+
/** The per-wallet `WalletActivity` PDA. `buy_packs` derives it from the purchaser automatically. */
|
|
419
531
|
export declare const activityAddress: (wallet: Address) => Promise<Address>;
|
|
420
532
|
/** `["identity"]` under Gabox. The PDA the program signs its randomness request with. */
|
|
421
533
|
export declare const vrfIdentityAddress: () => Promise<Address>;
|
|
@@ -574,6 +686,32 @@ export declare function assertRouteIsSafe(route: Route, expect: {
|
|
|
574
686
|
*/
|
|
575
687
|
export declare function solPriceOf(client: GaboxClient, quoteMint: Address, amount: bigint): Promise<bigint | null>;
|
|
576
688
|
//#endregion
|
|
689
|
+
//#region src/settle.d.ts
|
|
690
|
+
/** `math::ticket`. Pack `k`'s 16-bit ticket for this pool and purchase. */
|
|
691
|
+
export declare function ticketFor(randomness: Uint8Array | ReadonlyUint8Array, pool: Address, seqStart: bigint, k: number): Promise<number>;
|
|
692
|
+
export type SettleInput = {
|
|
693
|
+
/** The pool's tier table, as the draw snapshotted it. */
|
|
694
|
+
tiers: readonly Readonly<Tier>[];
|
|
695
|
+
packTokens: bigint;
|
|
696
|
+
/** `vault - reserved` at purchase, before the batch's own tokens. */
|
|
697
|
+
freeSnapshot: bigint;
|
|
698
|
+
count: number;
|
|
699
|
+
pool: Address;
|
|
700
|
+
seqStart: bigint;
|
|
701
|
+
randomness: Uint8Array | ReadonlyUint8Array;
|
|
702
|
+
/** An expired draw pays every pack its smallest tier; the randomness is then all zero. */
|
|
703
|
+
timedOut?: boolean;
|
|
704
|
+
};
|
|
705
|
+
/** `math::settle`. What the callback paid, or owed, for this purchase. */
|
|
706
|
+
export declare function settle(input: SettleInput): Promise<Settlement>;
|
|
707
|
+
/**
|
|
708
|
+
* The settlement of a draw that is still on chain: settled but not yet claimed. The account alone
|
|
709
|
+
* carries everything, so this needs no event and no indexer. `total` equals `draw.owed`.
|
|
710
|
+
*
|
|
711
|
+
* A pending draw (`settled === false`) has no randomness yet; this throws for it.
|
|
712
|
+
*/
|
|
713
|
+
export declare function settleDraw(draw: Draw): Promise<Settlement>;
|
|
714
|
+
//#endregion
|
|
577
715
|
//#region src/tx/quoteLeg.d.ts
|
|
578
716
|
/** Where the money for a purchase comes from. */
|
|
579
717
|
export type PayWith = 'sol' | 'quote';
|
|
@@ -662,18 +800,22 @@ export declare function computeUnitsWithRoute(own: number, leg: QuoteLeg): numbe
|
|
|
662
800
|
*/
|
|
663
801
|
export declare function routeSizeHint(cause: unknown, leg: QuoteLeg): unknown;
|
|
664
802
|
//#endregion
|
|
665
|
-
//#region src/tx/
|
|
666
|
-
export type
|
|
803
|
+
//#region src/tx/buyPacks.d.ts
|
|
804
|
+
export type BuyPacksInput = {
|
|
667
805
|
mint: Address;
|
|
668
806
|
purchaser: TransactionSigner;
|
|
807
|
+
/** How many packs, 1 to `MAX_BATCH_SIZE`. */
|
|
808
|
+
count: number;
|
|
809
|
+
/** The draw's nonce. Left out, a random one is drawn. */
|
|
810
|
+
nonce?: bigint;
|
|
669
811
|
/**
|
|
670
|
-
* The venue slippage cap, in the pool's quote token. The transaction puts
|
|
671
|
-
* token in the buyer's quote account before the buy, so it must cover the
|
|
672
|
-
* left over stays there, or comes back as SOL on a WSOL pool.
|
|
812
|
+
* The venue slippage cap for the whole batch, in the pool's quote token. The transaction puts
|
|
813
|
+
* this much of the quote token in the buyer's quote account before the buy, so it must cover the
|
|
814
|
+
* real price. Anything left over stays there, or comes back as SOL on a WSOL pool.
|
|
673
815
|
*/
|
|
674
816
|
maxQuoteIn: bigint;
|
|
675
|
-
/** The floor on the
|
|
676
|
-
|
|
817
|
+
/** The floor on the first pack's top prize. Refresh the offer if it fails. */
|
|
818
|
+
minFirstMaximum: bigint;
|
|
677
819
|
/** Caps every lamport the handler sees: venue account rent and the VRF request. */
|
|
678
820
|
maxNativeDebit: bigint;
|
|
679
821
|
/**
|
|
@@ -683,10 +825,26 @@ export type BuyPackInput = {
|
|
|
683
825
|
payWith?: PayWith;
|
|
684
826
|
/** Force a venue instead of reading the LaunchLab pool's `status`. */
|
|
685
827
|
venue?: VenueKind;
|
|
686
|
-
/** Pin `pool.nextSeq` to make a rebuild fail rather than buy a second pack. */
|
|
687
|
-
seq?: bigint;
|
|
688
828
|
} & Partial<BuildOptions>;
|
|
689
|
-
export
|
|
829
|
+
export type BuyPacksResult = {
|
|
830
|
+
message: GaboxTransactionMessage;
|
|
831
|
+
/** The draw this purchase opens. Watch it with `fetchDraw` and `findResolvedDraw`. */
|
|
832
|
+
draw: Address;
|
|
833
|
+
nonce: bigint;
|
|
834
|
+
/**
|
|
835
|
+
* `pool.nextSeq` when the message was built. The program assigns the real `seqStart` when the
|
|
836
|
+
* purchase executes, so another buyer landing first moves it; read it from `PacksBought`.
|
|
837
|
+
*/
|
|
838
|
+
seqStart: bigint;
|
|
839
|
+
count: number;
|
|
840
|
+
};
|
|
841
|
+
export declare function buyPacks(client: GaboxClient, input: BuyPacksInput): Promise<BuyPacksResult>;
|
|
842
|
+
export type BuyPackInput = Omit<BuyPacksInput, 'count' | 'minFirstMaximum'> & {
|
|
843
|
+
/** The floor on the top prize this pack may win. Refresh the offer if it fails. */
|
|
844
|
+
minMaximum: bigint;
|
|
845
|
+
};
|
|
846
|
+
/** One pack: `buyPacks` with `count: 1`. Same result shape, so the draw address is known. */
|
|
847
|
+
export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promise<BuyPacksResult>;
|
|
690
848
|
//#endregion
|
|
691
849
|
//#region src/tx/createMachine.d.ts
|
|
692
850
|
/** Which quote asset a new machine is priced in. Defaults to wrapped SOL. */
|
|
@@ -798,20 +956,49 @@ export type RetryDrawInput = {
|
|
|
798
956
|
draw: Address;
|
|
799
957
|
maxVrfDebit: bigint;
|
|
800
958
|
} & Partial<BuildOptions>;
|
|
959
|
+
/** Another randomness request for a draw whose earlier attempts have not landed. Any signer. */
|
|
801
960
|
export declare function retryDraw(client: GaboxClient, input: RetryDrawInput): Promise<GaboxTransactionMessage>;
|
|
802
961
|
export type ExpireDrawInput = {
|
|
803
962
|
payer: TransactionSigner;
|
|
804
963
|
pool: Address;
|
|
805
964
|
draw: Address;
|
|
806
965
|
} & Partial<BuildOptions>;
|
|
966
|
+
/**
|
|
967
|
+
* Fix a timed-out purchase at every pack's smallest tier, from `TIMEOUT_SLOTS` after the purchase.
|
|
968
|
+
* Any signer. The purchaser's ATA address is passed whether or not the account exists: the program
|
|
969
|
+
* pays it if it can and owes the total otherwise.
|
|
970
|
+
*/
|
|
807
971
|
export declare function expireDraw(client: GaboxClient, input: ExpireDrawInput): Promise<GaboxTransactionMessage>;
|
|
972
|
+
export type ClaimPrizeInput = {
|
|
973
|
+
/** Any signer. Pays the transaction and, when the purchaser's ATA is missing, its rent. */
|
|
974
|
+
payer: TransactionSigner;
|
|
975
|
+
draw: Address;
|
|
976
|
+
} & Partial<BuildOptions>;
|
|
977
|
+
/** Pay an owed prize to the purchaser's coin ATA, creating it if needed. Permissionless. */
|
|
978
|
+
export declare function claimPrize(client: GaboxClient, input: ClaimPrizeInput): Promise<GaboxTransactionMessage>;
|
|
979
|
+
export type ClaimPrizeToInput = {
|
|
980
|
+
/** The draw's purchaser. Nobody else can redirect a prize. */
|
|
981
|
+
purchaser: TransactionSigner;
|
|
982
|
+
draw: Address;
|
|
983
|
+
/** Any existing classic token account for the coin that the purchaser owns. Nothing is created. */
|
|
984
|
+
destination: Address;
|
|
985
|
+
} & Partial<BuildOptions>;
|
|
986
|
+
/** The purchaser pays their own owed prize to a coin account they name. */
|
|
987
|
+
export declare function claimPrizeTo(client: GaboxClient, input: ClaimPrizeToInput): Promise<GaboxTransactionMessage>;
|
|
808
988
|
export type DrawAvailability = {
|
|
809
989
|
attempts: number;
|
|
990
|
+
/** True once the callback or an expiry fixed the outcome. `owed` is then what a claim pays. */
|
|
991
|
+
settled: boolean;
|
|
992
|
+
owed: bigint;
|
|
810
993
|
slotsUntilRetry: bigint;
|
|
811
994
|
slotsUntilExpiry: bigint;
|
|
995
|
+
/** The oracle's callback is still accepted: pending, and before the deadline. */
|
|
996
|
+
canDeliver: boolean;
|
|
812
997
|
canRetry: boolean;
|
|
813
998
|
canExpire: boolean;
|
|
999
|
+
canClaim: boolean;
|
|
814
1000
|
};
|
|
1001
|
+
/** What can still happen to a draw, or `null` when it is closed. */
|
|
815
1002
|
export declare function drawAvailability(client: GaboxClient, address: Address): Promise<DrawAvailability | null>;
|
|
816
1003
|
//#endregion
|
|
817
1004
|
//#region src/tx/fundPrizes.d.ts
|
|
@@ -874,5 +1061,5 @@ export type OracleAccounts = {
|
|
|
874
1061
|
*/
|
|
875
1062
|
export declare function oracleAccounts(): Promise<OracleAccounts>;
|
|
876
1063
|
//#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 };
|
|
1064
|
+
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
1065
|
//# sourceMappingURL=index.d.ts.map
|