@gabox-labs/sdk 0.1.1 → 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 +249 -1
- package/README.md +116 -458
- 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 +211 -472
- package/dist/index.js +539 -1093
- 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 -141
- package/skills/gabox-sdk/references/api.md +102 -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;
|
|
@@ -44,61 +52,61 @@ export declare class GaboxMathError extends Error {
|
|
|
44
52
|
readonly code: string;
|
|
45
53
|
constructor(code: string, message: string);
|
|
46
54
|
}
|
|
47
|
-
/**
|
|
48
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The default prize table. The program does not enforce this table: it accepts any table that
|
|
57
|
+
* passes `validateTiers`. This is only the table the Gabox app creates its pools with, and the
|
|
58
|
+
* starting point for a client that has no reason to pick another one.
|
|
59
|
+
*
|
|
60
|
+
* Common 75% at 0.52x, Rare 20% at 1.2x, Epic 4% at 3x, Mythic 1% at 20x. Expected payout is
|
|
61
|
+
* 0.9499x of a pack, so the seed is 19 packs.
|
|
62
|
+
*/
|
|
63
|
+
export declare const DEFAULT_TIERS: readonly Readonly<Tier>[];
|
|
49
64
|
/** `math::tokens`. Floor division, and an overflow past u64 is an error, not a wrap. */
|
|
50
65
|
export declare function tierAmount(base: bigint, multiplierBps: number): bigint;
|
|
51
66
|
/**
|
|
52
67
|
* `math::validate`. Checks the table alone, with no base.
|
|
53
68
|
*
|
|
54
|
-
*
|
|
69
|
+
* Four rules, and each one closes a way to sell a bad ticket:
|
|
55
70
|
* - ticket counts sum to exactly 65,536, so the 16-bit draw is uniform;
|
|
56
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);
|
|
57
73
|
* - the expected multiplier over all tickets is at most 1x, so the table cannot promise more
|
|
58
74
|
* tokens than a pack buys. This bounds tokens, not cash value.
|
|
59
75
|
*/
|
|
60
|
-
export declare function validateTiers(tiers: readonly Tier[]): void;
|
|
76
|
+
export declare function validateTiers(tiers: readonly Readonly<Tier>[]): void;
|
|
61
77
|
/**
|
|
62
78
|
* `math::validate_pack`. Every ticketed tier must pay at least one token for a pack of this size.
|
|
63
79
|
*
|
|
64
80
|
* The program checks this once at creation. At `PACK_TOKENS` no sane table fails it; it exists so
|
|
65
81
|
* a table cannot sell a ticket that can only win zero.
|
|
66
82
|
*/
|
|
67
|
-
export declare function validatePack(packTokens: bigint, tiers: readonly Tier[]): void;
|
|
83
|
+
export declare function validatePack(packTokens: bigint, tiers: readonly Readonly<Tier>[]): void;
|
|
68
84
|
/**
|
|
69
|
-
* `math::seed_tokens`. The seed a table needs, in tokens.
|
|
85
|
+
* `math::seed_tokens`. The mandatory seed a table needs, in tokens.
|
|
70
86
|
*
|
|
71
|
-
* The
|
|
72
|
-
*
|
|
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:
|
|
73
91
|
*
|
|
74
|
-
* seedTokens = uncappedMaximum(packTokens, tiers) - packTokens
|
|
92
|
+
* seedTokens = min(uncappedMaximum(packTokens, tiers), tierAmount(packTokens, MIN_SEED_MULTIPLIER_BPS)) - packTokens
|
|
75
93
|
*
|
|
76
|
-
* A
|
|
77
|
-
*
|
|
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.
|
|
78
99
|
*
|
|
79
|
-
*
|
|
100
|
+
* Pool initialization computes this number itself and buys exactly that many tokens on the curve.
|
|
80
101
|
* The creator only signs a maximum SOL cost.
|
|
81
102
|
*/
|
|
82
|
-
export declare function seedTokens(packTokens: bigint, tiers: readonly Tier[]): bigint;
|
|
83
|
-
/**
|
|
84
|
-
* Derive a fully valid four-outcome rarity ladder from a jackpot multiplier and a risk preset.
|
|
85
|
-
*
|
|
86
|
-
* Mythic is exactly `jackpotBps`. Rare and Epic interpolate between sub-1x launch values
|
|
87
|
-
* and Mythic as the jackpot grows, so the four payouts remain strictly ordered even at 1x.
|
|
88
|
-
* The profile assigns fixed slices of one pack's EV budget to the three higher rarities. Whatever
|
|
89
|
-
* remains of the 95% target becomes Common. Integer rounding is always downward, so the result
|
|
90
|
-
* cannot cross the program's 100% expected-value ceiling.
|
|
91
|
-
*
|
|
92
|
-
* The seed this table needs is `seedTokens(packTokens, tiers)`: `(jackpotBps - 10_000)` bps of
|
|
93
|
-
* one pack.
|
|
94
|
-
*/
|
|
95
|
-
export declare function jackpotTiers(jackpotBps: number, profile: RiskProfile): Tier[];
|
|
103
|
+
export declare function seedTokens(packTokens: bigint, tiers: readonly Readonly<Tier>[]): bigint;
|
|
96
104
|
/**
|
|
97
105
|
* `math::uncapped_maximum`. The largest tier's award for this base, before any inventory cap.
|
|
98
106
|
*
|
|
99
107
|
* At `packTokens` this is the jackpot in tokens. `seedTokens` is this minus one pack.
|
|
100
108
|
*/
|
|
101
|
-
export declare function uncappedMaximum(base: bigint, tiers: readonly Tier[]): bigint;
|
|
109
|
+
export declare function uncappedMaximum(base: bigint, tiers: readonly Readonly<Tier>[]): bigint;
|
|
102
110
|
/**
|
|
103
111
|
* `math::quote`. The offer a pack of `base` tokens would freeze right now. `base` is always
|
|
104
112
|
* `pool.packTokens`; the parameter stays general so the vectors can use small numbers.
|
|
@@ -110,7 +118,7 @@ export declare function uncappedMaximum(base: bigint, tiers: readonly Tier[]): b
|
|
|
110
118
|
* Every amount is capped at what is actually available. A tier that rounds to zero tokens is an
|
|
111
119
|
* error: the pool must not sell a ticket that can only win nothing.
|
|
112
120
|
*/
|
|
113
|
-
export declare function quote(base: bigint, tiers: readonly Tier[], inventory: bigint, reserved: bigint): Offer;
|
|
121
|
+
export declare function quote(base: bigint, tiers: readonly Readonly<Tier>[], inventory: bigint, reserved: bigint): Offer;
|
|
114
122
|
/**
|
|
115
123
|
* `math::choose`. Which prize a 16-bit ticket wins.
|
|
116
124
|
*
|
|
@@ -121,40 +129,28 @@ export declare function choose(prizes: readonly Prize[], ticket: number): bigint
|
|
|
121
129
|
/** `math::resolve_reservation`. Release the unwon part of a maximum, keep the award reserved. */
|
|
122
130
|
export declare function resolveReservation(reserved: bigint, maximum: bigint, award: bigint): bigint;
|
|
123
131
|
/** The largest `multiplierBps` on any ticketed row. `0` for a table with no rows. */
|
|
124
|
-
export declare function maxMultiplierBps(tiers: readonly Tier[]): number;
|
|
132
|
+
export declare function maxMultiplierBps(tiers: readonly Readonly<Tier>[]): number;
|
|
125
133
|
/**
|
|
126
134
|
* The expected multiplier over all 65,536 tickets, in basis points. Rounded down.
|
|
127
135
|
*
|
|
128
136
|
* `validateTiers` caps this at 10,000. A table at 9,800 keeps 2% of every pack's tokens in the
|
|
129
137
|
* vault on average, which is what lets a pool survive a run of top-tier wins.
|
|
130
138
|
*/
|
|
131
|
-
export declare function averageMultiplierBps(tiers: readonly Tier[]): number;
|
|
139
|
+
export declare function averageMultiplierBps(tiers: readonly Readonly<Tier>[]): number;
|
|
132
140
|
//#endregion
|
|
133
141
|
//#region src/accounts.d.ts
|
|
134
|
-
/** `Draw.pool` sits straight after the discriminator. */
|
|
135
142
|
export declare const DRAW_POOL_OFFSET = 8;
|
|
136
|
-
/** `Draw.purchaser` sits after the discriminator and `pool`. */
|
|
137
143
|
export declare const DRAW_PURCHASER_OFFSET: number;
|
|
138
|
-
/** `Pool.creator` sits straight after the discriminator. */
|
|
139
144
|
export declare const POOL_CREATOR_OFFSET = 8;
|
|
140
|
-
/** `Pool.mint` sits after the discriminator and `creator`. */
|
|
141
145
|
export declare const POOL_MINT_OFFSET: number;
|
|
142
|
-
/** `ReferralLink.referrer` sits after the discriminator and `referee`. */
|
|
143
|
-
export declare const REFERRAL_LINK_REFERRER_OFFSET: number;
|
|
144
|
-
/** The pool for a coin, or `null` when the coin has no machine. */
|
|
145
146
|
export declare function fetchPoolByMint(client: GaboxClient, mint: Address): Promise<Pool | null>;
|
|
146
|
-
/**
|
|
147
|
-
* A pool by its own address, or `null`.
|
|
148
|
-
*
|
|
149
|
-
* `fetchPoolByMint` is the usual way in, because a coin's mint is the natural key. This one is for
|
|
150
|
-
* the other direction: a `Draw` names its pool and not its mint, so a client holding a draw reads
|
|
151
|
-
* the pool to learn which coin it belongs to.
|
|
152
|
-
*/
|
|
153
147
|
export declare function fetchPoolAt(client: GaboxClient, address: Address): Promise<Pool | null>;
|
|
154
|
-
/** A draw by address, or `null`. Delivered and legacy-claimed draws are closed. */
|
|
155
148
|
export declare function fetchDraw(client: GaboxClient, address: Address): Promise<Draw | null>;
|
|
156
|
-
/**
|
|
157
|
-
|
|
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>;
|
|
158
154
|
export type PoolRecord = {
|
|
159
155
|
address: Address;
|
|
160
156
|
data: Pool;
|
|
@@ -163,81 +159,25 @@ export type DrawRecord = {
|
|
|
163
159
|
address: Address;
|
|
164
160
|
data: Draw;
|
|
165
161
|
};
|
|
166
|
-
/**
|
|
167
|
-
* Every current-layout machine, by discriminator and account size. Older devnet
|
|
168
|
-
* pools predate seed fields and must not be decoded with the current schema.
|
|
169
|
-
*
|
|
170
|
-
* There is no on-chain registry — the design says so on purpose — so discovery is this scan plus
|
|
171
|
-
* the `PoolCreated` event. Public RPCs limit `getProgramAccounts`, so an app that lists machines
|
|
172
|
-
* for users should cache the result rather than call this per page view.
|
|
173
|
-
*/
|
|
174
162
|
export declare function listPools(client: GaboxClient): Promise<PoolRecord[]>;
|
|
175
|
-
/** Every draw of one pool, pending or ready. Closed draws are gone and never appear. */
|
|
176
|
-
export declare function listDrawsByPool(client: GaboxClient, pool: Address): Promise<DrawRecord[]>;
|
|
177
|
-
/**
|
|
178
|
-
* Every open draw of one wallet, across all pools. This is the "what am I owed" query.
|
|
179
|
-
*
|
|
180
|
-
* An address is already base58, so it goes into the filter unchanged.
|
|
181
|
-
*/
|
|
182
|
-
export declare function listDrawsByPurchaser(client: GaboxClient, purchaser: Address): Promise<DrawRecord[]>;
|
|
183
163
|
export type DrawQuery = {
|
|
184
|
-
/** A pool PDA. */
|
|
185
164
|
pool?: Address;
|
|
186
|
-
/** A buyer's wallet. */
|
|
187
165
|
purchaser?: Address;
|
|
188
166
|
};
|
|
189
|
-
/**
|
|
190
|
-
* Open draws, narrowed by pool, by purchaser, or by both.
|
|
191
|
-
*
|
|
192
|
-
* Both filters in one scan, because a UI asks for exactly that: "my pulls on this machine". Two
|
|
193
|
-
* separate scans and an intersection in the client would move twice the bytes and could disagree
|
|
194
|
-
* with itself, since the two reads happen at different slots. With neither filter this lists every
|
|
195
|
-
* open draw of every machine.
|
|
196
|
-
*/
|
|
197
167
|
export declare function listDraws(client: GaboxClient, query?: DrawQuery): Promise<DrawRecord[]>;
|
|
198
|
-
export
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* Every wallet bound to one referrer. This is the "who did I refer" query.
|
|
204
|
-
*
|
|
205
|
-
* A scan, because a link is seeded on the referee and nothing on chain indexes it by referrer.
|
|
206
|
-
* The list is small in practice, and a dashboard reads it once per load, not per poll.
|
|
207
|
-
*/
|
|
208
|
-
export declare function listReferralLinksByReferrer(client: GaboxClient, referrer: Address): Promise<ReferralLinkRecord[]>;
|
|
209
|
-
/** The vault's token balance. `0` when the vault does not exist yet. */
|
|
210
|
-
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>;
|
|
211
171
|
export type PoolInventory = {
|
|
212
|
-
pool: Pool;
|
|
213
172
|
poolAddress: Address;
|
|
214
|
-
|
|
215
|
-
/** The vault's whole token balance. */
|
|
173
|
+
pool: Pool;
|
|
216
174
|
inventory: bigint;
|
|
217
|
-
/** `pool.reserved`: maximum awards reserved by pending draws. */
|
|
218
175
|
reserved: bigint;
|
|
219
|
-
/** `inventory - reserved`. What a new pack's prizes can be paid from, besides its own tokens. */
|
|
220
176
|
free: bigint;
|
|
221
177
|
};
|
|
222
|
-
/**
|
|
223
|
-
* A pool with its live inventory. This is the pair every price display needs: the tiers are
|
|
224
|
-
* immutable, but what they actually pay depends on what is free in the vault right now.
|
|
225
|
-
*
|
|
226
|
-
* # Why one request reads both accounts
|
|
227
|
-
*
|
|
228
|
-
* The oracle callback lowers the vault and `pool.reserved` in one transaction, a few seconds after
|
|
229
|
-
* a buy. Two separate reads can land on either side of it: the old `reserved` with the new, smaller
|
|
230
|
-
* vault. That pair looks insolvent, and `quote` rightly refuses it. One `getMultipleAccounts` call
|
|
231
|
-
* returns both accounts from the same slot, so the pair is always one the chain actually held.
|
|
232
|
-
*/
|
|
233
178
|
export declare function fetchPoolInventory(client: GaboxClient, mint: Address): Promise<PoolInventory | null>;
|
|
234
|
-
/** The generated `Tier` uses the same field names as `math.ts`, so this is only a widening. */
|
|
235
179
|
export declare const tiersOf: (pool: Pool) => Tier[];
|
|
236
|
-
|
|
237
|
-
* The offer a pack of `base` tokens would freeze against this inventory. Pure — the same
|
|
238
|
-
* computation `buy_pack` performs, and the reason a client can show real amounts before paying.
|
|
239
|
-
*/
|
|
240
|
-
export declare const offerFor: (inventory: PoolInventory, base: bigint) => Offer;
|
|
180
|
+
export declare const quotePool: (inventory: PoolInventory) => Offer;
|
|
241
181
|
//#endregion
|
|
242
182
|
//#region src/compute.d.ts
|
|
243
183
|
export declare const COMPUTE_BUDGET_PROGRAM_ADDRESS: Address;
|
|
@@ -246,19 +186,28 @@ export declare const MAX_COMPUTE_UNIT_LIMIT = 1400000;
|
|
|
246
186
|
/** What an instruction gets when no `SetComputeUnitLimit` is present. */
|
|
247
187
|
export declare const DEFAULT_COMPUTE_UNIT_LIMIT = 200000;
|
|
248
188
|
/**
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
|
|
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.
|
|
253
199
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
export declare const REDEEM_COMPUTE_UNITS =
|
|
260
|
-
/**
|
|
261
|
-
|
|
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;
|
|
262
211
|
/** An instruction for the compute budget program: no accounts, all of it in the data. */
|
|
263
212
|
export type ComputeBudgetInstruction = Instruction<string, readonly []> & InstructionWithData<ReadonlyUint8Array>;
|
|
264
213
|
export declare function getSetComputeUnitLimitInstruction(units: number): ComputeBudgetInstruction;
|
|
@@ -274,58 +223,6 @@ export declare function getSetComputeUnitPriceInstruction(microLamports: number
|
|
|
274
223
|
/** The compute budget prefix a builder prepends: a limit, and a price only when one is asked for. */
|
|
275
224
|
export declare function computeBudgetInstructions(units: number, microLamports?: number | bigint): ComputeBudgetInstruction[];
|
|
276
225
|
//#endregion
|
|
277
|
-
//#region src/ids.d.ts
|
|
278
|
-
/** `declare_id!` in `programs/gabox-v2/src/lib.rs`. */
|
|
279
|
-
export declare const GABOX_PROGRAM_ID: Address<"GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA">;
|
|
280
|
-
/** Classic SPL Token. The quote side of every Pump trade uses it, because the quote is WSOL. */
|
|
281
|
-
export declare const TOKEN_PROGRAM_ADDRESS: Address;
|
|
282
|
-
/**
|
|
283
|
-
* Token-2022. Pump `create_v2` mints here, so every coin a machine is built on is a Token-2022
|
|
284
|
-
* mint and the pool vault ATA lives under this program.
|
|
285
|
-
*/
|
|
286
|
-
export declare const TOKEN_2022_PROGRAM_ADDRESS: Address;
|
|
287
|
-
/** Wrapped SOL. The quote mint on both venues. */
|
|
288
|
-
export declare const WSOL_MINT: Address;
|
|
289
|
-
/** MagicBlock's ephemeral VRF program. `vrf.rs` pins it and refuses any other. */
|
|
290
|
-
export declare const VRF_PROGRAM_ADDRESS: Address;
|
|
291
|
-
/**
|
|
292
|
-
* MagicBlock's default oracle queue. The program pins this one address, so a pool creator cannot
|
|
293
|
-
* point a draw at an oracle they control.
|
|
294
|
-
*/
|
|
295
|
-
export declare const VRF_DEFAULT_QUEUE: Address;
|
|
296
|
-
/** The seed of both identity PDAs. See `pdas.ts` — there are two, under different programs. */
|
|
297
|
-
export declare const IDENTITY_SEED: Uint8Array<ArrayBuffer>;
|
|
298
|
-
export declare const SLOT_HASHES_SYSVAR: Address;
|
|
299
|
-
export declare const INSTRUCTIONS_SYSVAR: Address;
|
|
300
|
-
/** `state.rs`. A retry may not run sooner than this after the last attempt. */
|
|
301
|
-
export declare const RETRY_SLOTS = 300n;
|
|
302
|
-
/** `state.rs`. After this many slots from the purchase, anyone may expire the draw. */
|
|
303
|
-
export declare const TIMEOUT_SLOTS = 216000n;
|
|
304
|
-
/** `state.rs`. Three requests in total, counting the one `buy_pack` makes. */
|
|
305
|
-
export declare const MAX_ATTEMPTS = 3;
|
|
306
|
-
/**
|
|
307
|
-
* `state.rs`. Tokens in one pack, in base units: 1,000,000 tokens at Pump's fixed 6 decimals, or
|
|
308
|
-
* 0.1% of the 1,000,000,000 supply. Every pool sells packs of this size. The venue decides what a
|
|
309
|
-
* pack costs, so the pack price follows the coin. Read `pool.packTokens` rather than this when a
|
|
310
|
-
* pool is at hand: a later program version may change the constant.
|
|
311
|
-
*/
|
|
312
|
-
export declare const PACK_TOKENS: bigint;
|
|
313
|
-
/** `state.rs`. The creator's per-pack fee, in bps of what the venue charged, may not exceed this. */
|
|
314
|
-
export declare const MAX_FEE_BPS = 100;
|
|
315
|
-
/** Referral reward: 1% of the creator fee, deducted from that fee. */
|
|
316
|
-
export declare const REFERRAL_FEE_BPS = 100n;
|
|
317
|
-
/** `state.rs`. The protocol's share of every pack's venue cost and of every sale's proceeds, in bps. */
|
|
318
|
-
export declare const PROTOCOL_FEE_BPS = 100n;
|
|
319
|
-
/**
|
|
320
|
-
* `PROTOCOL_FEE_COLLECTOR` in `state.rs`. Every pack pays 1% of its venue cost here, on top of
|
|
321
|
-
* that cost. Every sale through the program pays 1% of its proceeds here: SOL on Pump, WSOL (into the
|
|
322
|
-
* collector's WSOL ATA) on PumpSwap. The same key holds the program's upgrade authority.
|
|
323
|
-
*
|
|
324
|
-
* The generated instructions pin it as an `address` constraint, and `test/instruction-data.test.ts`
|
|
325
|
-
* checks this copy against the IDL.
|
|
326
|
-
*/
|
|
327
|
-
export declare const PROTOCOL_FEE_COLLECTOR: Address;
|
|
328
|
-
//#endregion
|
|
329
226
|
//#region src/events.d.ts
|
|
330
227
|
export type GaboxEvent = {
|
|
331
228
|
name: 'PoolCreated';
|
|
@@ -342,42 +239,51 @@ export type GaboxEvent = {
|
|
|
342
239
|
} | {
|
|
343
240
|
name: 'DrawResolved';
|
|
344
241
|
data: DrawResolvedEvent;
|
|
345
|
-
} | {
|
|
346
|
-
name: 'PrizeRedeemed';
|
|
347
|
-
data: PrizeRedeemedEvent;
|
|
348
242
|
} | {
|
|
349
243
|
name: 'TokensSold';
|
|
350
244
|
data: TokensSoldEvent;
|
|
351
245
|
};
|
|
352
|
-
/** Decode one `Program data:` payload, or `null` when it is not one of ours. */
|
|
353
246
|
export declare function decodeEvent(data: Uint8Array): GaboxEvent | null;
|
|
354
247
|
/**
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
* rather than reported. Another program in the same transaction emits its own events, and they are
|
|
359
|
-
* 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.
|
|
360
251
|
*/
|
|
361
252
|
export declare function decodeEvents(logs: readonly string[]): GaboxEvent[];
|
|
362
|
-
/** Fetch a transaction and decode the gabox events it emitted. */
|
|
363
253
|
export declare function fetchEvents(client: GaboxClient, signature: string): Promise<GaboxEvent[]>;
|
|
364
|
-
export type
|
|
365
|
-
|
|
366
|
-
signal?: AbortSignal;
|
|
367
|
-
/** Called on every account change, including the ones that are still `Pending`. */
|
|
368
|
-
onChange?: (draw: Draw) => void;
|
|
254
|
+
export type ResolvedDraw = DrawResolvedEvent & {
|
|
255
|
+
address: Address;
|
|
369
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;
|
|
370
265
|
/**
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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.
|
|
379
285
|
*/
|
|
380
|
-
export declare
|
|
286
|
+
export declare const PACK_TOKENS: bigint;
|
|
381
287
|
//#endregion
|
|
382
288
|
//#region src/lookupTables.d.ts
|
|
383
289
|
export declare const DEVNET_LOOKUP_TABLE_ADDRESS: Address<"Cx4ri1BU2bnDXPjnJykF3nbY2u4MD5pPvzFCJtNizWFa">;
|
|
@@ -400,16 +306,12 @@ export type PackOffer = {
|
|
|
400
306
|
/** The fixed token count of one pack. Every prize is a multiple of this. */
|
|
401
307
|
packTokens: bigint;
|
|
402
308
|
/** What the venue charges for `packTokens` right now, its own fees included. The pack price. */
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
protocolLamports: bigint;
|
|
410
|
-
/** What the seed cost the creator at creation. Display only. */
|
|
411
|
-
seedLamports: bigint;
|
|
412
|
-
/** 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. */
|
|
413
315
|
seedTokens: bigint;
|
|
414
316
|
/** Which venue the buy would route to right now. */
|
|
415
317
|
venue: VenueKind;
|
|
@@ -419,8 +321,10 @@ export type PackOffer = {
|
|
|
419
321
|
maximum: bigint;
|
|
420
322
|
/** The smallest prize. Also what a timed-out draw pays. */
|
|
421
323
|
minimum: bigint;
|
|
422
|
-
/**
|
|
423
|
-
*
|
|
324
|
+
/**
|
|
325
|
+
* The top prize with no inventory cap: the jackpot in tokens. Equal to `maximum` unless the
|
|
326
|
+
* inventory cap bites.
|
|
327
|
+
*/
|
|
424
328
|
uncapped: bigint;
|
|
425
329
|
/** Vault balance, `pool.reserved`, and the difference. */
|
|
426
330
|
inventory: bigint;
|
|
@@ -441,7 +345,7 @@ export type PackOffer = {
|
|
|
441
345
|
averageMultiplierBps: number;
|
|
442
346
|
};
|
|
443
347
|
export type GetOfferOptions = {
|
|
444
|
-
/** Force a venue instead of reading the
|
|
348
|
+
/** Force a venue instead of reading the LaunchLab pool's `status`. */
|
|
445
349
|
venue?: VenueKind;
|
|
446
350
|
/** The buyer, when you already know it. Only changes the account list, never the numbers. */
|
|
447
351
|
user?: Address;
|
|
@@ -454,10 +358,10 @@ export type GetOfferOptions = {
|
|
|
454
358
|
export declare function getOffer(client: GaboxClient, mint: Address, options?: GetOfferOptions): Promise<PackOffer>;
|
|
455
359
|
/**
|
|
456
360
|
* The same computation with the reads already done. Useful when a caller holds a `ResolvedVenue`
|
|
457
|
-
* and wants to re-price without touching the network. `
|
|
361
|
+
* and wants to re-price without touching the network. `quoteAmount` is
|
|
458
362
|
* `venue.quoteBuy(pool.packTokens)`.
|
|
459
363
|
*/
|
|
460
|
-
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind,
|
|
364
|
+
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint): PackOffer;
|
|
461
365
|
/**
|
|
462
366
|
* How short of the top prize a pool is, in tokens. `0` when it pays the whole table.
|
|
463
367
|
*
|
|
@@ -468,116 +372,38 @@ export declare function offerFromState(inventory: PoolInventory, venue: VenueKin
|
|
|
468
372
|
export declare function seedShortfall(offer: PackOffer): bigint;
|
|
469
373
|
//#endregion
|
|
470
374
|
//#region src/pdas.d.ts
|
|
471
|
-
/** `[
|
|
472
|
-
export declare
|
|
473
|
-
/** `[
|
|
474
|
-
export declare
|
|
475
|
-
/**
|
|
476
|
-
export declare
|
|
477
|
-
/** `["
|
|
478
|
-
export declare
|
|
479
|
-
/**
|
|
480
|
-
* `["identity"]` under gabox. This is the PDA gabox signs the VRF request with — the `identity`
|
|
481
|
-
* account of the `Oracle` group on `buy_pack` and `retry_draw`.
|
|
482
|
-
*/
|
|
483
|
-
export declare function vrfIdentityAddress(): Promise<Address>;
|
|
484
|
-
/**
|
|
485
|
-
* `["identity", gabox_program_id]` under the **VRF program**. A different address from
|
|
486
|
-
* `vrfIdentityAddress`, and it belongs to the other side: MagicBlock signs the `deliver_draw`
|
|
487
|
-
* callback with it. A client never puts it in an instruction. It is here so a client can recognise
|
|
488
|
-
* the signer on a callback transaction.
|
|
489
|
-
*/
|
|
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. */
|
|
490
384
|
export declare function scopedVrfIdentityAddress(): Promise<ProgramDerivedAddress>;
|
|
491
|
-
/**
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
export declare function associatedTokenAddress(owner: Address, mint: Address, tokenProgram?: Address): Promise<Address>;
|
|
496
|
-
/**
|
|
497
|
-
* The protocol fee collector's WSOL ATA, under classic SPL Token. A sale on PumpSwap pays its
|
|
498
|
-
* protocol fee here. The account must exist before the first PumpSwap sale; see `DEPLOYMENT.md`.
|
|
499
|
-
*/
|
|
500
|
-
export declare function feeCollectorWsolAddress(): Promise<Address>;
|
|
501
|
-
/**
|
|
502
|
-
* The pool's prize inventory: the pool PDA's ATA for the mint's own token program.
|
|
503
|
-
*
|
|
504
|
-
* `tokenProgram` defaults to Token-2022 because Pump `create_v2` mints there, and every machine is
|
|
505
|
-
* built on a coin Pump created. Pass the mint's real owner if you have it.
|
|
506
|
-
*/
|
|
507
|
-
export declare function vaultAddress(mint: Address, tokenProgram?: Address): Promise<Address>;
|
|
508
|
-
//#endregion
|
|
509
|
-
//#region src/tx/message.d.ts
|
|
510
|
-
/**
|
|
511
|
-
* What every builder returns: a version 0 message with a fee-payer signer and a blockhash
|
|
512
|
-
* lifetime, ready for `signTransactionMessageWithSigners`.
|
|
513
|
-
*
|
|
514
|
-
* Named, and built only from types `@solana/kit` exports, so the published declaration file
|
|
515
|
-
* refers to kit's types instead of copying them. `pipe`'s inferred type is a long intersection
|
|
516
|
-
* of kit-internal brands, and a copy of a branded type is not assignable to the original.
|
|
517
|
-
*/
|
|
518
|
-
export type GaboxTransactionMessage = Extract<TransactionMessage, {
|
|
519
|
-
version: 0;
|
|
520
|
-
}> & TransactionMessageWithFeePayerSigner & TransactionMessageWithBlockhashLifetime;
|
|
521
|
-
export type BuildOptions = {
|
|
522
|
-
/** Compute units to request. Each builder passes its own default. */
|
|
523
|
-
computeUnitLimit: number;
|
|
524
|
-
/** Priority fee in micro-lamports per compute unit. Left out, no price instruction is added. */
|
|
525
|
-
computeUnitPrice?: number | bigint;
|
|
526
|
-
/** Defaults to the client's tables, which the cluster chose. Pass `{}` to disable compression. */
|
|
527
|
-
addressLookupTables?: AddressesByLookupTableAddress;
|
|
528
|
-
};
|
|
529
|
-
/**
|
|
530
|
-
* Build the message. One RPC read, for the blockhash.
|
|
531
|
-
*
|
|
532
|
-
* The blockhash expires in about a minute, so build the message when the user is ready to sign
|
|
533
|
-
* rather than when the page loads.
|
|
534
|
-
*/
|
|
535
|
-
export declare function buildMessage(client: GaboxClient, feePayer: TransactionSigner, instructions: Instruction[], options: BuildOptions): Promise<GaboxTransactionMessage>;
|
|
536
|
-
/** Append `remainingAccounts` to a generated instruction, which is how a venue's list is passed. */
|
|
537
|
-
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>;
|
|
538
389
|
//#endregion
|
|
539
390
|
//#region src/tx/buyPack.d.ts
|
|
540
391
|
export type BuyPackInput = {
|
|
541
392
|
mint: Address;
|
|
542
|
-
/** Pays for everything and signs. Becomes `draw.purchaser`. */
|
|
543
393
|
purchaser: TransactionSigner;
|
|
544
|
-
/**
|
|
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
|
+
*/
|
|
545
398
|
maxQuoteIn: bigint;
|
|
546
|
-
/**
|
|
399
|
+
/** The floor on the top prize this pack may win. Refresh the offer if it fails. */
|
|
547
400
|
minMaximum: bigint;
|
|
548
|
-
/**
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
/** 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`. */
|
|
552
404
|
venue?: VenueKind;
|
|
553
|
-
/**
|
|
554
|
-
* Pin the draw's sequence number instead of reading `pool.nextSeq` now.
|
|
555
|
-
*
|
|
556
|
-
* The draw's address is `["draw", pool, seq]`, so a caller that has already told somebody which
|
|
557
|
-
* draw this purchase will create has to keep that promise if it rebuilds the message - after a
|
|
558
|
-
* stale blockhash, say. Rebuilding without a pin reads `nextSeq` again, and if the first attempt
|
|
559
|
-
* actually landed, the second one buys a **second pack** at the next sequence number rather than
|
|
560
|
-
* failing. With the pin it fails on the `init` constraint, which is the right outcome.
|
|
561
|
-
*/
|
|
405
|
+
/** Pin `pool.nextSeq` to make a rebuild fail rather than buy a second pack. */
|
|
562
406
|
seq?: bigint;
|
|
563
|
-
/**
|
|
564
|
-
* Lamports to wrap into the buyer's WSOL account on the PumpSwap route. Left out, the builder
|
|
565
|
-
* wraps `maxQuoteIn`: the venue never takes more than that, and any surplus stays in the buyer's
|
|
566
|
-
* own WSOL account.
|
|
567
|
-
*/
|
|
568
|
-
wrapLamports?: bigint;
|
|
569
|
-
/** Append PumpSwap's optional cashback account. Only for a cashback coin. */
|
|
570
|
-
cashback?: boolean;
|
|
571
|
-
/**
|
|
572
|
-
* A referrer to bind before the purchase, in the same transaction.
|
|
573
|
-
*
|
|
574
|
-
* A share link leaves the referrer's wallet in a cookie, and the first pack is where it matters:
|
|
575
|
-
* `bind_referrer` runs one instruction ahead of `buy_pack`, so the pack that converts the buyer
|
|
576
|
-
* is the pack that pays. Ignored when the buyer already has a link (the chain wins), when it
|
|
577
|
-
* names the buyer, or when it is the all-zero address. The link's rent is extra, on top of
|
|
578
|
-
* `maxTotalDebit`.
|
|
579
|
-
*/
|
|
580
|
-
referrer?: Address;
|
|
581
407
|
} & Partial<BuildOptions>;
|
|
582
408
|
export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promise<GaboxTransactionMessage>;
|
|
583
409
|
//#endregion
|
|
@@ -585,218 +411,131 @@ export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promi
|
|
|
585
411
|
export type CreateMachineInput = {
|
|
586
412
|
/** Pays for everything and signs both instructions. Becomes `pool.creator`. */
|
|
587
413
|
creator: TransactionSigner;
|
|
588
|
-
/** A fresh keypair for the coin. Signs `
|
|
414
|
+
/** A fresh keypair for the coin. Signs `initialize_v2` and is never needed again. */
|
|
589
415
|
mintKeypair: TransactionSigner;
|
|
416
|
+
/** At most 32 UTF-8 bytes. */
|
|
590
417
|
name: string;
|
|
418
|
+
/** At most 10 UTF-8 bytes. */
|
|
591
419
|
symbol: string;
|
|
592
|
-
/** The metadata URI
|
|
420
|
+
/** The metadata URI. At most 200 UTF-8 bytes. */
|
|
593
421
|
uri: string;
|
|
594
|
-
/** The creator's fee per pack, in bps of what the venue charges. `0` to `MAX_FEE_BPS`. Immutable. */
|
|
595
|
-
feeBps: number;
|
|
596
|
-
/** Controls how much probability moves from Common into Rare, Epic, and Mythic. */
|
|
597
|
-
riskProfile: RiskProfile;
|
|
598
422
|
/**
|
|
599
|
-
* The
|
|
600
|
-
* `
|
|
423
|
+
* The prize table. Immutable once the pool exists. Must pass `validateTiers` and
|
|
424
|
+
* `validatePack(PACK_TOKENS, tiers)`; the program checks both again on chain. Defaults to
|
|
425
|
+
* `DEFAULT_TIERS`, the table the Gabox app uses.
|
|
601
426
|
*/
|
|
602
|
-
|
|
427
|
+
tiers?: readonly Readonly<Tier>[];
|
|
603
428
|
/**
|
|
604
|
-
*
|
|
605
|
-
*
|
|
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.
|
|
606
432
|
*/
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
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.
|
|
443
|
+
*/
|
|
444
|
+
extraSeedTokens?: bigint;
|
|
612
445
|
} & Partial<BuildOptions>;
|
|
613
446
|
/**
|
|
614
447
|
* Build the transaction message. Sign it with both `creator` and `mintKeypair`.
|
|
615
448
|
*
|
|
616
|
-
* Reads
|
|
617
|
-
*
|
|
618
|
-
*
|
|
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.
|
|
619
452
|
*/
|
|
620
453
|
export declare function createMachine(client: GaboxClient, input: CreateMachineInput): Promise<GaboxTransactionMessage>;
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
* The coin does not exist yet, so the price is Pump's default new curve. Nothing else trades on
|
|
625
|
-
* it before `initialize_pool` runs in the same transaction, so this is exact up to a change in
|
|
626
|
-
* Pump's fee settings between the read and the send. Add a small margin for `maxSeedLamports`.
|
|
627
|
-
*/
|
|
628
|
-
export declare function seedCostEstimate(client: GaboxClient, jackpotBps: number, riskProfile: RiskProfile): Promise<{
|
|
629
|
-
tiers: Tier[];
|
|
454
|
+
export type SeedCostEstimate = {
|
|
455
|
+
tiers: readonly Tier[];
|
|
456
|
+
/** The mandatory seed alone: `seedTokens(PACK_TOKENS, tiers)`. */
|
|
630
457
|
seedTokens: bigint;
|
|
631
|
-
|
|
632
|
-
|
|
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
|
+
};
|
|
633
467
|
/**
|
|
634
|
-
*
|
|
468
|
+
* What the seed for this table costs, fees included, and how many tokens it is.
|
|
469
|
+
*
|
|
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.
|
|
635
474
|
*
|
|
636
|
-
*
|
|
637
|
-
* `
|
|
638
|
-
*
|
|
639
|
-
* two fee recipients come from `Global`.
|
|
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.
|
|
640
478
|
*/
|
|
641
|
-
export declare function
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
feeRecipientIndex?: number;
|
|
645
|
-
buybackRecipientIndex?: number;
|
|
646
|
-
}): Promise<AccountMeta[]>;
|
|
479
|
+
export declare function seedCostEstimate(client: GaboxClient, tiers?: readonly Readonly<Tier>[], options?: {
|
|
480
|
+
extraSeedTokens?: bigint;
|
|
481
|
+
}): Promise<SeedCostEstimate>;
|
|
647
482
|
//#endregion
|
|
648
483
|
//#region src/tx/draw.d.ts
|
|
649
484
|
export type RetryDrawInput = {
|
|
650
|
-
/** Pays the oracle fee and the transaction fee. Any wallet. */
|
|
651
485
|
payer: TransactionSigner;
|
|
652
486
|
pool: Address;
|
|
653
487
|
draw: Address;
|
|
654
|
-
/** Cap on what the oracle request may take from `payer`, in lamports. */
|
|
655
488
|
maxVrfDebit: bigint;
|
|
656
489
|
} & Partial<BuildOptions>;
|
|
657
490
|
export declare function retryDraw(client: GaboxClient, input: RetryDrawInput): Promise<GaboxTransactionMessage>;
|
|
658
491
|
export type ExpireDrawInput = {
|
|
659
|
-
/** Only pays the transaction fee. `expire_draw` itself has no signer account. */
|
|
660
492
|
payer: TransactionSigner;
|
|
661
493
|
pool: Address;
|
|
662
494
|
draw: Address;
|
|
663
495
|
} & Partial<BuildOptions>;
|
|
664
496
|
export declare function expireDraw(client: GaboxClient, input: ExpireDrawInput): Promise<GaboxTransactionMessage>;
|
|
665
497
|
export type DrawAvailability = {
|
|
666
|
-
status: DrawStatus;
|
|
667
498
|
attempts: number;
|
|
668
|
-
/** Slots remaining before a retry is allowed. `0` when it is allowed now. */
|
|
669
499
|
slotsUntilRetry: bigint;
|
|
670
|
-
/** Slots remaining before the draw can be expired. `0` when it can be expired now. */
|
|
671
500
|
slotsUntilExpiry: bigint;
|
|
672
|
-
/** All three conditions the program checks for `retry_draw`, together. */
|
|
673
501
|
canRetry: boolean;
|
|
674
|
-
/** The one condition `expire_draw` checks. */
|
|
675
502
|
canExpire: boolean;
|
|
676
503
|
};
|
|
677
|
-
|
|
678
|
-
* What a client may do to a draw right now.
|
|
679
|
-
*
|
|
680
|
-
* Reads the draw and the current slot, and reproduces the program's three retry conditions and its
|
|
681
|
-
* one expiry condition. Showing a disabled button with a countdown beats sending a transaction that
|
|
682
|
-
* fails with `RetryTooSoon`.
|
|
683
|
-
*/
|
|
684
|
-
export declare function drawAvailability(client: GaboxClient, draw: Address): Promise<DrawAvailability | null>;
|
|
504
|
+
export declare function drawAvailability(client: GaboxClient, address: Address): Promise<DrawAvailability | null>;
|
|
685
505
|
//#endregion
|
|
686
506
|
//#region src/tx/fundPrizes.d.ts
|
|
687
507
|
export type FundPrizesInput = {
|
|
688
508
|
mint: Address;
|
|
689
|
-
/** The donor. Signs, and the tokens leave its account. */
|
|
690
509
|
funder: TransactionSigner;
|
|
691
|
-
/** Tokens to donate, in the mint's smallest unit. Must be positive. */
|
|
692
510
|
amount: bigint;
|
|
693
|
-
/**
|
|
694
|
-
* The account the tokens come from. Defaults to the funder's associated token account, which is
|
|
695
|
-
* where a wallet holds them. Any token account the funder is the authority of works.
|
|
696
|
-
*/
|
|
697
511
|
source?: Address;
|
|
698
512
|
} & Partial<BuildOptions>;
|
|
699
513
|
export declare function fundPrizes(client: GaboxClient, input: FundPrizesInput): Promise<GaboxTransactionMessage>;
|
|
700
|
-
export type FundPrizesWithBuyInput = {
|
|
701
|
-
mint: Address;
|
|
702
|
-
/** The donor. Buys the tokens, then gives them away. Signs both instructions. */
|
|
703
|
-
funder: TransactionSigner;
|
|
704
|
-
/** Exact tokens to buy and donate. `seedShortfall(offer)` is the amount that uncaps the top prize. */
|
|
705
|
-
tokens: bigint;
|
|
706
|
-
/** The donor's slippage cap on the buy, in lamports (WSOL on PumpSwap). */
|
|
707
|
-
maxQuoteIn: bigint;
|
|
708
|
-
/** Force a venue. Left out, the bonding curve's `complete` flag decides. */
|
|
709
|
-
venue?: VenueKind;
|
|
710
|
-
/**
|
|
711
|
-
* Lamports to wrap on the PumpSwap route. Left out, `maxQuoteIn`. The venue never takes more
|
|
712
|
-
* than that, and any surplus stays in the donor's own WSOL account.
|
|
713
|
-
*/
|
|
714
|
-
wrapLamports?: bigint;
|
|
715
|
-
} & Partial<BuildOptions>;
|
|
716
|
-
/**
|
|
717
|
-
* Buy tokens at the venue with SOL and donate them to the vault, in one transaction.
|
|
718
|
-
*
|
|
719
|
-
* This is what a donor with SOL and no coins needs. `fundPrizes` moves tokens the donor already
|
|
720
|
-
* holds; this one buys them first. Both are irrevocable — there is no withdrawal instruction, and
|
|
721
|
-
* no authority can move vault tokens.
|
|
722
|
-
*
|
|
723
|
-
* Three instructions on the curve route: create the donor's token account if it is missing, buy,
|
|
724
|
-
* donate. Pump creates the account itself, but the idempotent instruction costs nothing when it
|
|
725
|
-
* already exists and it makes the transaction correct on its own terms. The PumpSwap route adds the
|
|
726
|
-
* WSOL create/fund/sync prefix, for the same reason `buyPack` does: PumpSwap spends WSOL.
|
|
727
|
-
*/
|
|
728
|
-
export declare function fundPrizesWithBuy(client: GaboxClient, input: FundPrizesWithBuyInput): Promise<GaboxTransactionMessage>;
|
|
729
514
|
//#endregion
|
|
730
515
|
//#region src/tx/redeem.d.ts
|
|
731
516
|
export type SellTokensInput = {
|
|
732
517
|
mint: Address;
|
|
733
|
-
/** Wallet that owns the tokens and signs the venue sale. */
|
|
734
518
|
seller: TransactionSigner;
|
|
735
|
-
/** Exact token amount to sell. Must be positive. */
|
|
736
519
|
amount: bigint;
|
|
737
|
-
/**
|
|
738
|
-
* 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. */
|
|
739
521
|
minQuoteOutput: bigint;
|
|
740
|
-
/** Force a venue. Left out, the bonding curve's `complete` flag decides. */
|
|
741
|
-
venue?: VenueKind;
|
|
742
|
-
} & Partial<BuildOptions>;
|
|
743
|
-
/**
|
|
744
|
-
* Sell a prize that the VRF callback already delivered to the wallet, through `sell_tokens`.
|
|
745
|
-
*
|
|
746
|
-
* The program needs the coin's pool: it keeps the vault out of the venue's account list. A mint
|
|
747
|
-
* with no pool cannot be sold this way; use a plain venue trade for that.
|
|
748
|
-
*/
|
|
749
|
-
export declare function sellTokens(client: GaboxClient, input: SellTokensInput): Promise<GaboxTransactionMessage>;
|
|
750
|
-
export type ClaimPrizeInput = {
|
|
751
|
-
mint: Address;
|
|
752
|
-
/** The wallet that bought the legacy pack. Only it can settle the draw. */
|
|
753
|
-
purchaser: TransactionSigner;
|
|
754
|
-
/** The draw to redeem. */
|
|
755
|
-
draw: Address;
|
|
756
|
-
} & Partial<BuildOptions>;
|
|
757
|
-
/** Transfer a legacy resolve-only award into the purchaser's token account and close the draw. */
|
|
758
|
-
export declare function claimPrize(client: GaboxClient, input: ClaimPrizeInput): Promise<GaboxTransactionMessage>;
|
|
759
|
-
export type SellPrizeInput = ClaimPrizeInput & {
|
|
760
522
|
/**
|
|
761
|
-
*
|
|
762
|
-
*
|
|
763
|
-
*
|
|
764
|
-
* This is the venue's own net quote, before the protocol fee. It is not net of the transaction
|
|
765
|
-
* 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.
|
|
766
525
|
*/
|
|
767
|
-
|
|
768
|
-
/** Force a venue. Left out, the bonding curve's `complete` flag decides. */
|
|
526
|
+
maxNativeDebit: bigint;
|
|
769
527
|
venue?: VenueKind;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
* Claim and sell a legacy resolve-only draw in one transaction.
|
|
773
|
-
*
|
|
774
|
-
* The award is read off the draw so the caller can price the sale before signing. A draw that has
|
|
775
|
-
* not resolved has no award yet, and this throws rather than building a sale of zero tokens.
|
|
776
|
-
*/
|
|
777
|
-
export declare function sellPrize(client: GaboxClient, input: SellPrizeInput): Promise<GaboxTransactionMessage>;
|
|
778
|
-
/**
|
|
779
|
-
* Quote the award held by a legacy open draw before the seller signs a floor.
|
|
780
|
-
*
|
|
781
|
-
* Read the draw, ask the venue, and subtract your own slippage tolerance to get `minQuoteOutput`.
|
|
782
|
-
*/
|
|
783
|
-
export declare function quoteSellPrize(client: GaboxClient, mint: Address, draw: Address, user: Address): Promise<{
|
|
784
|
-
award: bigint;
|
|
785
|
-
grossOutput: bigint;
|
|
786
|
-
}>;
|
|
528
|
+
} & Partial<BuildOptions>;
|
|
529
|
+
export declare function sellTokens(client: GaboxClient, input: SellTokensInput): Promise<GaboxTransactionMessage>;
|
|
787
530
|
//#endregion
|
|
788
|
-
//#region src/
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
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[];
|
|
793
536
|
}>;
|
|
794
|
-
/**
|
|
795
|
-
export declare function
|
|
796
|
-
/** Bind a wallet to a referrer. The purchaser signs and the binding is permanent. */
|
|
797
|
-
export declare function bindReferrer(client: GaboxClient, referee: TransactionSigner, referrer: Address, options?: Partial<BuildOptions>): Promise<GaboxTransactionMessage>;
|
|
798
|
-
/** Claim all accrued referral rewards for one pool. */
|
|
799
|
-
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;
|
|
800
539
|
//#endregion
|
|
801
540
|
//#region src/vrf.d.ts
|
|
802
541
|
/** The four accounts, named as the generated client names them. */
|
|
@@ -819,5 +558,5 @@ export type OracleAccounts = {
|
|
|
819
558
|
*/
|
|
820
559
|
export declare function oracleAccounts(): Promise<OracleAccounts>;
|
|
821
560
|
//#endregion
|
|
822
|
-
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 };
|
|
823
562
|
//# sourceMappingURL=index.d.ts.map
|