@gabox-labs/sdk 0.7.0 → 0.8.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 +43 -0
- package/README.md +37 -11
- package/dist/{index-C4at2cZ_.d.ts → index-CQcBMEah.d.ts} +192 -6
- package/dist/index.d.ts +32 -15
- package/dist/index.js +37 -38
- 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-CU-tZzIk.js → raydium-DIF1WOvI.js} +618 -62
- package/dist/raydium-DIF1WOvI.js.map +1 -0
- package/package.json +1 -1
- package/skills/gabox-sdk/SKILL.md +4 -2
- package/skills/gabox-sdk/references/api.md +16 -7
- package/dist/raydium-CU-tZzIk.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
All notable changes to `@gabox-labs/sdk`. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
4
4
|
and the project uses [Semantic Versioning](https://semver.org/) with the `0.x` rule from `CONTRIBUTING.md`.
|
|
5
5
|
|
|
6
|
+
## [0.8.0] - 2026-09-19
|
|
7
|
+
|
|
8
|
+
The platform's own fees, so the app can show them and claim them.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `raydium.fetchPlatformFees(client, { quoteMint })` reads the LaunchLab platform fee vault for one
|
|
13
|
+
quote asset, and `raydium.claimPlatformFee(client, { feeWallet, quoteMint })` claims it with
|
|
14
|
+
`claim_platform_fee_from_vault`. Only the wallet the platform config names can sign it.
|
|
15
|
+
- `raydium.fetchLockedPositions(client, owner)` lists every locked CPMM position a wallet holds the
|
|
16
|
+
fee NFT of, with the pool behind it and what it may withdraw now. `raydium.harvestLockedFees`
|
|
17
|
+
builds the lock program's `collect_cp_fees` for one of them. `raydium.lockedFeeLp` is the math,
|
|
18
|
+
checked against the lock program's own event on devnet.
|
|
19
|
+
- `raydiumIds` now carries Raydium's lock program and its authority per cluster, as `lock` and
|
|
20
|
+
`lockAuthority`. `decodeLockedCpLiquidity` reads a lock record, and `CpmmPoolState` gains
|
|
21
|
+
`lpMint` and `lpSupply`.
|
|
22
|
+
- `HARVEST_COMPUTE_UNITS`, measured at `102,221` on devnet.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- `RaydiumIds` is now the generated cluster table plus the lock ids. A caller that passed
|
|
27
|
+
`RAYDIUM_DEVNET_IDS` straight from `abi.ts` into a builder passes `raydiumIds('devnet')` instead.
|
|
28
|
+
|
|
29
|
+
## [0.7.1] - 2026-09-18
|
|
30
|
+
|
|
31
|
+
A product correction. Paying in SOL is for buyers, not for creators.
|
|
32
|
+
|
|
33
|
+
### Removed
|
|
34
|
+
|
|
35
|
+
- The seed-in-SOL option on `createMachine`: the creator pays the seed in the quote token. The
|
|
36
|
+
`payWith` input is gone, and with it the swap leg, the route safety check and the extra compute
|
|
37
|
+
units that creation used to ask for. A machine quoted in USDC now needs its creator to hold at
|
|
38
|
+
least `maxSeedQuoteIn` of USDC before the transaction runs, and `seedCostEstimate` says how much
|
|
39
|
+
that is.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- `SeedCostEstimate.solAmount` stays, and it is a display. It is what the seed is worth in SOL
|
|
44
|
+
through the route provider, not an amount any instruction spends. The create page shows it beside
|
|
45
|
+
the quote-token cost.
|
|
46
|
+
- `buyPack` keeps `payWith` and `sellTokens` keeps `receive`, both unchanged. Only a buyer arrives
|
|
47
|
+
holding SOL alone, so only a pack buy and a sale swap.
|
|
48
|
+
|
|
6
49
|
## [0.7.0] - 2026-09-18
|
|
7
50
|
|
|
8
51
|
Any quote token Raydium enabled, a price shown in SOL, and payment in SOL through a swap that runs
|
package/README.md
CHANGED
|
@@ -19,7 +19,9 @@ this SDK shows is the venue's own price with the venue's own fees already inside
|
|
|
19
19
|
| coin creator | 0.5% of every trade | the pool's `creator_fee_rate` |
|
|
20
20
|
|
|
21
21
|
Those shares come out of Raydium's revenue, not out of an extra charge Gabox adds. The creator
|
|
22
|
-
collects theirs with `raydium.claimCreatorFee` and `raydium.collectCreatorFee`.
|
|
22
|
+
collects theirs with `raydium.claimCreatorFee` and `raydium.collectCreatorFee`. The platform
|
|
23
|
+
collects its curve share with `raydium.claimPlatformFee`, and after graduation it holds the locked
|
|
24
|
+
LP of every pool, whose trade fees `raydium.harvestLockedFees` pays out.
|
|
23
25
|
|
|
24
26
|
## The quote asset
|
|
25
27
|
|
|
@@ -46,6 +48,9 @@ Buyers pay in SOL whatever the pool is priced in.
|
|
|
46
48
|
splits the two, because a swap that settled on its own would leave the buyer holding a token they
|
|
47
49
|
never asked for.
|
|
48
50
|
|
|
51
|
+
This is for packs and sales only. **A machine's seed is always paid by its creator, in the
|
|
52
|
+
machine's own quote token**, so `createMachine` never swaps. See "Create a machine" below.
|
|
53
|
+
|
|
49
54
|
```ts
|
|
50
55
|
import { createClient, raydiumCpmmRoute } from '@gabox-labs/sdk';
|
|
51
56
|
|
|
@@ -56,9 +61,8 @@ const client = createClient({
|
|
|
56
61
|
});
|
|
57
62
|
```
|
|
58
63
|
|
|
59
|
-
`payWith: 'quote'` on `buyPack`
|
|
60
|
-
|
|
61
|
-
token is SOL.
|
|
64
|
+
`payWith: 'quote'` on `buyPack` skips the swap and spends the token the wallet already holds.
|
|
65
|
+
`receive: 'quote'` does the same for a sale. A WSOL pool ignores both: its quote token is SOL.
|
|
62
66
|
|
|
63
67
|
The swap has to fit in the same 1,232-byte transaction as the buy. When it does not, the builder
|
|
64
68
|
fails with a clear error rather than splitting the work; supply more address lookup tables, or pay
|
|
@@ -96,9 +100,9 @@ Everything else is fixed: 6 decimals, 1,000,000,000 coins, 793,100,000 of them s
|
|
|
96
100
|
graduate into a CPMM pool, no vesting, the CPMM creator fee paid in the quote token. Metaplex limits
|
|
97
101
|
the three strings to 32, 10 and 200 UTF-8 bytes.
|
|
98
102
|
|
|
99
|
-
`maxSeedQuoteIn` is
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
`maxSeedQuoteIn` is the slippage cap on the seed buy, in the quote token, and the creator must
|
|
104
|
+
already hold that much. `maxSeedNativeDebit` is separate and small: it caps the lamports of rent
|
|
105
|
+
LaunchLab charges for the fee vaults it creates on a coin's first trade.
|
|
102
106
|
|
|
103
107
|
### Another quote asset
|
|
104
108
|
|
|
@@ -112,21 +116,24 @@ const message = await createMachine(client, {
|
|
|
112
116
|
uri: 'https://example.com/metadata.json',
|
|
113
117
|
quote: { mint: usdc },
|
|
114
118
|
raise, // total_quote_fund_raising, in USDC base units
|
|
115
|
-
payWith: 'sol', // the default: the seed is bought with a swap
|
|
116
119
|
maxSeedQuoteIn: (estimate.quoteAmount * 110n) / 100n,
|
|
117
120
|
maxSeedNativeDebit: 100_000_000n,
|
|
118
121
|
});
|
|
119
122
|
```
|
|
120
123
|
|
|
124
|
+
**The creator pays the seed, in the machine's own quote token.** There is no swap here: a machine
|
|
125
|
+
quoted in USDC needs the creator to hold at least `maxSeedQuoteIn` of USDC before this transaction
|
|
126
|
+
runs. Only a buyer arrives holding SOL alone, so only `buyPack` and `sellTokens` swap.
|
|
127
|
+
|
|
121
128
|
`raise` is how much the curve must take in before the coin graduates, in the quote's own base units.
|
|
122
129
|
A WSOL pool has it pinned by the program — 85 SOL on mainnet, 3 SOL on devnet — so leave it out
|
|
123
130
|
there. Any other quote has no default, because the same number means a different amount in every
|
|
124
131
|
token. LaunchLab refuses a raise below `min_quote_fund_raising` in that quote's config, and
|
|
125
132
|
`createMachine` checks the same thing before it builds anything.
|
|
126
133
|
|
|
127
|
-
`seedCostEstimate` reports `quoteAmount` in the quote token
|
|
128
|
-
`raise` it would use
|
|
129
|
-
`null` when nothing can price it.
|
|
134
|
+
`seedCostEstimate` reports `quoteAmount` in the quote token — what the creator actually pays —
|
|
135
|
+
plus `quoteDecimals`, `quoteSymbol` and the `raise` it would use. `solAmount` is what that cost is
|
|
136
|
+
worth in lamports through the route provider, for a display, or `null` when nothing can price it.
|
|
130
137
|
|
|
131
138
|
### The seed
|
|
132
139
|
|
|
@@ -217,6 +224,25 @@ reads the quote off the Gabox pool itself.
|
|
|
217
224
|
Both pay into the creator's account for the quote mint. When that is WSOL the builders close it, so
|
|
218
225
|
the creator receives SOL; any other quote arrives as that token.
|
|
219
226
|
|
|
227
|
+
## Platform fees
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
const owed = await raydium.fetchPlatformFees(client, { quoteMint }); // owed.curveQuote
|
|
231
|
+
await raydium.claimPlatformFee(client, { feeWallet, quoteMint }); // every coin on that quote
|
|
232
|
+
|
|
233
|
+
const positions = await raydium.fetchLockedPositions(client, feeWallet.address);
|
|
234
|
+
// position.poolAddress, position.claimableLp, position.claimableToken0, position.claimableToken1
|
|
235
|
+
await raydium.harvestLockedFees(client, { owner: feeWallet, position }); // one graduated coin
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
The platform's curve share waits in one LaunchLab vault per quote asset, and only the wallet the
|
|
239
|
+
platform config names as `platform_fee_wallet` can claim it. At graduation LaunchLab locks the
|
|
240
|
+
whole CPMM pool's LP under Raydium's lock program and mints one fee NFT to the platform NFT wallet.
|
|
241
|
+
`fetchLockedPositions` finds every such NFT in a wallet, reads the lock record and the pool behind
|
|
242
|
+
each, and computes what the position may withdraw now: the LP growth since the last harvest, as
|
|
243
|
+
`lockedFeeLp` works it out from the pool's `x * y` and LP supply. `harvestLockedFees` withdraws
|
|
244
|
+
that LP and pays both sides of the pair into the owner's accounts, closing the WSOL one.
|
|
245
|
+
|
|
220
246
|
## Wallet activity
|
|
221
247
|
|
|
222
248
|
`buyPack` keeps a `WalletActivity` account per buyer, at the PDA `findActivityPda({ purchaser })`
|
|
@@ -68,8 +68,9 @@ type ClientConfig = {
|
|
|
68
68
|
*
|
|
69
69
|
* Mainnet defaults to Jupiter, which is where the liquidity is. Devnet and localnet default to
|
|
70
70
|
* none, because Jupiter does not serve them: pass `raydiumCpmmRoute(pool)` with a CPMM pool that
|
|
71
|
-
* holds the SOL/quote pair. `null` disables the swap leg, and `payWith: 'sol'` then
|
|
72
|
-
* pool quoted in anything but WSOL.
|
|
71
|
+
* holds the SOL/quote pair. `null` disables the swap leg, and `buyPack`'s `payWith: 'sol'` then
|
|
72
|
+
* fails on a pool quoted in anything but WSOL. Creating a machine never needs it: the creator
|
|
73
|
+
* pays the seed in the machine's own quote token.
|
|
73
74
|
*/
|
|
74
75
|
route?: RouteProvider | null;
|
|
75
76
|
};
|
|
@@ -228,6 +229,10 @@ declare const LAUNCHLAB_SELL_EXACT_IN: VenueInstructionAbi;
|
|
|
228
229
|
* `claim_creator_fee` on `LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj` — not in interfaces.json (the program never builds it).
|
|
229
230
|
*/
|
|
230
231
|
declare const LAUNCHLAB_CLAIM_CREATOR_FEE: VenueInstructionAbi;
|
|
232
|
+
/**
|
|
233
|
+
* `claim_platform_fee_from_vault` on `LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj` — not in interfaces.json (the program never builds it).
|
|
234
|
+
*/
|
|
235
|
+
declare const LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT: VenueInstructionAbi;
|
|
231
236
|
/**
|
|
232
237
|
* `swap_base_output` on `CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C` — cross-checked against interfaces.json.
|
|
233
238
|
*/
|
|
@@ -244,8 +249,22 @@ declare const CPMM_SWAP_BASE_INPUT: VenueInstructionAbi;
|
|
|
244
249
|
declare const CPMM_COLLECT_CREATOR_FEE: VenueInstructionAbi;
|
|
245
250
|
//#endregion
|
|
246
251
|
//#region src/raydium/ids.d.ts
|
|
252
|
+
/**
|
|
253
|
+
* Raydium's liquidity lock program and its authority, per cluster.
|
|
254
|
+
*
|
|
255
|
+
* LaunchLab locks every graduated pool's LP under this program and mints one fee NFT to the
|
|
256
|
+
* platform NFT wallet. The Gabox program never calls it, so these two addresses are not in the Rust
|
|
257
|
+
* `ids.rs` and are typed here instead. Verified 2026-09-19: the devnet migration of a Gabox coin
|
|
258
|
+
* called the devnet program below, and `test/raydium-pdas.test.ts` derives both authorities.
|
|
259
|
+
*/
|
|
260
|
+
type LockIds = {
|
|
261
|
+
/** The lock program. `collect_cp_fees` on it pays the fee NFT holder. */
|
|
262
|
+
lock: Address;
|
|
263
|
+
/** `["lock_cp_authority_seed"]` under `lock`. It owns the vault that holds the locked LP. */
|
|
264
|
+
lockAuthority: Address;
|
|
265
|
+
};
|
|
247
266
|
/** The name the rest of the SDK uses for one cluster's Raydium deployment. */
|
|
248
|
-
type RaydiumIds = RaydiumClusterIds;
|
|
267
|
+
type RaydiumIds = RaydiumClusterIds & LockIds;
|
|
249
268
|
/**
|
|
250
269
|
* The decimals every Gabox coin is launched with. `venue/launch.rs` refuses any other value, and
|
|
251
270
|
* `tokens.rs` refuses a pool mint that does not have exactly this many.
|
|
@@ -277,6 +296,8 @@ declare const LAUNCHLAB_SEEDS: {
|
|
|
277
296
|
readonly vault: "pool_vault";
|
|
278
297
|
/** `["creator_fee_vault_auth_seed"]`, the authority over every creator fee vault. */
|
|
279
298
|
readonly creatorFeeVaultAuthority: "creator_fee_vault_auth_seed";
|
|
299
|
+
/** `["platform_fee_vault_auth_seed"]`, the authority over every platform fee vault. */
|
|
300
|
+
readonly platformFeeVaultAuthority: "platform_fee_vault_auth_seed";
|
|
280
301
|
};
|
|
281
302
|
/** CPMM's PDA seeds. */
|
|
282
303
|
declare const CPMM_SEEDS: {
|
|
@@ -291,6 +312,15 @@ declare const CPMM_SEEDS: {
|
|
|
291
312
|
/** `["creator_fee_share", creator, amm_config]`. */
|
|
292
313
|
readonly creatorFeeShare: "creator_fee_share";
|
|
293
314
|
};
|
|
315
|
+
/** The SPL Memo program. The lock program's `collect_cp_fees` lists it and never writes to it. */
|
|
316
|
+
declare const MEMO_PROGRAM_ADDRESS: Address;
|
|
317
|
+
/** The lock program's PDA seeds. */
|
|
318
|
+
declare const LOCK_SEEDS: {
|
|
319
|
+
/** `["lock_cp_authority_seed"]`. */
|
|
320
|
+
readonly authority: "lock_cp_authority_seed";
|
|
321
|
+
/** `["locked_liquidity", fee_nft_mint]`. One record per locked position. */
|
|
322
|
+
readonly lockedLiquidity: "locked_liquidity";
|
|
323
|
+
};
|
|
294
324
|
/** Metaplex's metadata PDA seed: `["metadata", metaplex, mint]`. */
|
|
295
325
|
declare const METADATA_SEED = "metadata";
|
|
296
326
|
/**
|
|
@@ -435,6 +465,8 @@ type CpmmPoolState = {
|
|
|
435
465
|
poolCreator: Address;
|
|
436
466
|
token0Vault: Address;
|
|
437
467
|
token1Vault: Address;
|
|
468
|
+
/** The LP token. A graduated coin's LP is locked, and its fee NFT holder harvests the fees. */
|
|
469
|
+
lpMint: Address;
|
|
438
470
|
token0Mint: Address;
|
|
439
471
|
token1Mint: Address;
|
|
440
472
|
token0Program: Address;
|
|
@@ -442,6 +474,8 @@ type CpmmPoolState = {
|
|
|
442
474
|
observationKey: Address;
|
|
443
475
|
/** Bit flags. Bit 2 set (value 4) means swaps are switched off. */
|
|
444
476
|
status: number;
|
|
477
|
+
/** LP tokens in circulation. The pool keeps this equal to the LP mint's supply. */
|
|
478
|
+
lpSupply: bigint;
|
|
445
479
|
mint0Decimals: number;
|
|
446
480
|
mint1Decimals: number;
|
|
447
481
|
/** Fees the pool owes and a swap must not spend. Subtract them from the vault balances. */
|
|
@@ -490,6 +524,36 @@ type CpmmAmmConfig = {
|
|
|
490
524
|
};
|
|
491
525
|
declare const CPMM_AMM_CONFIG_HEAD_SIZE = 116;
|
|
492
526
|
declare function decodeCpmmAmmConfig(data: Uint8Array): CpmmAmmConfig;
|
|
527
|
+
/**
|
|
528
|
+
* One locked CPMM position, as Raydium's lock program records it.
|
|
529
|
+
*
|
|
530
|
+
* LaunchLab locks a graduated pool's LP here and mints one fee NFT for it. Whoever holds the NFT
|
|
531
|
+
* harvests the fees. Layout from `LockedCpLiquidityState` in the `pinocchio-raydium-locking-program`
|
|
532
|
+
* crate, checked against a devnet record on 2026-09-19: six numbers, four addresses, then padding.
|
|
533
|
+
*/
|
|
534
|
+
type LockedCpLiquidity = {
|
|
535
|
+
/** LP tokens still locked. A harvest withdraws some of them and lowers this. */
|
|
536
|
+
lockedLpAmount: bigint;
|
|
537
|
+
/** LP tokens every past harvest withdrew, in total. */
|
|
538
|
+
claimedLpAmount: bigint;
|
|
539
|
+
unclaimedLpAmount: bigint;
|
|
540
|
+
/** The LP supply at the last checkpoint: the lock itself, or the last harvest. */
|
|
541
|
+
lastLp: bigint;
|
|
542
|
+
/** The pool's `x * y` at that checkpoint, on the balances that belong to LPs. */
|
|
543
|
+
lastK: bigint;
|
|
544
|
+
recentEpoch: bigint;
|
|
545
|
+
/** The CPMM pool the LP belongs to. */
|
|
546
|
+
poolId: Address;
|
|
547
|
+
/** The NFT whose holder may harvest. */
|
|
548
|
+
feeNftMint: Address;
|
|
549
|
+
lockedOwner: Address;
|
|
550
|
+
lockedLpMint: Address;
|
|
551
|
+
};
|
|
552
|
+
/** `sha256("account:LockedCpLiquidityState")[0..8]`. */
|
|
553
|
+
declare const LOCKED_CP_LIQUIDITY_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
554
|
+
/** Six numbers and four addresses after the discriminator. The account itself is 256 bytes. */
|
|
555
|
+
declare const LOCKED_CP_LIQUIDITY_HEAD_SIZE: number;
|
|
556
|
+
declare function decodeLockedCpLiquidity(data: Uint8Array): LockedCpLiquidity;
|
|
493
557
|
//#endregion
|
|
494
558
|
//#region src/raydium/curve.d.ts
|
|
495
559
|
/**
|
|
@@ -1053,6 +1117,11 @@ declare const platformFeeVaultAddress: (launchlab: Address, platformConfig: Addr
|
|
|
1053
1117
|
declare const creatorFeeVaultAddress: (launchlab: Address, creator: Address, quoteMint: Address) => Promise<Address>;
|
|
1054
1118
|
/** `["creator_fee_vault_auth_seed"]`. The authority `claim_creator_fee` signs the payout with. */
|
|
1055
1119
|
declare const creatorFeeVaultAuthority: (launchlab: Address) => Promise<Address>;
|
|
1120
|
+
/**
|
|
1121
|
+
* `["platform_fee_vault_auth_seed"]`. The authority `claim_platform_fee_from_vault` signs the
|
|
1122
|
+
* payout with.
|
|
1123
|
+
*/
|
|
1124
|
+
declare const platformFeeVaultAuthority: (launchlab: Address) => Promise<Address>;
|
|
1056
1125
|
/** `["metadata", metaplex, mint]` under Metaplex. LaunchLab's create instruction writes it. */
|
|
1057
1126
|
declare const metadataAddress: (mint: Address) => Promise<Address>;
|
|
1058
1127
|
/** `["vault_and_lp_mint_auth_seed"]`. */
|
|
@@ -1079,9 +1148,126 @@ declare const cpmmPoolAddress: (cpmm: Address, ammConfig: Address, mintA: Addres
|
|
|
1079
1148
|
* (3005) when it is missing. One account per creator per fee tier, not one per pool.
|
|
1080
1149
|
*/
|
|
1081
1150
|
declare const cpmmCreatorFeeShare: (cpmm: Address, creator: Address, ammConfig: Address) => Promise<Address>;
|
|
1151
|
+
/** `["lock_cp_authority_seed"]`. The lock program's authority, which owns every locked LP vault. */
|
|
1152
|
+
declare const lockAuthority: (lock: Address) => Promise<Address>;
|
|
1153
|
+
/**
|
|
1154
|
+
* `["locked_liquidity", fee_nft_mint]`. The record of one locked position: which pool, how much LP,
|
|
1155
|
+
* and the checkpoint the next fee harvest is measured from.
|
|
1156
|
+
*/
|
|
1157
|
+
declare const lockedLiquidityAddress: (lock: Address, feeNftMint: Address) => Promise<Address>;
|
|
1082
1158
|
/** An associated token account. Off-curve owners are allowed: pool PDAs are all off-curve. */
|
|
1083
1159
|
declare const ata: (owner: Address, mint: Address, tokenProgram?: Address) => Promise<Address>;
|
|
1084
1160
|
//#endregion
|
|
1161
|
+
//#region src/raydium/platform.d.ts
|
|
1162
|
+
/**
|
|
1163
|
+
* The instructions of a platform fee claim, for one quote asset: create the quote account, claim,
|
|
1164
|
+
* and close it again when the quote is WSOL.
|
|
1165
|
+
*
|
|
1166
|
+
* This sweeps **every** coin launched against that quote, because LaunchLab keeps one platform
|
|
1167
|
+
* vault per quote asset. `feeWallet` must be the wallet the platform config names, or LaunchLab
|
|
1168
|
+
* refuses the claim.
|
|
1169
|
+
*/
|
|
1170
|
+
declare function getClaimPlatformFeeInstructions(feeWallet: TransactionSigner, ids: RaydiumIds, quote: {
|
|
1171
|
+
mint: Address;
|
|
1172
|
+
tokenProgram: Address;
|
|
1173
|
+
}): Promise<Instruction[]>;
|
|
1174
|
+
type ClaimPlatformFeeInput = {
|
|
1175
|
+
/** The platform fee wallet. It signs, and it receives the payout. */
|
|
1176
|
+
feeWallet: TransactionSigner;
|
|
1177
|
+
/** The quote asset to claim. Defaults to wrapped SOL. One claim per quote asset. */
|
|
1178
|
+
quoteMint?: Address;
|
|
1179
|
+
} & Partial<BuildOptions>;
|
|
1180
|
+
/**
|
|
1181
|
+
* Claim the curve platform fee for one quote asset.
|
|
1182
|
+
*
|
|
1183
|
+
* A WSOL claim arrives as SOL, because the builder closes the WSOL account. Any other quote arrives
|
|
1184
|
+
* as that token, in the fee wallet's own account.
|
|
1185
|
+
*/
|
|
1186
|
+
declare function claimPlatformFee(client: GaboxClient, input: ClaimPlatformFeeInput): Promise<GaboxTransactionMessage>;
|
|
1187
|
+
/**
|
|
1188
|
+
* What the platform can claim from the curve right now, for one quote asset, in base units.
|
|
1189
|
+
*
|
|
1190
|
+
* `quoteMint` defaults to wrapped SOL. One vault per quote asset, so a platform with coins on two
|
|
1191
|
+
* quotes reads this twice. A vault that does not exist yet reads as zero.
|
|
1192
|
+
*/
|
|
1193
|
+
declare function fetchPlatformFees(client: GaboxClient, input?: {
|
|
1194
|
+
quoteMint?: Address;
|
|
1195
|
+
}): Promise<{
|
|
1196
|
+
quoteMint: Address;
|
|
1197
|
+
curveQuote: bigint;
|
|
1198
|
+
}>;
|
|
1199
|
+
/**
|
|
1200
|
+
* `collect_cp_fees` on the lock program. There is no public IDL for it. The account list and the
|
|
1201
|
+
* discriminator come from Raydium's own SDK and from the `pinocchio-raydium-locking-program`
|
|
1202
|
+
* client crate, and the devnet harvest in `test/devnet.e2e.test.ts` runs it.
|
|
1203
|
+
*/
|
|
1204
|
+
declare const LOCK_COLLECT_CP_FEES: VenueInstructionAbi;
|
|
1205
|
+
/** One locked CPMM position a wallet holds the fee NFT of, with what it can harvest right now. */
|
|
1206
|
+
type LockedPosition = {
|
|
1207
|
+
/** The fee NFT. Holding it is the right to harvest. */
|
|
1208
|
+
feeNftMint: Address;
|
|
1209
|
+
/** The lock program's record for this position. */
|
|
1210
|
+
record: Address;
|
|
1211
|
+
lock: LockedCpLiquidity;
|
|
1212
|
+
/** The CPMM pool the LP belongs to. */
|
|
1213
|
+
poolAddress: Address;
|
|
1214
|
+
pool: CpmmPoolState;
|
|
1215
|
+
/** The pool's balances that belong to LPs: each vault less the fees the pool still owes. */
|
|
1216
|
+
vault0: bigint;
|
|
1217
|
+
vault1: bigint;
|
|
1218
|
+
/** LP tokens the position may withdraw now. Zero until the pool trades. */
|
|
1219
|
+
claimableLp: bigint;
|
|
1220
|
+
/** What those LP tokens are worth in the pool's two tokens, rounded down. */
|
|
1221
|
+
claimableToken0: bigint;
|
|
1222
|
+
claimableToken1: bigint;
|
|
1223
|
+
};
|
|
1224
|
+
/**
|
|
1225
|
+
* The LP tokens a locked position may withdraw as fees.
|
|
1226
|
+
*
|
|
1227
|
+
* Every swap leaves its fee in the vaults, so one LP token buys a little more of the pool after
|
|
1228
|
+
* each trade than before it. The record keeps the pool's `x * y` and LP supply from its last
|
|
1229
|
+
* checkpoint. The LP tokens that still hold exactly the checkpoint's liquidity are
|
|
1230
|
+
* `locked * sqrt(last_k) / last_lp * supply / sqrt(k)`; everything above that is fee growth.
|
|
1231
|
+
*
|
|
1232
|
+
* The division rounds the kept part up, so the answer never claims a unit the pool does not owe.
|
|
1233
|
+
*/
|
|
1234
|
+
declare function lockedFeeLp(lock: Pick<LockedCpLiquidity, 'lockedLpAmount' | 'lastLp' | 'lastK'>, pool: {
|
|
1235
|
+
vault0: bigint;
|
|
1236
|
+
vault1: bigint;
|
|
1237
|
+
lpSupply: bigint;
|
|
1238
|
+
}): bigint;
|
|
1239
|
+
/**
|
|
1240
|
+
* Every locked CPMM position `owner` holds a fee NFT for, with what each one can harvest.
|
|
1241
|
+
*
|
|
1242
|
+
* Three reads: the wallet's token accounts, then the lock record behind every NFT-shaped one, then
|
|
1243
|
+
* the pool and the two vaults of every record found. A token account of one unit and zero decimals
|
|
1244
|
+
* is not always a lock NFT, so the record decides: no record, not a position.
|
|
1245
|
+
*/
|
|
1246
|
+
declare function fetchLockedPositions(client: GaboxClient, owner: Address, ids?: RaydiumIds): Promise<LockedPosition[]>;
|
|
1247
|
+
/**
|
|
1248
|
+
* The instructions of one harvest: create the two token accounts, collect, and close the WSOL one
|
|
1249
|
+
* when a side is WSOL.
|
|
1250
|
+
*
|
|
1251
|
+
* `feeLp` defaults to everything the position can withdraw now. The lock program refuses more than
|
|
1252
|
+
* that, so a caller that passes its own number keeps it at or below `position.claimableLp`.
|
|
1253
|
+
*/
|
|
1254
|
+
declare function getHarvestLockedFeesInstructions(owner: TransactionSigner, ids: RaydiumIds, position: LockedPosition, feeLp?: bigint): Promise<Instruction[]>;
|
|
1255
|
+
type HarvestLockedFeesInput = {
|
|
1256
|
+
/** The wallet holding the fee NFT. It signs, and it receives both tokens. */
|
|
1257
|
+
owner: TransactionSigner;
|
|
1258
|
+
/** The position, as `fetchLockedPositions` returned it. */
|
|
1259
|
+
position: LockedPosition;
|
|
1260
|
+
/** LP tokens to withdraw. Defaults to everything harvestable now. */
|
|
1261
|
+
feeLp?: bigint;
|
|
1262
|
+
} & Partial<BuildOptions>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Harvest one locked position's fees.
|
|
1265
|
+
*
|
|
1266
|
+
* A pool with WSOL on one side pays that side out as SOL, because the builder closes the WSOL
|
|
1267
|
+
* account. The other side arrives as that token, in the owner's own account.
|
|
1268
|
+
*/
|
|
1269
|
+
declare function harvestLockedFees(client: GaboxClient, input: HarvestLockedFeesInput): Promise<GaboxTransactionMessage>;
|
|
1270
|
+
//#endregion
|
|
1085
1271
|
//#region src/raydium/quote.d.ts
|
|
1086
1272
|
/** LaunchLab's settings for one quote, and the address they were read from. */
|
|
1087
1273
|
type QuoteConfig = LaunchlabGlobalConfig & {
|
|
@@ -1177,8 +1363,8 @@ type CurveBuyExactInInput = {
|
|
|
1177
1363
|
*/
|
|
1178
1364
|
declare function getCurveBuyExactInInstruction(client: GaboxClient, input: CurveBuyExactInInput, ids?: RaydiumIds): Promise<Instruction>;
|
|
1179
1365
|
declare namespace index_d_exports {
|
|
1180
|
-
export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, CONSTANT_CURVE_TAG, CPMM_AMM_CONFIG_DISCRIMINATOR, CPMM_AMM_CONFIG_HEAD_SIZE, CPMM_COLLECT_CREATOR_FEE, CPMM_POOL_OFFSETS, CPMM_POOL_STATE_DISCRIMINATOR, CPMM_POOL_STATE_HEAD_SIZE, CPMM_POOL_STATE_SIZE, CPMM_SEEDS, CPMM_SWAP_BASE_INPUT, CPMM_SWAP_BASE_OUTPUT, CREATOR_FEE_ON_QUOTE, ClaimCreatorFeeInput, CollectCreatorFeeInput, CpmmAmmConfig, CpmmFeeRates, CpmmPoolState, CpmmSwapSides, CpmmTradeAccountsInput, CreatorFees, CurveBuyExactInInput, CurveFeeRates, CurveReserves, CurveSettings, FindCpmmPoolOptions, LAUNCHLAB_BUY_EXACT_IN, LAUNCHLAB_BUY_EXACT_OUT, LAUNCHLAB_CLAIM_CREATOR_FEE, LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR, LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE, LAUNCHLAB_INITIALIZE, LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR, LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE, LAUNCHLAB_POOL_STATE_DISCRIMINATOR, LAUNCHLAB_POOL_STATE_HEAD_SIZE, LAUNCHLAB_SEEDS, LAUNCHLAB_SELL_EXACT_IN, LAUNCHLAB_STATUS_FUND, LAUNCHLAB_STATUS_MIGRATE, LAUNCHLAB_STATUS_TRADE, LAUNCH_DECIMALS, LAUNCH_SUPPLY, LAUNCH_TOTAL_BASE_SELL, LaunchInput, LaunchParams, LaunchlabGlobalConfig, LaunchlabPlatformConfig, LaunchlabPoolState, LaunchlabTradeAccountsInput, METADATA_LIMITS, METADATA_SEED, METAPLEX_PROGRAM_ADDRESS, MIGRATE_TO_CPMM, MaybeAccount$1 as MaybeAccount, MigratedCpmmPool, PLATFORM_ADMIN, QuoteAsset, QuoteBinding, QuoteConfig, QuoteDisplay, RATE_DENOMINATOR, RAYDIUM_DEVNET_IDS, RAYDIUM_IDS, RAYDIUM_MAINNET_IDS, RENT_SYSVAR_ADDRESS, RaydiumClusterIds, RaydiumIds, ResolveVenueOptions, ResolvedVenue, SHARE_FEE_RATE, SYSTEM_PROGRAM_ADDRESS, TOKEN_2022_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, VenueAccountSpec, VenueInstructionAbi, VenueKind, WSOL_MINT, ata, ceilDiv, ceilDivRate, claimCreatorFee, collectCreatorFee, compareAddresses, cpmmAuthority, cpmmBuyAccounts, cpmmCreatorFeeShare, cpmmPoolAddress, cpmmPoolMatches, cpmmSellAccounts, cpmmSwapBaseInput, cpmmSwapBaseOutput, creatorFeeOnInput, creatorFeeVaultAddress, creatorFeeVaultAuthority, curveBuyExactIn, curveBuyExactOut, curveQuote, curveSellExactIn, decodeBase64, decodeCpmmAmmConfig, decodeCpmmPool, decodeLaunchlabGlobalConfig, decodeLaunchlabPlatformConfig, decodeLaunchlabPool, fetchCreatorFees, fetchCurveSettings, fetchQuoteAsset, fetchQuoteBinding, fetchQuoteConfig, fetchQuoteDisplay, findCpmmPool, getClaimCreatorFeeInstructions, getCollectCreatorFeeInstructions, getCurveBuyExactInInstruction, getLaunchInstruction, initialCurve, isQuoteSupported, launchlabAuthority, launchlabBuyAccounts, launchlabBuyExactInAccounts, launchlabEventAuthority, launchlabGlobalConfig, launchlabPlatformConfig, launchlabPoolAddress, launchlabSellAccounts, launchlabVaultAddress, metadataAddress, metaplexSymbol, mintDecimals, newCurveBuyCost, newCurveReserves, order, platformFeeVaultAddress, preFeeAmount, quoteAccountFor, raydiumIds, readAccounts, remainingBase, resolveVenue, sellQuote, sortedMints, token2022Symbol, tokenAccountAmount, tokenAccountOwnerAndMint, totalCurveFeeRate, wsolAccountFor };
|
|
1366
|
+
export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, CONSTANT_CURVE_TAG, CPMM_AMM_CONFIG_DISCRIMINATOR, CPMM_AMM_CONFIG_HEAD_SIZE, CPMM_COLLECT_CREATOR_FEE, CPMM_POOL_OFFSETS, CPMM_POOL_STATE_DISCRIMINATOR, CPMM_POOL_STATE_HEAD_SIZE, CPMM_POOL_STATE_SIZE, CPMM_SEEDS, CPMM_SWAP_BASE_INPUT, CPMM_SWAP_BASE_OUTPUT, CREATOR_FEE_ON_QUOTE, ClaimCreatorFeeInput, ClaimPlatformFeeInput, CollectCreatorFeeInput, CpmmAmmConfig, CpmmFeeRates, CpmmPoolState, CpmmSwapSides, CpmmTradeAccountsInput, CreatorFees, CurveBuyExactInInput, CurveFeeRates, CurveReserves, CurveSettings, FindCpmmPoolOptions, HarvestLockedFeesInput, LAUNCHLAB_BUY_EXACT_IN, LAUNCHLAB_BUY_EXACT_OUT, LAUNCHLAB_CLAIM_CREATOR_FEE, LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT, LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR, LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE, LAUNCHLAB_INITIALIZE, LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR, LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE, LAUNCHLAB_POOL_STATE_DISCRIMINATOR, LAUNCHLAB_POOL_STATE_HEAD_SIZE, LAUNCHLAB_SEEDS, LAUNCHLAB_SELL_EXACT_IN, LAUNCHLAB_STATUS_FUND, LAUNCHLAB_STATUS_MIGRATE, LAUNCHLAB_STATUS_TRADE, LAUNCH_DECIMALS, LAUNCH_SUPPLY, LAUNCH_TOTAL_BASE_SELL, LOCKED_CP_LIQUIDITY_DISCRIMINATOR, LOCKED_CP_LIQUIDITY_HEAD_SIZE, LOCK_COLLECT_CP_FEES, LOCK_SEEDS, LaunchInput, LaunchParams, LaunchlabGlobalConfig, LaunchlabPlatformConfig, LaunchlabPoolState, LaunchlabTradeAccountsInput, LockIds, LockedCpLiquidity, LockedPosition, MEMO_PROGRAM_ADDRESS, METADATA_LIMITS, METADATA_SEED, METAPLEX_PROGRAM_ADDRESS, MIGRATE_TO_CPMM, MaybeAccount$1 as MaybeAccount, MigratedCpmmPool, PLATFORM_ADMIN, QuoteAsset, QuoteBinding, QuoteConfig, QuoteDisplay, RATE_DENOMINATOR, RAYDIUM_DEVNET_IDS, RAYDIUM_IDS, RAYDIUM_MAINNET_IDS, RENT_SYSVAR_ADDRESS, RaydiumClusterIds, RaydiumIds, ResolveVenueOptions, ResolvedVenue, SHARE_FEE_RATE, SYSTEM_PROGRAM_ADDRESS, TOKEN_2022_PROGRAM_ADDRESS, TOKEN_PROGRAM_ADDRESS, VenueAccountSpec, VenueInstructionAbi, VenueKind, WSOL_MINT, ata, ceilDiv, ceilDivRate, claimCreatorFee, claimPlatformFee, collectCreatorFee, compareAddresses, cpmmAuthority, cpmmBuyAccounts, cpmmCreatorFeeShare, cpmmPoolAddress, cpmmPoolMatches, cpmmSellAccounts, cpmmSwapBaseInput, cpmmSwapBaseOutput, creatorFeeOnInput, creatorFeeVaultAddress, creatorFeeVaultAuthority, curveBuyExactIn, curveBuyExactOut, curveQuote, curveSellExactIn, decodeBase64, decodeCpmmAmmConfig, decodeCpmmPool, decodeLaunchlabGlobalConfig, decodeLaunchlabPlatformConfig, decodeLaunchlabPool, decodeLockedCpLiquidity, fetchCreatorFees, fetchCurveSettings, fetchLockedPositions, fetchPlatformFees, fetchQuoteAsset, fetchQuoteBinding, fetchQuoteConfig, fetchQuoteDisplay, findCpmmPool, getClaimCreatorFeeInstructions, getClaimPlatformFeeInstructions, getCollectCreatorFeeInstructions, getCurveBuyExactInInstruction, getHarvestLockedFeesInstructions, getLaunchInstruction, harvestLockedFees, initialCurve, isQuoteSupported, launchlabAuthority, launchlabBuyAccounts, launchlabBuyExactInAccounts, launchlabEventAuthority, launchlabGlobalConfig, launchlabPlatformConfig, launchlabPoolAddress, launchlabSellAccounts, launchlabVaultAddress, lockAuthority, lockedFeeLp, lockedLiquidityAddress, metadataAddress, metaplexSymbol, mintDecimals, newCurveBuyCost, newCurveReserves, order, platformFeeVaultAddress, platformFeeVaultAuthority, preFeeAmount, quoteAccountFor, raydiumIds, readAccounts, remainingBase, resolveVenue, sellQuote, sortedMints, token2022Symbol, tokenAccountAmount, tokenAccountOwnerAndMint, totalCurveFeeRate, wsolAccountFor };
|
|
1181
1367
|
}
|
|
1182
1368
|
//#endregion
|
|
1183
|
-
export {
|
|
1184
|
-
//# sourceMappingURL=index-
|
|
1369
|
+
export { LaunchlabTradeAccountsInput as $, LAUNCH_SUPPLY as $n, LAUNCHLAB_POOL_STATE_HEAD_SIZE as $t, creatorFeeVaultAuthority as A, MIGRATE_TO_CPMM as An, CpmmSwapSides as At, platformFeeVaultAddress as B, CPMM_COLLECT_CREATOR_FEE as Bn, curveSellExactIn as Bt, harvestLockedFees as C, LAUNCHLAB_STATUS_TRADE as Cn, createClient as Cr, newCurveBuyCost as Ct, cpmmCreatorFeeShare as D, MEMO_PROGRAM_ADDRESS as Dn, RouteMode as Dr, sellQuote as Dt, cpmmAuthority as E, LockIds as En, Route as Er, resolveVenue as Et, launchlabPoolAddress as F, compareAddresses as Fn, ceilDivRate as Ft, CollectCreatorFeeInput as G, LAUNCHLAB_BUY_EXACT_OUT as Gn, CPMM_AMM_CONFIG_HEAD_SIZE as Gt, LaunchInput as H, CPMM_SWAP_BASE_INPUT as Hn, preFeeAmount as Ht, launchlabVaultAddress as I, raydiumIds as In, cpmmSwapBaseInput as It, collectCreatorFee as J, LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR as Jn, CPMM_POOL_STATE_SIZE as Jt, CreatorFees as K, LAUNCHLAB_CLAIM_CREATOR_FEE as Kn, CPMM_POOL_OFFSETS as Kt, lockAuthority as L, sortedMints as Ln, cpmmSwapBaseOutput as Lt, launchlabEventAuthority as M, RAYDIUM_IDS as Mn, CurveReserves as Mt, launchlabGlobalConfig as N, RaydiumIds as Nn, LaunchParams as Nt, cpmmPoolAddress as O, METADATA_LIMITS as On, RouteProvider as Or, wsolAccountFor as Ot, launchlabPlatformConfig as P, SHARE_FEE_RATE as Pn, ceilDiv as Pt, CpmmTradeAccountsInput as Q, LAUNCHLAB_SELL_EXACT_IN as Qn, LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE as Qt, lockedLiquidityAddress as R, ASSOCIATED_TOKEN_PROGRAM_ADDRESS as Rn, curveBuyExactIn as Rt, getHarvestLockedFeesInstructions as S, LAUNCHLAB_STATUS_MIGRATE as Sn, clusterNamedBy as Sr, findCpmmPool as St, ata as T, LOCK_SEEDS as Tn, websocketUrlFor as Tr, quoteAccountFor as Tt, getLaunchInstruction as U, CPMM_SWAP_BASE_OUTPUT as Un, remainingBase as Ut, platformFeeVaultAuthority as V, CPMM_POOL_STATE_DISCRIMINATOR as Vn, initialCurve as Vt, ClaimCreatorFeeInput as W, LAUNCHLAB_BUY_EXACT_IN as Wn, totalCurveFeeRate as Wt, getClaimCreatorFeeInstructions as X, LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR as Xn, CpmmPoolState as Xt, fetchCreatorFees as Y, LAUNCHLAB_INITIALIZE as Yn, CpmmAmmConfig as Yt, getCollectCreatorFeeInstructions as Z, LAUNCHLAB_POOL_STATE_DISCRIMINATOR as Zn, LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE as Zt, LockedPosition as _, CONSTANT_CURVE_TAG as _n, DEVNET_WS as _r, cpmmPoolMatches as _t, decodeBase64 as a, LockedCpLiquidity as an, RENT_SYSVAR_ADDRESS as ar, order as at, fetchPlatformFees as b, LAUNCHLAB_SEEDS as bn, GaboxRpcSubscriptions as br, fetchCurveSettings as bt, QuoteConfig as c, decodeLaunchlabGlobalConfig as cn, TOKEN_2022_PROGRAM_ADDRESS as cr, buildMessage as ct, fetchQuoteConfig as d, decodeLockedCpLiquidity as dn, VenueInstructionAbi as dr, FindCpmmPoolOptions as dt, LOCKED_CP_LIQUIDITY_DISCRIMINATOR as en, LAUNCH_TOTAL_BASE_SELL as er, cpmmBuyAccounts as et, fetchQuoteDisplay as f, metaplexSymbol as fn, WSOL_MINT as fr, MigratedCpmmPool as ft, LOCK_COLLECT_CP_FEES as g, tokenAccountOwnerAndMint as gn, DEVNET_HTTP as gr, VenueKind as gt, HarvestLockedFeesInput as h, tokenAccountAmount as hn, Cluster as hr, ResolvedVenue as ht, MaybeAccount$1 as i, LaunchlabPoolState as in, RAYDIUM_MAINNET_IDS as ir, launchlabSellAccounts as it, launchlabAuthority as j, RATE_DENOMINATOR as jn, CurveFeeRates as jt, creatorFeeVaultAddress as k, METADATA_SEED as kn, CpmmFeeRates as kt, QuoteDisplay as l, decodeLaunchlabPlatformConfig as ln, TOKEN_PROGRAM_ADDRESS as lr, withRemainingAccounts as lt, ClaimPlatformFeeInput as m, token2022Symbol as mn, ClientConfig as mr, ResolveVenueOptions as mt, CurveBuyExactInInput as n, LaunchlabGlobalConfig as nn, PLATFORM_ADMIN as nr, launchlabBuyAccounts as nt, readAccounts as o, decodeCpmmAmmConfig as on, RaydiumClusterIds as or, BuildOptions as ot, isQuoteSupported as p, mintDecimals as pn, CLUSTER_ENDPOINTS as pr, QuoteBinding as pt, claimCreatorFee as q, LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT as qn, CPMM_POOL_STATE_HEAD_SIZE as qt, getCurveBuyExactInInstruction as r, LaunchlabPlatformConfig as rn, RAYDIUM_DEVNET_IDS as rr, launchlabBuyExactInAccounts as rt, QuoteAsset as s, decodeCpmmPool as sn, SYSTEM_PROGRAM_ADDRESS as sr, GaboxTransactionMessage as st, index_d_exports as t, LOCKED_CP_LIQUIDITY_HEAD_SIZE as tn, METAPLEX_PROGRAM_ADDRESS as tr, cpmmSellAccounts as tt, fetchQuoteAsset as u, decodeLaunchlabPool as un, VenueAccountSpec as ur, CurveSettings as ut, claimPlatformFee as v, CPMM_SEEDS as vn, GaboxClient as vr, creatorFeeOnInput as vt, lockedFeeLp as w, LAUNCH_DECIMALS as wn, defaultRoute as wr, newCurveReserves as wt, getClaimPlatformFeeInstructions as x, LAUNCHLAB_STATUS_FUND as xn, assertClusterUrl as xr, fetchQuoteBinding as xt, fetchLockedPositions as y, CREATOR_FEE_ON_QUOTE as yn, GaboxRpc as yr, curveQuote as yt, metadataAddress as z, CPMM_AMM_CONFIG_DISCRIMINATOR as zn, curveBuyExactOut as zt };
|
|
1370
|
+
//# sourceMappingURL=index-CQcBMEah.d.ts.map
|
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 { Cr as createClient, Dr as RouteMode, Er as Route, Or as RouteProvider, Rn as ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Sr as clusterNamedBy, Tr as websocketUrlFor, _r as DEVNET_WS, br as GaboxRpcSubscriptions, ct as buildMessage, fr as WSOL_MINT, gr as DEVNET_HTTP, gt as VenueKind, hr as Cluster, ht as ResolvedVenue, lr as TOKEN_PROGRAM_ADDRESS, lt as withRemainingAccounts, mr as ClientConfig, nr as PLATFORM_ADMIN, ot as BuildOptions, pr as CLUSTER_ENDPOINTS, sr as SYSTEM_PROGRAM_ADDRESS, st as GaboxTransactionMessage, t as index_d_exports$1, tr as METAPLEX_PROGRAM_ADDRESS, vr as GaboxClient, wn as LAUNCH_DECIMALS, wr as defaultRoute, xr as assertClusterUrl, yr as GaboxRpc } from "./index-CQcBMEah.js";
|
|
3
3
|
import { Address, AddressesByLookupTableAddress, Instruction, InstructionWithData, ProgramDerivedAddress, ReadonlyUint8Array, TransactionSigner } from "@solana/kit";
|
|
4
4
|
//#region src/math.d.ts
|
|
5
5
|
/**
|
|
@@ -209,6 +209,15 @@ export declare const REDEEM_COMPUTE_UNITS = 125000;
|
|
|
209
209
|
* on a pool quoted in another token is cheaper, `17,635`, because nothing has to be unwrapped.
|
|
210
210
|
*/
|
|
211
211
|
export declare const CLAIM_COMPUTE_UNITS = 55000;
|
|
212
|
+
/**
|
|
213
|
+
* A harvest of one locked CPMM position: `collect_cp_fees` on the lock program, which withdraws
|
|
214
|
+
* LP through CPMM and pays both sides out.
|
|
215
|
+
*
|
|
216
|
+
* Measured at `102,221` on devnet on 2026-09-19 (tx `5s7xvy23…`), with both token accounts
|
|
217
|
+
* created in the same transaction and the WSOL one closed again. `82,697` of that is the lock
|
|
218
|
+
* program itself.
|
|
219
|
+
*/
|
|
220
|
+
export declare const HARVEST_COMPUTE_UNITS = 150000;
|
|
212
221
|
/** An instruction for the compute budget program: no accounts, all of it in the data. */
|
|
213
222
|
export type ComputeBudgetInstruction = Instruction<string, readonly []> & InstructionWithData<ReadonlyUint8Array>;
|
|
214
223
|
export declare function getSetComputeUnitLimitInstruction(units: number): ComputeBudgetInstruction;
|
|
@@ -594,6 +603,17 @@ export type QuoteLeg = {
|
|
|
594
603
|
export type GaboxAccounts = readonly Address[];
|
|
595
604
|
/** Create the wallet's quote account if it is missing. Idempotent, so a second create is free. */
|
|
596
605
|
export declare function createQuoteAccount(owner: TransactionSigner, venue: Pick<ResolvedVenue, 'quoteMint' | 'quoteTokenProgram' | 'userQuoteToken'>): Instruction;
|
|
606
|
+
/**
|
|
607
|
+
* The leg for a wallet that already holds what it is about to spend. No swap.
|
|
608
|
+
*
|
|
609
|
+
* A WSOL pool is the one case where "already holds it" means lamports, so those are wrapped and the
|
|
610
|
+
* account is closed again afterwards. Any other quote only needs its account to exist; closing it
|
|
611
|
+
* would throw away a real balance.
|
|
612
|
+
*
|
|
613
|
+
* `createMachine` uses this and nothing else: the seed is always the creator's own money, in the
|
|
614
|
+
* machine's quote token.
|
|
615
|
+
*/
|
|
616
|
+
export declare function quoteLegFromWallet(venue: Pick<ResolvedVenue, 'quoteMint' | 'quoteTokenProgram' | 'userQuoteToken'>, payer: TransactionSigner, maxQuoteIn: bigint): Promise<QuoteLeg>;
|
|
597
617
|
/**
|
|
598
618
|
* The leg that puts `maxQuoteIn` of the quote token in the buyer's quote account.
|
|
599
619
|
*
|
|
@@ -698,15 +718,9 @@ export type CreateMachineInput = {
|
|
|
698
718
|
*/
|
|
699
719
|
raise?: bigint;
|
|
700
720
|
/**
|
|
701
|
-
*
|
|
702
|
-
*
|
|
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.
|
|
721
|
+
* Seed slippage cap in the quote token, for `mandatory + extraSeedTokens` together. The creator
|
|
722
|
+
* must already hold this much of the quote token, so it has to cover the real cost. Anything left
|
|
723
|
+
* over stays in their quote account, or comes back as SOL on a WSOL pool.
|
|
710
724
|
*/
|
|
711
725
|
maxSeedQuoteIn: bigint;
|
|
712
726
|
/**
|
|
@@ -747,8 +761,11 @@ export type SeedCostEstimate = {
|
|
|
747
761
|
/** `total_quote_fund_raising` the launch would use, in the quote's base units. */
|
|
748
762
|
raise: bigint;
|
|
749
763
|
/**
|
|
750
|
-
* What `quoteAmount`
|
|
751
|
-
* no provider or no route. Equal to `quoteAmount` on a WSOL
|
|
764
|
+
* What `quoteAmount` is worth in SOL through the client's route provider, or `null` when there is
|
|
765
|
+
* no provider or no route. Equal to `quoteAmount` on a WSOL machine.
|
|
766
|
+
*
|
|
767
|
+
* A display only. The creator pays the seed in the quote token, not in SOL, so this says what
|
|
768
|
+
* that costs them in familiar money; it is not an amount any instruction spends.
|
|
752
769
|
*/
|
|
753
770
|
solAmount: bigint | null;
|
|
754
771
|
};
|
|
@@ -760,9 +777,9 @@ export type SeedCostEstimate = {
|
|
|
760
777
|
* same transaction, so this is exact up to a change in Raydium's fee rates between the read and the
|
|
761
778
|
* send.
|
|
762
779
|
*
|
|
763
|
-
* `solAmount` is
|
|
764
|
-
*
|
|
765
|
-
* caller passes `raydiumCpmmRoute(pool)`.
|
|
780
|
+
* `solAmount` is what that cost is worth in SOL, priced through the client's route provider. It is
|
|
781
|
+
* a display: the creator pays in the quote token. It is `null` when the client has no provider, or
|
|
782
|
+
* when no route exists: a devnet client has none unless the caller passes `raydiumCpmmRoute(pool)`.
|
|
766
783
|
*
|
|
767
784
|
* Defaults to `DEFAULT_TIERS`, wrapped SOL and no extra seed. Throws if `tiers` fails
|
|
768
785
|
* `validateTiers`/`validatePack`, if `extraSeedTokens` is negative, if the total seed is bigger
|