@forgedevv/core 0.1.0 → 0.2.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 +88 -5
- package/README.md +4 -3
- package/dist/addresses.d.ts +50 -3
- package/dist/addresses.js +70 -1
- package/dist/claims.d.ts +12 -2
- package/dist/claims.js +29 -11
- package/dist/config.d.ts +40 -37
- package/dist/config.js +265 -47
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -1
- package/dist/jupiter-referral.d.ts +119 -0
- package/dist/jupiter-referral.js +295 -0
- package/dist/launch-metadata.d.ts +3 -1
- package/dist/pool.d.ts +68 -17
- package/dist/pool.js +112 -39
- package/dist/position-claims.d.ts +207 -0
- package/dist/position-claims.js +440 -0
- package/dist/settings.d.ts +73 -0
- package/dist/settings.js +119 -0
- package/dist/swap.d.ts +70 -17
- package/dist/swap.js +89 -24
- package/dist/validate.d.ts +14 -1
- package/dist/validate.js +86 -6
- package/package.json +3 -2
package/dist/config.js
CHANGED
|
@@ -25,46 +25,20 @@
|
|
|
25
25
|
* `buildLaunchpadConfig` / `buildLaunchpadCoinConfig` are pure and deterministic. Every result
|
|
26
26
|
* passes `validate.ts` before it is returned; otherwise a `ValidationError` is thrown.
|
|
27
27
|
*/
|
|
28
|
-
import {
|
|
28
|
+
import { CollectFeeMode, DynamicBondingCurveClient, FEE_DENOMINATOR, MAX_BASIS_POINT, MAX_CURVE_POINT, buildCurve, getMigrationThresholdPrice, swapQuoteExactIn, } from '@meteora-ag/dynamic-bonding-curve-sdk';
|
|
29
29
|
import { PublicKey, Transaction } from '@solana/web3.js';
|
|
30
30
|
import BN from 'bn.js';
|
|
31
31
|
import { LaunchpadSpec } from '@forge/shared';
|
|
32
|
-
import { CLIENT_BOUNDS,
|
|
32
|
+
import { CLIENT_BOUNDS, CLIENT_POOL_CREATION_FEE_LAMPORTS, FEES, LAMPORTS_PER_SOL_BIGINT, SOL_QUOTE_MINT, solToLamports, } from './constants.js';
|
|
33
33
|
import { LaunchCoinError, assertSpecLaunchable } from './launch-metadata.js';
|
|
34
|
+
import { ANTI_SNIPER_FEE_SCHEDULE, FORGE_ACTIVATION_TYPE, FORGE_MIGRATION_SETTINGS, FORGE_TOKEN_SETTINGS, forgeFeeSchedulerParam, } from './settings.js';
|
|
34
35
|
import { computeBudgetInstructions } from './tx.js';
|
|
35
36
|
import { ValidationError, assertValid, validateLaunchpadCoinConfigParams, validateLaunchpadConfigParams, } from './validate.js';
|
|
36
37
|
// ---------------------------------------------------------------------------------------------
|
|
37
38
|
// Settings
|
|
38
39
|
// ---------------------------------------------------------------------------------------------
|
|
39
|
-
|
|
40
|
-
export
|
|
41
|
-
tokenType: TokenType.SPLToken,
|
|
42
|
-
tokenBaseDecimal: TokenDecimal.SIX,
|
|
43
|
-
tokenQuoteDecimal: SOL_DECIMALS,
|
|
44
|
-
tokenAuthorityOption: TokenAuthorityOption.Immutable,
|
|
45
|
-
totalTokenSupply: 1_000_000_000,
|
|
46
|
-
leftover: 0,
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Anti-sniper fee schedule (`spec.antiSniper`): the fee starts at `startingFeeBps` and decreases
|
|
50
|
-
* linearly, in `numberOfPeriod` equal steps over `totalDurationSeconds`, to `spec.tradingFeeBps`.
|
|
51
|
-
* Within the validate.ts bounds (starting fee <= 9900 bps, duration <= 300 s).
|
|
52
|
-
*/
|
|
53
|
-
export const ANTI_SNIPER_FEE_SCHEDULE = {
|
|
54
|
-
baseFeeMode: BaseFeeMode.FeeSchedulerLinear,
|
|
55
|
-
startingFeeBps: MAX_ANTI_SNIPER_STARTING_FEE_BPS,
|
|
56
|
-
numberOfPeriod: 10,
|
|
57
|
-
totalDurationSeconds: 60,
|
|
58
|
-
};
|
|
59
|
-
/** Migration: DAMM v2, migrated pool fee 0.25%, no migration fee, 20% of the supply migrated. */
|
|
60
|
-
export const FORGE_MIGRATION_SETTINGS = {
|
|
61
|
-
migrationOption: MigrationOption.MET_DAMM_V2,
|
|
62
|
-
migrationFeeOption: MigrationFeeOption.FixedBps25,
|
|
63
|
-
migrationFee: { feePercentage: 0, creatorFeePercentage: 0 },
|
|
64
|
-
percentageSupplyOnMigration: 20,
|
|
65
|
-
};
|
|
66
|
-
/** Fee scheduler periods are counted in seconds. */
|
|
67
|
-
export const FORGE_ACTIVATION_TYPE = ActivationType.Timestamp;
|
|
40
|
+
// The fixed settings live in settings.ts (shared with validate.ts) and stay exported from here.
|
|
41
|
+
export { ANTI_SNIPER_FEE_SCHEDULE, FORGE_ACTIVATION_TYPE, FORGE_MIGRATION_SETTINGS, FORGE_TOKEN_SETTINGS, FORGE_TOKEN_SUPPLY_RAW, forgeBaseFee, forgeFeeSchedulerParam, forgeReferenceCurve, } from './settings.js';
|
|
68
42
|
/**
|
|
69
43
|
* Pool creation fee of the launchpad coin config: none. The only pool ever created on it is the
|
|
70
44
|
* client's own coin, paid by the client: a fee would only move the client's SOL to its own fee
|
|
@@ -129,28 +103,15 @@ function ownerKeyOf(spec) {
|
|
|
129
103
|
export function creatorTradingFeePercentageFor(spec, kind) {
|
|
130
104
|
return kind === 'launchpadCoin' ? FEES.forgeCreatorSharePct : spec.coinCreatorSharePct;
|
|
131
105
|
}
|
|
132
|
-
/** The `buildCurve` input for a spec and a config kind (pure). */
|
|
106
|
+
/** The `buildCurve` input for a spec (or just its config fields) and a config kind (pure). */
|
|
133
107
|
export function curveParamsFor(spec, kind) {
|
|
134
108
|
const creatorShare = creatorTradingFeePercentageFor(spec, kind);
|
|
135
|
-
const schedule = ANTI_SNIPER_FEE_SCHEDULE;
|
|
136
109
|
return {
|
|
137
110
|
token: { ...FORGE_TOKEN_SETTINGS },
|
|
138
111
|
fee: {
|
|
139
112
|
baseFeeParams: {
|
|
140
|
-
baseFeeMode:
|
|
141
|
-
feeSchedulerParam: spec.antiSniper
|
|
142
|
-
? {
|
|
143
|
-
startingFeeBps: schedule.startingFeeBps,
|
|
144
|
-
endingFeeBps: spec.tradingFeeBps,
|
|
145
|
-
numberOfPeriod: schedule.numberOfPeriod,
|
|
146
|
-
totalDuration: schedule.totalDurationSeconds,
|
|
147
|
-
}
|
|
148
|
-
: {
|
|
149
|
-
startingFeeBps: spec.tradingFeeBps,
|
|
150
|
-
endingFeeBps: spec.tradingFeeBps,
|
|
151
|
-
numberOfPeriod: 0,
|
|
152
|
-
totalDuration: 0,
|
|
153
|
-
},
|
|
113
|
+
baseFeeMode: ANTI_SNIPER_FEE_SCHEDULE.baseFeeMode,
|
|
114
|
+
feeSchedulerParam: forgeFeeSchedulerParam(spec.tradingFeeBps, spec.antiSniper),
|
|
154
115
|
},
|
|
155
116
|
dynamicFeeEnabled: false,
|
|
156
117
|
collectFeeMode: CollectFeeMode.QuoteToken,
|
|
@@ -260,6 +221,263 @@ export function buildLaunchpadConfig(spec) {
|
|
|
260
221
|
export function buildLaunchpadCoinConfig(spec) {
|
|
261
222
|
return buildConfigParams(spec, 'launchpadCoin');
|
|
262
223
|
}
|
|
224
|
+
const FEE_NUMERATOR_PER_BPS = BigInt(FEE_DENOMINATOR / MAX_BASIS_POINT);
|
|
225
|
+
/** An integer field (BN, number, bigint or boolean) as a bigint, or null. */
|
|
226
|
+
function integerOf(value) {
|
|
227
|
+
if (typeof value === 'bigint')
|
|
228
|
+
return value;
|
|
229
|
+
if (typeof value === 'boolean')
|
|
230
|
+
return value ? 1n : 0n;
|
|
231
|
+
if (typeof value === 'number')
|
|
232
|
+
return Number.isSafeInteger(value) ? BigInt(value) : null;
|
|
233
|
+
if (BN.isBN(value))
|
|
234
|
+
return BigInt(value.toString());
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The spec fields of a config read from the chain, when no spec is given. They must be values a
|
|
239
|
+
* FORGE spec can hold: a linear fee schedule ending on a whole client fee (50..200 bps), a creator
|
|
240
|
+
* share within the client bounds and a client pool creation fee. Problems are pushed to
|
|
241
|
+
* `problems`; a placeholder is returned for an impossible field so that every other field is still
|
|
242
|
+
* compared.
|
|
243
|
+
*/
|
|
244
|
+
function inferSpecFields(config, kind, expectedFeeLamports, problems) {
|
|
245
|
+
const { tradingFeeBps: feeBounds, coinCreatorSharePct: shareBounds } = CLIENT_BOUNDS;
|
|
246
|
+
const baseFee = config.poolFees?.baseFee;
|
|
247
|
+
const cliff = integerOf(baseFee?.cliffFeeNumerator);
|
|
248
|
+
const periods = integerOf(baseFee?.firstFactor);
|
|
249
|
+
const reduction = integerOf(baseFee?.thirdFactor);
|
|
250
|
+
let tradingFeeBps = feeBounds.min;
|
|
251
|
+
let antiSniper = false;
|
|
252
|
+
if (baseFee?.baseFeeMode !== ANTI_SNIPER_FEE_SCHEDULE.baseFeeMode ||
|
|
253
|
+
cliff === null ||
|
|
254
|
+
periods === null ||
|
|
255
|
+
reduction === null) {
|
|
256
|
+
problems.push('base fee is not a linear fee scheduler');
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
antiSniper = periods > 0n;
|
|
260
|
+
const ending = cliff - periods * reduction;
|
|
261
|
+
const bps = ending / FEE_NUMERATOR_PER_BPS;
|
|
262
|
+
if (ending % FEE_NUMERATOR_PER_BPS !== 0n ||
|
|
263
|
+
bps < BigInt(feeBounds.min) ||
|
|
264
|
+
bps > BigInt(feeBounds.max)) {
|
|
265
|
+
problems.push(`trading fee (fee numerator ${ending}) is not a whole fee between ${feeBounds.min} and ${feeBounds.max} bps`);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
tradingFeeBps = Number(bps);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
let coinCreatorSharePct = shareBounds.default;
|
|
272
|
+
if (kind === 'launchpad') {
|
|
273
|
+
const share = config.creatorTradingFeePercentage;
|
|
274
|
+
if (Number.isInteger(share) && share >= shareBounds.min && share <= shareBounds.max) {
|
|
275
|
+
coinCreatorSharePct = share;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
problems.push(`creator trading fee ${share}% is not between ${shareBounds.min}% and ${shareBounds.max}%`);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
let poolCreationFeeLamports = 0n;
|
|
282
|
+
if (kind === 'launchpad') {
|
|
283
|
+
const onchain = integerOf(config.poolCreationFee);
|
|
284
|
+
const { min, max, allowZero } = CLIENT_POOL_CREATION_FEE_LAMPORTS;
|
|
285
|
+
if (expectedFeeLamports !== undefined) {
|
|
286
|
+
poolCreationFeeLamports = expectedFeeLamports;
|
|
287
|
+
}
|
|
288
|
+
else if (onchain !== null &&
|
|
289
|
+
((onchain === 0n && allowZero) || (onchain >= min && onchain <= max))) {
|
|
290
|
+
poolCreationFeeLamports = onchain;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
problems.push(`pool creation fee ${String(onchain)} lamports is outside the client bounds`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
fields: {
|
|
298
|
+
tradingFeeBps,
|
|
299
|
+
antiSniper,
|
|
300
|
+
coinCreatorSharePct,
|
|
301
|
+
poolCreationFeeSol: Number(poolCreationFeeLamports) / Number(LAMPORTS_PER_SOL_BIGINT),
|
|
302
|
+
},
|
|
303
|
+
poolCreationFeeLamports,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/** Every field of `onchain` that differs from what core sends for `params` (`createConfig`). */
|
|
307
|
+
function compareWithParams(onchain, params) {
|
|
308
|
+
const problems = [];
|
|
309
|
+
const same = (field, actual, expected) => {
|
|
310
|
+
const a = integerOf(actual);
|
|
311
|
+
const e = integerOf(expected);
|
|
312
|
+
if (a === null || e === null || a !== e) {
|
|
313
|
+
problems.push(`${field} is ${String(a ?? actual)}, expected ${String(e ?? expected)}`);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
const sameKey = (field, actual, expected) => {
|
|
317
|
+
if (!actual.equals(expected))
|
|
318
|
+
problems.push(`${field} is ${actual.toBase58()}, expected ${expected.toBase58()}`);
|
|
319
|
+
};
|
|
320
|
+
// Accounts and token.
|
|
321
|
+
sameKey('quoteMint', onchain.quoteMint, params.quoteMint);
|
|
322
|
+
same('quoteTokenFlag', onchain.quoteTokenFlag, 0);
|
|
323
|
+
sameKey('feeClaimer', onchain.feeClaimer, params.feeClaimer);
|
|
324
|
+
sameKey('leftoverReceiver', onchain.leftoverReceiver, params.leftoverReceiver);
|
|
325
|
+
same('tokenType', onchain.tokenType, params.tokenType);
|
|
326
|
+
same('tokenDecimal', onchain.tokenDecimal, params.tokenDecimal);
|
|
327
|
+
same('tokenUpdateAuthority', onchain.tokenUpdateAuthority, params.tokenUpdateAuthority);
|
|
328
|
+
// Fees.
|
|
329
|
+
const base = onchain.poolFees.baseFee;
|
|
330
|
+
const expectedBase = params.poolFees.baseFee;
|
|
331
|
+
same('baseFee.baseFeeMode', base.baseFeeMode, expectedBase.baseFeeMode);
|
|
332
|
+
same('baseFee.cliffFeeNumerator', base.cliffFeeNumerator, expectedBase.cliffFeeNumerator);
|
|
333
|
+
same('baseFee.numberOfPeriod', base.firstFactor, expectedBase.firstFactor);
|
|
334
|
+
same('baseFee.periodFrequency', base.secondFactor, expectedBase.secondFactor);
|
|
335
|
+
same('baseFee.reductionFactor', base.thirdFactor, expectedBase.thirdFactor);
|
|
336
|
+
// FORGE never enables the dynamic fee (validate.ts refuses it).
|
|
337
|
+
same('dynamicFee.initialized', onchain.poolFees.dynamicFee.initialized, 0);
|
|
338
|
+
same('collectFeeMode', onchain.collectFeeMode, params.collectFeeMode);
|
|
339
|
+
same('creatorTradingFeePercentage', onchain.creatorTradingFeePercentage, params.creatorTradingFeePercentage);
|
|
340
|
+
same('poolCreationFee', onchain.poolCreationFee, params.poolCreationFee);
|
|
341
|
+
same('enableFirstSwapWithMinFee', onchain.enableFirstSwapWithMinFee, params.enableFirstSwapWithMinFee);
|
|
342
|
+
same('activationType', onchain.activationType, params.activationType);
|
|
343
|
+
// Liquidity after migration.
|
|
344
|
+
same('partnerLiquidityPercentage', onchain.partnerLiquidityPercentage, params.partnerLiquidityPercentage);
|
|
345
|
+
same('partnerPermanentLockedLiquidityPercentage', onchain.partnerPermanentLockedLiquidityPercentage, params.partnerPermanentLockedLiquidityPercentage);
|
|
346
|
+
same('creatorLiquidityPercentage', onchain.creatorLiquidityPercentage, params.creatorLiquidityPercentage);
|
|
347
|
+
same('creatorPermanentLockedLiquidityPercentage', onchain.creatorPermanentLockedLiquidityPercentage, params.creatorPermanentLockedLiquidityPercentage);
|
|
348
|
+
for (const name of ['partnerLiquidityVestingInfo', 'creatorLiquidityVestingInfo']) {
|
|
349
|
+
const actual = onchain[name];
|
|
350
|
+
const expected = params[name];
|
|
351
|
+
const fields = [
|
|
352
|
+
'vestingPercentage',
|
|
353
|
+
'bpsPerPeriod',
|
|
354
|
+
'numberOfPeriods',
|
|
355
|
+
'frequency',
|
|
356
|
+
'cliffDurationFromMigrationTime',
|
|
357
|
+
];
|
|
358
|
+
const empty = !expected || fields.every((f) => integerOf(expected[f]) === 0n);
|
|
359
|
+
same(`${name}.isInitialized`, actual.isInitialized, empty ? 0 : 1);
|
|
360
|
+
for (const f of fields)
|
|
361
|
+
same(`${name}.${f}`, actual[f], expected ? expected[f] : 0);
|
|
362
|
+
}
|
|
363
|
+
// Migration.
|
|
364
|
+
same('migrationOption', onchain.migrationOption, params.migrationOption);
|
|
365
|
+
same('migrationFeeOption', onchain.migrationFeeOption, params.migrationFeeOption);
|
|
366
|
+
same('migrationQuoteThreshold', onchain.migrationQuoteThreshold, params.migrationQuoteThreshold);
|
|
367
|
+
same('migrationFeePercentage', onchain.migrationFeePercentage, params.migrationFee.feePercentage);
|
|
368
|
+
same('creatorMigrationFeePercentage', onchain.creatorMigrationFeePercentage, params.migrationFee.creatorFeePercentage);
|
|
369
|
+
const migrated = params.migratedPoolFee;
|
|
370
|
+
same('migratedCollectFeeMode', onchain.migratedCollectFeeMode, migrated?.collectFeeMode ?? 0);
|
|
371
|
+
same('migratedDynamicFee', onchain.migratedDynamicFee, migrated?.dynamicFee ?? 0);
|
|
372
|
+
same('migratedPoolFeeBps', onchain.migratedPoolFeeBps, migrated?.poolFeeBps ?? 0);
|
|
373
|
+
same('migratedPoolBaseFeeMode', onchain.migratedPoolBaseFeeMode, params.migratedPoolBaseFeeMode ?? 0);
|
|
374
|
+
same('migratedCompoundingFeeBps', onchain.migratedCompoundingFeeBps, params.compoundingFeeBps ?? 0);
|
|
375
|
+
const marketCap = params.migratedPoolMarketCapFeeSchedulerParams;
|
|
376
|
+
const marketCapOff = !marketCap ||
|
|
377
|
+
[
|
|
378
|
+
marketCap.numberOfPeriod,
|
|
379
|
+
marketCap.sqrtPriceStepBps,
|
|
380
|
+
marketCap.schedulerExpirationDuration,
|
|
381
|
+
marketCap.reductionFactor,
|
|
382
|
+
].every((v) => integerOf(v) === 0n);
|
|
383
|
+
if (!marketCapOff) {
|
|
384
|
+
problems.push('the expected config has a migrated pool market cap fee scheduler (not supported)');
|
|
385
|
+
}
|
|
386
|
+
else if (!onchain.migratedPoolBaseFeeBytes.every((byte) => byte === 0)) {
|
|
387
|
+
problems.push('migratedPoolBaseFeeBytes is set, expected none (no market cap fee scheduler)');
|
|
388
|
+
}
|
|
389
|
+
// Supply: locked vesting, fixed supply, curve.
|
|
390
|
+
const vesting = onchain.lockedVestingConfig;
|
|
391
|
+
const expectedVesting = params.lockedVesting;
|
|
392
|
+
same('lockedVesting.amountPerPeriod', vesting.amountPerPeriod, expectedVesting.amountPerPeriod);
|
|
393
|
+
same('lockedVesting.cliffDurationFromMigrationTime', vesting.cliffDurationFromMigrationTime, expectedVesting.cliffDurationFromMigrationTime);
|
|
394
|
+
same('lockedVesting.frequency', vesting.frequency, expectedVesting.frequency);
|
|
395
|
+
same('lockedVesting.numberOfPeriod', vesting.numberOfPeriod, expectedVesting.numberOfPeriod);
|
|
396
|
+
same('lockedVesting.cliffUnlockAmount', vesting.cliffUnlockAmount, expectedVesting.cliffUnlockAmount);
|
|
397
|
+
const supply = params.tokenSupply;
|
|
398
|
+
same('fixedTokenSupplyFlag', onchain.fixedTokenSupplyFlag, supply ? 1 : 0);
|
|
399
|
+
same('preMigrationTokenSupply', onchain.preMigrationTokenSupply, supply?.preMigrationTokenSupply ?? 0);
|
|
400
|
+
same('postMigrationTokenSupply', onchain.postMigrationTokenSupply, supply?.postMigrationTokenSupply ?? 0);
|
|
401
|
+
same('sqrtStartPrice', onchain.sqrtStartPrice, params.sqrtStartPrice);
|
|
402
|
+
// The account stores a fixed-size curve (unused points are zero); the params hold at most
|
|
403
|
+
// MAX_CURVE_POINT points.
|
|
404
|
+
const curve = onchain.curve;
|
|
405
|
+
if (curve.length < params.curve.length || params.curve.length > MAX_CURVE_POINT) {
|
|
406
|
+
problems.push(`curve has ${curve.length} points, expected ${params.curve.length} and zeros`);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
curve.forEach((point, i) => {
|
|
410
|
+
const expected = params.curve[i];
|
|
411
|
+
same(`curve[${i}].sqrtPrice`, point.sqrtPrice, expected ? expected.sqrtPrice : 0);
|
|
412
|
+
same(`curve[${i}].liquidity`, point.liquidity, expected ? expected.liquidity : 0);
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
return problems;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Compares a config read from the chain with the parameters core builds for it, field by field:
|
|
419
|
+
* accounts, token, base fee (cliff, periods, period, reduction, mode), dynamic fee, creator share,
|
|
420
|
+
* pool creation fee, first swap at the minimum fee, activation, liquidity split and vesting,
|
|
421
|
+
* migration (option, fee option, threshold, migration fee percentages, migrated pool fee), locked
|
|
422
|
+
* vesting, token supply, start price and curve. The values the program derives from these
|
|
423
|
+
* (`swapBaseAmount`, `migrationBaseThreshold`, `migrationSqrtPrice`) are not compared.
|
|
424
|
+
*
|
|
425
|
+
* With `expected.spec`, the reference is `buildConfigParams(spec, kind)`. Without it, the spec
|
|
426
|
+
* fields are read from the config itself (`inferSpecFields`: they must be values a FORGE spec can
|
|
427
|
+
* hold) and every other field must be FORGE's fixed setting; the fee claimer and leftover receiver
|
|
428
|
+
* must be `expected.owner` (or, without it, the same key).
|
|
429
|
+
*
|
|
430
|
+
* @returns every mismatch, as readable messages (on-chain values are public); empty when the config
|
|
431
|
+
* is exactly a FORGE config of this kind.
|
|
432
|
+
*/
|
|
433
|
+
export function onchainConfigMismatches(config, kind, expected = {}) {
|
|
434
|
+
if (kind !== 'launchpad' && kind !== 'launchpadCoin') {
|
|
435
|
+
throw new TypeError(`unknown config kind: ${String(kind)}`);
|
|
436
|
+
}
|
|
437
|
+
const problems = [];
|
|
438
|
+
let params;
|
|
439
|
+
if (expected.spec !== undefined) {
|
|
440
|
+
try {
|
|
441
|
+
params = buildConfigParams(expected.spec, kind);
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
return [
|
|
445
|
+
`the spec does not build a valid ${kind} config: ${error instanceof Error ? error.message : String(error)}`,
|
|
446
|
+
];
|
|
447
|
+
}
|
|
448
|
+
if (expected.owner && !expected.owner.equals(params.feeClaimer)) {
|
|
449
|
+
problems.push('the expected owner is not spec.ownerWallet');
|
|
450
|
+
}
|
|
451
|
+
if (expected.poolCreationFeeLamports !== undefined &&
|
|
452
|
+
expected.poolCreationFeeLamports !== integerOf(params.poolCreationFee)) {
|
|
453
|
+
problems.push('the expected pool creation fee is not the one the spec builds');
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
const owner = expected.owner ?? config.feeClaimer;
|
|
458
|
+
const inferred = inferSpecFields(config, kind, expected.poolCreationFeeLamports, problems);
|
|
459
|
+
let curve;
|
|
460
|
+
try {
|
|
461
|
+
curve = buildCurve(curveParamsFor(inferred.fields, kind));
|
|
462
|
+
}
|
|
463
|
+
catch (error) {
|
|
464
|
+
return [
|
|
465
|
+
...problems,
|
|
466
|
+
`SDK buildCurve: ${error instanceof Error ? error.message : String(error)}`,
|
|
467
|
+
];
|
|
468
|
+
}
|
|
469
|
+
params = {
|
|
470
|
+
...curve,
|
|
471
|
+
// Exact lamports: the SOL figure above only feeds buildCurve.
|
|
472
|
+
poolCreationFee: new BN(inferred.poolCreationFeeLamports.toString()),
|
|
473
|
+
feeClaimer: owner,
|
|
474
|
+
leftoverReceiver: owner,
|
|
475
|
+
quoteMint: SOL_QUOTE_MINT,
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
problems.push(...compareWithParams(config, params));
|
|
479
|
+
return problems;
|
|
480
|
+
}
|
|
263
481
|
/**
|
|
264
482
|
* Quote of the first buy of a pool that does not exist yet, at the minimum (ending) fee
|
|
265
483
|
* (`enableFirstSwapWithMinFee`), on a config given either as built here (`ConfigParameters`) or
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ export * from './config.js';
|
|
|
5
5
|
export * from './pool.js';
|
|
6
6
|
export * from './tx.js';
|
|
7
7
|
export * from './launch-check.js';
|
|
8
|
-
export { DEFAULT_SWAP_COMPUTE_UNIT_LIMIT, MAX_SWAP_COMPUTE_UNIT_LIMIT, MAX_SWAP_PRIORITY_FEE_MICRO_LAMPORTS, MAX_SWAP_SLIPPAGE_BPS, PLATFORM_FEE_BPS, SWAP_BASE_FEE_LAMPORTS_PER_SIGNATURE, SWAP_ERROR_CODES, SWAP_MAX_TRANSACTION_BYTES, SwapError, assertPlatformFeeWalletReady, assertPoolTradable, assertReferralAccountReady, assertSwapFeeAccountsReady, buildBuyTx, buildDbcSwapInstruction, buildSellTx, buildSwapTransaction, coinTokenProgram, compileSwapTransaction, computeSwapQuote, estimateSwapNetworkFeeLamports, fetchSwapContext, fetchSwapPoolState, minAmountOutForSlippage, needsInstructionsSysvar, platformFeeLamports, poolSwapStatus, quoteSwap, requiredSwapLamports, swapFeeAddresses, swapPriceImpactBps, } from './swap.js';
|
|
9
|
-
export type { BuildBuyTxParams, BuildSellTxParams, BuiltSwapTransaction, DbcSwapInstructionAccounts, FetchSwapContextParams, PoolSwapStatus, PriceImpactInput, QuoteSwapParams, SlippageInput, SwapAccountSnapshot, SwapBuildOptions, SwapBuildRequest, SwapContext, SwapErrorCode, SwapErrorDetails, SwapFeeBreakdown, SwapPoolState, SwapQuote, SwapQuoteRequest, SwapSide, SwapSolRequirementInput, } from './swap.js';
|
|
8
|
+
export { DEFAULT_SWAP_COMPUTE_UNIT_LIMIT, MAX_SWAP_COMPUTE_UNIT_LIMIT, MAX_SWAP_PRIORITY_FEE_MICRO_LAMPORTS, MAX_SWAP_SLIPPAGE_BPS, PLATFORM_FEE_BPS, SWAP_BASE_FEE_LAMPORTS_PER_SIGNATURE, SWAP_ERROR_CODES, SWAP_MAX_TRANSACTION_BYTES, SwapError, assertPlatformFeeWalletReady, assertPoolConfigAllowed, assertPoolTradable, assertReferralAccountReady, assertSwapFeeAccountsReady, buildBuyTx, buildDbcSwapInstruction, buildSellTx, buildSwapTransaction, coinTokenProgram, compileSwapTransaction, computeSwapQuote, estimateSwapNetworkFeeLamports, fetchSwapContext, fetchSwapPoolState, minAmountOutForSlippage, needsInstructionsSysvar, platformFeeLamports, poolSwapStatus, quoteSwap, requiredSwapLamports, swapFeeAddresses, swapPriceImpactBps, } from './swap.js';
|
|
9
|
+
export type { BuildBuyTxParams, BuildSellTxParams, BuiltSwapTransaction, DbcSwapInstructionAccounts, FetchSwapContextParams, PoolSwapStatus, PriceImpactInput, QuoteSwapParams, SlippageInput, SwapAccountSnapshot, SwapBuildOptions, SwapBuildRequest, SwapContext, SwapErrorCode, SwapErrorDetails, SwapFeeAccountExpectations, SwapFeeBreakdown, SwapPoolState, SwapQuote, SwapQuoteRequest, SwapSide, SwapSolRequirementInput, } from './swap.js';
|
|
10
10
|
export { CLAIM_LAMPORTS_PER_SIGNATURE, ClaimError, PARTNER_POOL_CREATION_FEE_CLAIMED_BIT, buildCreatorClaimTx, buildForgeCreatorClaimTx, buildPartnerClaimTx, buildPartnerPoolCreationFeeClaimTx, isClaimWorthwhile, minimumWorthwhileClaimLamports, partnerPoolCreationFeeShare, type ClaimCosts, type ClaimErrorCode, type ClaimKind, type ClaimOptions, type ClaimSkipReason, type ClaimSummary, type ClaimTxResult, type CreatorClaimParams, type ForgeCreatorClaimParams, type PartnerClaimParams, type PartnerPoolCreationFeeClaimParams, type PoolCreationFeeClaimSummary, type PoolCreationFeeClaimTxResult, type PoolCreationFeeSkipReason, } from './claims.js';
|
|
11
|
+
export { CLAIM_POSITION_FEE_ACCOUNTS, CLAIM_POSITION_FEE_DISCRIMINATOR, DAMM_V2_PROGRAM_ID, buildCreatorPositionFeeClaimTx, buildForgeCreatorPositionFeeClaimTx, dammV2TokenProgram, findCreatorDammV2Positions, getDammV2PoolState, isPositionClaimWorthwhile, migratedDammV2Pool, positionPendingFees, sumPendingFees, summarizePosition, type CreatorDammV2Positions, type CreatorPositionClaimParams, type DammV2PoolState, type DammV2PositionRef, type DammV2PositionState, type DammV2PositionSummary, type FindCreatorPositionsParams, type ForgeCreatorPositionClaimParams, type MigratedDammV2Pool, type PositionClaimCosts, type PositionClaimSkipReason, type PositionClaimSummary, type PositionClaimTxResult, } from './position-claims.js';
|
|
11
12
|
export { CURVE_PROGRESS_FULL_BPS, DBC_MIGRATION_PROGRESS, DBC_POOL_CONFIG_OFFSET, DBC_POOL_CREATOR_OFFSET, DbcReadError, PROTOCOL_POOL_CREATION_FEE_CLAIMED_BIT, READ_COMMITMENT, curveProgress, feeMetrics, getDbcPoolState, graduationStatus, isGraduated, isTransientRpcError, listCoinsOfConfig, listCoinsOfCreator, poolCreationFeeStatus, readCoin, retryRpc, summarizeCoin, type CoinOfConfig, type CurveProgress, type DbcPoolState, type DbcReadErrorCode, type FeeMetrics, type GraduationStatus, type PoolCreationFeeStatus, type ReadOptions, type RetryOptions, type TokenAmounts, } from './reads.js';
|
|
12
13
|
export { CLUSTER_GENESIS_HASH, MAX_PAYMENT_LAMPORTS, MEMO_PROGRAM_ID, MEMO_V1_PROGRAM_ID, PAYMENT_MEMO_PREFIX, PaymentError, assertCluster, buildPaymentInstructions, buildPaymentTx, checkPaymentTransaction, paymentMemo, verifyPayment, type ExpectedPayment, type PaymentCheck, type PaymentCluster, type PaymentErrorCode, type PaymentParams, type PaymentPendingReason, type PaymentRejectReason, type PaymentTxOptions, type PaymentTxResult, type PaymentVerification, type VerifyPaymentOptions, } from './payments.js';
|
|
13
14
|
export { GatingError, getForgeBalance, passesForgeGate, type ForgeBalance, type GatingErrorCode, type GatingOptions, } from './gating.js';
|
|
15
|
+
export { JUPITER_CLAIM_DISCRIMINATOR, JUPITER_CLAIM_V2_DISCRIMINATOR, JUPITER_CREATE_ADMIN_TOKEN_ACCOUNT_DISCRIMINATOR, JUPITER_PROJECT_DISCRIMINATOR, JUPITER_REFERRAL_ACCOUNT_DISCRIMINATOR, JUPITER_REFERRAL_PROGRAM_ID, JupiterReferralError, buildJupiterCreateAdminTokenAccountIx, buildJupiterReferralClaimIx, buildJupiterReferralClaimTx, decodeJupiterProject, decodeJupiterReferralAccount, deriveJupiterProjectAuthority, deriveJupiterReferralTokenAccount, deriveJupiterReferralTokenAccountV2, type BuildJupiterReferralClaimTxParams, type JupiterClaimAccounts, type JupiterCreateAdminTokenAccountAccounts, type JupiterProject, type JupiterReferralAccount, type JupiterReferralClaimItem, type JupiterReferralClaimSummary, type JupiterReferralClaimTx, type JupiterReferralClaimVersion, type JupiterReferralErrorCode, } from './jupiter-referral.js';
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,14 @@ export * from './tx.js';
|
|
|
8
8
|
// Launch transaction check before the owner signs (browser-safe: only @solana/web3.js).
|
|
9
9
|
export * from './launch-check.js';
|
|
10
10
|
// Swap: buy / sell with the FORGE Meteora referral and the platform fee (swap.ts).
|
|
11
|
-
export { DEFAULT_SWAP_COMPUTE_UNIT_LIMIT, MAX_SWAP_COMPUTE_UNIT_LIMIT, MAX_SWAP_PRIORITY_FEE_MICRO_LAMPORTS, MAX_SWAP_SLIPPAGE_BPS, PLATFORM_FEE_BPS, SWAP_BASE_FEE_LAMPORTS_PER_SIGNATURE, SWAP_ERROR_CODES, SWAP_MAX_TRANSACTION_BYTES, SwapError, assertPlatformFeeWalletReady, assertPoolTradable, assertReferralAccountReady, assertSwapFeeAccountsReady, buildBuyTx, buildDbcSwapInstruction, buildSellTx, buildSwapTransaction, coinTokenProgram, compileSwapTransaction, computeSwapQuote, estimateSwapNetworkFeeLamports, fetchSwapContext, fetchSwapPoolState, minAmountOutForSlippage, needsInstructionsSysvar, platformFeeLamports, poolSwapStatus, quoteSwap, requiredSwapLamports, swapFeeAddresses, swapPriceImpactBps, } from './swap.js';
|
|
11
|
+
export { DEFAULT_SWAP_COMPUTE_UNIT_LIMIT, MAX_SWAP_COMPUTE_UNIT_LIMIT, MAX_SWAP_PRIORITY_FEE_MICRO_LAMPORTS, MAX_SWAP_SLIPPAGE_BPS, PLATFORM_FEE_BPS, SWAP_BASE_FEE_LAMPORTS_PER_SIGNATURE, SWAP_ERROR_CODES, SWAP_MAX_TRANSACTION_BYTES, SwapError, assertPlatformFeeWalletReady, assertPoolConfigAllowed, assertPoolTradable, assertReferralAccountReady, assertSwapFeeAccountsReady, buildBuyTx, buildDbcSwapInstruction, buildSellTx, buildSwapTransaction, coinTokenProgram, compileSwapTransaction, computeSwapQuote, estimateSwapNetworkFeeLamports, fetchSwapContext, fetchSwapPoolState, minAmountOutForSlippage, needsInstructionsSysvar, platformFeeLamports, poolSwapStatus, quoteSwap, requiredSwapLamports, swapFeeAddresses, swapPriceImpactBps, } from './swap.js';
|
|
12
12
|
// Claims, reads, payments, gating.
|
|
13
13
|
export { CLAIM_LAMPORTS_PER_SIGNATURE, ClaimError, PARTNER_POOL_CREATION_FEE_CLAIMED_BIT, buildCreatorClaimTx, buildForgeCreatorClaimTx, buildPartnerClaimTx, buildPartnerPoolCreationFeeClaimTx, isClaimWorthwhile, minimumWorthwhileClaimLamports, partnerPoolCreationFeeShare, } from './claims.js';
|
|
14
|
+
// DAMM v2 position fee claims of migrated pools (position-claims.ts).
|
|
15
|
+
export { CLAIM_POSITION_FEE_ACCOUNTS, CLAIM_POSITION_FEE_DISCRIMINATOR, DAMM_V2_PROGRAM_ID, buildCreatorPositionFeeClaimTx, buildForgeCreatorPositionFeeClaimTx, dammV2TokenProgram, findCreatorDammV2Positions, getDammV2PoolState, isPositionClaimWorthwhile, migratedDammV2Pool, positionPendingFees, sumPendingFees, summarizePosition, } from './position-claims.js';
|
|
14
16
|
export { CURVE_PROGRESS_FULL_BPS, DBC_MIGRATION_PROGRESS, DBC_POOL_CONFIG_OFFSET, DBC_POOL_CREATOR_OFFSET, DbcReadError, PROTOCOL_POOL_CREATION_FEE_CLAIMED_BIT, READ_COMMITMENT, curveProgress, feeMetrics, getDbcPoolState, graduationStatus, isGraduated, isTransientRpcError, listCoinsOfConfig, listCoinsOfCreator, poolCreationFeeStatus, readCoin, retryRpc, summarizeCoin, } from './reads.js';
|
|
15
17
|
export { CLUSTER_GENESIS_HASH, MAX_PAYMENT_LAMPORTS, MEMO_PROGRAM_ID, MEMO_V1_PROGRAM_ID, PAYMENT_MEMO_PREFIX, PaymentError, assertCluster, buildPaymentInstructions, buildPaymentTx, checkPaymentTransaction, paymentMemo, verifyPayment, } from './payments.js';
|
|
16
18
|
export { GatingError, getForgeBalance, passesForgeGate, } from './gating.js';
|
|
19
|
+
// Jupiter referral fee claim (mainnet-beta only): the integrator fees collected after graduation
|
|
20
|
+
// go to the referral account's partner, the FORGE multisig vault (jupiter-referral.ts).
|
|
21
|
+
export { JUPITER_CLAIM_DISCRIMINATOR, JUPITER_CLAIM_V2_DISCRIMINATOR, JUPITER_CREATE_ADMIN_TOKEN_ACCOUNT_DISCRIMINATOR, JUPITER_PROJECT_DISCRIMINATOR, JUPITER_REFERRAL_ACCOUNT_DISCRIMINATOR, JUPITER_REFERRAL_PROGRAM_ID, JupiterReferralError, buildJupiterCreateAdminTokenAccountIx, buildJupiterReferralClaimIx, buildJupiterReferralClaimTx, decodeJupiterProject, decodeJupiterReferralAccount, deriveJupiterProjectAuthority, deriveJupiterReferralTokenAccount, deriveJupiterReferralTokenAccountV2, } from './jupiter-referral.js';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { PublicKey, Transaction, TransactionInstruction, type Commitment, type Connection } from '@solana/web3.js';
|
|
2
|
+
import { type RetryOptions } from './reads.js';
|
|
3
|
+
/** Jupiter referral program (mainnet-beta). */
|
|
4
|
+
export declare const JUPITER_REFERRAL_PROGRAM_ID: PublicKey;
|
|
5
|
+
export declare const JUPITER_REFERRAL_ACCOUNT_DISCRIMINATOR: Buffer;
|
|
6
|
+
export declare const JUPITER_PROJECT_DISCRIMINATOR: Buffer;
|
|
7
|
+
export declare const JUPITER_CLAIM_DISCRIMINATOR: Buffer;
|
|
8
|
+
export declare const JUPITER_CLAIM_V2_DISCRIMINATOR: Buffer;
|
|
9
|
+
export declare const JUPITER_CREATE_ADMIN_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer;
|
|
10
|
+
export type JupiterReferralClaimVersion = 'v1' | 'v2';
|
|
11
|
+
export type JupiterReferralErrorCode = 'wrong_cluster' | 'invalid_params' | 'referral_account_not_found' | 'not_a_referral_account' | 'project_not_found' | 'not_a_project' | 'mint_not_found' | 'not_a_mint' | 'partner_mismatch';
|
|
12
|
+
export declare class JupiterReferralError extends Error {
|
|
13
|
+
readonly code: JupiterReferralErrorCode;
|
|
14
|
+
constructor(code: JupiterReferralErrorCode, message: string, options?: {
|
|
15
|
+
cause?: unknown;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export interface JupiterReferralAccount {
|
|
19
|
+
/** Receives the claimed fees (FORGE: the multisig vault). */
|
|
20
|
+
partner: PublicKey;
|
|
21
|
+
project: PublicKey;
|
|
22
|
+
shareBps: number;
|
|
23
|
+
name: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface JupiterProject {
|
|
26
|
+
base: PublicKey;
|
|
27
|
+
admin: PublicKey;
|
|
28
|
+
name: string;
|
|
29
|
+
defaultShareBps: number;
|
|
30
|
+
}
|
|
31
|
+
/** `ReferralAccount { partner, project, share_bps: u16, name: Option<String> }`. */
|
|
32
|
+
export declare function decodeJupiterReferralAccount(data: Buffer): JupiterReferralAccount;
|
|
33
|
+
/** `Project { base, admin, name: String, default_share_bps: u16 }`. */
|
|
34
|
+
export declare function decodeJupiterProject(data: Buffer): JupiterProject;
|
|
35
|
+
/** Classic referral token account: PDA `["referral_ata", referral account, mint]`. */
|
|
36
|
+
export declare function deriveJupiterReferralTokenAccount(referralAccount: PublicKey, mint: PublicKey, programId?: PublicKey): PublicKey;
|
|
37
|
+
/** V2 referral token account: the associated token account of the referral account. */
|
|
38
|
+
export declare function deriveJupiterReferralTokenAccountV2(referralAccount: PublicKey, mint: PublicKey, tokenProgram: PublicKey): PublicKey;
|
|
39
|
+
/** Project authority: PDA `["project_authority", project.base]`. */
|
|
40
|
+
export declare function deriveJupiterProjectAuthority(base: PublicKey, programId?: PublicKey): PublicKey;
|
|
41
|
+
export interface JupiterClaimAccounts {
|
|
42
|
+
/** Signer, pays the network fee (and the partner token account rent, the first time). */
|
|
43
|
+
payer: PublicKey;
|
|
44
|
+
project: PublicKey;
|
|
45
|
+
admin: PublicKey;
|
|
46
|
+
projectAdminTokenAccount: PublicKey;
|
|
47
|
+
referralAccount: PublicKey;
|
|
48
|
+
referralTokenAccount: PublicKey;
|
|
49
|
+
partner: PublicKey;
|
|
50
|
+
partnerTokenAccount: PublicKey;
|
|
51
|
+
mint: PublicKey;
|
|
52
|
+
tokenProgram: PublicKey;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `claim` (v1) or `claim_v2`: the IDL's accounts in the IDL's order. The two differ only in the
|
|
56
|
+
* position of the program accounts at the end (v1: associated token, system, token; v2: system,
|
|
57
|
+
* token, associated token). No arguments.
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildJupiterReferralClaimIx(accounts: JupiterClaimAccounts, version: JupiterReferralClaimVersion, programId?: PublicKey): TransactionInstruction;
|
|
60
|
+
export interface JupiterCreateAdminTokenAccountAccounts {
|
|
61
|
+
project: PublicKey;
|
|
62
|
+
/** Pays the rent of the admin token account (PDA of the project). */
|
|
63
|
+
projectAuthority: PublicKey;
|
|
64
|
+
admin: PublicKey;
|
|
65
|
+
projectAdminTokenAccount: PublicKey;
|
|
66
|
+
mint: PublicKey;
|
|
67
|
+
tokenProgram: PublicKey;
|
|
68
|
+
}
|
|
69
|
+
/** `create_admin_token_account`: needed once per mint before the first claim of that mint. */
|
|
70
|
+
export declare function buildJupiterCreateAdminTokenAccountIx(accounts: JupiterCreateAdminTokenAccountAccounts, programId?: PublicKey): TransactionInstruction;
|
|
71
|
+
export interface BuildJupiterReferralClaimTxParams {
|
|
72
|
+
connection: Connection;
|
|
73
|
+
/** FORGE_JUPITER_REFERRAL_ACCOUNT (read through addresses.ts by the caller). */
|
|
74
|
+
referralAccount: PublicKey;
|
|
75
|
+
/** Currency to claim (e.g. wrapped SOL or USDC). */
|
|
76
|
+
mint: PublicKey;
|
|
77
|
+
/** Fee payer and only signer. */
|
|
78
|
+
payer: PublicKey;
|
|
79
|
+
/** When given, the referral account's partner must be this key (the FORGE multisig vault). */
|
|
80
|
+
expectedPartner?: PublicKey;
|
|
81
|
+
commitment?: Commitment;
|
|
82
|
+
retry?: RetryOptions;
|
|
83
|
+
programId?: PublicKey;
|
|
84
|
+
}
|
|
85
|
+
export interface JupiterReferralClaimItem {
|
|
86
|
+
version: JupiterReferralClaimVersion;
|
|
87
|
+
referralTokenAccount: PublicKey;
|
|
88
|
+
/** Raw units held by that referral token account when the transaction was built. */
|
|
89
|
+
amount: bigint;
|
|
90
|
+
}
|
|
91
|
+
export interface JupiterReferralClaimSummary {
|
|
92
|
+
referralAccount: PublicKey;
|
|
93
|
+
partner: PublicKey;
|
|
94
|
+
partnerTokenAccount: PublicKey;
|
|
95
|
+
project: PublicKey;
|
|
96
|
+
/** The project's admin (receives the project's share) and its authority PDA (pays its rent). */
|
|
97
|
+
admin: PublicKey;
|
|
98
|
+
projectAuthority: PublicKey;
|
|
99
|
+
mint: PublicKey;
|
|
100
|
+
tokenProgram: PublicKey;
|
|
101
|
+
/** The funded referral token accounts claimed by the transaction (empty: nothing to claim). */
|
|
102
|
+
claims: JupiterReferralClaimItem[];
|
|
103
|
+
/** True when the transaction also creates the partner's token account (rent paid by `payer`). */
|
|
104
|
+
createsPartnerTokenAccount: boolean;
|
|
105
|
+
/** True when the transaction also creates the project admin's token account (program-paid). */
|
|
106
|
+
createsAdminTokenAccount: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface JupiterReferralClaimTx {
|
|
109
|
+
/** Unsigned legacy transaction (fee payer and blockhash set), or null when nothing is claimable. */
|
|
110
|
+
transaction: Transaction | null;
|
|
111
|
+
lastValidBlockHeight: number | null;
|
|
112
|
+
summary: JupiterReferralClaimSummary;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Reads the referral account, its project, the mint and the collection accounts, and builds the
|
|
116
|
+
* claim(s) of every funded collection account of `mint` to the partner's associated token account.
|
|
117
|
+
* Mainnet-beta only (genesis hash). Returns `transaction: null` when nothing is claimable.
|
|
118
|
+
*/
|
|
119
|
+
export declare function buildJupiterReferralClaimTx(p: BuildJupiterReferralClaimTxParams): Promise<JupiterReferralClaimTx>;
|