@gabox-labs/sdk 0.2.0 → 0.7.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 +310 -0
- package/README.md +173 -438
- package/dist/{gaboxV2-CV2XltqC.js → gabox-DGTCh34U.js} +575 -1584
- package/dist/gabox-DGTCh34U.js.map +1 -0
- package/dist/generated/index.d.ts +384 -752
- package/dist/generated/index.js +116 -338
- package/dist/generated/index.js.map +1 -1
- package/dist/index-C4at2cZ_.d.ts +1184 -0
- package/dist/index.d.ts +474 -432
- package/dist/index.js +1186 -1374
- 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-CU-tZzIk.js +3282 -0
- package/dist/raydium-CU-tZzIk.js.map +1 -0
- package/llms.txt +7 -3
- package/package.json +11 -16
- package/skills/gabox-sdk/SKILL.md +57 -146
- package/skills/gabox-sdk/references/api.md +155 -145
- 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 { $n as assertClusterUrl, Gn as CLUSTER_ENDPOINTS, J as buildMessage, Jn as DEVNET_HTTP, K as BuildOptions, Kn as ClientConfig, Nn as METAPLEX_PROGRAM_ADDRESS, Pn as PLATFORM_ADMIN, Qn as GaboxRpcSubscriptions, Vn as TOKEN_PROGRAM_ADDRESS, Wn as WSOL_MINT, Xn as GaboxClient, Y as withRemainingAccounts, Yn as DEVNET_WS, Zn as GaboxRpc, _n as ASSOCIATED_TOKEN_PROGRAM_ADDRESS, ar as RouteMode, er as clusterNamedBy, ir as Route, nr as defaultRoute, nt as VenueKind, on as LAUNCH_DECIMALS, or as RouteProvider, q as GaboxTransactionMessage, qn as Cluster, rr as websocketUrlFor, t as index_d_exports$1, tr as createClient, tt as ResolvedVenue, zn as SYSTEM_PROGRAM_ADDRESS } from "./index-C4at2cZ_.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,29 @@ 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
|
-
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
189
|
+
* LaunchLab `initialize_v2`, the WSOL wrap, pool initialization with a seed buy, and the WSOL
|
|
190
|
+
* close, in one transaction. Measured at `266,488`, `258,988` and `267,988` over three devnet runs
|
|
191
|
+
* against the slot-500297753 build.
|
|
192
|
+
*/
|
|
193
|
+
export declare const CREATE_MACHINE_COMPUTE_UNITS = 350000;
|
|
194
|
+
/**
|
|
195
|
+
* A WSOL wrap, a venue buy, an escrow transfer, a draw init, a VRF request and the WSOL close.
|
|
196
|
+
* Measured at `178,690`, `163,686` and `157,692` on the curve, and `113,891`, `110,922` and
|
|
197
|
+
* `106,387` on CPMM. The curve buy is dearer because a coin's first trade also creates the platform
|
|
198
|
+
* and creator fee vaults.
|
|
199
|
+
*/
|
|
200
|
+
export declare const BUY_PACK_COMPUTE_UNITS = 235000;
|
|
201
|
+
/**
|
|
202
|
+
* A WSOL wrap, a venue sale, and the WSOL close. Measured at `94,246`, `86,745` and `88,246` on the
|
|
203
|
+
* curve, and `61,545`, `55,576` and `57,046` on CPMM.
|
|
204
|
+
*/
|
|
205
|
+
export declare const REDEEM_COMPUTE_UNITS = 125000;
|
|
206
|
+
/**
|
|
207
|
+
* A creator fee claim: create the quote account, claim or collect, and close it when it is WSOL.
|
|
208
|
+
* Measured at `31,319` every run for the LaunchLab claim and `40,959` for the CPMM collect. A claim
|
|
209
|
+
* on a pool quoted in another token is cheaper, `17,635`, because nothing has to be unwrapped.
|
|
210
|
+
*/
|
|
211
|
+
export declare const CLAIM_COMPUTE_UNITS = 55000;
|
|
256
212
|
/** An instruction for the compute budget program: no accounts, all of it in the data. */
|
|
257
213
|
export type ComputeBudgetInstruction = Instruction<string, readonly []> & InstructionWithData<ReadonlyUint8Array>;
|
|
258
214
|
export declare function getSetComputeUnitLimitInstruction(units: number): ComputeBudgetInstruction;
|
|
@@ -268,58 +224,6 @@ export declare function getSetComputeUnitPriceInstruction(microLamports: number
|
|
|
268
224
|
/** The compute budget prefix a builder prepends: a limit, and a price only when one is asked for. */
|
|
269
225
|
export declare function computeBudgetInstructions(units: number, microLamports?: number | bigint): ComputeBudgetInstruction[];
|
|
270
226
|
//#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
227
|
//#region src/events.d.ts
|
|
324
228
|
export type GaboxEvent = {
|
|
325
229
|
name: 'PoolCreated';
|
|
@@ -336,42 +240,51 @@ export type GaboxEvent = {
|
|
|
336
240
|
} | {
|
|
337
241
|
name: 'DrawResolved';
|
|
338
242
|
data: DrawResolvedEvent;
|
|
339
|
-
} | {
|
|
340
|
-
name: 'PrizeRedeemed';
|
|
341
|
-
data: PrizeRedeemedEvent;
|
|
342
243
|
} | {
|
|
343
244
|
name: 'TokensSold';
|
|
344
245
|
data: TokensSoldEvent;
|
|
345
246
|
};
|
|
346
|
-
/** Decode one `Program data:` payload, or `null` when it is not one of ours. */
|
|
347
247
|
export declare function decodeEvent(data: Uint8Array): GaboxEvent | null;
|
|
348
248
|
/**
|
|
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.
|
|
249
|
+
* Decode only Gabox events committed by successful runtime frames. Program logs are emitted before
|
|
250
|
+
* transaction commit and are forgeable by arbitrary programs, so `Program data` is authenticated
|
|
251
|
+
* by the canonical invoke/success stack and buffered until every enclosing frame succeeds.
|
|
354
252
|
*/
|
|
355
253
|
export declare function decodeEvents(logs: readonly string[]): GaboxEvent[];
|
|
356
|
-
/** Fetch a transaction and decode the gabox events it emitted. */
|
|
357
254
|
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;
|
|
255
|
+
export type ResolvedDraw = DrawResolvedEvent & {
|
|
256
|
+
address: Address;
|
|
363
257
|
};
|
|
258
|
+
/** Poll final resolution events for one closed draw address. There is no separate Ready/claim state to poll instead. */
|
|
259
|
+
export declare function findResolvedDraw(client: GaboxClient, address: Address): Promise<ResolvedDraw | null>;
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/ids.d.ts
|
|
262
|
+
/** `declare_id!` in `programs/gabox/src/lib.rs`. */
|
|
263
|
+
export declare const GABOX_PROGRAM_ID: Address<"GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA">;
|
|
264
|
+
/** MagicBlock's ephemeral VRF program. `vrf.rs` pins it and refuses any other. */
|
|
265
|
+
export declare const VRF_PROGRAM_ADDRESS: Address;
|
|
364
266
|
/**
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
267
|
+
* MagicBlock's default oracle queue. The program pins this one address, so a pool creator cannot
|
|
268
|
+
* point a draw at an oracle they control.
|
|
269
|
+
*/
|
|
270
|
+
export declare const VRF_DEFAULT_QUEUE: Address;
|
|
271
|
+
/** The seed of both identity PDAs. See `pdas.ts` — there are two, under different programs. */
|
|
272
|
+
export declare const IDENTITY_SEED: Uint8Array<ArrayBuffer>;
|
|
273
|
+
export declare const SLOT_HASHES_SYSVAR: Address;
|
|
274
|
+
export declare const INSTRUCTIONS_SYSVAR: Address;
|
|
275
|
+
/** `constants.rs`. A retry may not run sooner than this after the last attempt. */
|
|
276
|
+
export declare const RETRY_SLOTS = 300n;
|
|
277
|
+
/** `constants.rs`. After this many slots from the purchase, anyone may expire the draw. */
|
|
278
|
+
export declare const TIMEOUT_SLOTS = 216000n;
|
|
279
|
+
/** `constants.rs`. Three requests in total, counting the one `buy_pack` makes. */
|
|
280
|
+
export declare const MAX_ATTEMPTS = 3;
|
|
281
|
+
/**
|
|
282
|
+
* `constants.rs`. Tokens in one pack, in base units: 1,000,000 tokens at the fixed 6 decimals, or
|
|
283
|
+
* 0.1% of the 1,000,000,000 supply. Every pool sells packs of this size. The venue decides what a
|
|
284
|
+
* pack costs, so the pack price follows the coin. Read `pool.packTokens` rather than this when a
|
|
285
|
+
* pool is at hand: a later program version may change the constant.
|
|
373
286
|
*/
|
|
374
|
-
export declare
|
|
287
|
+
export declare const PACK_TOKENS: bigint;
|
|
375
288
|
//#endregion
|
|
376
289
|
//#region src/lookupTables.d.ts
|
|
377
290
|
export declare const DEVNET_LOOKUP_TABLE_ADDRESS: Address<"Cx4ri1BU2bnDXPjnJykF3nbY2u4MD5pPvzFCJtNizWFa">;
|
|
@@ -386,6 +299,15 @@ export declare const DEVNET_ADDRESS_LOOKUP_TABLES: AddressesByLookupTableAddress
|
|
|
386
299
|
* supply your own.
|
|
387
300
|
*/
|
|
388
301
|
export declare function defaultAddressLookupTables(cluster: Cluster): AddressesByLookupTableAddress;
|
|
302
|
+
/**
|
|
303
|
+
* Read lookup tables off chain by address, for compressing against tables this SDK does not pin.
|
|
304
|
+
*
|
|
305
|
+
* A router picks its own tables per quote, so their contents are only known at run time, and a
|
|
306
|
+
* message can only be compressed against a table whose addresses are loaded. An address with no
|
|
307
|
+
* account, a wrong owner, or a malformed body is skipped rather than failing the whole route: the
|
|
308
|
+
* message then carries those accounts in full, which is correct, only larger.
|
|
309
|
+
*/
|
|
310
|
+
export declare function fetchAddressLookupTables(client: GaboxClient, addresses: Address[]): Promise<AddressesByLookupTableAddress>;
|
|
389
311
|
//#endregion
|
|
390
312
|
//#region src/offer.d.ts
|
|
391
313
|
export type PackOffer = {
|
|
@@ -394,16 +316,21 @@ export type PackOffer = {
|
|
|
394
316
|
/** The fixed token count of one pack. Every prize is a multiple of this. */
|
|
395
317
|
packTokens: bigint;
|
|
396
318
|
/** What the venue charges for `packTokens` right now, its own fees included. The pack price. */
|
|
397
|
-
|
|
398
|
-
/** The
|
|
399
|
-
|
|
400
|
-
/** The
|
|
401
|
-
|
|
402
|
-
/** The
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
|
|
406
|
-
|
|
319
|
+
quoteAmount: bigint;
|
|
320
|
+
/** The pool's quote asset. Both venues settle in it; there is no native-SOL path. */
|
|
321
|
+
quoteMint: Address;
|
|
322
|
+
/** The quote mint's decimals, so `quoteAmount` can be shown as a number. */
|
|
323
|
+
quoteDecimals: number;
|
|
324
|
+
/** The quote mint's symbol, from Metaplex or Token-2022 metadata. `null` when it has none. */
|
|
325
|
+
quoteSymbol: string | null;
|
|
326
|
+
/**
|
|
327
|
+
* The same pack price in lamports, through the client's route provider. Equal to `quoteAmount` on
|
|
328
|
+
* a WSOL pool, and `null` when no route can price it.
|
|
329
|
+
*/
|
|
330
|
+
solAmount: bigint | null;
|
|
331
|
+
/** What the seed cost the creator at creation, in the quote token. Display only. */
|
|
332
|
+
seedQuoteAmount: bigint;
|
|
333
|
+
/** Tokens the seed locked in the vault. Derived from the live table. */
|
|
407
334
|
seedTokens: bigint;
|
|
408
335
|
/** Which venue the buy would route to right now. */
|
|
409
336
|
venue: VenueKind;
|
|
@@ -413,8 +340,10 @@ export type PackOffer = {
|
|
|
413
340
|
maximum: bigint;
|
|
414
341
|
/** The smallest prize. Also what a timed-out draw pays. */
|
|
415
342
|
minimum: bigint;
|
|
416
|
-
/**
|
|
417
|
-
*
|
|
343
|
+
/**
|
|
344
|
+
* The top prize with no inventory cap: the jackpot in tokens. Equal to `maximum` unless the
|
|
345
|
+
* inventory cap bites.
|
|
346
|
+
*/
|
|
418
347
|
uncapped: bigint;
|
|
419
348
|
/** Vault balance, `pool.reserved`, and the difference. */
|
|
420
349
|
inventory: bigint;
|
|
@@ -435,23 +364,34 @@ export type PackOffer = {
|
|
|
435
364
|
averageMultiplierBps: number;
|
|
436
365
|
};
|
|
437
366
|
export type GetOfferOptions = {
|
|
438
|
-
/** Force a venue instead of reading the
|
|
367
|
+
/** Force a venue instead of reading the LaunchLab pool's `status`. */
|
|
439
368
|
venue?: VenueKind;
|
|
440
369
|
/** The buyer, when you already know it. Only changes the account list, never the numbers. */
|
|
441
370
|
user?: Address;
|
|
442
371
|
};
|
|
443
372
|
/**
|
|
444
|
-
* The full offer for one machine.
|
|
373
|
+
* The full offer for one machine. Three round trips: the pool and its vault, the venue, then the
|
|
374
|
+
* quote mint and its metadata. A non-SOL pool adds one HTTP call to the route provider for
|
|
375
|
+
* `solAmount`.
|
|
445
376
|
*
|
|
446
377
|
* Throws when the coin has no pool.
|
|
447
378
|
*/
|
|
448
379
|
export declare function getOffer(client: GaboxClient, mint: Address, options?: GetOfferOptions): Promise<PackOffer>;
|
|
380
|
+
/** The three display fields `getOffer` reads separately from the price. */
|
|
381
|
+
export type QuoteDisplayFields = {
|
|
382
|
+
quoteDecimals: number;
|
|
383
|
+
quoteSymbol: string | null;
|
|
384
|
+
solAmount: bigint | null;
|
|
385
|
+
};
|
|
449
386
|
/**
|
|
450
387
|
* 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. `
|
|
388
|
+
* and wants to re-price without touching the network. `quoteAmount` is
|
|
452
389
|
* `venue.quoteBuy(pool.packTokens)`.
|
|
390
|
+
*
|
|
391
|
+
* `display` is optional: a caller that only wants the prize numbers can leave it out, and the three
|
|
392
|
+
* display fields then report the quote's own base units with no symbol and no SOL price.
|
|
453
393
|
*/
|
|
454
|
-
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind,
|
|
394
|
+
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint, display?: QuoteDisplayFields): PackOffer;
|
|
455
395
|
/**
|
|
456
396
|
* How short of the top prize a pool is, in tokens. `0` when it pays the whole table.
|
|
457
397
|
*
|
|
@@ -462,337 +402,439 @@ export declare function offerFromState(inventory: PoolInventory, venue: VenueKin
|
|
|
462
402
|
export declare function seedShortfall(offer: PackOffer): bigint;
|
|
463
403
|
//#endregion
|
|
464
404
|
//#region src/pdas.d.ts
|
|
465
|
-
/** `[
|
|
466
|
-
export declare
|
|
467
|
-
/** `[
|
|
468
|
-
export declare
|
|
469
|
-
/**
|
|
470
|
-
export declare
|
|
471
|
-
/** `["
|
|
472
|
-
export declare
|
|
405
|
+
/** `["pool", mint]`. One pool per coin. */
|
|
406
|
+
export declare const poolAddress: (mint: Address) => Promise<Address>;
|
|
407
|
+
/** `["draw", pool, seq]`, with the sequence as eight little-endian bytes. */
|
|
408
|
+
export declare const drawAddress: (pool: Address, seq: bigint) => Promise<Address>;
|
|
409
|
+
/** The per-wallet `WalletActivity` PDA. `buy_pack` derives it from the purchaser automatically. */
|
|
410
|
+
export declare const activityAddress: (wallet: Address) => Promise<Address>;
|
|
411
|
+
/** `["identity"]` under Gabox. The PDA the program signs its randomness request with. */
|
|
412
|
+
export declare const vrfIdentityAddress: () => Promise<Address>;
|
|
413
|
+
/** `["identity", gabox_program_id]` under the VRF program. MagicBlock signs the callback with it. */
|
|
414
|
+
export declare function scopedVrfIdentityAddress(): Promise<ProgramDerivedAddress>;
|
|
415
|
+
/** An associated token account under classic SPL Token. */
|
|
416
|
+
export declare const associatedTokenAddress: (owner: Address, mint: Address, tokenProgram?: Address) => Promise<Address>;
|
|
417
|
+
/** The prize vault: the pool PDA's own associated token account for the coin. */
|
|
418
|
+
export declare const vaultAddress: (mint: Address) => Promise<Address>;
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/route/cpmm.d.ts
|
|
473
421
|
/**
|
|
474
|
-
*
|
|
475
|
-
*
|
|
422
|
+
* The slippage this provider signs for on a pool swap, in basis points. 1%, the same as the
|
|
423
|
+
* Jupiter provider's default. It only widens the on-chain bound; the price itself is exact.
|
|
476
424
|
*/
|
|
477
|
-
export declare
|
|
425
|
+
export declare const CPMM_ROUTE_SLIPPAGE_BPS = 100n;
|
|
478
426
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
427
|
+
* The compute units one swap through this provider adds to a transaction.
|
|
428
|
+
*
|
|
429
|
+
* Measured on devnet on 2026-09-18 against one Raydium CPMM pool, as the difference from the same
|
|
430
|
+
* builder with no route: `55,110` and `29,272` on `createMachine`, `21,488` and `52,980` on
|
|
431
|
+
* `buyPack`, and `30,138` and `51,138` on `sellTokens`. The spread is wide because which token
|
|
432
|
+
* accounts already exist changes from run to run, so this rounds up to the top of it.
|
|
433
|
+
*
|
|
434
|
+
* It is a safe figure here and nowhere else: this provider always uses exactly one pool. A router
|
|
435
|
+
* that may pick several hops states its own number; see `JUPITER_DEFAULT_COMPUTE_UNITS`.
|
|
483
436
|
*/
|
|
484
|
-
export declare
|
|
437
|
+
export declare const CPMM_ROUTE_COMPUTE_UNITS = 75000;
|
|
485
438
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
439
|
+
* Swap through one named Raydium CPMM pool.
|
|
440
|
+
*
|
|
441
|
+
* The pool must hold the pair the route asks for. On devnet the SOL/USDC-test pool with the most
|
|
442
|
+
* liquidity is `5Eu2G2USTy1pqphmQzQ2SBXWrBq5sdhgEh7hso9R2xix`, under the fee tier
|
|
443
|
+
* `A9qBhPy4k5UYW72hSgAkh1Epr2do69P54yzzcMV3yv6b`.
|
|
488
444
|
*/
|
|
489
|
-
export declare function
|
|
445
|
+
export declare function raydiumCpmmRoute(poolAddress: Address): RouteProvider;
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/route/jupiter.d.ts
|
|
448
|
+
/** Jupiter's free endpoint. The keyed host `https://api.jup.ag/swap/v1` has the same shape. */
|
|
449
|
+
export declare const JUPITER_LITE_URL = "https://lite-api.jup.ag/swap/v1";
|
|
450
|
+
/** The slippage Jupiter prices a route with when the caller names none. 1%. */
|
|
451
|
+
export declare const JUPITER_DEFAULT_SLIPPAGE_BPS = 100;
|
|
452
|
+
/**
|
|
453
|
+
* The compute units a Jupiter route is assumed to need when the response carries no limit.
|
|
454
|
+
*
|
|
455
|
+
* Jupiter normally sends a `SetComputeUnitLimit` of its own, and that number is what this SDK uses.
|
|
456
|
+
* When it does not, this is the fallback: enough for a route through several pools, and still far
|
|
457
|
+
* below the 1,400,000-unit ceiling once the Gabox instruction's own budget is added. A caller who
|
|
458
|
+
* knows better passes `computeUnitLimit` to the builder.
|
|
459
|
+
*/
|
|
460
|
+
export declare const JUPITER_DEFAULT_COMPUTE_UNITS = 400000;
|
|
461
|
+
export type JupiterRouteOptions = {
|
|
462
|
+
/** The base URL of the swap API. Defaults to the free `lite-api` host. */
|
|
463
|
+
url?: string;
|
|
464
|
+
/** Slippage for the quote, in basis points. Defaults to 100, which is 1%. */
|
|
465
|
+
slippageBps?: number;
|
|
466
|
+
};
|
|
467
|
+
/** One account as the swap-instructions response writes it. */
|
|
468
|
+
type JupiterAccount = {
|
|
469
|
+
pubkey: string;
|
|
470
|
+
isSigner: boolean;
|
|
471
|
+
isWritable: boolean;
|
|
472
|
+
};
|
|
473
|
+
type JupiterInstruction = {
|
|
474
|
+
programId: string;
|
|
475
|
+
accounts: JupiterAccount[];
|
|
476
|
+
data: string;
|
|
477
|
+
};
|
|
478
|
+
/** The fields of a `swap-instructions` response this SDK reads. */
|
|
479
|
+
export type JupiterSwapInstructions = {
|
|
480
|
+
/** Read for its unit limit only. These instructions are never copied into the message. */
|
|
481
|
+
computeBudgetInstructions?: JupiterInstruction[] | null;
|
|
482
|
+
setupInstructions?: JupiterInstruction[] | null;
|
|
483
|
+
swapInstruction: JupiterInstruction;
|
|
484
|
+
cleanupInstruction?: JupiterInstruction | null;
|
|
485
|
+
addressLookupTableAddresses?: string[] | null;
|
|
486
|
+
};
|
|
490
487
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
488
|
+
* A route provider backed by Jupiter. Use it on mainnet, where Jupiter has the liquidity.
|
|
489
|
+
*
|
|
490
|
+
* It makes read-only HTTP calls and never sends a transaction: the instructions come back to the
|
|
491
|
+
* caller, who signs them together with the Gabox instruction.
|
|
493
492
|
*/
|
|
494
|
-
export declare function
|
|
493
|
+
export declare function jupiterRoute(options?: JupiterRouteOptions): RouteProvider;
|
|
495
494
|
/**
|
|
496
|
-
*
|
|
495
|
+
* Turn a decoded `swap-instructions` response into a `Route`.
|
|
497
496
|
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
497
|
+
* Exported so a test can read a recorded response without making an HTTP call. The lookup tables
|
|
498
|
+
* are read through the client, because the response names them by address only.
|
|
500
499
|
*/
|
|
501
|
-
export declare function
|
|
500
|
+
export declare function routeFrom(client: GaboxClient, response: JupiterSwapInstructions, amounts: {
|
|
501
|
+
inAmount: bigint;
|
|
502
|
+
outAmount: bigint;
|
|
503
|
+
mode: Route['mode'];
|
|
504
|
+
}): Promise<Route>;
|
|
505
|
+
/**
|
|
506
|
+
* The unit limit Jupiter asked for, or `JUPITER_DEFAULT_COMPUTE_UNITS` when it asked for none.
|
|
507
|
+
*
|
|
508
|
+
* `SetComputeUnitLimit` is five bytes: the tag `2`, then the units as a little-endian u32. Any other
|
|
509
|
+
* compute budget instruction, such as a unit price, is skipped.
|
|
510
|
+
*/
|
|
511
|
+
export declare function computeUnitsOf(response: JupiterSwapInstructions): number;
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region src/route/leg.d.ts
|
|
514
|
+
/**
|
|
515
|
+
* The margin added to an exact-in fallback, in basis points.
|
|
516
|
+
*
|
|
517
|
+
* An exact-in quote prices one spend. The spend that buys the amount wanted is worked out from that
|
|
518
|
+
* price, and the price moves against a larger spend, so the result is always a little short without
|
|
519
|
+
* a margin. 1% is the same order as the slippage a caller already signs for on the pack itself.
|
|
520
|
+
*/
|
|
521
|
+
export declare const EXACT_IN_MARGIN_BPS = 100n;
|
|
522
|
+
/**
|
|
523
|
+
* A swap that leaves at least `amount` of `quoteMint` in the user's quote account, paid for in SOL.
|
|
524
|
+
*
|
|
525
|
+
* Exact-out when the pair has such a route, so the buyer spends only what the pack costs. Exact-in
|
|
526
|
+
* otherwise, which overshoots on purpose: the leftover quote stays in the buyer's own account.
|
|
527
|
+
*/
|
|
528
|
+
export declare function routeQuoteIn(client: GaboxClient, provider: RouteProvider, input: {
|
|
529
|
+
quoteMint: Address;
|
|
530
|
+
amount: bigint;
|
|
531
|
+
user: Address;
|
|
532
|
+
}): Promise<Route>;
|
|
533
|
+
/**
|
|
534
|
+
* A swap that turns exactly `amount` of `quoteMint` into SOL.
|
|
535
|
+
*
|
|
536
|
+
* `sellTokens` uses it on the proceeds floor it already signs for, so the amount swapped is one the
|
|
537
|
+
* sale is guaranteed to have produced. Anything the sale paid above that floor stays in the
|
|
538
|
+
* seller's quote account.
|
|
539
|
+
*/
|
|
540
|
+
export declare function routeQuoteOut(client: GaboxClient, provider: RouteProvider, input: {
|
|
541
|
+
quoteMint: Address;
|
|
542
|
+
amount: bigint;
|
|
543
|
+
user: Address;
|
|
544
|
+
}): Promise<Route>;
|
|
545
|
+
/**
|
|
546
|
+
* Refuse a route that would touch Gabox state, or that does not settle in the account the program
|
|
547
|
+
* binds.
|
|
548
|
+
*
|
|
549
|
+
* `forbidden` is every Gabox account the transaction itself uses, plus the Gabox program id.
|
|
550
|
+
* `settlesIn` is the user's quote associated token account: the swap has to name it, because that
|
|
551
|
+
* is where `buy_pack` measures the quote it spends and where `sell_tokens` measures the proceeds.
|
|
552
|
+
*/
|
|
553
|
+
export declare function assertRouteIsSafe(route: Route, expect: {
|
|
554
|
+
forbidden: readonly Address[];
|
|
555
|
+
settlesIn: Address;
|
|
556
|
+
}): void;
|
|
557
|
+
/**
|
|
558
|
+
* What `amount` of a quote token costs in SOL, through the client's route provider.
|
|
559
|
+
*
|
|
560
|
+
* `null` when the client has no provider, or when the provider has no exact-out route. A price is a
|
|
561
|
+
* display, so a missing one is not an error. A WSOL amount is already SOL and comes back unchanged.
|
|
562
|
+
*
|
|
563
|
+
* No fallback to exact-in here on purpose: an exact-in price answers a different question, and a
|
|
564
|
+
* display that silently swapped the two would be wrong rather than missing.
|
|
565
|
+
*/
|
|
566
|
+
export declare function solPriceOf(client: GaboxClient, quoteMint: Address, amount: bigint): Promise<bigint | null>;
|
|
502
567
|
//#endregion
|
|
503
|
-
//#region src/tx/
|
|
504
|
-
/**
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
|
|
568
|
+
//#region src/tx/quoteLeg.d.ts
|
|
569
|
+
/** Where the money for a purchase comes from. */
|
|
570
|
+
export type PayWith = 'sol' | 'quote';
|
|
571
|
+
/** What a sale pays out. */
|
|
572
|
+
export type Receive = 'sol' | 'quote';
|
|
573
|
+
/** The instructions that go around the Gabox instruction, and what the route did. */
|
|
574
|
+
export type QuoteLeg = {
|
|
575
|
+
/** Everything that runs before the Gabox instruction. */
|
|
576
|
+
before: Instruction[];
|
|
577
|
+
/** Everything that runs after it. */
|
|
578
|
+
after: Instruction[];
|
|
579
|
+
/** The lookup tables the route's own instructions need, on top of the client's. */
|
|
580
|
+
lookupTables: AddressesByLookupTableAddress;
|
|
581
|
+
/** Which swap mode the route used, or `null` when no route was needed. */
|
|
582
|
+
mode: RouteMode | null;
|
|
583
|
+
/** SOL the route spends, or `null` when no route was needed. */
|
|
584
|
+
solAmount: bigint | null;
|
|
585
|
+
/**
|
|
586
|
+
* The compute units the route adds to the transaction, or `0` when there is no route.
|
|
587
|
+
*
|
|
588
|
+
* The builder adds this to its own limit, because the swap runs on the same budget. It comes from
|
|
589
|
+
* the route itself, so a Jupiter route through several pools asks for more than a single-pool one.
|
|
590
|
+
*/
|
|
591
|
+
computeUnits: number;
|
|
522
592
|
};
|
|
593
|
+
/** The Gabox accounts a route must never name. */
|
|
594
|
+
export type GaboxAccounts = readonly Address[];
|
|
595
|
+
/** Create the wallet's quote account if it is missing. Idempotent, so a second create is free. */
|
|
596
|
+
export declare function createQuoteAccount(owner: TransactionSigner, venue: Pick<ResolvedVenue, 'quoteMint' | 'quoteTokenProgram' | 'userQuoteToken'>): Instruction;
|
|
597
|
+
/**
|
|
598
|
+
* The leg that puts `maxQuoteIn` of the quote token in the buyer's quote account.
|
|
599
|
+
*
|
|
600
|
+
* `payWith` decides where it comes from. On a WSOL pool the choice makes no difference: the quote
|
|
601
|
+
* token is SOL either way, so the builder wraps it.
|
|
602
|
+
*/
|
|
603
|
+
export declare function quoteLegIn(client: GaboxClient, input: {
|
|
604
|
+
venue: Pick<ResolvedVenue, 'quoteMint' | 'quoteTokenProgram' | 'userQuoteToken'>;
|
|
605
|
+
payer: TransactionSigner;
|
|
606
|
+
maxQuoteIn: bigint;
|
|
607
|
+
payWith: PayWith;
|
|
608
|
+
/** Gabox accounts a route must never name. The Gabox program id is added here. */
|
|
609
|
+
gaboxAccounts: GaboxAccounts;
|
|
610
|
+
}): Promise<QuoteLeg>;
|
|
611
|
+
/**
|
|
612
|
+
* The leg around a sale: make sure the quote account exists, and turn the proceeds into SOL when
|
|
613
|
+
* the seller asked for SOL.
|
|
614
|
+
*
|
|
615
|
+
* The swap is an exact-in of `minQuoteOutput`, the floor the seller already signs for on the sale
|
|
616
|
+
* itself. Anything the venue pays above that floor stays in the seller's quote account: a swap can
|
|
617
|
+
* only spend what the sale is guaranteed to have produced.
|
|
618
|
+
*/
|
|
619
|
+
export declare function quoteLegOut(client: GaboxClient, input: {
|
|
620
|
+
venue: Pick<ResolvedVenue, 'quoteMint' | 'quoteTokenProgram' | 'userQuoteToken'>;
|
|
621
|
+
seller: TransactionSigner;
|
|
622
|
+
minQuoteOutput: bigint;
|
|
623
|
+
receive: Receive;
|
|
624
|
+
gaboxAccounts: GaboxAccounts;
|
|
625
|
+
}): Promise<QuoteLeg>;
|
|
626
|
+
/** The client's route provider, with a message that says what to do when it has none. */
|
|
627
|
+
export declare function providerOf(client: GaboxClient, quoteMint: Address): RouteProvider;
|
|
523
628
|
/**
|
|
524
|
-
*
|
|
629
|
+
* The compute limit a builder asks for: its own budget plus whatever the route needs.
|
|
525
630
|
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
631
|
+
* Capped at the runtime's ceiling. Jupiter often asks for the whole 1,400,000 units rather than
|
|
632
|
+
* estimating, and a request above the ceiling is rejected outright, so the sum has to be clamped
|
|
633
|
+
* rather than passed through.
|
|
528
634
|
*/
|
|
529
|
-
export declare function
|
|
530
|
-
/**
|
|
531
|
-
|
|
635
|
+
export declare function computeUnitsWithRoute(own: number, leg: QuoteLeg): number;
|
|
636
|
+
/**
|
|
637
|
+
* Add the route to a "transaction is too large" error.
|
|
638
|
+
*
|
|
639
|
+
* `buildMessage` already refuses a message above the 1,232-byte limit. When a swap is in the same
|
|
640
|
+
* message, the reason is usually the swap, and the fix is not to split the transaction: the two
|
|
641
|
+
* halves have to settle together. So the message says what a caller can actually do instead.
|
|
642
|
+
*/
|
|
643
|
+
export declare function routeSizeHint(cause: unknown, leg: QuoteLeg): unknown;
|
|
532
644
|
//#endregion
|
|
533
645
|
//#region src/tx/buyPack.d.ts
|
|
534
646
|
export type BuyPackInput = {
|
|
535
647
|
mint: Address;
|
|
536
|
-
/** Pays for everything and signs. Becomes `draw.purchaser`. */
|
|
537
648
|
purchaser: TransactionSigner;
|
|
538
|
-
/**
|
|
649
|
+
/**
|
|
650
|
+
* The venue slippage cap, in the pool's quote token. The transaction puts this much of the quote
|
|
651
|
+
* token in the buyer's quote account before the buy, so it must cover the real price. Anything
|
|
652
|
+
* left over stays there, or comes back as SOL on a WSOL pool.
|
|
653
|
+
*/
|
|
539
654
|
maxQuoteIn: bigint;
|
|
540
|
-
/**
|
|
655
|
+
/** The floor on the top prize this pack may win. Refresh the offer if it fails. */
|
|
541
656
|
minMaximum: bigint;
|
|
542
|
-
/**
|
|
543
|
-
|
|
544
|
-
maxTotalDebit: bigint;
|
|
545
|
-
/** Force a venue. Left out, the bonding curve's `complete` flag decides. */
|
|
546
|
-
venue?: VenueKind;
|
|
657
|
+
/** Caps every lamport the handler sees: venue account rent and the VRF request. */
|
|
658
|
+
maxNativeDebit: bigint;
|
|
547
659
|
/**
|
|
548
|
-
*
|
|
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.
|
|
660
|
+
* Pay in SOL through a swap, or in the quote token the buyer already holds. Defaults to `'sol'`.
|
|
661
|
+
* A WSOL pool ignores it: its quote token is SOL.
|
|
555
662
|
*/
|
|
663
|
+
payWith?: PayWith;
|
|
664
|
+
/** Force a venue instead of reading the LaunchLab pool's `status`. */
|
|
665
|
+
venue?: VenueKind;
|
|
666
|
+
/** Pin `pool.nextSeq` to make a rebuild fail rather than buy a second pack. */
|
|
556
667
|
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
668
|
} & Partial<BuildOptions>;
|
|
576
669
|
export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promise<GaboxTransactionMessage>;
|
|
577
670
|
//#endregion
|
|
578
671
|
//#region src/tx/createMachine.d.ts
|
|
672
|
+
/** Which quote asset a new machine is priced in. Defaults to wrapped SOL. */
|
|
673
|
+
export type QuoteChoice = {
|
|
674
|
+
mint: Address;
|
|
675
|
+
};
|
|
579
676
|
export type CreateMachineInput = {
|
|
580
677
|
/** Pays for everything and signs both instructions. Becomes `pool.creator`. */
|
|
581
678
|
creator: TransactionSigner;
|
|
582
|
-
/** A fresh keypair for the coin. Signs `
|
|
679
|
+
/** A fresh keypair for the coin. Signs `initialize_v2` and is never needed again. */
|
|
583
680
|
mintKeypair: TransactionSigner;
|
|
681
|
+
/** At most 32 UTF-8 bytes. */
|
|
584
682
|
name: string;
|
|
683
|
+
/** At most 10 UTF-8 bytes. */
|
|
585
684
|
symbol: string;
|
|
586
|
-
/** The metadata URI
|
|
685
|
+
/** The metadata URI. At most 200 UTF-8 bytes. */
|
|
587
686
|
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
687
|
/**
|
|
591
688
|
* The prize table. Immutable once the pool exists. Must pass `validateTiers` and
|
|
592
|
-
* `validatePack(PACK_TOKENS, tiers)`; the program checks both again on
|
|
689
|
+
* `validatePack(PACK_TOKENS, tiers)`; the program checks both again on chain. Defaults to
|
|
593
690
|
* `DEFAULT_TIERS`, the table the Gabox app uses.
|
|
594
691
|
*/
|
|
595
692
|
tiers?: readonly Readonly<Tier>[];
|
|
693
|
+
/** The quote asset the machine is priced in. Defaults to wrapped SOL. */
|
|
694
|
+
quote?: QuoteChoice;
|
|
695
|
+
/**
|
|
696
|
+
* `total_quote_fund_raising`, in the quote's own base units. Required for a quote other than
|
|
697
|
+
* wrapped SOL; a WSOL pool uses the raise the program pins for this cluster.
|
|
698
|
+
*/
|
|
699
|
+
raise?: bigint;
|
|
700
|
+
/**
|
|
701
|
+
* Pay for the seed in SOL through a swap, or in the quote token the creator already holds.
|
|
702
|
+
* Defaults to `'sol'`. A WSOL pool ignores it: its quote token is SOL.
|
|
703
|
+
*/
|
|
704
|
+
payWith?: PayWith;
|
|
596
705
|
/**
|
|
597
|
-
*
|
|
598
|
-
*
|
|
706
|
+
* Seed slippage cap in the quote token, for `mandatory + extraSeedTokens` together. The
|
|
707
|
+
* transaction puts this much of the quote token in the creator's quote account before the buy, so
|
|
708
|
+
* it must cover the real cost. Anything left over stays there, or comes back as SOL on a WSOL
|
|
709
|
+
* pool.
|
|
599
710
|
*/
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
711
|
+
maxSeedQuoteIn: bigint;
|
|
712
|
+
/**
|
|
713
|
+
* A separate cap on the lamports the seed buy itself spends. LaunchLab creates its platform and
|
|
714
|
+
* creator fee vaults on a coin's first trade and charges that rent to the payer, which is the
|
|
715
|
+
* only SOL the buy touches. It is not the price.
|
|
716
|
+
*/
|
|
717
|
+
maxSeedNativeDebit: bigint;
|
|
718
|
+
/**
|
|
719
|
+
* Extra tokens to seed on top of the mandatory amount `seedTokens(PACK_TOKENS, tiers)` computes.
|
|
720
|
+
* Defaults to `0n`. Must not be negative.
|
|
721
|
+
*/
|
|
722
|
+
extraSeedTokens?: bigint;
|
|
605
723
|
} & Partial<BuildOptions>;
|
|
606
724
|
/**
|
|
607
725
|
* Build the transaction message. Sign it with both `creator` and `mintKeypair`.
|
|
608
726
|
*
|
|
609
|
-
* Reads
|
|
610
|
-
*
|
|
727
|
+
* Reads the quote's LaunchLab config, the quote mint, and the Gabox platform config, because the
|
|
728
|
+
* seed price and every quote-side account depend on them. Nothing else needs the chain: the coin
|
|
611
729
|
* does not exist yet, so every other account is a derivation.
|
|
612
730
|
*/
|
|
613
731
|
export declare function createMachine(client: GaboxClient, input: CreateMachineInput): Promise<GaboxTransactionMessage>;
|
|
732
|
+
export type SeedCostEstimate = {
|
|
733
|
+
tiers: readonly Tier[];
|
|
734
|
+
/** The mandatory seed alone: `seedTokens(PACK_TOKENS, tiers)`. */
|
|
735
|
+
seedTokens: bigint;
|
|
736
|
+
/** `options.extraSeedTokens`, defaulted to `0n`. */
|
|
737
|
+
extraSeedTokens: bigint;
|
|
738
|
+
/** `seedTokens + extraSeedTokens`. What `createMachine` actually buys in the seed trade. */
|
|
739
|
+
totalSeedTokens: bigint;
|
|
740
|
+
/** Exact fresh-curve cost, in the quote token's base units, Raydium's fees included. */
|
|
741
|
+
quoteAmount: bigint;
|
|
742
|
+
/** The quote asset the machine would be priced in. */
|
|
743
|
+
quoteMint: Address;
|
|
744
|
+
quoteDecimals: number;
|
|
745
|
+
/** The symbol Metaplex or Token-2022 records for the quote mint, when it has one. */
|
|
746
|
+
quoteSymbol: string | null;
|
|
747
|
+
/** `total_quote_fund_raising` the launch would use, in the quote's base units. */
|
|
748
|
+
raise: bigint;
|
|
749
|
+
/**
|
|
750
|
+
* What `quoteAmount` costs in SOL through the client's route provider, or `null` when there is
|
|
751
|
+
* no provider or no route. Equal to `quoteAmount` on a WSOL pool.
|
|
752
|
+
*/
|
|
753
|
+
solAmount: bigint | null;
|
|
754
|
+
};
|
|
614
755
|
/**
|
|
615
756
|
* What the seed for this table costs, fees included, and how many tokens it is.
|
|
616
757
|
*
|
|
617
|
-
* The coin does not exist yet, so the price
|
|
618
|
-
*
|
|
619
|
-
*
|
|
758
|
+
* The coin does not exist yet, so the price comes from the starting reserves LaunchLab derives from
|
|
759
|
+
* the launch shape and the raise. Nothing trades on the curve before `initialize_pool` runs in the
|
|
760
|
+
* same transaction, so this is exact up to a change in Raydium's fee rates between the read and the
|
|
761
|
+
* send.
|
|
620
762
|
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
|
|
624
|
-
export declare function seedCostEstimate(client: GaboxClient, tiers?: readonly Readonly<Tier>[]): Promise<{
|
|
625
|
-
tiers: readonly Tier[];
|
|
626
|
-
seedTokens: bigint;
|
|
627
|
-
lamports: bigint;
|
|
628
|
-
}>;
|
|
629
|
-
/**
|
|
630
|
-
* The Pump buy accounts for the seed, built without reading the bonding curve.
|
|
763
|
+
* `solAmount` is the same cost in SOL, priced through the client's route provider. It is `null`
|
|
764
|
+
* when the client has no provider, or when no route exists: a devnet client has none unless the
|
|
765
|
+
* caller passes `raydiumCpmmRoute(pool)`.
|
|
631
766
|
*
|
|
632
|
-
*
|
|
633
|
-
* `
|
|
634
|
-
*
|
|
635
|
-
* two fee recipients come from `Global`.
|
|
767
|
+
* Defaults to `DEFAULT_TIERS`, wrapped SOL and no extra seed. Throws if `tiers` fails
|
|
768
|
+
* `validateTiers`/`validatePack`, if `extraSeedTokens` is negative, if the total seed is bigger
|
|
769
|
+
* than the curve sells, or if the raise is missing or below what LaunchLab accepts.
|
|
636
770
|
*/
|
|
637
|
-
export declare function
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}): Promise<AccountMeta[]>;
|
|
771
|
+
export declare function seedCostEstimate(client: GaboxClient, tiers?: readonly Readonly<Tier>[], options?: {
|
|
772
|
+
extraSeedTokens?: bigint;
|
|
773
|
+
quote?: QuoteChoice;
|
|
774
|
+
raise?: bigint;
|
|
775
|
+
}): Promise<SeedCostEstimate>;
|
|
643
776
|
//#endregion
|
|
644
777
|
//#region src/tx/draw.d.ts
|
|
645
778
|
export type RetryDrawInput = {
|
|
646
|
-
/** Pays the oracle fee and the transaction fee. Any wallet. */
|
|
647
779
|
payer: TransactionSigner;
|
|
648
780
|
pool: Address;
|
|
649
781
|
draw: Address;
|
|
650
|
-
/** Cap on what the oracle request may take from `payer`, in lamports. */
|
|
651
782
|
maxVrfDebit: bigint;
|
|
652
783
|
} & Partial<BuildOptions>;
|
|
653
784
|
export declare function retryDraw(client: GaboxClient, input: RetryDrawInput): Promise<GaboxTransactionMessage>;
|
|
654
785
|
export type ExpireDrawInput = {
|
|
655
|
-
/** Only pays the transaction fee. `expire_draw` itself has no signer account. */
|
|
656
786
|
payer: TransactionSigner;
|
|
657
787
|
pool: Address;
|
|
658
788
|
draw: Address;
|
|
659
789
|
} & Partial<BuildOptions>;
|
|
660
790
|
export declare function expireDraw(client: GaboxClient, input: ExpireDrawInput): Promise<GaboxTransactionMessage>;
|
|
661
791
|
export type DrawAvailability = {
|
|
662
|
-
status: DrawStatus;
|
|
663
792
|
attempts: number;
|
|
664
|
-
/** Slots remaining before a retry is allowed. `0` when it is allowed now. */
|
|
665
793
|
slotsUntilRetry: bigint;
|
|
666
|
-
/** Slots remaining before an unanswered draw reaches its expiry deadline. */
|
|
667
794
|
slotsUntilExpiry: bigint;
|
|
668
|
-
/** All three conditions the program checks for `retry_draw`, together. */
|
|
669
795
|
canRetry: boolean;
|
|
670
|
-
/** True only when the draw is still `Pending` and its expiry deadline passed. */
|
|
671
796
|
canExpire: boolean;
|
|
672
797
|
};
|
|
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>;
|
|
798
|
+
export declare function drawAvailability(client: GaboxClient, address: Address): Promise<DrawAvailability | null>;
|
|
681
799
|
//#endregion
|
|
682
800
|
//#region src/tx/fundPrizes.d.ts
|
|
683
801
|
export type FundPrizesInput = {
|
|
684
802
|
mint: Address;
|
|
685
|
-
/** The donor. Signs, and the tokens leave its account. */
|
|
686
803
|
funder: TransactionSigner;
|
|
687
|
-
/** Tokens to donate, in the mint's smallest unit. Must be positive. */
|
|
688
804
|
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
805
|
source?: Address;
|
|
694
806
|
} & Partial<BuildOptions>;
|
|
695
807
|
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
808
|
//#endregion
|
|
726
809
|
//#region src/tx/redeem.d.ts
|
|
727
810
|
export type SellTokensInput = {
|
|
728
811
|
mint: Address;
|
|
729
|
-
/** Wallet that owns the tokens and signs the venue sale. */
|
|
730
812
|
seller: TransactionSigner;
|
|
731
|
-
/** Exact token amount to sell. Must be positive. */
|
|
732
813
|
amount: bigint;
|
|
733
|
-
/**
|
|
734
|
-
* positive: the program rejects zero, because a zero floor is not slippage protection. */
|
|
814
|
+
/** The venue's own floor on the quote token it pays out. Nothing else is taken out of the sale. */
|
|
735
815
|
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
816
|
/**
|
|
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.
|
|
817
|
+
* Caps the lamports the sale itself spends. A sale normally spends none, but LaunchLab charges
|
|
818
|
+
* the payer for a fee vault it has to create on a coin's first trade.
|
|
762
819
|
*/
|
|
763
|
-
|
|
764
|
-
/**
|
|
820
|
+
maxNativeDebit: bigint;
|
|
821
|
+
/**
|
|
822
|
+
* Take the proceeds as SOL through a swap, or keep them in the quote token. Defaults to `'sol'`.
|
|
823
|
+
* A WSOL pool ignores it: its quote token is SOL.
|
|
824
|
+
*/
|
|
825
|
+
receive?: Receive;
|
|
765
826
|
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
|
-
}>;
|
|
827
|
+
} & Partial<BuildOptions>;
|
|
828
|
+
export declare function sellTokens(client: GaboxClient, input: SellTokensInput): Promise<GaboxTransactionMessage>;
|
|
783
829
|
//#endregion
|
|
784
|
-
//#region src/
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
830
|
+
//#region src/tx/wsol.d.ts
|
|
831
|
+
/** The wallet's WSOL account, and the instructions that put `lamports` of spendable WSOL in it. */
|
|
832
|
+
export declare function fundWsol(owner: TransactionSigner, lamports: bigint): Promise<{
|
|
833
|
+
account: Address;
|
|
834
|
+
instructions: Instruction[];
|
|
789
835
|
}>;
|
|
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>;
|
|
836
|
+
/** Close the WSOL account, sending every lamport in it back to the owner as SOL. */
|
|
837
|
+
export declare function unwrapWsol(owner: TransactionSigner, account: Address): Instruction;
|
|
796
838
|
//#endregion
|
|
797
839
|
//#region src/vrf.d.ts
|
|
798
840
|
/** The four accounts, named as the generated client names them. */
|
|
@@ -815,5 +857,5 @@ export type OracleAccounts = {
|
|
|
815
857
|
*/
|
|
816
858
|
export declare function oracleAccounts(): Promise<OracleAccounts>;
|
|
817
859
|
//#endregion
|
|
818
|
-
export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, CLUSTER_ENDPOINTS, ClientConfig, Cluster, DEVNET_HTTP, DEVNET_WS, DRAW_DISCRIMINATOR, type Draw, GaboxClient, GaboxRpc, GaboxRpcSubscriptions,
|
|
860
|
+
export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, BuildOptions, CLUSTER_ENDPOINTS, ClientConfig, Cluster, DEVNET_HTTP, DEVNET_WS, DRAW_DISCRIMINATOR, type Draw, GaboxClient, GaboxRpc, GaboxRpcSubscriptions, GaboxTransactionMessage, LAUNCH_DECIMALS, METAPLEX_PROGRAM_ADDRESS, PLATFORM_ADMIN, POOL_DISCRIMINATOR, type Pool, Route, RouteMode, RouteProvider, SYSTEM_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, WALLET_ACTIVITY_DISCRIMINATOR, WSOL_MINT, type WalletActivity, assertClusterUrl, buildMessage, clusterNamedBy, createClient, decodeDraw, decodePool, decodeWalletActivity, defaultRoute, findActivityPda, findDrawPda, findIdentityPda, findPoolPda, index_d_exports as generated, index_d_exports$1 as raydium, websocketUrlFor, withRemainingAccounts };
|
|
819
861
|
//# sourceMappingURL=index.d.ts.map
|