@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,2 +1,2 @@
1
- import { $ as readAccounts, $n as MEMO_PROGRAM_ADDRESS, A as wsolAccountFor, Ar as RENT_SYSVAR_ADDRESS, At as CPMM_POOL_STATE_SIZE, B as remainingBase, Bt as decodeLaunchlabPool, C as fetchQuoteBinding, Cr as LAUNCHLAB_SELL_EXACT_IN, D as quoteAccountFor, Dr as PLATFORM_ADMIN, Dt as CPMM_AMM_CONFIG_HEAD_SIZE, E as newCurveReserves, Er as METAPLEX_PROGRAM_ADDRESS, F as curveBuyExactIn, Ft as LOCKED_CP_LIQUIDITY_HEAD_SIZE, G as launchlabBuyExactInAccounts, Gn as CPMM_SEEDS, Gt as tokenAccountAmount, H as cpmmBuyAccounts, Ht as metaplexSymbol, I as curveBuyExactOut, It as decodeCpmmAmmConfig, J as fetchQuoteAsset, Jn as LAUNCHLAB_STATUS_FUND, K as launchlabSellAccounts, Kn as CREATOR_FEE_ON_QUOTE, Kt as tokenAccountOwnerAndMint, L as curveSellExactIn, Lt as decodeCpmmPool, M as ceilDivRate, Mr as TOKEN_2022_PROGRAM_ADDRESS, Mt as LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE, N as cpmmSwapBaseInput, Nr as TOKEN_PROGRAM_ADDRESS, Nt as LAUNCHLAB_POOL_STATE_HEAD_SIZE, O as resolveVenue, Or as RAYDIUM_DEVNET_IDS, Ot as CPMM_POOL_OFFSETS, P as cpmmSwapBaseOutput, Pr as WSOL_MINT, Pt as LOCKED_CP_LIQUIDITY_DISCRIMINATOR, Q as decodeBase64, Qn as LOCK_SEEDS, R as initialCurve, Rt as decodeLaunchlabGlobalConfig, S as fetchCurveSettings, Sr as LAUNCHLAB_POOL_STATE_DISCRIMINATOR, T as newCurveBuyCost, Tr as LAUNCH_TOTAL_BASE_SELL, U as cpmmSellAccounts, Ut as mintDecimals, V as totalCurveFeeRate, Vt as decodeLockedCpLiquidity, W as launchlabBuyAccounts, Wn as CONSTANT_CURVE_TAG, Wt as token2022Symbol, X as fetchQuoteDisplay, Xn as LAUNCHLAB_STATUS_TRADE, Y as fetchQuoteConfig, Yn as LAUNCHLAB_STATUS_MIGRATE, Z as isQuoteSupported, Zn as LAUNCH_DECIMALS, _r as LAUNCHLAB_CLAIM_CREATOR_FEE, a as fetchLockedPositions, an as creatorFeeVaultAuthority, ar as SHARE_FEE_RATE, b as creatorFeeOnInput, br as LAUNCHLAB_INITIALIZE, c as getHarvestLockedFeesInstructions, cn as launchlabGlobalConfig, cr as sortedMints, d as claimCreatorFee, dn as launchlabVaultAddress, dr as CPMM_COLLECT_CREATOR_FEE, en as ata, er as METADATA_LIMITS, f as collectCreatorFee, fn as lockAuthority, fr as CPMM_POOL_STATE_DISCRIMINATOR, g as getLaunchInstruction, gn as platformFeeVaultAuthority, gr as LAUNCHLAB_BUY_EXACT_OUT, h as getCollectCreatorFeeInstructions, hn as platformFeeVaultAddress, hr as LAUNCHLAB_BUY_EXACT_IN, i as claimPlatformFee, in as creatorFeeVaultAddress, ir as RAYDIUM_IDS, j as ceilDiv, jr as SYSTEM_PROGRAM_ADDRESS, jt as LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE, k as sellQuote, kr as RAYDIUM_MAINNET_IDS, kt as CPMM_POOL_STATE_HEAD_SIZE, l as harvestLockedFees, ln as launchlabPlatformConfig, lr as ASSOCIATED_TOKEN_PROGRAM_ADDRESS, m as getClaimCreatorFeeInstructions, mn as metadataAddress, mr as CPMM_SWAP_BASE_OUTPUT, n as getCurveBuyExactInInstruction, nn as cpmmCreatorFeeShare, nr as MIGRATE_TO_CPMM, o as fetchPlatformFees, on as launchlabAuthority, or as compareAddresses, p as fetchCreatorFees, pn as lockedLiquidityAddress, pr as CPMM_SWAP_BASE_INPUT, q as order, qn as LAUNCHLAB_SEEDS, r as LOCK_COLLECT_CP_FEES, rn as cpmmPoolAddress, rr as RATE_DENOMINATOR, s as getClaimPlatformFeeInstructions, sn as launchlabEventAuthority, sr as raydiumIds, tn as cpmmAuthority, tr as METADATA_SEED, u as lockedFeeLp, un as launchlabPoolAddress, ur as CPMM_AMM_CONFIG_DISCRIMINATOR, vr as LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT, w as findCpmmPool, wr as LAUNCH_SUPPLY, x as curveQuote, xr as LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR, y as cpmmPoolMatches, yr as LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR, z as preFeeAmount, zt as decodeLaunchlabPlatformConfig } from "../raydium-DIF1WOvI.js";
1
+ import { $ as readAccounts, A as wsolAccountFor, Ar as LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT, At as CPMM_AMM_CONFIG_HEAD_SIZE, B as remainingBase, Br as RAYDIUM_DEVNET_IDS, Bt as decodeCpmmPool, C as fetchQuoteBinding, Cr as CPMM_COLLECT_CREATOR_FEE, D as quoteAccountFor, Dr as LAUNCHLAB_BUY_EXACT_IN, E as newCurveReserves, Er as CPMM_SWAP_BASE_OUTPUT, F as curveBuyExactIn, Fr as LAUNCHLAB_SELL_EXACT_IN, Ft as LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE, G as launchlabBuyExactInAccounts, Gr as TOKEN_PROGRAM_ADDRESS, Gt as metaplexSymbol, H as cpmmBuyAccounts, Hr as RENT_SYSVAR_ADDRESS, Ht as decodeLaunchlabPlatformConfig, I as curveBuyExactOut, Ir as LAUNCH_SUPPLY, It as LAUNCHLAB_POOL_STATE_HEAD_SIZE, J as fetchQuoteAsset, Jt as tokenAccountAmount, K as launchlabSellAccounts, Kr as WSOL_MINT, Kt as mintDecimals, L as curveSellExactIn, Lr as LAUNCH_TOTAL_BASE_SELL, Lt as LOCKED_CP_LIQUIDITY_DISCRIMINATOR, M as ceilDivRate, Mr as LAUNCHLAB_INITIALIZE, Mt as CPMM_POOL_STATE_HEAD_SIZE, N as cpmmSwapBaseInput, Nr as LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR, Nt as CPMM_POOL_STATE_SIZE, O as resolveVenue, Or as LAUNCHLAB_BUY_EXACT_OUT, P as cpmmSwapBaseOutput, Pr as LAUNCHLAB_POOL_STATE_DISCRIMINATOR, Pt as LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE, Q as decodeBase64, R as initialCurve, Rr as METAPLEX_PROGRAM_ADDRESS, Rt as LOCKED_CP_LIQUIDITY_HEAD_SIZE, S as fetchCurveSettings, Sr as CPMM_AMM_CONFIG_DISCRIMINATOR, T as newCurveBuyCost, Tr as CPMM_SWAP_BASE_INPUT, U as cpmmSellAccounts, Ur as SYSTEM_PROGRAM_ADDRESS, Ut as decodeLaunchlabPool, V as totalCurveFeeRate, Vr as RAYDIUM_MAINNET_IDS, Vt as decodeLaunchlabGlobalConfig, W as launchlabBuyAccounts, Wr as TOKEN_2022_PROGRAM_ADDRESS, Wt as decodeLockedCpLiquidity, X as fetchQuoteDisplay, Y as fetchQuoteConfig, Yt as tokenAccountOwnerAndMint, Z as isQuoteSupported, _n as lockedLiquidityAddress, _r as SHARE_FEE_RATE, a as fetchLockedPositions, an as cpmmAuthority, ar as LAUNCHLAB_SEEDS, b as creatorFeeOnInput, bn as platformFeeVaultAuthority, br as sortedMints, c as getHarvestLockedFeesInstructions, cn as creatorFeeVaultAddress, cr as LAUNCHLAB_STATUS_TRADE, d as claimCreatorFee, dn as launchlabEventAuthority, dr as MEMO_PROGRAM_ADDRESS, f as collectCreatorFee, fn as launchlabGlobalConfig, fr as METADATA_LIMITS, g as getLaunchInstruction, gn as lockAuthority, gr as RAYDIUM_IDS, h as getCollectCreatorFeeInstructions, hn as launchlabVaultAddress, hr as RATE_DENOMINATOR, i as claimPlatformFee, in as ata, ir as CREATOR_FEE_ON_QUOTE, j as ceilDiv, jr as LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR, jt as CPMM_POOL_OFFSETS, k as sellQuote, kr as LAUNCHLAB_CLAIM_CREATOR_FEE, l as harvestLockedFees, ln as creatorFeeVaultAuthority, lr as LAUNCH_DECIMALS, m as getClaimCreatorFeeInstructions, mn as launchlabPoolAddress, mr as MIGRATE_TO_CPMM, n as getCurveBuyExactInInstruction, nr as CONSTANT_CURVE_TAG, o as fetchPlatformFees, on as cpmmCreatorFeeShare, or as LAUNCHLAB_STATUS_FUND, p as fetchCreatorFees, pn as launchlabPlatformConfig, pr as METADATA_SEED, q as order, qt as token2022Symbol, r as LOCK_COLLECT_CP_FEES, rr as CPMM_SEEDS, s as getClaimPlatformFeeInstructions, sn as cpmmPoolAddress, sr as LAUNCHLAB_STATUS_MIGRATE, u as lockedFeeLp, un as launchlabAuthority, ur as LOCK_SEEDS, vn as metadataAddress, vr as compareAddresses, w as findCpmmPool, wr as CPMM_POOL_STATE_DISCRIMINATOR, x as curveQuote, xr as ASSOCIATED_TOKEN_PROGRAM_ADDRESS, y as cpmmPoolMatches, yn as platformFeeVaultAddress, yr as raydiumIds, z as preFeeAmount, zr as PLATFORM_ADMIN, zt as decodeCpmmAmmConfig } from "../raydium-BZT4-i79.js";
2
2
  export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, CONSTANT_CURVE_TAG, CPMM_AMM_CONFIG_DISCRIMINATOR, CPMM_AMM_CONFIG_HEAD_SIZE, CPMM_COLLECT_CREATOR_FEE, CPMM_POOL_OFFSETS, CPMM_POOL_STATE_DISCRIMINATOR, CPMM_POOL_STATE_HEAD_SIZE, CPMM_POOL_STATE_SIZE, CPMM_SEEDS, CPMM_SWAP_BASE_INPUT, CPMM_SWAP_BASE_OUTPUT, CREATOR_FEE_ON_QUOTE, LAUNCHLAB_BUY_EXACT_IN, LAUNCHLAB_BUY_EXACT_OUT, LAUNCHLAB_CLAIM_CREATOR_FEE, LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT, LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR, LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE, LAUNCHLAB_INITIALIZE, LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR, LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE, LAUNCHLAB_POOL_STATE_DISCRIMINATOR, LAUNCHLAB_POOL_STATE_HEAD_SIZE, LAUNCHLAB_SEEDS, LAUNCHLAB_SELL_EXACT_IN, LAUNCHLAB_STATUS_FUND, LAUNCHLAB_STATUS_MIGRATE, LAUNCHLAB_STATUS_TRADE, LAUNCH_DECIMALS, LAUNCH_SUPPLY, LAUNCH_TOTAL_BASE_SELL, LOCKED_CP_LIQUIDITY_DISCRIMINATOR, LOCKED_CP_LIQUIDITY_HEAD_SIZE, LOCK_COLLECT_CP_FEES, LOCK_SEEDS, MEMO_PROGRAM_ADDRESS, METADATA_LIMITS, METADATA_SEED, METAPLEX_PROGRAM_ADDRESS, MIGRATE_TO_CPMM, PLATFORM_ADMIN, RATE_DENOMINATOR, RAYDIUM_DEVNET_IDS, RAYDIUM_IDS, RAYDIUM_MAINNET_IDS, RENT_SYSVAR_ADDRESS, SHARE_FEE_RATE, SYSTEM_PROGRAM_ADDRESS, TOKEN_2022_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, WSOL_MINT, ata, ceilDiv, ceilDivRate, claimCreatorFee, claimPlatformFee, collectCreatorFee, compareAddresses, cpmmAuthority, cpmmBuyAccounts, cpmmCreatorFeeShare, cpmmPoolAddress, cpmmPoolMatches, cpmmSellAccounts, cpmmSwapBaseInput, cpmmSwapBaseOutput, creatorFeeOnInput, creatorFeeVaultAddress, creatorFeeVaultAuthority, curveBuyExactIn, curveBuyExactOut, curveQuote, curveSellExactIn, decodeBase64, decodeCpmmAmmConfig, decodeCpmmPool, decodeLaunchlabGlobalConfig, decodeLaunchlabPlatformConfig, decodeLaunchlabPool, decodeLockedCpLiquidity, fetchCreatorFees, fetchCurveSettings, fetchLockedPositions, fetchPlatformFees, fetchQuoteAsset, fetchQuoteBinding, fetchQuoteConfig, fetchQuoteDisplay, findCpmmPool, getClaimCreatorFeeInstructions, getClaimPlatformFeeInstructions, getCollectCreatorFeeInstructions, getCurveBuyExactInInstruction, getHarvestLockedFeesInstructions, getLaunchInstruction, harvestLockedFees, initialCurve, isQuoteSupported, launchlabAuthority, launchlabBuyAccounts, launchlabBuyExactInAccounts, launchlabEventAuthority, launchlabGlobalConfig, launchlabPlatformConfig, launchlabPoolAddress, launchlabSellAccounts, launchlabVaultAddress, lockAuthority, lockedFeeLp, lockedLiquidityAddress, metadataAddress, metaplexSymbol, mintDecimals, newCurveBuyCost, newCurveReserves, order, platformFeeVaultAddress, platformFeeVaultAuthority, preFeeAmount, quoteAccountFor, raydiumIds, readAccounts, remainingBase, resolveVenue, sellQuote, sortedMints, token2022Symbol, tokenAccountAmount, tokenAccountOwnerAndMint, totalCurveFeeRate, wsolAccountFor };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { Dt as POOL_DISCRIMINATOR, Et as getWalletActivitySize, Jt as getDrawSize, Lt as getPoolSize, Ot as decodePool, Rt as DRAW_DISCRIMINATOR, _t as decodeWalletActivity, ft as findPoolPda, ht as findActivityPda, mt as findDrawPda, pt as findIdentityPda, t as GABOX_PROGRAM_ADDRESS, zt as decodeDraw } from "./gabox-DGTCh34U.js";
