@gabox-labs/sdk 0.6.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 +84 -0
- package/README.md +113 -34
- package/dist/gabox-DGTCh34U.js +2338 -0
- package/dist/gabox-DGTCh34U.js.map +1 -0
- package/dist/generated/index.d.ts +89 -36
- package/dist/generated/index.js +2 -2289
- package/dist/generated/index.js.map +1 -1
- package/dist/{index-BDfGvmgF.d.ts → index-C4at2cZ_.d.ts} +304 -54
- package/dist/index.d.ts +333 -34
- package/dist/index.js +884 -506
- package/dist/index.js.map +1 -1
- package/dist/raydium/index.d.ts +2 -2
- package/dist/raydium/index.js +2 -2
- package/dist/{raydium-B-l9V3O-.js → raydium-CU-tZzIk.js} +869 -191
- package/dist/raydium-CU-tZzIk.js.map +1 -0
- package/llms.txt +4 -2
- package/package.json +1 -1
- package/skills/gabox-sdk/SKILL.md +27 -14
- package/skills/gabox-sdk/references/api.md +78 -26
- package/dist/raydium-B-l9V3O-.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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 {
|
|
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
3
|
import { Address, AddressesByLookupTableAddress, Instruction, InstructionWithData, ProgramDerivedAddress, ReadonlyUint8Array, TransactionSigner } from "@solana/kit";
|
|
4
4
|
//#region src/math.d.ts
|
|
5
5
|
/**
|
|
@@ -187,25 +187,26 @@ export declare const MAX_COMPUTE_UNIT_LIMIT = 1400000;
|
|
|
187
187
|
export declare const DEFAULT_COMPUTE_UNIT_LIMIT = 200000;
|
|
188
188
|
/**
|
|
189
189
|
* LaunchLab `initialize_v2`, the WSOL wrap, pool initialization with a seed buy, and the WSOL
|
|
190
|
-
* close, in one transaction. Measured at `
|
|
191
|
-
*
|
|
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
192
|
*/
|
|
193
|
-
export declare const CREATE_MACHINE_COMPUTE_UNITS =
|
|
193
|
+
export declare const CREATE_MACHINE_COMPUTE_UNITS = 350000;
|
|
194
194
|
/**
|
|
195
195
|
* A WSOL wrap, a venue buy, an escrow transfer, a draw init, a VRF request and the WSOL close.
|
|
196
|
-
* Measured at `
|
|
197
|
-
* `
|
|
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
198
|
* and creator fee vaults.
|
|
199
199
|
*/
|
|
200
|
-
export declare const BUY_PACK_COMPUTE_UNITS =
|
|
200
|
+
export declare const BUY_PACK_COMPUTE_UNITS = 235000;
|
|
201
201
|
/**
|
|
202
|
-
* A WSOL wrap, a venue sale, and the WSOL close. Measured at `
|
|
203
|
-
*
|
|
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
204
|
*/
|
|
205
|
-
export declare const REDEEM_COMPUTE_UNITS =
|
|
205
|
+
export declare const REDEEM_COMPUTE_UNITS = 125000;
|
|
206
206
|
/**
|
|
207
|
-
* A creator fee claim: create the
|
|
208
|
-
* `31,319` every run for the LaunchLab claim
|
|
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.
|
|
209
210
|
*/
|
|
210
211
|
export declare const CLAIM_COMPUTE_UNITS = 55000;
|
|
211
212
|
/** An instruction for the compute budget program: no accounts, all of it in the data. */
|
|
@@ -298,6 +299,15 @@ export declare const DEVNET_ADDRESS_LOOKUP_TABLES: AddressesByLookupTableAddress
|
|
|
298
299
|
* supply your own.
|
|
299
300
|
*/
|
|
300
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>;
|
|
301
311
|
//#endregion
|
|
302
312
|
//#region src/offer.d.ts
|
|
303
313
|
export type PackOffer = {
|
|
@@ -307,9 +317,18 @@ export type PackOffer = {
|
|
|
307
317
|
packTokens: bigint;
|
|
308
318
|
/** What the venue charges for `packTokens` right now, its own fees included. The pack price. */
|
|
309
319
|
quoteAmount: bigint;
|
|
310
|
-
/**
|
|
320
|
+
/** The pool's quote asset. Both venues settle in it; there is no native-SOL path. */
|
|
311
321
|
quoteMint: Address;
|
|
312
|
-
/**
|
|
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. */
|
|
313
332
|
seedQuoteAmount: bigint;
|
|
314
333
|
/** Tokens the seed locked in the vault. Derived from the live table. */
|
|
315
334
|
seedTokens: bigint;
|
|
@@ -351,17 +370,28 @@ export type GetOfferOptions = {
|
|
|
351
370
|
user?: Address;
|
|
352
371
|
};
|
|
353
372
|
/**
|
|
354
|
-
* 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`.
|
|
355
376
|
*
|
|
356
377
|
* Throws when the coin has no pool.
|
|
357
378
|
*/
|
|
358
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
|
+
};
|
|
359
386
|
/**
|
|
360
387
|
* The same computation with the reads already done. Useful when a caller holds a `ResolvedVenue`
|
|
361
388
|
* and wants to re-price without touching the network. `quoteAmount` is
|
|
362
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.
|
|
363
393
|
*/
|
|
364
|
-
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint): PackOffer;
|
|
394
|
+
export declare function offerFromState(inventory: PoolInventory, venue: VenueKind, quoteAmount: bigint, display?: QuoteDisplayFields): PackOffer;
|
|
365
395
|
/**
|
|
366
396
|
* How short of the top prize a pool is, in tokens. `0` when it pays the whole table.
|
|
367
397
|
*
|
|
@@ -387,19 +417,250 @@ export declare const associatedTokenAddress: (owner: Address, mint: Address, tok
|
|
|
387
417
|
/** The prize vault: the pool PDA's own associated token account for the coin. */
|
|
388
418
|
export declare const vaultAddress: (mint: Address) => Promise<Address>;
|
|
389
419
|
//#endregion
|
|
420
|
+
//#region src/route/cpmm.d.ts
|
|
421
|
+
/**
|
|
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.
|
|
424
|
+
*/
|
|
425
|
+
export declare const CPMM_ROUTE_SLIPPAGE_BPS = 100n;
|
|
426
|
+
/**
|
|
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`.
|
|
436
|
+
*/
|
|
437
|
+
export declare const CPMM_ROUTE_COMPUTE_UNITS = 75000;
|
|
438
|
+
/**
|
|
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`.
|
|
444
|
+
*/
|
|
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
|
+
};
|
|
487
|
+
/**
|
|
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.
|
|
492
|
+
*/
|
|
493
|
+
export declare function jupiterRoute(options?: JupiterRouteOptions): RouteProvider;
|
|
494
|
+
/**
|
|
495
|
+
* Turn a decoded `swap-instructions` response into a `Route`.
|
|
496
|
+
*
|
|
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.
|
|
499
|
+
*/
|
|
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>;
|
|
567
|
+
//#endregion
|
|
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;
|
|
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;
|
|
628
|
+
/**
|
|
629
|
+
* The compute limit a builder asks for: its own budget plus whatever the route needs.
|
|
630
|
+
*
|
|
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.
|
|
634
|
+
*/
|
|
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;
|
|
644
|
+
//#endregion
|
|
390
645
|
//#region src/tx/buyPack.d.ts
|
|
391
646
|
export type BuyPackInput = {
|
|
392
647
|
mint: Address;
|
|
393
648
|
purchaser: TransactionSigner;
|
|
394
649
|
/**
|
|
395
|
-
* The venue slippage cap, in
|
|
396
|
-
*
|
|
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.
|
|
397
653
|
*/
|
|
398
654
|
maxQuoteIn: bigint;
|
|
399
655
|
/** The floor on the top prize this pack may win. Refresh the offer if it fails. */
|
|
400
656
|
minMaximum: bigint;
|
|
401
657
|
/** Caps every lamport the handler sees: venue account rent and the VRF request. */
|
|
402
658
|
maxNativeDebit: bigint;
|
|
659
|
+
/**
|
|
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.
|
|
662
|
+
*/
|
|
663
|
+
payWith?: PayWith;
|
|
403
664
|
/** Force a venue instead of reading the LaunchLab pool's `status`. */
|
|
404
665
|
venue?: VenueKind;
|
|
405
666
|
/** Pin `pool.nextSeq` to make a rebuild fail rather than buy a second pack. */
|
|
@@ -408,6 +669,10 @@ export type BuyPackInput = {
|
|
|
408
669
|
export declare function buyPack(client: GaboxClient, input: BuyPackInput): Promise<GaboxTransactionMessage>;
|
|
409
670
|
//#endregion
|
|
410
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
|
+
};
|
|
411
676
|
export type CreateMachineInput = {
|
|
412
677
|
/** Pays for everything and signs both instructions. Becomes `pool.creator`. */
|
|
413
678
|
creator: TransactionSigner;
|
|
@@ -425,10 +690,23 @@ export type CreateMachineInput = {
|
|
|
425
690
|
* `DEFAULT_TIERS`, the table the Gabox app uses.
|
|
426
691
|
*/
|
|
427
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;
|
|
428
700
|
/**
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
|
|
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;
|
|
705
|
+
/**
|
|
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.
|
|
432
710
|
*/
|
|
433
711
|
maxSeedQuoteIn: bigint;
|
|
434
712
|
/**
|
|
@@ -446,9 +724,9 @@ export type CreateMachineInput = {
|
|
|
446
724
|
/**
|
|
447
725
|
* Build the transaction message. Sign it with both `creator` and `mintKeypair`.
|
|
448
726
|
*
|
|
449
|
-
* Reads
|
|
450
|
-
*
|
|
451
|
-
* account is a derivation.
|
|
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
|
|
729
|
+
* does not exist yet, so every other account is a derivation.
|
|
452
730
|
*/
|
|
453
731
|
export declare function createMachine(client: GaboxClient, input: CreateMachineInput): Promise<GaboxTransactionMessage>;
|
|
454
732
|
export type SeedCostEstimate = {
|
|
@@ -459,25 +737,41 @@ export type SeedCostEstimate = {
|
|
|
459
737
|
extraSeedTokens: bigint;
|
|
460
738
|
/** `seedTokens + extraSeedTokens`. What `createMachine` actually buys in the seed trade. */
|
|
461
739
|
totalSeedTokens: bigint;
|
|
462
|
-
/** Exact fresh-curve cost in
|
|
740
|
+
/** Exact fresh-curve cost, in the quote token's base units, Raydium's fees included. */
|
|
463
741
|
quoteAmount: bigint;
|
|
464
|
-
/**
|
|
465
|
-
quoteMint:
|
|
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;
|
|
466
754
|
};
|
|
467
755
|
/**
|
|
468
756
|
* What the seed for this table costs, fees included, and how many tokens it is.
|
|
469
757
|
*
|
|
470
758
|
* The coin does not exist yet, so the price comes from the starting reserves LaunchLab derives from
|
|
471
|
-
* the
|
|
472
|
-
* transaction, so this is exact up to a change in Raydium's fee rates between the read and the
|
|
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
|
|
473
761
|
* send.
|
|
474
762
|
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
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)`.
|
|
766
|
+
*
|
|
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.
|
|
478
770
|
*/
|
|
479
771
|
export declare function seedCostEstimate(client: GaboxClient, tiers?: readonly Readonly<Tier>[], options?: {
|
|
480
772
|
extraSeedTokens?: bigint;
|
|
773
|
+
quote?: QuoteChoice;
|
|
774
|
+
raise?: bigint;
|
|
481
775
|
}): Promise<SeedCostEstimate>;
|
|
482
776
|
//#endregion
|
|
483
777
|
//#region src/tx/draw.d.ts
|
|
@@ -517,13 +811,18 @@ export type SellTokensInput = {
|
|
|
517
811
|
mint: Address;
|
|
518
812
|
seller: TransactionSigner;
|
|
519
813
|
amount: bigint;
|
|
520
|
-
/** The venue's own floor on the
|
|
814
|
+
/** The venue's own floor on the quote token it pays out. Nothing else is taken out of the sale. */
|
|
521
815
|
minQuoteOutput: bigint;
|
|
522
816
|
/**
|
|
523
817
|
* Caps the lamports the sale itself spends. A sale normally spends none, but LaunchLab charges
|
|
524
818
|
* the payer for a fee vault it has to create on a coin's first trade.
|
|
525
819
|
*/
|
|
526
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;
|
|
527
826
|
venue?: VenueKind;
|
|
528
827
|
} & Partial<BuildOptions>;
|
|
529
828
|
export declare function sellTokens(client: GaboxClient, input: SellTokensInput): Promise<GaboxTransactionMessage>;
|
|
@@ -558,5 +857,5 @@ export type OracleAccounts = {
|
|
|
558
857
|
*/
|
|
559
858
|
export declare function oracleAccounts(): Promise<OracleAccounts>;
|
|
560
859
|
//#endregion
|
|
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 };
|
|
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 };
|
|
562
861
|
//# sourceMappingURL=index.d.ts.map
|