@forgedevv/core 0.1.0 → 0.3.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 +227 -4
- package/README.md +4 -3
- package/dist/addresses.d.ts +73 -7
- package/dist/addresses.js +96 -5
- package/dist/claims.d.ts +43 -6
- package/dist/claims.js +75 -16
- package/dist/config.d.ts +48 -37
- package/dist/config.js +282 -52
- package/dist/constants.d.ts +16 -0
- package/dist/constants.js +20 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.js +15 -4
- package/dist/jupiter-referral.d.ts +334 -0
- package/dist/jupiter-referral.js +666 -0
- package/dist/launch-metadata.d.ts +5 -1
- package/dist/launch-metadata.js +2 -0
- package/dist/meteora-referral.d.ts +119 -0
- package/dist/meteora-referral.js +188 -0
- package/dist/payments.d.ts +17 -0
- package/dist/payments.js +20 -2
- package/dist/pool.d.ts +108 -17
- package/dist/pool.js +237 -60
- package/dist/position-claims.d.ts +215 -0
- package/dist/position-claims.js +457 -0
- package/dist/priority-fee.d.ts +202 -0
- package/dist/priority-fee.js +322 -0
- package/dist/reads.d.ts +20 -0
- package/dist/reads.js +39 -2
- package/dist/settings.d.ts +73 -0
- package/dist/settings.js +119 -0
- package/dist/swap.d.ts +95 -23
- package/dist/swap.js +144 -30
- package/dist/tx.d.ts +2 -0
- package/dist/tx.js +4 -2
- 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 {
|
|
34
|
+
import { ANTI_SNIPER_FEE_SCHEDULE, FORGE_ACTIVATION_TYPE, FORGE_MIGRATION_SETTINGS, FORGE_TOKEN_SETTINGS, forgeFeeSchedulerParam, } from './settings.js';
|
|
35
|
+
import { estimatePriorityFee, fixedPriorityFee, priorityFeeInstructions, resolvePriorityFeePolicy, } from './priority-fee.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
|
|
@@ -352,6 +570,12 @@ export class CreateConfigError extends Error {
|
|
|
352
570
|
*/
|
|
353
571
|
export async function buildCreateConfigTx(params) {
|
|
354
572
|
const configAddress = params.config instanceof PublicKey ? params.config : params.config.publicKey;
|
|
573
|
+
if (params.priority !== undefined) {
|
|
574
|
+
if (params.computeUnitPriceMicroLamports !== undefined) {
|
|
575
|
+
throw new RangeError('pass either priority or computeUnitPriceMicroLamports, not both');
|
|
576
|
+
}
|
|
577
|
+
resolvePriorityFeePolicy(params.priority);
|
|
578
|
+
}
|
|
355
579
|
const configParams = buildConfigParams(params.spec, params.kind, params.metadataUri !== undefined ? { metadataUri: params.metadataUri } : {});
|
|
356
580
|
if (configAddress.equals(params.payer) ||
|
|
357
581
|
configAddress.equals(configParams.feeClaimer) ||
|
|
@@ -370,11 +594,16 @@ export async function buildCreateConfigTx(params) {
|
|
|
370
594
|
});
|
|
371
595
|
const rentLamports = BigInt(await connection.getMinimumBalanceForRentExemption(client.partner.getProgram().account.poolConfig.size));
|
|
372
596
|
const { blockhash, lastValidBlockHeight } = params.recentBlockhash ?? (await connection.getLatestBlockhash('confirmed'));
|
|
597
|
+
const priorityFee = params.priority === undefined
|
|
598
|
+
? fixedPriorityFee(CREATE_CONFIG_COMPUTE_UNITS, params.computeUnitPriceMicroLamports ?? 0)
|
|
599
|
+
: await estimatePriorityFee({
|
|
600
|
+
connection,
|
|
601
|
+
writableAccounts: [params.payer, configAddress],
|
|
602
|
+
computeUnitLimit: CREATE_CONFIG_COMPUTE_UNITS,
|
|
603
|
+
setting: params.priority,
|
|
604
|
+
});
|
|
373
605
|
const transaction = new Transaction({ feePayer: params.payer, blockhash, lastValidBlockHeight });
|
|
374
|
-
transaction.add(...
|
|
375
|
-
units: CREATE_CONFIG_COMPUTE_UNITS,
|
|
376
|
-
microLamports: params.computeUnitPriceMicroLamports ?? 0,
|
|
377
|
-
}), ...sdkTx.instructions);
|
|
606
|
+
transaction.add(...priorityFeeInstructions(priorityFee), ...sdkTx.instructions);
|
|
378
607
|
return {
|
|
379
608
|
transaction,
|
|
380
609
|
configAddress,
|
|
@@ -382,5 +611,6 @@ export async function buildCreateConfigTx(params) {
|
|
|
382
611
|
rentLamports,
|
|
383
612
|
lastValidBlockHeight,
|
|
384
613
|
signers: [params.payer, configAddress],
|
|
614
|
+
priorityFee,
|
|
385
615
|
};
|
|
386
616
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -45,3 +45,19 @@ export declare const CLIENT_POOL_CREATION_FEE_LAMPORTS: {
|
|
|
45
45
|
readonly max: bigint;
|
|
46
46
|
readonly allowZero: true;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Referral fee range of Jupiter Ultra, in bps. The Jupiter Plugin passes `referralFee` as is to
|
|
50
|
+
* Ultra `/order`, which refuses any value outside 50..255 ("must be between 50 and 255
|
|
51
|
+
* (inclusive)", checked on 2026-10-17); Jupiter keeps 20% of the fee.
|
|
52
|
+
* @see https://developers.jup.ag/docs/swap/fees
|
|
53
|
+
*/
|
|
54
|
+
export declare const JUPITER_REFERRAL_FEE_BPS_RANGE: {
|
|
55
|
+
readonly min: 50;
|
|
56
|
+
readonly max: 255;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Returns `bps` when Jupiter Ultra accepts it as a referral fee: a whole number of bps within
|
|
60
|
+
* `JUPITER_REFERRAL_FEE_BPS_RANGE`. Throws a `RangeError` otherwise: with such a fee Jupiter
|
|
61
|
+
* refuses every swap, so it must never reach the plugin.
|
|
62
|
+
*/
|
|
63
|
+
export declare function assertJupiterReferralFeeBps(bps: number): number;
|
package/dist/constants.js
CHANGED
|
@@ -68,3 +68,23 @@ export const CLIENT_POOL_CREATION_FEE_LAMPORTS = {
|
|
|
68
68
|
max: solToLamports(CLIENT_BOUNDS.poolCreationFeeSol.max),
|
|
69
69
|
allowZero: CLIENT_BOUNDS.poolCreationFeeSol.allowZero,
|
|
70
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Referral fee range of Jupiter Ultra, in bps. The Jupiter Plugin passes `referralFee` as is to
|
|
73
|
+
* Ultra `/order`, which refuses any value outside 50..255 ("must be between 50 and 255
|
|
74
|
+
* (inclusive)", checked on 2026-10-17); Jupiter keeps 20% of the fee.
|
|
75
|
+
* @see https://developers.jup.ag/docs/swap/fees
|
|
76
|
+
*/
|
|
77
|
+
export const JUPITER_REFERRAL_FEE_BPS_RANGE = { min: 50, max: 255 };
|
|
78
|
+
/**
|
|
79
|
+
* Returns `bps` when Jupiter Ultra accepts it as a referral fee: a whole number of bps within
|
|
80
|
+
* `JUPITER_REFERRAL_FEE_BPS_RANGE`. Throws a `RangeError` otherwise: with such a fee Jupiter
|
|
81
|
+
* refuses every swap, so it must never reach the plugin.
|
|
82
|
+
*/
|
|
83
|
+
export function assertJupiterReferralFeeBps(bps) {
|
|
84
|
+
const { min, max } = JUPITER_REFERRAL_FEE_BPS_RANGE;
|
|
85
|
+
if (!Number.isInteger(bps) || bps < min || bps > max) {
|
|
86
|
+
throw new RangeError(`Jupiter referral fee must be a whole number of bps between ${min} and ${max} ` +
|
|
87
|
+
`(Jupiter Ultra refuses any other value), got ${String(bps)}`);
|
|
88
|
+
}
|
|
89
|
+
return bps;
|
|
90
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,14 @@ export * from './validate.js';
|
|
|
4
4
|
export * from './config.js';
|
|
5
5
|
export * from './pool.js';
|
|
6
6
|
export * from './tx.js';
|
|
7
|
+
export * from './priority-fee.js';
|
|
7
8
|
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';
|
|
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 {
|
|
12
|
-
export {
|
|
9
|
+
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';
|
|
10
|
+
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';
|
|
11
|
+
export { CLAIM_COMPUTE_UNITS, CLAIM_LAMPORTS_PER_SIGNATURE, ClaimError, PARTNER_POOL_CREATION_FEE_CLAIMED_BIT, POOL_CREATION_FEE_CLAIM_COMPUTE_UNITS, 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';
|
|
12
|
+
export { CLAIM_POSITION_FEE_ACCOUNTS, CLAIM_POSITION_FEE_DISCRIMINATOR, DAMM_V2_PROGRAM_ID, buildCreatorPositionFeeClaimTx, buildForgeCreatorPositionFeeClaimTx, dammV2TokenProgram, findCreatorDammV2Positions, getDammV2PoolState, isPositionClaimWorthwhile, migratedDammV2Pool, positionClaimComputeUnits, 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';
|
|
13
|
+
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, listPoolStatesOfConfig, poolCreationFeeStatus, poolSpotPrice, 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';
|
|
14
|
+
export { CLUSTER_GENESIS_HASH, MAX_PAYMENT_LAMPORTS, MEMO_PROGRAM_ID, MEMO_V1_PROGRAM_ID, PAYMENT_COMPUTE_UNITS, 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
15
|
export { GatingError, getForgeBalance, passesForgeGate, type ForgeBalance, type GatingErrorCode, type GatingOptions, } from './gating.js';
|
|
16
|
+
export { JUPITER_CLAIM_DISCRIMINATOR, JUPITER_CLAIM_V2_DISCRIMINATOR, JUPITER_CREATE_ADMIN_TOKEN_ACCOUNT_DISCRIMINATOR, JUPITER_INITIALIZE_REFERRAL_ACCOUNT_WITH_NAME_DISCRIMINATOR, JUPITER_PROJECT_DISCRIMINATOR, JUPITER_REFERRAL_ACCOUNT_SIZE, JUPITER_REFERRAL_CLAIM_COMPUTE_UNITS, JUPITER_REFERRAL_ACCOUNT_DISCRIMINATOR, JUPITER_REFERRAL_NAME_MAX_BYTES, JUPITER_REFERRAL_NAME_MAX_CHARS, JUPITER_REFERRAL_PROGRAM_ID, JUPITER_REFERRAL_SETUP_COMPUTE_UNITS, JUPITER_ULTRA_REFERRAL_PROJECT, JupiterReferralError, assertJupiterReferralName, buildJupiterCreateAdminTokenAccountIx, buildJupiterInitializeReferralAccountWithNameIx, buildJupiterReferralClaimIx, buildJupiterReferralClaimTx, buildJupiterReferralSetupTx, buildJupiterReferralTokenAccountV2Ix, decodeJupiterProject, decodeJupiterReferralAccount, deriveJupiterProjectAuthority, deriveJupiterReferralAccount, deriveJupiterReferralTokenAccount, deriveJupiterReferralTokenAccountV2, encodeJupiterReferralName, inspectJupiterReferralAccount, inspectJupiterReferralTokenAccountV2, readJupiterReferralSetup, type BuildJupiterReferralClaimTxParams, type BuildJupiterReferralSetupTxParams, type JupiterClaimAccounts, type JupiterCreateAdminTokenAccountAccounts, type JupiterInitializeReferralAccountWithNameAccounts, type JupiterProject, type JupiterReferralAccount, type JupiterReferralAccountExpectation, type JupiterReferralAccountMismatch, type JupiterReferralAccountStatus, type JupiterReferralClaimItem, type JupiterReferralClaimSummary, type JupiterReferralClaimTx, type JupiterReferralClaimVersion, type JupiterReferralErrorCode, type JupiterReferralSetupMint, type JupiterReferralSetupState, type JupiterReferralSetupTokenAccount, type JupiterReferralSetupTokenAccountState, type JupiterReferralSetupTx, type JupiterReferralTokenAccountMismatch, type JupiterReferralTokenAccountStatus, type JupiterReferralTokenAccountV2Ix, type JupiterReferralTokenAccountV2Params, type ReadJupiterReferralSetupParams, } from './jupiter-referral.js';
|
|
17
|
+
export { MAX_METEORA_REFERRAL_SEED_BYTES, METEORA_REFERRAL_ACCOUNT_SEED, METEORA_REFERRAL_SETUP_COMPUTE_UNITS, MeteoraReferralError, TOKEN_INITIALIZE_ACCOUNT3_TAG, assertMeteoraReferralSeed, buildCreateMeteoraReferralAccountIxs, buildCreateMeteoraReferralAccountTx, deriveMeteoraReferralAccount, inspectMeteoraReferralAccount, readMeteoraReferralAccount, type BuildCreateMeteoraReferralAccountTxParams, type CreateMeteoraReferralAccountParams, type CreateMeteoraReferralAccountTx, type MeteoraReferralAccountInstructions, type MeteoraReferralAccountStatus, type MeteoraReferralErrorCode, type MeteoraReferralExpectation, type MeteoraReferralMismatch, type ReadMeteoraReferralAccountParams, } from './meteora-referral.js';
|
package/dist/index.js
CHANGED
|
@@ -5,12 +5,23 @@ export * from './validate.js';
|
|
|
5
5
|
export * from './config.js';
|
|
6
6
|
export * from './pool.js';
|
|
7
7
|
export * from './tx.js';
|
|
8
|
+
// Priority fees: price from the recent fees, bounded, and the matching policy check.
|
|
9
|
+
export * from './priority-fee.js';
|
|
8
10
|
// Launch transaction check before the owner signs (browser-safe: only @solana/web3.js).
|
|
9
11
|
export * from './launch-check.js';
|
|
10
12
|
// 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';
|
|
13
|
+
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
14
|
// Claims, reads, payments, gating.
|
|
13
|
-
export { CLAIM_LAMPORTS_PER_SIGNATURE, ClaimError, PARTNER_POOL_CREATION_FEE_CLAIMED_BIT, buildCreatorClaimTx, buildForgeCreatorClaimTx, buildPartnerClaimTx, buildPartnerPoolCreationFeeClaimTx, isClaimWorthwhile, minimumWorthwhileClaimLamports, partnerPoolCreationFeeShare, } from './claims.js';
|
|
14
|
-
|
|
15
|
-
export {
|
|
15
|
+
export { CLAIM_COMPUTE_UNITS, CLAIM_LAMPORTS_PER_SIGNATURE, ClaimError, PARTNER_POOL_CREATION_FEE_CLAIMED_BIT, POOL_CREATION_FEE_CLAIM_COMPUTE_UNITS, buildCreatorClaimTx, buildForgeCreatorClaimTx, buildPartnerClaimTx, buildPartnerPoolCreationFeeClaimTx, isClaimWorthwhile, minimumWorthwhileClaimLamports, partnerPoolCreationFeeShare, } from './claims.js';
|
|
16
|
+
// DAMM v2 position fee claims of migrated pools (position-claims.ts).
|
|
17
|
+
export { CLAIM_POSITION_FEE_ACCOUNTS, CLAIM_POSITION_FEE_DISCRIMINATOR, DAMM_V2_PROGRAM_ID, buildCreatorPositionFeeClaimTx, buildForgeCreatorPositionFeeClaimTx, dammV2TokenProgram, findCreatorDammV2Positions, getDammV2PoolState, isPositionClaimWorthwhile, migratedDammV2Pool, positionClaimComputeUnits, positionPendingFees, sumPendingFees, summarizePosition, } from './position-claims.js';
|
|
18
|
+
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, listPoolStatesOfConfig, poolCreationFeeStatus, poolSpotPrice, readCoin, retryRpc, summarizeCoin, } from './reads.js';
|
|
19
|
+
export { CLUSTER_GENESIS_HASH, MAX_PAYMENT_LAMPORTS, MEMO_PROGRAM_ID, MEMO_V1_PROGRAM_ID, PAYMENT_COMPUTE_UNITS, PAYMENT_MEMO_PREFIX, PaymentError, assertCluster, buildPaymentInstructions, buildPaymentTx, checkPaymentTransaction, paymentMemo, verifyPayment, } from './payments.js';
|
|
16
20
|
export { GatingError, getForgeBalance, passesForgeGate, } from './gating.js';
|
|
21
|
+
// Jupiter referral fee claim (mainnet-beta only): the integrator fees collected after graduation
|
|
22
|
+
// go to the referral account's partner, the FORGE revenue wallet (jupiter-referral.ts); and the
|
|
23
|
+
// one-off setup of that referral account (named, Ultra project) with its v2 collection accounts.
|
|
24
|
+
export { JUPITER_CLAIM_DISCRIMINATOR, JUPITER_CLAIM_V2_DISCRIMINATOR, JUPITER_CREATE_ADMIN_TOKEN_ACCOUNT_DISCRIMINATOR, JUPITER_INITIALIZE_REFERRAL_ACCOUNT_WITH_NAME_DISCRIMINATOR, JUPITER_PROJECT_DISCRIMINATOR, JUPITER_REFERRAL_ACCOUNT_SIZE, JUPITER_REFERRAL_CLAIM_COMPUTE_UNITS, JUPITER_REFERRAL_ACCOUNT_DISCRIMINATOR, JUPITER_REFERRAL_NAME_MAX_BYTES, JUPITER_REFERRAL_NAME_MAX_CHARS, JUPITER_REFERRAL_PROGRAM_ID, JUPITER_REFERRAL_SETUP_COMPUTE_UNITS, JUPITER_ULTRA_REFERRAL_PROJECT, JupiterReferralError, assertJupiterReferralName, buildJupiterCreateAdminTokenAccountIx, buildJupiterInitializeReferralAccountWithNameIx, buildJupiterReferralClaimIx, buildJupiterReferralClaimTx, buildJupiterReferralSetupTx, buildJupiterReferralTokenAccountV2Ix, decodeJupiterProject, decodeJupiterReferralAccount, deriveJupiterProjectAuthority, deriveJupiterReferralAccount, deriveJupiterReferralTokenAccount, deriveJupiterReferralTokenAccountV2, encodeJupiterReferralName, inspectJupiterReferralAccount, inspectJupiterReferralTokenAccountV2, readJupiterReferralSetup, } from './jupiter-referral.js';
|
|
25
|
+
// Meteora referral account setup: the standalone wrapped-SOL token account of the revenue wallet
|
|
26
|
+
// that every curve swap built by core names as referral (meteora-referral.ts).
|
|
27
|
+
export { MAX_METEORA_REFERRAL_SEED_BYTES, METEORA_REFERRAL_ACCOUNT_SEED, METEORA_REFERRAL_SETUP_COMPUTE_UNITS, MeteoraReferralError, TOKEN_INITIALIZE_ACCOUNT3_TAG, assertMeteoraReferralSeed, buildCreateMeteoraReferralAccountIxs, buildCreateMeteoraReferralAccountTx, deriveMeteoraReferralAccount, inspectMeteoraReferralAccount, readMeteoraReferralAccount, } from './meteora-referral.js';
|