2
+ import { $t as getPoolSize, At as findDrawPda, Ht as getWalletActivitySize, Nt as decodeWalletActivity, Ot as findPoolPda, Ut as POOL_DISCRIMINATOR, Wt as decodePool, en as DRAW_DISCRIMINATOR, jt as findActivityPda, kt as findIdentityPda, t as GABOX_PROGRAM_ADDRESS, tn as decodeDraw, un as getDrawSize } from "./gabox-CuyJYmrS.js";
3
3
  import { AccountRole, Endian, addEncoderSizePrefix, appendTransactionMessageInstructions, compileTransaction, compressTransactionMessageUsingAddressLookupTables, createTransactionMessage, fetchEncodedAccount, fixDecoderSize, getAddressDecoder, getAddressEncoder, getBase58Decoder, getBase64Encoder, getBooleanDecoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getTransactionEncoder, getU128Decoder, getU16Decoder, getU16Encoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, getUtf8Encoder, pipe, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash } from "@solana/kit";
4
4
  import { getCloseAccountInstruction, getCreateAssociatedTokenIdempotentInstruction } from "@solana-program/token";
5
5
  //#region src/raydium/abi.ts
@@ -1064,43 +1064,6 @@ function compareAddresses(a, b) {
1064
1064
  return 0;
1065
1065
  }
