@gabox-labs/sdk 0.2.0 → 0.6.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 +226 -0
- package/README.md +116 -460
- package/dist/generated/index.d.ts +334 -755
- package/dist/generated/index.js +2403 -338
- package/dist/generated/index.js.map +1 -1
- package/dist/index-BDfGvmgF.d.ts +934 -0
- package/dist/index.d.ts +191 -448
- package/dist/index.js +468 -1034
- package/dist/index.js.map +1 -1
- package/dist/raydium/index.d.ts +2 -0
- package/dist/raydium/index.js +2 -0
- package/dist/raydium-B-l9V3O-.js +2604 -0
- package/dist/raydium-B-l9V3O-.js.map +1 -0
- package/llms.txt +4 -2
- package/package.json +11 -16
- package/skills/gabox-sdk/SKILL.md +40 -142
- package/skills/gabox-sdk/references/api.md +103 -145
- package/dist/gaboxV2-CV2XltqC.js +0 -3347
- package/dist/gaboxV2-CV2XltqC.js.map +0 -1
- package/dist/index-BxvSkzCO.d.ts +0 -471
- package/dist/pump/index.d.ts +0 -2
- package/dist/pump/index.js +0 -2
- package/dist/pump-D0K_0uiC.js +0 -1531
- package/dist/pump-D0K_0uiC.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import { DRAW_DISCRIMINATOR, Draw, DrawResolvedEvent,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { DRAW_DISCRIMINATOR, Draw, DrawResolvedEvent, POOL_DISCRIMINATOR, PackBoughtEvent, Pool, PoolCreatedEvent, PrizesFundedEvent, RandomnessRetriedEvent, TokensSoldEvent, WALLET_ACTIVITY_DISCRIMINATOR, WalletActivity, decodeDraw, decodePool, decodeWalletActivity, findActivityPda, findDrawPda, findIdentityPda, findPoolPda, t as index_d_exports } from "./generated/index.js";
|
|
2
|
+
import { An as Cluster, Cn as SYSTEM_PROGRAM_ADDRESS, Dn as WSOL_MINT, Fn as GaboxRpcSubscriptions, G as VenueKind, I as BuildOptions, In as assertClusterUrl, L as GaboxTransactionMessage, Ln as clusterNamedBy, Mn as DEVNET_WS, Nn as GaboxClient, On as CLUSTER_ENDPOINTS, Pn as GaboxRpc, R as buildMessage, Rn as createClient, Wt as LAUNCH_DECIMALS, _n as METAPLEX_PROGRAM_ADDRESS, jn as DEVNET_HTTP, kn as ClientConfig, t as index_d_exports$1, tn as ASSOCIATED_TOKEN_PROGRAM_ADDRESS, vn as PLATFORM_ADMIN, wn as TOKEN_PROGRAM_ADDRESS, z as withRemainingAccounts, zn as websocketUrlFor } from "./index-BDfGvmgF.js";
|
|
3
|
+
import { Address, AddressesByLookupTableAddress, Instruction, InstructionWithData, ProgramDerivedAddress, ReadonlyUint8Array, TransactionSigner } from "@solana/kit";
|
|
4
4
|
//#region src/math.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* A bigint port of `programs/gabox
|
|
6
|
+
* A bigint port of `programs/gabox/src/math.rs`.
|
|
7
7
|
*
|
|
8
8
|
* The point is that a client can show a buyer the exact prize table the program will freeze into
|
|
9
9
|
* their `Draw`, before they pay. Every rounding step here matches the Rust, including the direction
|
|
10
|
-
* of each division. `test/math.test.ts` runs the same vectors as `programs/gabox
|
|
11
|
-
* economics.rs`.
|
|
10
|
+
* of each division. `test/math.test.ts` runs the same vectors as `programs/gabox/tests/math.rs`.
|
|
12
11
|
*
|
|
13
12
|
* All amounts are `bigint`, in the mint's smallest unit. `multiplierBps` and `tickets` are numbers
|
|
14
13
|
* because both are `u32` in the program and both stay small.
|
|
15
14
|
*/
|
|
16
15
|
/** Basis points. A multiplier of 10_000 pays back exactly one pack. */
|
|
17
16
|
export declare const BPS = 10000n;
|
|
18
|
-
/**
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `constants::MIN_SEED_MULTIPLIER_BPS`. The mandatory seed makes a 3x top prize payable on the
|
|
19
|
+
* first pack, or the full top prize when the table's top tier is below 3x. A creator can add more
|
|
20
|
+
* seed on top through `extraSeedTokens`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MIN_SEED_MULTIPLIER_BPS = 30000;
|
|
23
|
+
/**
|
|
24
|
+
* `constants::MAX_MULTIPLIER_BPS`. A table's top tier can be at most 20x. Seed beyond what a 20x
|
|
25
|
+
* prize needs stays in the vault as backup for the draws after a top-tier hit.
|
|
26
|
+
*/
|
|
27
|
+
export declare const MAX_MULTIPLIER_BPS = 200000;
|
|
20
28
|
/** Ticket counts must sum to this. A uniform 16-bit word then maps with no modulo bias. */
|
|
21
29
|
export declare const TICKETS = 65536;
|
|
22
30
|
/** The prize table has exactly this many slots. Unused slots are all-zero. */
|
|
@@ -33,7 +41,7 @@ export type Prize = {
|
|
|
33
41
|
amount: bigint;
|
|
34
42
|
tickets: number;
|
|
35
43
|
};
|
|
36
|
-
/** What
|
|
44
|
+
/** What a pack buy writes into the `Draw`. `minimum` is also the timeout payout. */
|
|
37
45
|
export type Offer = {
|
|
38
46
|
prizes: Prize[];
|
|
39
47
|
maximum: bigint;
|
|
@@ -58,9 +66,10 @@ export declare function tierAmount(base: bigint, multiplierBps: number): bigint;
|
|
|
58
66
|
/**
|
|
59
67
|
* `math::validate`. Checks the table alone, with no base.
|
|
60
68
|
*
|
|
61
|
-
*
|
|
69
|
+
* Four rules, and each one closes a way to sell a bad ticket:
|
|
62
70
|
* - ticket counts sum to exactly 65,536, so the 16-bit draw is uniform;
|
|
63
71
|
* - an unused row is all-zero, so a hidden multiplier cannot ride along;
|
|
72
|
+
* - a ticketed tier's multiplier is from 1 to `MAX_MULTIPLIER_BPS` (20x);
|
|
64
73
|
* - the expected multiplier over all tickets is at most 1x, so the table cannot promise more
|
|
65
74
|
* tokens than a pack buys. This bounds tokens, not cash value.
|
|
66
75
|
*/
|
|
@@ -73,17 +82,22 @@ export declare function validateTiers(tiers: readonly Readonly<Tier>[]): void;
|
|
|
73
82
|
*/
|
|
74
83
|
export declare function validatePack(packTokens: bigint, tiers: readonly Readonly<Tier>[]): void;
|
|
75
84
|
/**
|
|
76
|
-
* `math::seed_tokens`. The seed a table needs, in tokens.
|
|
85
|
+
* `math::seed_tokens`. The mandatory seed a table needs, in tokens.
|
|
77
86
|
*
|
|
78
|
-
* The
|
|
79
|
-
*
|
|
87
|
+
* The mandatory seed makes a 3x top prize payable on the first pack, or the full top prize when
|
|
88
|
+
* the table's top tier is below 3x. A jackpot above 3x still shows the full table once later
|
|
89
|
+
* packs grow the free vault; the mandatory seed alone does not have to fund it. The pack itself
|
|
90
|
+
* brings `packTokens` into the vault, so the vault has to hold the rest beforehand:
|
|
80
91
|
*
|
|
81
|
-
* seedTokens = uncappedMaximum(packTokens, tiers) - packTokens
|
|
92
|
+
* seedTokens = min(uncappedMaximum(packTokens, tiers), tierAmount(packTokens, MIN_SEED_MULTIPLIER_BPS)) - packTokens
|
|
82
93
|
*
|
|
83
|
-
* A
|
|
84
|
-
*
|
|
94
|
+
* A 20x or a 3x top tier on a 1M-token pack both need a 2M-token seed, since the mandatory seed
|
|
95
|
+
* stops at the 3x minimum. A 2x top tier needs a 1M-token seed, already below the minimum. A
|
|
96
|
+
* table whose top tier pays exactly one pack needs no seed. A top tier below one pack is refused:
|
|
97
|
+
* every ticket would lose. `createMachine` lets a creator add more seed on top of this mandatory
|
|
98
|
+
* amount through `extraSeedTokens`, for example to fund a top tier above 3x from the first pack.
|
|
85
99
|
*
|
|
86
|
-
*
|
|
100
|
+
* Pool initialization computes this number itself and buys exactly that many tokens on the curve.
|
|
87
101
|
* The creator only signs a maximum SOL cost.
|
|
88
102
|
*/
|
|
89
103
|
export declare function seedTokens(packTokens: bigint, tiers: readonly Readonly<Tier>[]): bigint;
|
|
@@ -125,30 +139,18 @@ export declare function maxMultiplierBps(tiers: readonly Readonly<Tier>[]): numb
|
|
|
125
139
|
export declare function averageMultiplierBps(tiers: readonly Readonly<Tier>[]): number;
|
|
126
140
|
//#endregion
|
|
127
141
|
//#region src/accounts.d.ts
|
|
128
|
-
/** `Draw.pool` sits straight after the discriminator. */
|
|
129
142
|
export declare const DRAW_POOL_OFFSET = 8;
|
|
130
|
-
/** `Draw.purchaser` sits after the discriminator and `pool`. */
|
|
131
143
|
export declare const DRAW_PURCHASER_OFFSET: number;
|
|
132
|
-
/** `Pool.creator` sits straight after the discriminator. */
|
|
133
144
|
export declare const POOL_CREATOR_OFFSET = 8;
|
|
134
|
-
/** `Pool.mint` sits after the discriminator and `creator`. */
|
|
135
145
|
export declare const POOL_MINT_OFFSET: number;
|
|
136
|
-
/** `ReferralLink.referrer` sits after the discriminator and `referee`. */
|
|
137
|
-
export declare const REFERRAL_LINK_REFERRER_OFFSET: number;
|
|
138
|
-
/** The pool for a coin, or `null` when the coin has no machine. */
|
|
139
146
|
export declare function fetchPoolByMint(client: GaboxClient, mint: Address): Promise<Pool | null>;
|
|
140
|
-
/**
|
|
141
|
-
* A pool by its own address, or `null`.
|
|
142
|
-
*
|
|
143
|
-
* `fetchPoolByMint` is the usual way in, because a coin's mint is the natural key. This one is for
|
|
144
|
-
* the other direction: a `Draw` names its pool and not its mint, so a client holding a draw reads
|
|
145
|
-
* the pool to learn which coin it belongs to.
|
|
146
|
-
*/
|
|
147
147
|
export declare function fetchPoolAt(client: GaboxClient, address: Address): Promise<Pool | null>;
|
|
148
|
-
/** A draw by address, or `null`. Delivered and legacy-claimed draws are closed. */
|
|
149
148
|
export declare function fetchDraw(client: GaboxClient, address: Address): Promise<Draw | null>;
|
|
150
|
-
/**
|
|
151
|
-
|
|
149
|
+
/**
|
|
150
|
+
* A wallet's lifetime pack-buying activity, or `null` before it has bought its first pack.
|
|
151
|
+
* `buy_pack` creates this account `init_if_needed`, so a fresh wallet has none yet.
|
|
152
|
+
*/
|
|
153
|
+
export declare function fetchWalletActivity(client: GaboxClient, wallet: Address): Promise<WalletActivity | null>;
|
|
152
154
|
export type PoolRecord = {
|
|
153
155
|
address: Address;
|
|
154
156
|
data: Pool;
|
|
@@ -157,81 +159,25 @@ export type DrawRecord = {
|
|
|
157
159
|
address: Address;
|
|
158
160
|
data: Draw;
|
|
159
161
|
};
|
|
160
|
-
/**
|
|
161
|
-
* Every current-layout machine, by discriminator and account size. Older devnet
|
|
162
|
-
* pools predate seed fields and must not be decoded with the current schema.
|
|
163
|
-
*
|
|
164
|
-
* There is no on-chain registry — the design says so on purpose — so discovery is this scan plus
|
|
165
|
-
* the `PoolCreated` event. Public RPCs limit `getProgramAccounts`, so an app that lists machines
|
|
166
|
-
* for users should cache the result rather than call this per page view.
|
|
167
|
-
*/
|
|
168
162
|
export declare function listPools(client: GaboxClient): Promise<PoolRecord[]>;
|
|
169
|
-
/** Every draw of one pool, pending or ready. Closed draws are gone and never appear. */
|
|
170
|
-
export declare function listDrawsByPool(client: GaboxClient, pool: Address): Promise<DrawRecord[]>;
|
|
171
|
-
/**
|
|
172
|
-
* Every open draw of one wallet, across all pools. This is the "what am I owed" query.
|
|
173
|
-
*
|
|
174
|
-
* An address is already base58, so it goes into the filter unchanged.
|
|
175
|
-
*/
|
|
176
|
-
export declare function listDrawsByPurchaser(client: GaboxClient, purchaser: Address): Promise<DrawRecord[]>;
|
|
177
163
|
export type DrawQuery = {
|
|
178
|
-
/** A pool PDA. */
|
|
179
164
|
pool?: Address;
|
|
180
|
-
/** A buyer's wallet. */
|
|
181
165
|
purchaser?: Address;
|
|
182
166
|
};
|
|
183
|
-
/**
|
|
184
|
-
* Open draws, narrowed by pool, by purchaser, or by both.
|
|
185
|
-
*
|
|
186
|
-
* Both filters in one scan, because a UI asks for exactly that: "my pulls on this machine". Two
|
|
187
|
-
* separate scans and an intersection in the client would move twice the bytes and could disagree
|
|
188
|
-
* with itself, since the two reads happen at different slots. With neither filter this lists every
|
|
189
|
-
* open draw of every machine.
|
|
190
|
-
*/
|
|
191
167
|
export declare function listDraws(client: GaboxClient, query?: DrawQuery): Promise<DrawRecord[]>;
|
|
192
|
-
export
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* Every wallet bound to one referrer. This is the "who did I refer" query.
|
|
198
|
-
*
|
|
199
|
-
* A scan, because a link is seeded on the referee and nothing on chain indexes it by referrer.
|
|
200
|
-
* The list is small in practice, and a dashboard reads it once per load, not per poll.
|
|
201
|
-
*/
|
|
202
|
-
export declare function listReferralLinksByReferrer(client: GaboxClient, referrer: Address): Promise<ReferralLinkRecord[]>;
|
|
203
|
-
/** The vault's token balance. `0` when the vault does not exist yet. */
|
|
204
|
-
export declare function fetchVaultBalance(client: GaboxClient, mint: Address, tokenProgram?: Address): Promise<bigint>;
|
|
168
|
+
export declare const listDrawsByPool: (client: GaboxClient, pool: Address) => Promise<DrawRecord[]>;
|
|
169
|
+
export declare const listDrawsByPurchaser: (client: GaboxClient, purchaser: Address) => Promise<DrawRecord[]>;
|
|
170
|
+
export declare function fetchVaultBalance(client: GaboxClient, mint: Address): Promise<bigint>;
|
|
205
171
|
export type PoolInventory = {
|
|
206
|
-
pool: Pool;
|
|
207
172
|
poolAddress: Address;
|
|
208
|
-
|
|
209
|
-
/** The vault's whole token balance. */
|
|
173
|
+
pool: Pool;
|
|
210
174
|
inventory: bigint;
|
|
211
|
-
/** `pool.reserved`: maximum awards reserved by pending draws. */
|
|
212
175
|
reserved: bigint;
|
|
213
|
-
/** `inventory - reserved`. What a new pack's prizes can be paid from, besides its own tokens. */
|
|
214
176
|
free: bigint;
|
|
215
177
|
};
|
|
216
|
-
/**
|
|
217
|
-
* A pool with its live inventory. This is the pair every price display needs: the tiers are
|
|
218
|
-
* immutable, but what they actually pay depends on what is free in the vault right now.
|
|
219
|
-
*
|
|
220
|
-
* # Why one request reads both accounts
|
|
221
|
-
*
|
|
222
|
-
* The oracle callback lowers the vault and `pool.reserved` in one transaction, a few seconds after
|
|
223
|
-
* a buy. Two separate reads can land on either side of it: the old `reserved` with the new, smaller
|
|
224
|
-
* vault. That pair looks insolvent, and `quote` rightly refuses it. One `getMultipleAccounts` call
|
|
225
|
-
* returns both accounts from the same slot, so the pair is always one the chain actually held.
|
|
226
|
-
*/
|
|
227
178
|
export declare function fetchPoolInventory(client: GaboxClient, mint: Address): Promise<PoolInventory | null>;
|
|
228
|
-
/** The generated `Tier` uses the same field names as `math.ts`, so this is only a widening. */
|
|
229
179
|
export declare const tiersOf: (pool: Pool) => Tier[];
|
|
230
|
-
|
|
231
|
-
* The offer a pack of `base` tokens would freeze against this inventory. Pure — the same
|
|
232
|
-
* computation `buy_pack` performs, and the reason a client can show real amounts before paying.
|
|
233
|
-
*/
|
|
234
|
-
export declare const offerFor: (inventory: PoolInventory, base: bigint) => Offer;
|
|
180
|
+
export declare const quotePool: (inventory: PoolInventory) => Offer;
|
|
235
181
|
//#endregion
|
|
236
182
|
//#region src/compute.d.ts
|
|
237
183
|
export declare const COMPUTE_BUDGET_PROGRAM_ADDRESS: Address;
|
|
@@ -240,19 +186,28 @@ export declare const MAX_COMPUTE_UNIT_LIMIT = 1400000;
|
|
|
240
186
|
/** What an instruction gets when no `SetComputeUnitLimit` is present. */
|
|
241
187
|
export declare const DEFAULT_COMPUTE_UNIT_LIMIT = 200000;
|
|
242
188
|
/**
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
|
|
189
|
+
* LaunchLab `initialize_v2`, the WSOL wrap, pool initialization with a seed buy, and the WSOL
|
|
190
|
+
* close, in one transaction. Measured at `293,004`, `264,249` and `268,749`. The first run is the
|
|
191
|
+
* worst case: that creator had no LaunchLab fee vault yet, so the transaction created one.
|
|
192
|
+
*/
|
|
193
|
+
export declare const CREATE_MACHINE_COMPUTE_UNITS = 385000;
|
|
194
|
+
/**
|
|
195
|
+
* A WSOL wrap, a venue buy, an escrow transfer, a draw init, a VRF request and the WSOL close.
|
|
196
|
+
* Measured at `164,717`, `167,723` and `181,225` on the curve, and `116,332`, `113,342` and
|
|
197
|
+
* `119,334` on CPMM. The curve buy is dearer because a coin's first trade also creates the platform
|
|
198
|
+
* and creator fee vaults.
|
|
247
199
|
*/
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
export declare const REDEEM_COMPUTE_UNITS =
|
|
254
|
-
/**
|
|
255
|
-
|
|
200
|
+
export declare const BUY_PACK_COMPUTE_UNITS = 240000;
|
|
201
|
+
/**
|
|
202
|
+
* A WSOL wrap, a venue sale, and the WSOL close. Measured at `93,827`, `93,827` and `101,327` on
|
|
203
|
+
* the curve, and `61,041`, `64,041` and `67,041` on CPMM.
|
|
204
|
+
*/
|
|
205
|
+
export declare const REDEEM_COMPUTE_UNITS = 135000;
|
|
206
|
+
/**
|
|
207
|
+
* A creator fee claim: create the WSOL account, claim or collect, close it again. Measured at
|
|
208
|
+
* `31,319` every run for the LaunchLab claim, and `40,959` every run for the CPMM collect.
|
|
209
|
+
*/
|
|
210
|
+
export declare const CLAIM_COMPUTE_UNITS = 55000;
|
|
256
211
|
/** An instruction for the compute budget program: no accounts, all of it in the data. */
|
|
257
212
|
export type ComputeBudgetInstruction = Instruction<string, readonly []> & InstructionWithData<ReadonlyUint8Array>;
|
|
258
213
|
export declare function getSetComputeUnitLimitInstruction(units: number): ComputeBudgetInstruction;
|
|
@@ -268,58 +223,6 @@ export declare function getSetComputeUnitPriceInstruction(microLamports: number
|
|
|
268
223
|
/** The compute budget prefix a builder prepends: a limit, and a price only when one is asked for. */
|
|
269
224
|
export declare function computeBudgetInstructions(units: number, microLamports?: number | bigint): ComputeBudgetInstruction[];
|
|
270
225
|
//#endregion
|
|
271
|
-
//#region src/ids.d.ts
|
|
272
|
-
/** `declare_id!` in `programs/gabox-v2/src/lib.rs`. */
|
|
273
|
-
export declare const GABOX_PROGRAM_ID: Address<"GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA">;
|
|
274
|
-
/** Classic SPL Token. The quote side of every Pump trade uses it, because the quote is WSOL. */
|
|
275
|
-
export declare const TOKEN_PROGRAM_ADDRESS: Address;
|
|
276
|
-
/**
|
|
277
|
-
* Token-2022. Pump `create_v2` mints here, so every coin a machine is built on is a Token-2022
|
|
278
|
-
* mint and the pool vault ATA lives under this program.
|
|
279
|
-
*/
|
|
280
|
-
export declare const TOKEN_2022_PROGRAM_ADDRESS: Address;
|
|
281
|
-
/** Wrapped SOL. The quote mint on both venues. */
|
|
282
|
-
export declare const WSOL_MINT: Address;
|
|
283
|
-
/** MagicBlock's ephemeral VRF program. `vrf.rs` pins it and refuses any other. */
|
|
284
|
-
export declare const VRF_PROGRAM_ADDRESS: Address;
|
|
285
|
-
/**
|
|
286
|
-
* MagicBlock's default oracle queue. The program pins this one address, so a pool creator cannot
|
|
287
|
-
* point a draw at an oracle they control.
|
|
288
|
-
*/
|
|
289
|
-
export declare const VRF_DEFAULT_QUEUE: Address;
|
|
290
|
-
/** The seed of both identity PDAs. See `pdas.ts` — there are two, under different programs. */
|
|
291
|
-
export declare const IDENTITY_SEED: Uint8Array<ArrayBuffer>;
|
|
292
|
-
export declare const SLOT_HASHES_SYSVAR: Address;
|
|
293
|
-
export declare const INSTRUCTIONS_SYSVAR: Address;
|
|
294
|
-
/** `state.rs`. A retry may not run sooner than this after the last attempt. */
|
|
295
|
-
export declare const RETRY_SLOTS = 300n;
|
|
296
|
-
/** `state.rs`. After this many slots from the purchase, anyone may expire the draw. */
|
|
297
|
-
export declare const TIMEOUT_SLOTS = 216000n;
|
|
298
|
-
/** `state.rs`. Three requests in total, counting the one `buy_pack` makes. */
|
|
299
|
-
export declare const MAX_ATTEMPTS = 3;
|
|
300
|
-
/**
|
|
301
|
-
* `state.rs`. Tokens in one pack, in base units: 1,000,000 tokens at Pump's fixed 6 decimals, or
|
|
302
|
-
* 0.1% of the 1,000,000,000 supply. Every pool sells packs of this size. The venue decides what a
|
|
303
|
-
* pack costs, so the pack price follows the coin. Read `pool.packTokens` rather than this when a
|
|
304
|
-
* pool is at hand: a later program version may change the constant.
|
|
305
|
-
*/
|
|
306
|
-
export declare const PACK_TOKENS: bigint;
|
|
307
|
-
/** `state.rs`. The creator's per-pack fee, in bps of what the venue charged, may not exceed this. */
|
|
308
|
-
export declare const MAX_FEE_BPS = 100;
|
|
309
|
-
/** Referral reward: 1% of the creator fee, deducted from that fee. */
|
|
310
|
-
export declare const REFERRAL_FEE_BPS = 100n;
|
|
311
|
-
/** `state.rs`. The protocol's share of every pack's venue cost and of every sale's proceeds, in bps. */
|
|
312
|
-
export declare const PROTOCOL_FEE_BPS = 100n;
|
|
313
|
-
/**
|
|
314
|
-
* `PROTOCOL_FEE_COLLECTOR` in `state.rs`. Every pack pays 1% of its venue cost here, on top of
|
|
315
|
-
* that cost. Every sale through the program pays 1% of its proceeds here: SOL on Pump, WSOL (into the
|
|
316
|
-
* collector's WSOL ATA) on PumpSwap. The same key holds the program's upgrade authority.
|
|
317
|
-
*
|
|
318
|
-
* The generated instructions pin it as an `address` constraint, and `test/instruction-data.test.ts`
|
|
319
|
-
* checks this copy against the IDL.
|
|
320
|
-
*/
|
|
321
|
-
export declare const PROTOCOL_FEE_COLLECTOR: Address;
|
|
322
|
-
//#endregion
|
|
323
226
|
//#region src/events.d.ts
|
|
324
227
|
export type GaboxEvent = {
|
|
325
228
|
name: 'PoolCreated';
|
|
@@ -336,42 +239,51 @@ export type GaboxEvent = {
|
|
|
336
239
|
} | {
|
|
337
240
|
name: 'DrawResolved';
|
|
338
241
|
data: DrawResolvedEvent;
|
|
339
|
-
} | {
|
|
340
|
-
name: 'PrizeRedeemed';
|
|
341
|
-
data: PrizeRedeemedEvent;
|
|
342
242
|
} | {
|
|
343
243
|
name: 'TokensSold';
|
|
344
244
|
data: TokensSoldEvent;
|
|
345
245
|
};
|
|
346
|
-
/** Decode one `Program data:` payload, or `null` when it is not one of ours. */
|
|
347
246
|
export declare function decodeEvent(data: Uint8Array): GaboxEvent | null;
|
|
348
247
|
/**
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
* rather than reported. Another program in the same transaction emits its own events, and they are
|
|
353
|
-
* not an error here.
|
|
248
|
+
* Decode only Gabox events committed by successful runtime frames. Program logs are emitted before
|
|
249
|
+
* transaction commit and are forgeable by arbitrary programs, so `Program data` is authenticated
|
|
250
|
+
* by the canonical invoke/success stack and buffered until every enclosing frame succeeds.
|
|
354
251
|
*/
|
|
355
252
|
export declare function decodeEvents(logs: readonly string[]): GaboxEvent[];
|
|
356
|
-
/** Fetch a transaction and decode the gabox events it emitted. */
|
|
357
253
|
export declare function fetchEvents(client: GaboxClient, signature: string): Promise<GaboxEvent[]>;
|
|
358
|
-
export type
|
|
359
|
-
|
|
360
|
-
signal?: AbortSignal;
|
|
361
|
-
/** Called on every account change, including the ones that are still `Pending`. */
|
|
362
|
-
onChange?: (draw: Draw) => void;
|
|
254
|
+
export type ResolvedDraw = DrawResolvedEvent & {
|
|
255
|
+
address: Address;
|
|
363
256
|
};
|
|
257
|
+
/** Poll final resolution events for one closed draw address. There is no separate Ready/claim state to poll instead. */
|
|
258
|
+
export declare function findResolvedDraw(client: GaboxClient, address: Address): Promise<ResolvedDraw | null>;
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/ids.d.ts
|
|
261
|
+
/** `declare_id!` in `programs/gabox/src/lib.rs`. */
|
|
262
|
+
export declare const GABOX_PROGRAM_ID: Address<"GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA">;
|
|
263
|
+
/** MagicBlock's ephemeral VRF program. `vrf.rs` pins it and refuses any other. */
|
|
264
|
+
export declare const VRF_PROGRAM_ADDRESS: Address;
|
|
364
265
|
/**
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
266
|
+
* MagicBlock's default oracle queue. The program pins this one address, so a pool creator cannot
|
|
267
|
+
* point a draw at an oracle they control.
|
|
268
|
+
*/
|
|
269
|
+
export declare const VRF_DEFAULT_QUEUE: Address;
|
|
270
|
+
/** The seed of both identity PDAs. See `pdas.ts` — there are two, under different programs. */
|
|
271
|
+
export declare const IDENTITY_SEED: Uint8Array<ArrayBuffer>;
|
|
272
|
+
export declare const SLOT_HASHES_SYSVAR: Address;
|
|
273
|
+
export declare const INSTRUCTIONS_SYSVAR: Address;
|
|
274
|
+
/** `constants.rs`. A retry may not run sooner than this after the last attempt. */
|
|
275
|
+
export declare const RETRY_SLOTS = 300n;
|
|
276
|
+
/** `constants.rs`. After this many slots from the purchase, anyone may expire the draw. */
|
|
277
|
+
export declare const TIMEOUT_SLOTS = 216000n;
|
|
278
|
+
/** `constants.rs`. Three requests in total, counting the one `buy_pack` makes. */
|
|
279
|
+
export declare const MAX_ATTEMPTS = 3;
|
|
280
|
+
/**
|
|
281
|
+
* `constants.rs`. Tokens in one pack, in base units: 1,000,000 tokens at the fixed 6 decimals, or
|
|
282
|
+
* 0.1% of the 1,000,000,000 supply. Every pool sells packs of this size. The venue decides what a
|
|
283
|
+
* pack costs, so the pack price follows the coin. Read `pool.packTokens` rather than this when a
|
|
284
|
+
* pool is at hand: a later program version may change the constant.
|
|
373
285
|
*/
|
|
374
|
-
export declare
|
|
286
|
+
export declare const PACK_TOKENS: bigint;
|
|
375
287
|
//#endregion
|
|
376
288
|
//#region src/lookupTables.d.ts
|
|
377
289
|
export declare const DEVNET_LOOKUP_TABLE_ADDRESS: Address<"Cx4ri1BU2bnDXPjnJykF3nbY2u4MD5pPvzFCJtNizWFa">;
|
|
@@ -394,16 +306,12 @@ export type PackOffer = {
|
|
|
394
306
|
/** The fixed token count of one pack. Every prize is a multiple of this. */
|
|
395
307
|
packTokens: bigint;
|
|
396
308
|
/** What the venue charges for `packTokens` right now, its own fees included. The pack price. */
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
protocolLamports: bigint;
|
|
404
|
-
/** What the seed cost the creator at creation. Display only. */
|
|
405
|
-
seedLamports: bigint;
|
|
406
|
-
/** Tokens the seed locked in the vault: `(maxMultiplier - 1x)` packs. */
|
|
309
|
+
quoteAmount: bigint;
|
|
310
|
+
/** Always WSOL today. Both venues settle in it; there is no native-SOL path. */
|
|
311
|
+
quoteMint: Address;
|
|
312
|
+
/** What the seed cost the creator at creation, in WSOL. Display only. */
|
|
313
|
+
seedQuoteAmount: bigint;
|
|
314
|
+
/** Tokens the seed locked in the vault. Derived from the live table. */
|
|
407
315
|
seedTokens: bigint;
|
|
408
316
|
/** Which venue the buy would route to right now. */
|
|
409
317
|
venue: VenueKind;
|
|
@@ -413,8 +321,10 @@ export type PackOffer = {
|
|
|
413
321
|
maximum: bigint;
|
|
414
322
|
/** The smallest prize. Also what a timed-out draw pays. */
|
|
415
323
|
minimum: bigint;
|
|
416
|
-
/**
|
|
417
|
-
*
|
|
324
|
+
/**
|
|
325
|
+
* The top prize with no inventory cap: the jackpot in tokens. Equal to `maximum` unless the
|
|
326
|
+
* inventory cap bites.
|
|
327
|
+
*/
|
|
418
328
|
uncapped: bigint;
|
|
419
329
|
/** Vault balance, `pool.reserved`, and the difference. */
|
|
420
330
|
inventory: bigint;
|
|
@@ -435,7 +345,7 @@ export type PackOffer = {
|
|
|
435
345
|
averageMultiplierBps: number;
|
|
436
346
|
};
|
|
437
347
|
export type GetOfferOptions = {
|
|
438
|
-
/** Force a venue instead of reading the
|
|
348
|
+
/** Force a venue instead of reading the LaunchLab pool's `status`. */
|
|
439
349
|
venue?: VenueKind;
|
|
440
350
|
/** The buyer, when you already know it. Only changes the account list, never the numbers. */
|
|
441
351
|
user?: Address;
|
|
@@ -448,10 +358,10 @@ export type GetOfferOptions = {
|
|
|
448
358
|
export declare function getOffer(client: GaboxClient, mint: Address, options?: GetOfferOptions): Promise<PackOffer>;
|
|
449
359
|
/**
|
|
450
360
|
* The same computation with the reads already done. Useful when a caller holds a `ResolvedVenue`
|
|
451
|
-
* and wants to re-price without touching the network. `
|
|
361
|
+
* and wants to re-price without touching the network. `quoteAmount` is
|
|
452
362
|
* `venue.quoteBuy(pool.packTokens)`.
|
|
453
363
|
*/
|
|
454
|
-
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind,
|
|
364
|
+
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint): PackOffer;
|
|
455
365
|
/**
|
|
456
366
|
* How short of the top prize a pool is, in tokens. `0` when it pays the whole table.
|
|
457
367
|
*
|
|
@@ -462,116 +372,38 @@ export declare function offerFromState(inventory: PoolInventory, venue: VenueKin
|
|
|
462
372
|
export declare function seedShortfall(offer: PackOffer): bigint;
|
|
463
373
|
//#endregion
|
|
464
374
|
//#region src/pdas.d.ts
|
|
465
|
-
/** `[
|
|
466
|
-
export declare
|
|
467
|
-
/** `[
|
|
468
|
-
export declare
|
|
469
|
-
/**
|
|
470
|
-
export declare
|
|
471
|
-
/** `["
|
|
472
|
-
export declare
|
|
473
|
-
/**
|
|
474
|
-
* `["identity"]` under gabox. This is the PDA gabox signs the VRF request with — the `identity`
|
|
475
|
-
* account of the `Oracle` group on `buy_pack` and `retry_draw`.
|
|
476
|
-
*/
|
|
477
|
-
export declare function vrfIdentityAddress(): Promise<Address>;
|
|
478
|
-
/**
|
|
479
|
-
* `["identity", gabox_program_id]` under the **VRF program**. A different address from
|
|
480
|
-
* `vrfIdentityAddress`, and it belongs to the other side: MagicBlock signs the `deliver_draw`
|
|
481
|
-
* callback with it. A client never puts it in an instruction. It is here so a client can recognise
|
|
482
|
-
* the signer on a callback transaction.
|
|
483
|
-
*/
|
|
375
|
+
/** `["pool", mint]`. One pool per coin. */
|
|
376
|
+
export declare const poolAddress: (mint: Address) => Promise<Address>;
|
|
377
|
+
/** `["draw", pool, seq]`, with the sequence as eight little-endian bytes. */
|
|
378
|
+
export declare const drawAddress: (pool: Address, seq: bigint) => Promise<Address>;
|
|
379
|
+
/** The per-wallet `WalletActivity` PDA. `buy_pack` derives it from the purchaser automatically. */
|
|
380
|
+
export declare const activityAddress: (wallet: Address) => Promise<Address>;
|
|
381
|
+
/** `["identity"]` under Gabox. The PDA the program signs its randomness request with. */
|
|
382
|
+
export declare const vrfIdentityAddress: () => Promise<Address>;
|
|
383
|
+
/** `["identity", gabox_program_id]` under the VRF program. MagicBlock signs the callback with it. */
|
|
484
384
|
export declare function scopedVrfIdentityAddress(): Promise<ProgramDerivedAddress>;
|
|
485
|
-
/**
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
export declare function associatedTokenAddress(owner: Address, mint: Address, tokenProgram?: Address): Promise<Address>;
|
|
490
|
-
/**
|
|
491
|
-
* The protocol fee collector's WSOL ATA, under classic SPL Token. A sale on PumpSwap pays its
|
|
492
|
-
* protocol fee here. The account must exist before the first PumpSwap sale; see `DEPLOYMENT.md`.
|
|
493
|
-
*/
|
|
494
|
-
export declare function feeCollectorWsolAddress(): Promise<Address>;
|
|
495
|
-
/**
|
|
496
|
-
* The pool's prize inventory: the pool PDA's ATA for the mint's own token program.
|
|
497
|
-
*
|
|
498
|
-
* `tokenProgram` defaults to Token-2022 because Pump `create_v2` mints there, and every machine is
|
|
499
|
-
* built on a coin Pump created. Pass the mint's real owner if you have it.
|
|
500
|
-
*/
|
|
501
|
-
export declare function vaultAddress(mint: Address, tokenProgram?: Address): Promise<Address>;
|
|
502
|
-
//#endregion
|
|
503
|
-
//#region src/tx/message.d.ts
|
|
504
|
-
/**
|
|
505
|
-
* What every builder returns: a version 0 message with a fee-payer signer and a blockhash
|
|
506
|
-
* lifetime, ready for `signTransactionMessageWithSigners`.
|
|
507
|
-
*
|
|
508
|
-
* Named, and built only from types `@solana/kit` exports, so the published declaration file
|
|
509
|
-
* refers to kit's types instead of copying them. `pipe`'s inferred type is a long intersection
|
|
510
|
-
* of kit-internal brands, and a copy of a branded type is not assignable to the original.
|
|
511
|
-
*/
|
|
512
|
-
export type GaboxTransactionMessage = Extract<TransactionMessage, {
|
|
513
|
-
version: 0;
|
|
514
|
-
}> & TransactionMessageWithFeePayerSigner & TransactionMessageWithBlockhashLifetime;
|
|
515
|
-
export type BuildOptions = {
|
|
516
|
-
/** Compute units to request. Each builder passes its own default. */
|
|
517
|
-
computeUnitLimit: number;
|
|
518
|
-
/** Priority fee in micro-lamports per compute unit. Left out, no price instruction is added. */
|
|
519
|
-
computeUnitPrice?: number | bigint;
|
|
520
|
-
/** Defaults to the client's tables, which the cluster chose. Pass `{}` to disable compression. */
|
|
521
|
-
addressLookupTables?: AddressesByLookupTableAddress;
|
|
522
|
-
};
|
|
523
|
-
/**
|
|
524
|
-
* Build the message. One RPC read, for the blockhash.
|
|
525
|
-
*
|
|
526
|
-
* The blockhash expires in about a minute, so build the message when the user is ready to sign
|
|
527
|
-
* rather than when the page loads.
|
|
528
|
-
*/
|
|
529
|
-
export declare function buildMessage(client: GaboxClient, feePayer: TransactionSigner, instructions: Instruction[], options: BuildOptions): Promise<GaboxTransactionMessage>;
|
|
530
|
-
/** Append `remainingAccounts` to a generated instruction, which is how a venue's list is passed. */
|
|
531
|
-
export declare function withRemainingAccounts<T extends Instruction>(instruction: T, remaining: readonly NonNullable<T['accounts']>[number][]): T;
|
|
385
|
+
/** An associated token account under classic SPL Token. */
|
|
386
|
+
export declare const associatedTokenAddress: (owner: Address, mint: Address, tokenProgram?: Address) => Promise<Address>;
|
|
387
|
+
/** The prize vault: the pool PDA's own associated token account for the coin. */
|
|
388
|
+
export declare const vaultAddress: (mint: Address) => Promise<Address>;
|
|
532
389
|
//#endregion
|
|
533
390
|
//#region src/tx/buyPack.d.ts
|
|
534
391
|
export type BuyPackInput = {
|
|
535
392
|
mint: Address;
|
|
536
|
-
/** Pays for everything and signs. Becomes `draw.purchaser`. */
|
|
537
393
|
purchaser: TransactionSigner;
|
|
538
|
-
/**
|
|
394
|
+
/**
|
|
395
|
+
* The venue slippage cap, in WSOL. This many lamports are wrapped before the buy, so it must
|
|
396
|
+
* cover the real price. Anything left comes back as SOL.
|
|
397
|
+
*/
|
|
539
398
|
maxQuoteIn: bigint;
|
|
540
|
-
/**
|
|
399
|
+
/** The floor on the top prize this pack may win. Refresh the offer if it fails. */
|
|
541
400
|
minMaximum: bigint;
|
|
542
|
-
/**
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
/** Force a venue. Left out, the bonding curve's `complete` flag decides. */
|
|
401
|
+
/** Caps every lamport the handler sees: venue account rent and the VRF request. */
|
|
402
|
+
maxNativeDebit: bigint;
|
|
403
|
+
/** Force a venue instead of reading the LaunchLab pool's `status`. */
|
|
546
404
|
venue?: VenueKind;
|
|
547
|
-
/**
|
|
548
|
-
* Pin the draw's sequence number instead of reading `pool.nextSeq` now.
|
|
549
|
-
*
|
|
550
|
-
* The draw's address is `["draw", pool, seq]`, so a caller that has already told somebody which
|
|
551
|
-
* draw this purchase will create has to keep that promise if it rebuilds the message - after a
|
|
552
|
-
* stale blockhash, say. Rebuilding without a pin reads `nextSeq` again, and if the first attempt
|
|
553
|
-
* actually landed, the second one buys a **second pack** at the next sequence number rather than
|
|
554
|
-
* failing. With the pin it fails on the `init` constraint, which is the right outcome.
|
|
555
|
-
*/
|
|
405
|
+
/** Pin `pool.nextSeq` to make a rebuild fail rather than buy a second pack. */
|
|
556
406
|
seq?: bigint;
|
|
557
|
-
/**
|
|
558
|
-
* Lamports to wrap into the buyer's WSOL account on the PumpSwap route. Left out, the builder
|
|
559
|
-
* wraps `maxQuoteIn`: the venue never takes more than that, and any surplus stays in the buyer's
|
|
560
|
-
* own WSOL account.
|
|
561
|
-
*/
|
|
562
|
-
wrapLamports?: bigint;
|
|
563
|
-
/** Append PumpSwap's optional cashback account. Only for a cashback coin. */
|
|
564
|
-
cashback?: boolean;
|
|
565
|
-
/**
|
|
566
|
-
* A referrer to bind before the purchase, in the same transaction.
|
|
567
|
-
*
|
|
568
|
-
* A share link leaves the referrer's wallet in a cookie, and the first pack is where it matters:
|
|
569
|
-
* `bind_referrer` runs one instruction ahead of `buy_pack`, so the pack that converts the buyer
|
|
570
|
-
* is the pack that pays. Ignored when the buyer already has a link (the chain wins), when it
|
|
571
|
-
* names the buyer, or when it is the all-zero address. The link's rent is extra, on top of
|
|
572
|
-
* `maxTotalDebit`.
|
|
573
|
-
*/
|
|
574
|
-
referrer?: Address;
|
|
575
407
|
} & Partial<BuildOptions>;
|
|
576
408
|
export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promise<GaboxTransactionMessage>;
|
|
577
409
|
//#endregion
|
|
@@ -579,220 +411,131 @@ export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promi
|
|
|
579
411
|
export type CreateMachineInput = {
|
|
580
412
|
/** Pays for everything and signs both instructions. Becomes `pool.creator`. */
|
|
581
413
|
creator: TransactionSigner;
|
|
582
|
-
/** A fresh keypair for the coin. Signs `
|
|
414
|
+
/** A fresh keypair for the coin. Signs `initialize_v2` and is never needed again. */
|
|
583
415
|
mintKeypair: TransactionSigner;
|
|
416
|
+
/** At most 32 UTF-8 bytes. */
|
|
584
417
|
name: string;
|
|
418
|
+
/** At most 10 UTF-8 bytes. */
|
|
585
419
|
symbol: string;
|
|
586
|
-
/** The metadata URI
|
|
420
|
+
/** The metadata URI. At most 200 UTF-8 bytes. */
|
|
587
421
|
uri: string;
|
|
588
|
-
/** The creator's fee per pack, in bps of what the venue charges. `0` to `MAX_FEE_BPS`. Immutable. */
|
|
589
|
-
feeBps: number;
|
|
590
422
|
/**
|
|
591
423
|
* The prize table. Immutable once the pool exists. Must pass `validateTiers` and
|
|
592
|
-
* `validatePack(PACK_TOKENS, tiers)`; the program checks both again on
|
|
424
|
+
* `validatePack(PACK_TOKENS, tiers)`; the program checks both again on chain. Defaults to
|
|
593
425
|
* `DEFAULT_TIERS`, the table the Gabox app uses.
|
|
594
426
|
*/
|
|
595
427
|
tiers?: readonly Readonly<Tier>[];
|
|
596
428
|
/**
|
|
597
|
-
*
|
|
598
|
-
*
|
|
429
|
+
* Seed slippage cap in WSOL, for `mandatory + extraSeedTokens` together. This is also the number
|
|
430
|
+
* of lamports wrapped into the creator's WSOL account before the buy, so it must cover the real
|
|
431
|
+
* cost. Anything left over comes back as SOL when the account is closed.
|
|
432
|
+
*/
|
|
433
|
+
maxSeedQuoteIn: bigint;
|
|
434
|
+
/**
|
|
435
|
+
* A separate cap on the lamports the seed buy itself spends. LaunchLab creates its platform and
|
|
436
|
+
* creator fee vaults on a coin's first trade and charges that rent to the payer, which is the
|
|
437
|
+
* only SOL the buy touches. It is not the price.
|
|
438
|
+
*/
|
|
439
|
+
maxSeedNativeDebit: bigint;
|
|
440
|
+
/**
|
|
441
|
+
* Extra tokens to seed on top of the mandatory amount `seedTokens(PACK_TOKENS, tiers)` computes.
|
|
442
|
+
* Defaults to `0n`. Must not be negative.
|
|
599
443
|
*/
|
|
600
|
-
|
|
601
|
-
/** Which Pump fee recipient to use, as an index. Left out, one is picked at random. */
|
|
602
|
-
feeRecipientIndex?: number;
|
|
603
|
-
/** Same, for the buyback recipient list. */
|
|
604
|
-
buybackRecipientIndex?: number;
|
|
444
|
+
extraSeedTokens?: bigint;
|
|
605
445
|
} & Partial<BuildOptions>;
|
|
606
446
|
/**
|
|
607
447
|
* Build the transaction message. Sign it with both `creator` and `mintKeypair`.
|
|
608
448
|
*
|
|
609
|
-
* Reads
|
|
610
|
-
*
|
|
611
|
-
*
|
|
449
|
+
* Reads LaunchLab's global config and the Gabox platform config, because the seed price depends on
|
|
450
|
+
* their fee rates. Nothing else needs the chain: the coin does not exist yet, so every other
|
|
451
|
+
* account is a derivation.
|
|
612
452
|
*/
|
|
613
453
|
export declare function createMachine(client: GaboxClient, input: CreateMachineInput): Promise<GaboxTransactionMessage>;
|
|
614
|
-
|
|
615
|
-
* What the seed for this table costs, fees included, and how many tokens it is.
|
|
616
|
-
*
|
|
617
|
-
* The coin does not exist yet, so the price is Pump's default new curve. Nothing else trades on
|
|
618
|
-
* it before `initialize_pool` runs in the same transaction, so this is exact up to a change in
|
|
619
|
-
* Pump's fee settings between the read and the send. Add a small margin for `maxSeedLamports`.
|
|
620
|
-
*
|
|
621
|
-
* Defaults to `DEFAULT_TIERS`. Throws if `tiers` fails `validateTiers`/`validatePack`, or if the
|
|
622
|
-
* seed is bigger than a fresh Pump curve can sell in one buy.
|
|
623
|
-
*/
|
|
624
|
-
export declare function seedCostEstimate(client: GaboxClient, tiers?: readonly Readonly<Tier>[]): Promise<{
|
|
454
|
+
export type SeedCostEstimate = {
|
|
625
455
|
tiers: readonly Tier[];
|
|
456
|
+
/** The mandatory seed alone: `seedTokens(PACK_TOKENS, tiers)`. */
|
|
626
457
|
seedTokens: bigint;
|
|
627
|
-
|
|
628
|
-
|
|
458
|
+
/** `options.extraSeedTokens`, defaulted to `0n`. */
|
|
459
|
+
extraSeedTokens: bigint;
|
|
460
|
+
/** `seedTokens + extraSeedTokens`. What `createMachine` actually buys in the seed trade. */
|
|
461
|
+
totalSeedTokens: bigint;
|
|
462
|
+
/** Exact fresh-curve cost in lamports, Raydium's fees included. */
|
|
463
|
+
quoteAmount: bigint;
|
|
464
|
+
/** Always WSOL today. */
|
|
465
|
+
quoteMint: typeof WSOL_MINT;
|
|
466
|
+
};
|
|
629
467
|
/**
|
|
630
|
-
*
|
|
468
|
+
* What the seed for this table costs, fees included, and how many tokens it is.
|
|
631
469
|
*
|
|
632
|
-
* The
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
470
|
+
* The coin does not exist yet, so the price comes from the starting reserves LaunchLab derives from
|
|
471
|
+
* the pinned launch shape. Nothing trades on the curve before `initialize_pool` runs in the same
|
|
472
|
+
* transaction, so this is exact up to a change in Raydium's fee rates between the read and the
|
|
473
|
+
* send.
|
|
474
|
+
*
|
|
475
|
+
* Defaults to `DEFAULT_TIERS` and no extra seed. Throws if `tiers` fails
|
|
476
|
+
* `validateTiers`/`validatePack`, if `extraSeedTokens` is negative, or if the total seed is bigger
|
|
477
|
+
* than the curve sells.
|
|
636
478
|
*/
|
|
637
|
-
export declare function
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
feeRecipientIndex?: number;
|
|
641
|
-
buybackRecipientIndex?: number;
|
|
642
|
-
}): Promise<AccountMeta[]>;
|
|
479
|
+
export declare function seedCostEstimate(client: GaboxClient, tiers?: readonly Readonly<Tier>[], options?: {
|
|
480
|
+
extraSeedTokens?: bigint;
|
|
481
|
+
}): Promise<SeedCostEstimate>;
|
|
643
482
|
//#endregion
|
|
644
483
|
//#region src/tx/draw.d.ts
|
|
645
484
|
export type RetryDrawInput = {
|
|
646
|
-
/** Pays the oracle fee and the transaction fee. Any wallet. */
|
|
647
485
|
payer: TransactionSigner;
|
|
648
486
|
pool: Address;
|
|
649
487
|
draw: Address;
|
|
650
|
-
/** Cap on what the oracle request may take from `payer`, in lamports. */
|
|
651
488
|
maxVrfDebit: bigint;
|
|
652
489
|
} & Partial<BuildOptions>;
|
|
653
490
|
export declare function retryDraw(client: GaboxClient, input: RetryDrawInput): Promise<GaboxTransactionMessage>;
|
|
654
491
|
export type ExpireDrawInput = {
|
|
655
|
-
/** Only pays the transaction fee. `expire_draw` itself has no signer account. */
|
|
656
492
|
payer: TransactionSigner;
|
|
657
493
|
pool: Address;
|
|
658
494
|
draw: Address;
|
|
659
495
|
} & Partial<BuildOptions>;
|
|
660
496
|
export declare function expireDraw(client: GaboxClient, input: ExpireDrawInput): Promise<GaboxTransactionMessage>;
|
|
661
497
|
export type DrawAvailability = {
|
|
662
|
-
status: DrawStatus;
|
|
663
498
|
attempts: number;
|
|
664
|
-
/** Slots remaining before a retry is allowed. `0` when it is allowed now. */
|
|
665
499
|
slotsUntilRetry: bigint;
|
|
666
|
-
/** Slots remaining before an unanswered draw reaches its expiry deadline. */
|
|
667
500
|
slotsUntilExpiry: bigint;
|
|
668
|
-
/** All three conditions the program checks for `retry_draw`, together. */
|
|
669
501
|
canRetry: boolean;
|
|
670
|
-
/** True only when the draw is still `Pending` and its expiry deadline passed. */
|
|
671
502
|
canExpire: boolean;
|
|
672
503
|
};
|
|
673
|
-
|
|
674
|
-
* What a client may do to a draw right now.
|
|
675
|
-
*
|
|
676
|
-
* Reads the draw and the current slot, and reproduces the program's three retry conditions and the
|
|
677
|
-
* pending-status-plus-deadline expiry conditions. Showing a disabled button with a countdown beats
|
|
678
|
-
* sending a transaction that fails with `RetryTooSoon` or `NotPending`.
|
|
679
|
-
*/
|
|
680
|
-
export declare function drawAvailability(client: GaboxClient, draw: Address): Promise<DrawAvailability | null>;
|
|
504
|
+
export declare function drawAvailability(client: GaboxClient, address: Address): Promise<DrawAvailability | null>;
|
|
681
505
|
//#endregion
|
|
682
506
|
//#region src/tx/fundPrizes.d.ts
|
|
683
507
|
export type FundPrizesInput = {
|
|
684
508
|
mint: Address;
|
|
685
|
-
/** The donor. Signs, and the tokens leave its account. */
|
|
686
509
|
funder: TransactionSigner;
|
|
687
|
-
/** Tokens to donate, in the mint's smallest unit. Must be positive. */
|
|
688
510
|
amount: bigint;
|
|
689
|
-
/**
|
|
690
|
-
* The account the tokens come from. Defaults to the funder's associated token account, which is
|
|
691
|
-
* where a wallet holds them. Any token account the funder is the authority of works.
|
|
692
|
-
*/
|
|
693
511
|
source?: Address;
|
|
694
512
|
} & Partial<BuildOptions>;
|
|
695
513
|
export declare function fundPrizes(client: GaboxClient, input: FundPrizesInput): Promise<GaboxTransactionMessage>;
|
|
696
|
-
export type FundPrizesWithBuyInput = {
|
|
697
|
-
mint: Address;
|
|
698
|
-
/** The donor. Buys the tokens, then gives them away. Signs both instructions. */
|
|
699
|
-
funder: TransactionSigner;
|
|
700
|
-
/** Exact tokens to buy and donate. `seedShortfall(offer)` is the amount that uncaps the top prize. */
|
|
701
|
-
tokens: bigint;
|
|
702
|
-
/** The donor's slippage cap on the buy, in lamports (WSOL on PumpSwap). */
|
|
703
|
-
maxQuoteIn: bigint;
|
|
704
|
-
/** Force a venue. Left out, the bonding curve's `complete` flag decides. */
|
|
705
|
-
venue?: VenueKind;
|
|
706
|
-
/**
|
|
707
|
-
* Lamports to wrap on the PumpSwap route. Left out, `maxQuoteIn`. The venue never takes more
|
|
708
|
-
* than that, and any surplus stays in the donor's own WSOL account.
|
|
709
|
-
*/
|
|
710
|
-
wrapLamports?: bigint;
|
|
711
|
-
} & Partial<BuildOptions>;
|
|
712
|
-
/**
|
|
713
|
-
* Buy tokens at the venue with SOL and donate them to the vault, in one transaction.
|
|
714
|
-
*
|
|
715
|
-
* This is what a donor with SOL and no coins needs. `fundPrizes` moves tokens the donor already
|
|
716
|
-
* holds; this one buys them first. Both are irrevocable — there is no withdrawal instruction, and
|
|
717
|
-
* no authority can move vault tokens.
|
|
718
|
-
*
|
|
719
|
-
* Three instructions on the curve route: create the donor's token account if it is missing, buy,
|
|
720
|
-
* donate. Pump creates the account itself, but the idempotent instruction costs nothing when it
|
|
721
|
-
* already exists and it makes the transaction correct on its own terms. The PumpSwap route adds the
|
|
722
|
-
* WSOL create/fund/sync prefix, for the same reason `buyPack` does: PumpSwap spends WSOL.
|
|
723
|
-
*/
|
|
724
|
-
export declare function fundPrizesWithBuy(client: GaboxClient, input: FundPrizesWithBuyInput): Promise<GaboxTransactionMessage>;
|
|
725
514
|
//#endregion
|
|
726
515
|
//#region src/tx/redeem.d.ts
|
|
727
516
|
export type SellTokensInput = {
|
|
728
517
|
mint: Address;
|
|
729
|
-
/** Wallet that owns the tokens and signs the venue sale. */
|
|
730
518
|
seller: TransactionSigner;
|
|
731
|
-
/** Exact token amount to sell. Must be positive. */
|
|
732
519
|
amount: bigint;
|
|
733
|
-
/**
|
|
734
|
-
* positive: the program rejects zero, because a zero floor is not slippage protection. */
|
|
520
|
+
/** The venue's own floor on the WSOL it pays out. Nothing else is taken out of the sale. */
|
|
735
521
|
minQuoteOutput: bigint;
|
|
736
|
-
/** Force a venue. Left out, the bonding curve's `complete` flag decides. */
|
|
737
|
-
venue?: VenueKind;
|
|
738
|
-
} & Partial<BuildOptions>;
|
|
739
|
-
/**
|
|
740
|
-
* Sell a prize that the VRF callback already delivered to the wallet, through `sell_tokens`.
|
|
741
|
-
*
|
|
742
|
-
* The program needs the coin's pool: it keeps the vault out of the venue's account list. A mint
|
|
743
|
-
* with no pool cannot be sold this way; use a plain venue trade for that.
|
|
744
|
-
*/
|
|
745
|
-
export declare function sellTokens(client: GaboxClient, input: SellTokensInput): Promise<GaboxTransactionMessage>;
|
|
746
|
-
export type ClaimPrizeInput = {
|
|
747
|
-
mint: Address;
|
|
748
|
-
/** The wallet that bought the legacy pack. Only it can settle the draw. */
|
|
749
|
-
purchaser: TransactionSigner;
|
|
750
|
-
/** The draw to redeem. */
|
|
751
|
-
draw: Address;
|
|
752
|
-
} & Partial<BuildOptions>;
|
|
753
|
-
/** Transfer a legacy resolve-only award into the purchaser's token account and close the draw. */
|
|
754
|
-
export declare function claimPrize(client: GaboxClient, input: ClaimPrizeInput): Promise<GaboxTransactionMessage>;
|
|
755
|
-
export type SellPrizeInput = ClaimPrizeInput & {
|
|
756
522
|
/**
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
* This is the venue's own net quote, before the protocol fee. It is not net of the transaction
|
|
761
|
-
* fee or of any rent the transaction pays.
|
|
523
|
+
* Caps the lamports the sale itself spends. A sale normally spends none, but LaunchLab charges
|
|
524
|
+
* the payer for a fee vault it has to create on a coin's first trade.
|
|
762
525
|
*/
|
|
763
|
-
|
|
764
|
-
/** Force a venue. Left out, the bonding curve's `complete` flag decides. */
|
|
526
|
+
maxNativeDebit: bigint;
|
|
765
527
|
venue?: VenueKind;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
* Claim and sell a legacy resolve-only draw in one transaction.
|
|
769
|
-
*
|
|
770
|
-
* The award is read off the draw so the caller can price the sale before signing. A draw that has
|
|
771
|
-
* not resolved has no award yet, and this throws rather than building a sale of zero tokens.
|
|
772
|
-
*/
|
|
773
|
-
export declare function sellPrize(client: GaboxClient, input: SellPrizeInput): Promise<GaboxTransactionMessage>;
|
|
774
|
-
/**
|
|
775
|
-
* Quote the award held by a legacy open draw before the seller signs a floor.
|
|
776
|
-
*
|
|
777
|
-
* Read the draw, ask the venue, and subtract your own slippage tolerance to get `minQuoteOutput`.
|
|
778
|
-
*/
|
|
779
|
-
export declare function quoteSellPrize(client: GaboxClient, mint: Address, draw: Address, user: Address): Promise<{
|
|
780
|
-
award: bigint;
|
|
781
|
-
grossOutput: bigint;
|
|
782
|
-
}>;
|
|
528
|
+
} & Partial<BuildOptions>;
|
|
529
|
+
export declare function sellTokens(client: GaboxClient, input: SellTokensInput): Promise<GaboxTransactionMessage>;
|
|
783
530
|
//#endregion
|
|
784
|
-
//#region src/
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
531
|
+
//#region src/tx/wsol.d.ts
|
|
532
|
+
/** The wallet's WSOL account, and the instructions that put `lamports` of spendable WSOL in it. */
|
|
533
|
+
export declare function fundWsol(owner: TransactionSigner, lamports: bigint): Promise<{
|
|
534
|
+
account: Address;
|
|
535
|
+
instructions: Instruction[];
|
|
789
536
|
}>;
|
|
790
|
-
/**
|
|
791
|
-
export declare function
|
|
792
|
-
/** Bind a wallet to a referrer. The purchaser signs and the binding is permanent. */
|
|
793
|
-
export declare function bindReferrer(client: GaboxClient, referee: TransactionSigner, referrer: Address, options?: Partial<BuildOptions>): Promise<GaboxTransactionMessage>;
|
|
794
|
-
/** Claim all accrued referral rewards for one pool. */
|
|
795
|
-
export declare function claimReferral(client: GaboxClient, referrer: TransactionSigner, pool: Address, options?: Partial<BuildOptions>): Promise<GaboxTransactionMessage>;
|
|
537
|
+
/** Close the WSOL account, sending every lamport in it back to the owner as SOL. */
|
|
538
|
+
export declare function unwrapWsol(owner: TransactionSigner, account: Address): Instruction;
|
|
796
539
|
//#endregion
|
|
797
540
|
//#region src/vrf.d.ts
|
|
798
541
|
/** The four accounts, named as the generated client names them. */
|
|
@@ -815,5 +558,5 @@ export type OracleAccounts = {
|
|
|
815
558
|
*/
|
|
816
559
|
export declare function oracleAccounts(): Promise<OracleAccounts>;
|
|
817
560
|
//#endregion
|
|
818
|
-
export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, CLUSTER_ENDPOINTS, ClientConfig, Cluster, DEVNET_HTTP, DEVNET_WS, DRAW_DISCRIMINATOR, type Draw, GaboxClient, GaboxRpc, GaboxRpcSubscriptions,
|
|
561
|
+
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, SYSTEM_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, WALLET_ACTIVITY_DISCRIMINATOR, WSOL_MINT, type WalletActivity, assertClusterUrl, buildMessage, clusterNamedBy, createClient, decodeDraw, decodePool, decodeWalletActivity, findActivityPda, findDrawPda, findIdentityPda, findPoolPda, index_d_exports as generated, index_d_exports$1 as raydium, websocketUrlFor, withRemainingAccounts };
|
|
819
562
|
//# sourceMappingURL=index.d.ts.map
|