1066
1066
  //#endregion
1067
- //#region src/ids.ts
1068
- /** `declare_id!` in `programs/gabox/src/lib.rs`. */
1069
- const GABOX_PROGRAM_ID = GABOX_PROGRAM_ADDRESS;
1070
- /** MagicBlock's ephemeral VRF program. `vrf.rs` pins it and refuses any other. */
1071
- const VRF_PROGRAM_ADDRESS = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
1072
- /**
1073
- * MagicBlock's default oracle queue. The program pins this one address, so a pool creator cannot
1074
- * point a draw at an oracle they control.
1075
- */
1076
- const VRF_DEFAULT_QUEUE = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
1077
- /** The seed of both identity PDAs. See `pdas.ts` — there are two, under different programs. */
1078
- const IDENTITY_SEED = new Uint8Array([
1079
- 105,
1080
- 100,
1081
- 101,
1082
- 110,
1083
- 116,
1084
- 105,
1085
- 116,
1086
- 121
1087
- ]);
1088
- const SLOT_HASHES_SYSVAR = "SysvarS1otHashes111111111111111111111111111";
1089
- const INSTRUCTIONS_SYSVAR = "Sysvar1nstructions1111111111111111111111111";
1090
- /** `constants.rs`. A retry may not run sooner than this after the last attempt. */
1091
- const RETRY_SLOTS = 300n;
1092
- /** `constants.rs`. After this many slots from the purchase, anyone may expire the draw. */
1093
- const TIMEOUT_SLOTS = 216000n;
1094
- /** `constants.rs`. Three requests in total, counting the one `buy_pack` makes. */
1095
- const MAX_ATTEMPTS = 3;
1096
- /**
1097
- * `constants.rs`. Tokens in one pack, in base units: 1,000,000 tokens at the fixed 6 decimals, or
1098
- * 0.1% of the 1,000,000,000 supply. Every pool sells packs of this size. The venue decides what a
1099
- * pack costs, so the pack price follows the coin. Read `pool.packTokens` rather than this when a
1100
- * pool is at hand: a later program version may change the constant.
1101
- */
1102
- const PACK_TOKENS = 1000000n * 1000000n;
1103
- //#endregion
1104
1067
  //#region src/math.ts
1105
1068
  /**
1106
1069
  * A bigint port of `programs/gabox/src/math.rs`.
@@ -1129,6 +1092,12 @@ const MAX_MULTIPLIER_BPS = 2e5;
1129
1092
  const TICKETS = 65536;
1130
1093
  /** The prize table has exactly this many slots. Unused slots are all-zero. */
1131
1094
  const TIERS = 8;
1095
+ /**
1096
+ * `constants::MAX_BATCH_SIZE`. The most packs one `buy_packs` call opens. A limit per purchase,
1097
+ * not on pending packs: any number of buyers and overlapping purchases are fine, because every
1098
+ * pending draw carries its own reservation.
1099
+ */
1100
+ const MAX_BATCH_SIZE = 5;
1132
1101
  /** Thrown by every function here. `code` matches a `GaboxError` variant name. */
1133
1102
  var GaboxMathError = class extends Error {
1134
1103
  code;
@@ -1145,24 +1114,28 @@ const U32_MAX = 4294967295;
1145
1114
  * passes `validateTiers`. This is only the table the Gabox app creates its pools with, and the
1146
1115
  * starting point for a client that has no reason to pick another one.
1147
1116
  *
1148
- * Common 75% at 0.52x, Rare 20% at 1.2x, Epic 4% at 3x, Mythic 1% at 20x. Expected payout is
1149
- * 0.9499x of a pack, so the seed is 19 packs.
1117
+ * Common 80% at 0.5126x, Rare 15% at 2x, Epic 4% at 3.5x, Mythic 1% at 10x. Expected payout is
1118
+ * 0.9499x of a pack. The mandatory seed is 2 packs, because `seedTokens` stops at the 3x minimum.
1119
+ *
1120
+ * Every win at least doubles the pack. The top tier stops at 10x, half the program's cap, so one
1121
+ * hit pays 1% of the supply instead of 2%, and the vault funds the full 10x after about 140 packs
1122
+ * instead of 360.
1150
1123
  */
1151
1124
  const DEFAULT_TIERS = Object.freeze([
1152
1125
  Object.freeze({
1153
- multiplierBps: 5201,
1154
- tickets: 49153
1126
+ multiplierBps: 5126,
1127
+ tickets: 52430
1155
1128
  }),
1156
1129
  Object.freeze({
1157
- multiplierBps: 12e3,
1158
- tickets: 13107
1130
+ multiplierBps: 2e4,
1131
+ tickets: 9830
1159
1132
  }),
1160
1133
  Object.freeze({
1161
- multiplierBps: 3e4,
1134
+ multiplierBps: 35e3,
1162
1135
  tickets: 2621
1163
1136
  }),
1164
1137
  Object.freeze({
1165
- multiplierBps: 2e5,
1138
+ multiplierBps: 1e5,
1166
1139
  tickets: 655
1167
1140
  }),
1168
1141
  Object.freeze({
@@ -1333,6 +1306,124 @@ function choose(prizes, ticket) {
1333
1306
  }
1334
1307
  return 0n;
1335
1308
  }
1309
+ /** A ticket is a `u16`: the first two bytes of the pack's hash, little-endian. */
1310
+ function checkedTicket(ticket) {
1311
+ if (!Number.isInteger(ticket) || ticket < 0 || ticket >= 65536) throw new GaboxMathError("Arithmetic", `a ticket is an integer from 0 to 65535`);
1312
+ return ticket;
1313
+ }
1314
+ /** `count` is a `u8` the program bounds at `MAX_BATCH_SIZE`. Zero is refused before any trade. */
1315
+ function checkedCount(count) {
1316
+ if (!Number.isInteger(count) || count < 1) throw new GaboxMathError("ZeroAmount", "a purchase opens at least one pack");
1317
+ if (count > 5) throw new GaboxMathError("TooManyPacks", `a purchase opens at most 5 packs`);
1318
+ return count;
1319
+ }
1320
+ /**
1321
+ * `math::uncapped`. Every tier's award for this base before any inventory cap, `0n` on an unused
1322
+ * row. A ticketed tier that would pay nothing is refused, the same as in `quote`.
1323
+ */
1324
+ function uncappedAmounts(base, tiers) {
1325
+ validateTiers(tiers);
1326
+ return tiers.map((tier, i) => {
1327
+ if (tier.tickets === 0) return 0n;
1328
+ const amount = tierAmount(base, tier.multiplierBps);
1329
+ if (amount === 0n) throw new GaboxMathError("PackTooSmall", `tier ${i} rounds to zero tokens at this pack size`);
1330
+ return amount;
1331
+ });
1332
+ }
1333
+ /** `math::min_tier`. The ticketed tier with the smallest award. Expiry pays it for every pack. */
1334
+ function minTier(uncapped, tiers) {
1335
+ let best = null;
1336
+ for (const [i, tier] of tiers.entries()) {
1337
+ if (tier.tickets === 0) continue;
1338
+ if (best === null || uncapped[i] < uncapped[best]) best = i;
1339
+ }
1340
+ return best ?? 0;
1341
+ }
1342
+ /**
1343
+ * `math::choose_index`. Which tier a 16-bit ticket lands on: the rows are consecutive ranges in
1344
+ * table order. Exactly 65,536 tickets, so there is no modulo and no bias.
1345
+ */
1346
+ function chooseIndex(tiers, ticket) {
1347
+ checkedTicket(ticket);
1348
+ let end = 0;
1349
+ let last = 0;
1350
+ for (const [i, tier] of tiers.entries()) {
1351
+ if (tier.tickets === 0) continue;
1352
+ last = i;
1353
+ end += tier.tickets;
1354
+ if (ticket < end) return i;
1355
+ }
1356
+ return last;
1357
+ }
1358
+ /**
1359
+ * `math::reserve_for`. What a purchase of `count` packs adds to `pool.reserved`:
1360
+ * `min(count * uncappedMax, free + count * packTokens)`. Settlement in order can never pay more
1361
+ * than either bound, so this is the least reservation that keeps the vault solvent whatever the
1362
+ * outcomes. With `count = 1` it is exactly the single pack's capped maximum.
1363
+ */
1364
+ function reserveFor(count, packTokens, uncappedMax, free) {
1365
+ checkedCount(count);
1366
+ const byPrizes = checkedU64(uncappedMax * BigInt(count), "reservation");
1367
+ const byVault = checkedU64(free + packTokens * BigInt(count), "reservation");
1368
+ return byPrizes < byVault ? byPrizes : byVault;
1369
+ }
1370
+ /**
1371
+ * `math::settle_with`. Settle a batch in order from explicit tickets.
1372
+ *
1373
+ * Pack k's table caps every tier at what the vault can pay after packs 1..k-1 paid out, counting
1374
+ * the batch's own tokens as they arrive: pack 1 sees `freeSnapshot + packTokens`, and every later
1375
+ * pack sees the remainder plus one more pack. So no pack can lose its own base to an earlier pack,
1376
+ * and the total never exceeds `reserveFor(...)`.
1377
+ *
1378
+ * With `timedOut` every pack pays its smallest tier, and `tickets` is ignored.
1379
+ */
1380
+ function settleWith(tiers, packTokens, freeSnapshot, count, tickets, timedOut = false) {
1381
+ checkedCount(count);
1382
+ const uncapped = uncappedAmounts(packTokens, tiers);
1383
+ const fallback = minTier(uncapped, tiers);
1384
+ let avail = checkedU64(freeSnapshot + packTokens, "available inventory");
1385
+ let total = 0n;
1386
+ const results = [];
1387
+ for (let k = 0; k < count; k++) {
1388
+ let tier;
1389
+ if (timedOut) tier = fallback;
1390
+ else {
1391
+ const ticket = tickets[k];
1392
+ if (ticket === void 0) throw new GaboxMathError("Arithmetic", `no ticket for pack ${k} of ${count}`);
1393
+ tier = chooseIndex(tiers, ticket);
1394
+ }
1395
+ const cap = uncapped[tier];
1396
+ const amount = cap < avail ? cap : avail;
1397
+ results.push({
1398
+ tier,
1399
+ amount
1400
+ });
1401
+ total = checkedU64(total + amount, "settlement total");
1402
+ avail = checkedU64(avail - amount + packTokens, "available inventory");
1403
+ }
1404
+ return {
1405
+ total,
1406
+ results
1407
+ };
1408
+ }
1409
+ /**
1410
+ * The top prize each pack of a purchase can still win if every pack before it won its own top
1411
+ * prize: the worst case for the later packs, which is what a buyer should see next to the first
1412
+ * pack's table. `caps[0]` is the first pack's capped maximum; on a deep vault every entry is the
1413
+ * uncapped jackpot, on a thin one the later entries fall towards one pack.
1414
+ */
1415
+ function perPackCaps(tiers, packTokens, freeSnapshot, count) {
1416
+ checkedCount(count);
1417
+ const uncapped = uncappedMaximum(packTokens, tiers);
1418
+ let avail = checkedU64(freeSnapshot + packTokens, "available inventory");
1419
+ const caps = [];
1420
+ for (let k = 0; k < count; k++) {
1421
+ const cap = uncapped < avail ? uncapped : avail;
1422
+ caps.push(cap);
1423
+ avail = checkedU64(avail - cap + packTokens, "available inventory");
1424
+ }
1425
+ return caps;
1426
+ }
1336
1427
  /** `math::resolve_reservation`. Release the unwon part of a maximum, keep the award reserved. */
1337
1428
  function resolveReservation(reserved, maximum, award) {
1338
1429
  if (award > maximum) throw new GaboxMathError("InsolventInventory", "the award exceeds the reserved maximum");
@@ -1365,6 +1456,43 @@ function averageMultiplierBps(tiers) {
1365
1456
  return Number(weighted / BigInt(TICKETS));
1366
1457
  }
1367
1458
  //#endregion
1459
+ //#region src/ids.ts
1460
+ /** `declare_id!` in `programs/gabox/src/lib.rs`. */
1461
+ const GABOX_PROGRAM_ID = GABOX_PROGRAM_ADDRESS;
1462
+ /** MagicBlock's ephemeral VRF program. `vrf.rs` pins it and refuses any other. */
1463
+ const VRF_PROGRAM_ADDRESS = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
1464
+ /**
1465
+ * MagicBlock's default oracle queue. The program pins this one address, so a pool creator cannot
1466
+ * point a draw at an oracle they control.
1467
+ */
1468
+ const VRF_DEFAULT_QUEUE = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
1469
+ /** The seed of both identity PDAs. See `pdas.ts` — there are two, under different programs. */
1470
+ const IDENTITY_SEED = new Uint8Array([
1471
+ 105,
1472
+ 100,
1473
+ 101,
1474
+ 110,
1475
+ 116,
1476
+ 105,
1477
+ 116,
1478
+ 121
1479
+ ]);
1480
+ const SLOT_HASHES_SYSVAR = "SysvarS1otHashes111111111111111111111111111";
1481
+ const INSTRUCTIONS_SYSVAR = "Sysvar1nstructions1111111111111111111111111";
1482
+ /** `constants.rs`. A retry may not run sooner than this after the last attempt. */
1483
+ const RETRY_SLOTS = 300n;
1484
+ /** `constants.rs`. After this many slots from the purchase, anyone may expire the draw. */
1485
+ const TIMEOUT_SLOTS = 216000n;
1486
+ /** `constants.rs`. Three requests in total, counting the one `buy_packs` makes. */
1487
+ const MAX_ATTEMPTS = 3;
1488
+ /**
1489
+ * `constants.rs`. Tokens in one pack, in base units: 1,000,000 tokens at the fixed 6 decimals, or
1490
+ * 0.1% of the 1,000,000,000 supply. Every pool sells packs of this size. The venue decides what a
1491
+ * pack costs, so the pack price follows the coin. Read `pool.packTokens` rather than this when a
1492
+ * pool is at hand: a later program version may change the constant.
1493
+ */
1494
+ const PACK_TOKENS = 1000000n * 1000000n;
1495
+ //#endregion
1368
1496
  //#region src/raydium/pdas.ts
1369
1497
  /**
1370
1498
  * Every Raydium address a Gabox transaction derives.
@@ -1501,12 +1629,30 @@ const ata = async (owner, mint, tokenProgram = TOKEN_PROGRAM_ADDRESS) => await d
1501
1629
  */
1502
1630
  /** `["pool", mint]`. One pool per coin. */
1503
1631
  const poolAddress = async (mint) => (await findPoolPda({ mint }))[0];
1504
- /** `["draw", pool, seq]`, with the sequence as eight little-endian bytes. */
1505
- const drawAddress = async (pool, seq) => (await findDrawPda({
1632
+ /**
1633
+ * `["draw", pool, purchaser, nonce]`, with the nonce as eight little-endian bytes. The buyer's
1634
+ * client picks the nonce, so two buyers, or two purchases of one buyer, never name the same draw.
1635
+ * The pool's sequence counter is not in the address any more; the program assigns `seqStart`
1636
+ * when the purchase executes.
1637
+ */
1638
+ const drawAddress = async (pool, purchaser, nonce) => (await findDrawPda({
1506
1639
  pool,
1507
- seq
1640
+ purchaser,
1641
+ nonce
1508
1642
  }))[0];
1509
- /** The per-wallet `WalletActivity` PDA. `buy_pack` derives it from the purchaser automatically. */
1643
+ /**
1644
+ * A random `u64` nonce for one purchase. `buyPacks` draws one per build. A nonce that is still in
1645
+ * use fails the purchase at the program; one whose draw already closed names a new draw, so a
1646
+ * rebuilt transaction must never reuse the nonce of a purchase that may have landed.
1647
+ */
1648
+ function randomNonce() {
1649
+ const bytes = /* @__PURE__ */ new Uint8Array(8);
1650
+ crypto.getRandomValues(bytes);
1651
+ let nonce = 0n;
1652
+ for (let i = 7; i >= 0; i--) nonce = nonce << 8n | BigInt(bytes[i]);
1653
+ return nonce;
1654
+ }
1655
+ /** The per-wallet `WalletActivity` PDA. `buy_packs` derives it from the purchaser automatically. */
1510
1656
  const activityAddress = async (wallet) => (await findActivityPda({ purchaser: wallet }))[0];
1511
1657
  /** `["identity"]` under Gabox. The PDA the program signs its randomness request with. */
1512
1658
  const vrfIdentityAddress = async () => (await findIdentityPda())[0];
@@ -1902,6 +2048,12 @@ function decodeLockedCpLiquidity(data) {
1902
2048
  const DISCRIMINATOR = 8;
1903
2049
  const DRAW_POOL_OFFSET = DISCRIMINATOR;
1904
2050
  const DRAW_PURCHASER_OFFSET = 40;
2051
+ /**
2052
+ * The `settled` byte: after pool, purchaser, nonce, bump, seq_start, count, two slots, attempts,
2053
+ * eight tiers, pack_tokens, free_snapshot and reserved. `test/surface.test.ts` pins it against the
2054
+ * generated encoder.
2055
+ */
2056
+ const DRAW_SETTLED_OFFSET = 195;
1905
2057
  const POOL_CREATOR_OFFSET = DISCRIMINATOR;
1906
2058
  const POOL_MINT_OFFSET = 40;
1907
2059
  const base58 = getBase58Decoder();
@@ -1947,7 +2099,7 @@ function decodeCurrentWalletActivity(account) {
1947
2099
  }
1948
2100
  /**
1949
2101
  * A wallet's lifetime pack-buying activity, or `null` before it has bought its first pack.
1950
- * `buy_pack` creates this account `init_if_needed`, so a fresh wallet has none yet.
2102
+ * `buy_packs` creates this account `init_if_needed`, so a fresh wallet has none yet.
1951
2103
  */
1952
2104
  async function fetchWalletActivity(client, wallet) {
1953
2105
  return decodeCurrentWalletActivity(await fetchEncodedAccount(client.rpc, await activityAddress(wallet), { commitment: "confirmed" }));
@@ -1976,6 +2128,23 @@ async function listDraws(client, query = {}) {
1976
2128
  }
1977
2129
  const listDrawsByPool = async (client, pool) => await listDraws(client, { pool });
1978
2130
  const listDrawsByPurchaser = async (client, purchaser) => await listDraws(client, { purchaser });
2131
+ /**
2132
+ * A purchaser's draws that settled without paying: the callback could not use the purchaser's coin
2133
+ * account, so the tokens wait in the vault as `owed` until `claimPrize` or `claimPrizeTo` pays
2134
+ * them. A pending draw is not in this list, and a paid one no longer exists.
2135
+ */
2136
+ async function fetchOwedDraws(client, purchaser) {
2137
+ const filters = [
2138
+ memcmp$1(0, asBase58(DRAW_DISCRIMINATOR)),
2139
+ { dataSize: BigInt(getDrawSize()) },
2140
+ memcmp$1(40, purchaser),
2141
+ memcmp$1(195, asBase58(new Uint8Array([1])))
2142
+ ];
2143
+ return (await scan(client.rpc, filters, (address, data) => ({
2144
+ address,
2145
+ data: decodeDraw(encoded(address, data)).data
2146
+ }))).filter((row) => row.data.settled && row.data.owed > 0n);
2147
+ }
1979
2148
  async function fetchVaultBalance(client, mint) {
1980
2149
  const vault = await vaultAddress(mint);
1981
2150
  const { value } = await client.rpc.getAccountInfo(vault, {
@@ -2059,9 +2228,18 @@ const CREATE_MACHINE_COMPUTE_UNITS = 35e4;
2059
2228
  * Measured at `178,690`, `163,686` and `157,692` on the curve, and `113,891`, `110,922` and
2060
2229
  * `106,387` on CPMM. The curve buy is dearer because a coin's first trade also creates the platform
2061
2230
  * and creator fee vaults.
2231
+ *
2232
+ * One figure for every `count` from 1 to `MAX_BATCH_SIZE`: a purchase of five packs is still one
2233
+ * trade, one draw and one request. The per-pack work runs in the oracle's callback, on the oracle's
2234
+ * own budget. The devnet end-to-end test re-measures count 1 and 5.
2062
2235
  */
2063
2236
  const BUY_PACK_COMPUTE_UNITS = 235e3;
2064
2237
  /**
2238
+ * `claim_prize`: create the purchaser's ATA when it is missing, one transfer, close the draw. An
2239
+ * estimate until the devnet run measures it; a caller may override it.
2240
+ */
2241
+ const CLAIM_PRIZE_COMPUTE_UNITS = 8e4;
2242
+ /**
2065
2243
  * A WSOL wrap, a venue sale, and the WSOL close. Measured at `94,246`, `86,745` and `88,246` on the
2066
2244
  * curve, and `61,545`, `55,576` and `57,046` on CPMM.
2067
2245
  */
@@ -3833,6 +4011,6 @@ var raydium_exports = /* @__PURE__ */ __exportAll({
3833
4011
  wsolAccountFor: () => wsolAccountFor
3834
4012
  });
3835
4013
  //#endregion
3836
- export { readAccounts as $, MEMO_PROGRAM_ADDRESS as $n, vrfIdentityAddress as $t, wsolAccountFor as A, tierAmount as An, RENT_SYSVAR_ADDRESS as Ar, CPMM_POOL_STATE_SIZE as At, remainingBase as B, SLOT_HASHES_SYSVAR as Bn, decodeLaunchlabPool as Bt, fetchQuoteBinding as C, TIERS as Cn, LAUNCHLAB_SELL_EXACT_IN as Cr, listDrawsByPurchaser as Ct, quoteAccountFor as D, quote as Dn, PLATFORM_ADMIN as Dr, CPMM_AMM_CONFIG_HEAD_SIZE as Dt, newCurveReserves as E, maxMultiplierBps as En, METAPLEX_PROGRAM_ADDRESS as Er, tiersOf as Et, curveBuyExactIn as F, IDENTITY_SEED as Fn, LOCKED_CP_LIQUIDITY_HEAD_SIZE as Ft, launchlabBuyExactInAccounts as G, CPMM_SEEDS as Gn, tokenAccountAmount as Gt, cpmmBuyAccounts as H, VRF_DEFAULT_QUEUE as Hn, metaplexSymbol as Ht, curveBuyExactOut as I, INSTRUCTIONS_SYSVAR as In, decodeCpmmAmmConfig as It, fetchQuoteAsset as J, LAUNCHLAB_STATUS_FUND as Jn, associatedTokenAddress as Jt, launchlabSellAccounts as K, CREATOR_FEE_ON_QUOTE as Kn, tokenAccountOwnerAndMint as Kt, curveSellExactIn as L, MAX_ATTEMPTS as Ln, decodeCpmmPool as Lt, ceilDivRate as M, validatePack as Mn, TOKEN_2022_PROGRAM_ADDRESS as Mr, LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE as Mt, cpmmSwapBaseInput as N, validateTiers as Nn, TOKEN_PROGRAM_ADDRESS as Nr, LAUNCHLAB_POOL_STATE_HEAD_SIZE as Nt, resolveVenue as O, resolveReservation as On, RAYDIUM_DEVNET_IDS as Or, CPMM_POOL_OFFSETS as Ot, cpmmSwapBaseOutput as P, GABOX_PROGRAM_ID as Pn, WSOL_MINT as Pr, LOCKED_CP_LIQUIDITY_DISCRIMINATOR as Pt, decodeBase64 as Q, LOCK_SEEDS as Qn, vaultAddress as Qt, initialCurve as R, PACK_TOKENS as Rn, decodeLaunchlabGlobalConfig as Rt, fetchCurveSettings as S, TICKETS as Sn, LAUNCHLAB_POOL_STATE_DISCRIMINATOR as Sr, listDrawsByPool as St, newCurveBuyCost as T, choose as Tn, LAUNCH_TOTAL_BASE_SELL as Tr, quotePool as Tt, cpmmSellAccounts as U, VRF_PROGRAM_ADDRESS as Un, mintDecimals as Ut, totalCurveFeeRate as V, TIMEOUT_SLOTS as Vn, decodeLockedCpLiquidity as Vt, launchlabBuyAccounts as W, CONSTANT_CURVE_TAG as Wn, token2022Symbol as Wt, fetchQuoteDisplay as X, LAUNCHLAB_STATUS_TRADE as Xn, poolAddress as Xt, fetchQuoteConfig as Y, LAUNCHLAB_STATUS_MIGRATE as Yn, drawAddress as Yt, isQuoteSupported as Z, LAUNCH_DECIMALS as Zn, scopedVrfIdentityAddress as Zt, buildMessage as _, BPS as _n, LAUNCHLAB_CLAIM_CREATOR_FEE as _r, fetchPoolByMint as _t, fetchLockedPositions as a, creatorFeeVaultAuthority as an, SHARE_FEE_RATE as ar, HARVEST_COMPUTE_UNITS as at, creatorFeeOnInput as b, MAX_MULTIPLIER_BPS as bn, LAUNCHLAB_INITIALIZE as br, fetchWalletActivity as bt, getHarvestLockedFeesInstructions as c, launchlabGlobalConfig as cn, sortedMints as cr, computeBudgetInstructions as ct, claimCreatorFee as d, launchlabVaultAddress as dn, CPMM_COLLECT_CREATOR_FEE as dr, DRAW_POOL_OFFSET as dt, ata as en, METADATA_LIMITS as er, BUY_PACK_COMPUTE_UNITS as et, collectCreatorFee as f, lockAuthority as fn, CPMM_POOL_STATE_DISCRIMINATOR as fr, DRAW_PURCHASER_OFFSET as ft, getLaunchInstruction as g, platformFeeVaultAuthority as gn, LAUNCHLAB_BUY_EXACT_OUT as gr, fetchPoolAt as gt, getCollectCreatorFeeInstructions as h, platformFeeVaultAddress as hn, LAUNCHLAB_BUY_EXACT_IN as hr, fetchDraw as ht, claimPlatformFee as i, creatorFeeVaultAddress as in, RAYDIUM_IDS as ir, DEFAULT_COMPUTE_UNIT_LIMIT as it, ceilDiv as j, uncappedMaximum as jn, SYSTEM_PROGRAM_ADDRESS as jr, LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE as jt, sellQuote as k, seedTokens as kn, RAYDIUM_MAINNET_IDS as kr, CPMM_POOL_STATE_HEAD_SIZE as kt, harvestLockedFees as l, launchlabPlatformConfig as ln, ASSOCIATED_TOKEN_PROGRAM_ADDRESS as lr, getSetComputeUnitLimitInstruction as lt, getClaimCreatorFeeInstructions as m, metadataAddress as mn, CPMM_SWAP_BASE_OUTPUT as mr, POOL_MINT_OFFSET as mt, getCurveBuyExactInInstruction as n, cpmmCreatorFeeShare as nn, MIGRATE_TO_CPMM as nr, COMPUTE_BUDGET_PROGRAM_ADDRESS as nt, fetchPlatformFees as o, launchlabAuthority as on, compareAddresses as or, MAX_COMPUTE_UNIT_LIMIT as ot, fetchCreatorFees as p, lockedLiquidityAddress as pn, CPMM_SWAP_BASE_INPUT as pr, POOL_CREATOR_OFFSET as pt, order as q, LAUNCHLAB_SEEDS as qn, activityAddress as qt, LOCK_COLLECT_CP_FEES as r, cpmmPoolAddress as rn, RATE_DENOMINATOR as rr, CREATE_MACHINE_COMPUTE_UNITS as rt, getClaimPlatformFeeInstructions as s, launchlabEventAuthority as sn, raydiumIds as sr, REDEEM_COMPUTE_UNITS as st, raydium_exports as t, cpmmAuthority as tn, METADATA_SEED as tr, CLAIM_COMPUTE_UNITS as tt, lockedFeeLp as u, launchlabPoolAddress as un, CPMM_AMM_CONFIG_DISCRIMINATOR as ur, getSetComputeUnitPriceInstruction as ut, withRemainingAccounts as v, DEFAULT_TIERS as vn, LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT as vr, fetchPoolInventory as vt, findCpmmPool as w, averageMultiplierBps as wn, LAUNCH_SUPPLY as wr, listPools as wt, curveQuote as x, MIN_SEED_MULTIPLIER_BPS as xn, LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR as xr, listDraws as xt, cpmmPoolMatches as y, GaboxMathError as yn, LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR as yr, fetchVaultBalance as yt, preFeeAmount as z, RETRY_SLOTS as zn, decodeLaunchlabPlatformConfig as zt };
4014
+ export { readAccounts as $, uncappedMaximum as $n, poolAddress as $t, wsolAccountFor as A, VRF_PROGRAM_ADDRESS as An, LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT as Ar, CPMM_AMM_CONFIG_HEAD_SIZE as At, remainingBase as B, checkedCount as Bn, RAYDIUM_DEVNET_IDS as Br, decodeCpmmPool as Bt, fetchQuoteBinding as C, INSTRUCTIONS_SYSVAR as Cn, CPMM_COLLECT_CREATOR_FEE as Cr, fetchWalletActivity as Ct, quoteAccountFor as D, SLOT_HASHES_SYSVAR as Dn, LAUNCHLAB_BUY_EXACT_IN as Dr, listPools as Dt, newCurveReserves as E, RETRY_SLOTS as En, CPMM_SWAP_BASE_OUTPUT as Er, listDrawsByPurchaser as Et, curveBuyExactIn as F, MAX_MULTIPLIER_BPS as Fn, LAUNCHLAB_SELL_EXACT_IN as Fr, LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE as Ft, launchlabBuyExactInAccounts as G, perPackCaps as Gn, TOKEN_PROGRAM_ADDRESS as Gr, metaplexSymbol as Gt, cpmmBuyAccounts as H, chooseIndex as Hn, RENT_SYSVAR_ADDRESS as Hr, decodeLaunchlabPlatformConfig as Ht, curveBuyExactOut as I, MIN_SEED_MULTIPLIER_BPS as In, LAUNCH_SUPPLY as Ir, LAUNCHLAB_POOL_STATE_HEAD_SIZE as It, fetchQuoteAsset as J, resolveReservation as Jn, tokenAccountAmount as Jt, launchlabSellAccounts as K, quote as Kn, WSOL_MINT as Kr, mintDecimals as Kt, curveSellExactIn as L, TICKETS as Ln, LAUNCH_TOTAL_BASE_SELL as Lr, LOCKED_CP_LIQUIDITY_DISCRIMINATOR as Lt, ceilDivRate as M, DEFAULT_TIERS as Mn, LAUNCHLAB_INITIALIZE as Mr, CPMM_POOL_STATE_HEAD_SIZE as Mt, cpmmSwapBaseInput as N, GaboxMathError as Nn, LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR as Nr, CPMM_POOL_STATE_SIZE as Nt, resolveVenue as O, TIMEOUT_SLOTS as On, LAUNCHLAB_BUY_EXACT_OUT as Or, quotePool as Ot, cpmmSwapBaseOutput as P, MAX_BATCH_SIZE as Pn, LAUNCHLAB_POOL_STATE_DISCRIMINATOR as Pr, LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE as Pt, decodeBase64 as Q, uncappedAmounts as Qn, drawAddress as Qt, initialCurve as R, TIERS as Rn, METAPLEX_PROGRAM_ADDRESS as Rr, LOCKED_CP_LIQUIDITY_HEAD_SIZE as Rt, fetchCurveSettings as S, IDENTITY_SEED as Sn, CPMM_AMM_CONFIG_DISCRIMINATOR as Sr, fetchVaultBalance as St, newCurveBuyCost as T, PACK_TOKENS as Tn, CPMM_SWAP_BASE_INPUT as Tr, listDrawsByPool as Tt, cpmmSellAccounts as U, maxMultiplierBps as Un, SYSTEM_PROGRAM_ADDRESS as Ur, decodeLaunchlabPool as Ut, totalCurveFeeRate as V, choose as Vn, RAYDIUM_MAINNET_IDS as Vr, decodeLaunchlabGlobalConfig as Vt, launchlabBuyAccounts as W, minTier as Wn, TOKEN_2022_PROGRAM_ADDRESS as Wr, decodeLockedCpLiquidity as Wt, fetchQuoteDisplay as X, settleWith as Xn, activityAddress as Xt, fetchQuoteConfig as Y, seedTokens as Yn, tokenAccountOwnerAndMint as Yt, isQuoteSupported as Z, tierAmount as Zn, associatedTokenAddress as Zt, buildMessage as _, lockedLiquidityAddress as _n, SHARE_FEE_RATE as _r, fetchDraw as _t, fetchLockedPositions as a, cpmmAuthority as an, LAUNCHLAB_SEEDS as ar, DEFAULT_COMPUTE_UNIT_LIMIT as at, creatorFeeOnInput as b, platformFeeVaultAuthority as bn, sortedMints as br, fetchPoolByMint as bt, getHarvestLockedFeesInstructions as c, creatorFeeVaultAddress as cn, LAUNCHLAB_STATUS_TRADE as cr, REDEEM_COMPUTE_UNITS as ct, claimCreatorFee as d, launchlabEventAuthority as dn, MEMO_PROGRAM_ADDRESS as dr, getSetComputeUnitPriceInstruction as dt, randomNonce as en, validatePack as er, BUY_PACK_COMPUTE_UNITS as et, collectCreatorFee as f, launchlabGlobalConfig as fn, METADATA_LIMITS as fr, DRAW_POOL_OFFSET as ft, getLaunchInstruction as g, lockAuthority as gn, RAYDIUM_IDS as gr, POOL_MINT_OFFSET as gt, getCollectCreatorFeeInstructions as h, launchlabVaultAddress as hn, RATE_DENOMINATOR as hr, POOL_CREATOR_OFFSET as ht, claimPlatformFee as i, ata as in, CREATOR_FEE_ON_QUOTE as ir, CREATE_MACHINE_COMPUTE_UNITS as it, ceilDiv as j, BPS as jn, LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR as jr, CPMM_POOL_OFFSETS as jt, sellQuote as k, VRF_DEFAULT_QUEUE as kn, LAUNCHLAB_CLAIM_CREATOR_FEE as kr, tiersOf as kt, harvestLockedFees as l, creatorFeeVaultAuthority as ln, LAUNCH_DECIMALS as lr, computeBudgetInstructions as lt, getClaimCreatorFeeInstructions as m, launchlabPoolAddress as mn, MIGRATE_TO_CPMM as mr, DRAW_SETTLED_OFFSET as mt, getCurveBuyExactInInstruction as n, vaultAddress as nn, CONSTANT_CURVE_TAG as nr, CLAIM_PRIZE_COMPUTE_UNITS as nt, fetchPlatformFees as o, cpmmCreatorFeeShare as on, LAUNCHLAB_STATUS_FUND as or, HARVEST_COMPUTE_UNITS as ot, fetchCreatorFees as p, launchlabPlatformConfig as pn, METADATA_SEED as pr, DRAW_PURCHASER_OFFSET as pt, order as q, reserveFor as qn, token2022Symbol as qt, LOCK_COLLECT_CP_FEES as r, vrfIdentityAddress as rn, CPMM_SEEDS as rr, COMPUTE_BUDGET_PROGRAM_ADDRESS as rt, getClaimPlatformFeeInstructions as s, cpmmPoolAddress as sn, LAUNCHLAB_STATUS_MIGRATE as sr, MAX_COMPUTE_UNIT_LIMIT as st, raydium_exports as t, scopedVrfIdentityAddress as tn, validateTiers as tr, CLAIM_COMPUTE_UNITS as tt, lockedFeeLp as u, launchlabAuthority as un, LOCK_SEEDS as ur, getSetComputeUnitLimitInstruction as ut, withRemainingAccounts as v, metadataAddress as vn, compareAddresses as vr, fetchOwedDraws as vt, findCpmmPool as w, MAX_ATTEMPTS as wn, CPMM_POOL_STATE_DISCRIMINATOR as wr, listDraws as wt, curveQuote as x, GABOX_PROGRAM_ID as xn, ASSOCIATED_TOKEN_PROGRAM_ADDRESS as xr, fetchPoolInventory as xt, cpmmPoolMatches as y, platformFeeVaultAddress as yn, raydiumIds as yr, fetchPoolAt as yt, preFeeAmount as z, averageMultiplierBps as zn, PLATFORM_ADMIN as zr, decodeCpmmAmmConfig as zt };
3837
4015
 
3838
- //# sourceMappingURL=raydium-DIF1WOvI.js.map
4016
+ //# sourceMappingURL=raydium-BZT4-i79.js.map