@forgedevv/core 0.2.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 +142 -2
- package/dist/addresses.d.ts +25 -6
- package/dist/addresses.js +27 -5
- package/dist/claims.d.ts +31 -4
- package/dist/claims.js +46 -5
- package/dist/config.d.ts +8 -0
- package/dist/config.js +17 -5
- package/dist/constants.d.ts +16 -0
- package/dist/constants.js +20 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.js +12 -6
- package/dist/jupiter-referral.d.ts +219 -4
- package/dist/jupiter-referral.js +382 -11
- package/dist/launch-metadata.d.ts +2 -0
- 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 +40 -0
- package/dist/pool.js +128 -24
- package/dist/position-claims.d.ts +9 -1
- package/dist/position-claims.js +21 -4
- 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/swap.d.ts +35 -16
- package/dist/swap.js +68 -19
- package/dist/tx.d.ts +2 -0
- package/dist/tx.js +4 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,12 +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
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';
|
|
9
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';
|
|
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';
|
|
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';
|
|
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';
|
|
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';
|
|
14
15
|
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';
|
|
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,17 +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
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';
|
|
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';
|
|
14
16
|
// 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';
|
|
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';
|
|
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';
|
|
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';
|
|
18
20
|
export { GatingError, getForgeBalance, passesForgeGate, } from './gating.js';
|
|
19
21
|
// Jupiter referral fee claim (mainnet-beta only): the integrator fees collected after graduation
|
|
20
|
-
// go to the referral account's partner, the FORGE
|
|
21
|
-
|
|
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';
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import { PublicKey, Transaction, TransactionInstruction, type Commitment, type Connection } from '@solana/web3.js';
|
|
1
|
+
import { PublicKey, Transaction, TransactionInstruction, type AccountInfo, type Commitment, type Connection } from '@solana/web3.js';
|
|
2
|
+
import { type PriorityFeeQuote, type PriorityFeeSetting } from './priority-fee.js';
|
|
2
3
|
import { type RetryOptions } from './reads.js';
|
|
3
4
|
/** Jupiter referral program (mainnet-beta). */
|
|
4
5
|
export declare const JUPITER_REFERRAL_PROGRAM_ID: PublicKey;
|
|
6
|
+
/**
|
|
7
|
+
* Jupiter's Ultra project in the referral program (mainnet-beta). The Jupiter Plugin and Ultra
|
|
8
|
+
* `/order` only collect the referral fee into referral accounts of this project.
|
|
9
|
+
* @see https://developers.jup.ag/docs/ultra/add-fees-to-ultra.md
|
|
10
|
+
*/
|
|
11
|
+
export declare const JUPITER_ULTRA_REFERRAL_PROJECT: PublicKey;
|
|
5
12
|
export declare const JUPITER_REFERRAL_ACCOUNT_DISCRIMINATOR: Buffer;
|
|
6
13
|
export declare const JUPITER_PROJECT_DISCRIMINATOR: Buffer;
|
|
7
14
|
export declare const JUPITER_CLAIM_DISCRIMINATOR: Buffer;
|
|
8
15
|
export declare const JUPITER_CLAIM_V2_DISCRIMINATOR: Buffer;
|
|
9
16
|
export declare const JUPITER_CREATE_ADMIN_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer;
|
|
10
17
|
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'
|
|
18
|
+
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'
|
|
19
|
+
/** The referral account belongs to another project than the expected one (Jupiter Ultra's). */
|
|
20
|
+
| 'project_mismatch'
|
|
21
|
+
/** Funds wait in the v2 collection account, but `claim_v2` needs a named referral account. */
|
|
22
|
+
| 'referral_account_unnamed'
|
|
23
|
+
/** Named, but not the PDA `["referral", project, name]` that `claim_v2` signs with. */
|
|
24
|
+
| 'referral_account_not_pda';
|
|
12
25
|
export declare class JupiterReferralError extends Error {
|
|
13
26
|
readonly code: JupiterReferralErrorCode;
|
|
14
27
|
constructor(code: JupiterReferralErrorCode, message: string, options?: {
|
|
@@ -16,7 +29,7 @@ export declare class JupiterReferralError extends Error {
|
|
|
16
29
|
});
|
|
17
30
|
}
|
|
18
31
|
export interface JupiterReferralAccount {
|
|
19
|
-
/** Receives the claimed fees (FORGE: the
|
|
32
|
+
/** Receives the claimed fees (FORGE: the revenue wallet, D34). */
|
|
20
33
|
partner: PublicKey;
|
|
21
34
|
project: PublicKey;
|
|
22
35
|
shareBps: number;
|
|
@@ -34,6 +47,11 @@ export declare function decodeJupiterReferralAccount(data: Buffer): JupiterRefer
|
|
|
34
47
|
export declare function decodeJupiterProject(data: Buffer): JupiterProject;
|
|
35
48
|
/** Classic referral token account: PDA `["referral_ata", referral account, mint]`. */
|
|
36
49
|
export declare function deriveJupiterReferralTokenAccount(referralAccount: PublicKey, mint: PublicKey, programId?: PublicKey): PublicKey;
|
|
50
|
+
/**
|
|
51
|
+
* Named referral account: PDA `["referral", project, name]` (`initialize_referral_account_with_name`,
|
|
52
|
+
* and the signer seeds of `claim_v2`). Throws when the name is longer than a seed (32 bytes).
|
|
53
|
+
*/
|
|
54
|
+
export declare function deriveJupiterReferralAccount(project: PublicKey, name: string, programId?: PublicKey): PublicKey;
|
|
37
55
|
/** V2 referral token account: the associated token account of the referral account. */
|
|
38
56
|
export declare function deriveJupiterReferralTokenAccountV2(referralAccount: PublicKey, mint: PublicKey, tokenProgram: PublicKey): PublicKey;
|
|
39
57
|
/** Project authority: PDA `["project_authority", project.base]`. */
|
|
@@ -76,12 +94,28 @@ export interface BuildJupiterReferralClaimTxParams {
|
|
|
76
94
|
mint: PublicKey;
|
|
77
95
|
/** Fee payer and only signer. */
|
|
78
96
|
payer: PublicKey;
|
|
79
|
-
/** When given, the referral account's partner must be this key (the
|
|
97
|
+
/** When given, the referral account's partner must be this key (the revenue wallet, D34). */
|
|
80
98
|
expectedPartner?: PublicKey;
|
|
99
|
+
/**
|
|
100
|
+
* The referral account's project must be this key. Default: `JUPITER_ULTRA_REFERRAL_PROJECT`,
|
|
101
|
+
* the only project the Jupiter Plugin pays.
|
|
102
|
+
*/
|
|
103
|
+
expectedProject?: PublicKey;
|
|
81
104
|
commitment?: Commitment;
|
|
82
105
|
retry?: RetryOptions;
|
|
83
106
|
programId?: PublicKey;
|
|
107
|
+
/**
|
|
108
|
+
* Priority fee read from the cluster for the claim's writable accounts, bounded by this setting
|
|
109
|
+
* (priority-fee.ts): `setComputeUnitLimit` (`JUPITER_REFERRAL_CLAIM_COMPUTE_UNITS`) then
|
|
110
|
+
* `setComputeUnitPrice`, first. Default: none.
|
|
111
|
+
*/
|
|
112
|
+
priority?: PriorityFeeSetting;
|
|
84
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Compute unit limit of a Jupiter referral claim with a priority fee: up to two token account
|
|
116
|
+
* creations and two claims (each a token transfer pair), with a wide margin.
|
|
117
|
+
*/
|
|
118
|
+
export declare const JUPITER_REFERRAL_CLAIM_COMPUTE_UNITS = 300000;
|
|
85
119
|
export interface JupiterReferralClaimItem {
|
|
86
120
|
version: JupiterReferralClaimVersion;
|
|
87
121
|
referralTokenAccount: PublicKey;
|
|
@@ -110,10 +144,191 @@ export interface JupiterReferralClaimTx {
|
|
|
110
144
|
transaction: Transaction | null;
|
|
111
145
|
lastValidBlockHeight: number | null;
|
|
112
146
|
summary: JupiterReferralClaimSummary;
|
|
147
|
+
/** The priority fee (price, fee, cap), or null without a `priority` setting or transaction. */
|
|
148
|
+
priorityFee: PriorityFeeQuote | null;
|
|
113
149
|
}
|
|
114
150
|
/**
|
|
115
151
|
* Reads the referral account, its project, the mint and the collection accounts, and builds the
|
|
116
152
|
* claim(s) of every funded collection account of `mint` to the partner's associated token account.
|
|
117
153
|
* Mainnet-beta only (genesis hash). Returns `transaction: null` when nothing is claimable.
|
|
154
|
+
* The referral account must belong to `expectedProject` (default: Jupiter's Ultra project), and a
|
|
155
|
+
* funded v2 collection account is only claimed for a named referral PDA (typed errors otherwise).
|
|
118
156
|
*/
|
|
119
157
|
export declare function buildJupiterReferralClaimTx(p: BuildJupiterReferralClaimTxParams): Promise<JupiterReferralClaimTx>;
|
|
158
|
+
export declare const JUPITER_INITIALIZE_REFERRAL_ACCOUNT_WITH_NAME_DISCRIMINATOR: Buffer;
|
|
159
|
+
/** `ReferralAccount::LEN` = 8 + 32 + 32 + 200 + 2: what the initialization allocates. */
|
|
160
|
+
export declare const JUPITER_REFERRAL_ACCOUNT_SIZE = 274;
|
|
161
|
+
/** `params.name.chars().count() < 20` in the program. */
|
|
162
|
+
export declare const JUPITER_REFERRAL_NAME_MAX_CHARS = 19;
|
|
163
|
+
/** The name is a PDA seed: at most 32 bytes. */
|
|
164
|
+
export declare const JUPITER_REFERRAL_NAME_MAX_BYTES = 32;
|
|
165
|
+
/**
|
|
166
|
+
* Compute unit limit of the setup transaction with a priority fee: one Anchor account
|
|
167
|
+
* initialization and up to a few associated token account creations, with a wide margin.
|
|
168
|
+
*/
|
|
169
|
+
export declare const JUPITER_REFERRAL_SETUP_COMPUTE_UNITS = 150000;
|
|
170
|
+
/**
|
|
171
|
+
* Checks a referral account name: 1 to 19 characters (code points, the program's rule), at most
|
|
172
|
+
* 32 UTF-8 bytes (a PDA seed), and FORGE's own restriction to printable characters without
|
|
173
|
+
* whitespace (a name goes into environment files and documentation). Returns the name.
|
|
174
|
+
* @throws JupiterReferralError `invalid_params`
|
|
175
|
+
*/
|
|
176
|
+
export declare function assertJupiterReferralName(name: string): string;
|
|
177
|
+
/** Borsh `String`: u32 little-endian byte length, then the UTF-8 bytes. */
|
|
178
|
+
export declare function encodeJupiterReferralName(name: string): Buffer;
|
|
179
|
+
export interface JupiterInitializeReferralAccountWithNameAccounts {
|
|
180
|
+
/** Signer: pays the network fee and the referral account rent. */
|
|
181
|
+
payer: PublicKey;
|
|
182
|
+
/** Receives the claimed fees (FORGE: the revenue wallet, D34). Does not sign. */
|
|
183
|
+
partner: PublicKey;
|
|
184
|
+
project: PublicKey;
|
|
185
|
+
/** Must be `deriveJupiterReferralAccount(project, name)`. */
|
|
186
|
+
referralAccount: PublicKey;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* `initialize_referral_account_with_name`: the IDL's accounts in the IDL's order, the Anchor
|
|
190
|
+
* discriminator then the Borsh-encoded `{ name }`. Refuses a referral account that is not the
|
|
191
|
+
* PDA of the project and the name, and a payer, partner, project or referral account that
|
|
192
|
+
* coincide.
|
|
193
|
+
*/
|
|
194
|
+
export declare function buildJupiterInitializeReferralAccountWithNameIx(accounts: JupiterInitializeReferralAccountWithNameAccounts, name: string, programId?: PublicKey): TransactionInstruction;
|
|
195
|
+
export interface JupiterReferralTokenAccountV2Params {
|
|
196
|
+
/** Signer: pays the rent of the token account. */
|
|
197
|
+
payer: PublicKey;
|
|
198
|
+
referralAccount: PublicKey;
|
|
199
|
+
mint: PublicKey;
|
|
200
|
+
/** The mint's program (classic SPL Token or Token-2022). */
|
|
201
|
+
tokenProgram: PublicKey;
|
|
202
|
+
}
|
|
203
|
+
export interface JupiterReferralTokenAccountV2Ix {
|
|
204
|
+
/** `deriveJupiterReferralTokenAccountV2(referralAccount, mint, tokenProgram)`. */
|
|
205
|
+
tokenAccount: PublicKey;
|
|
206
|
+
instruction: TransactionInstruction;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The v2 collection account of `mint` (what the Jupiter Plugin pays and `claim_v2` empties): an
|
|
210
|
+
* idempotent creation of the referral account's associated token account, paid by `payer`
|
|
211
|
+
* (the SDK's `initializeReferralTokenAccountV2`). Idempotent on-chain: an existing account is
|
|
212
|
+
* left as it is.
|
|
213
|
+
*/
|
|
214
|
+
export declare function buildJupiterReferralTokenAccountV2Ix(p: JupiterReferralTokenAccountV2Params): JupiterReferralTokenAccountV2Ix;
|
|
215
|
+
export interface JupiterReferralSetupMint {
|
|
216
|
+
mint: PublicKey;
|
|
217
|
+
tokenProgram: PublicKey;
|
|
218
|
+
}
|
|
219
|
+
export interface BuildJupiterReferralSetupTxParams {
|
|
220
|
+
/** Fee payer and only signer. */
|
|
221
|
+
payer: PublicKey;
|
|
222
|
+
/** The referral account's partner: the revenue wallet. */
|
|
223
|
+
partner: PublicKey;
|
|
224
|
+
/** Default: `JUPITER_ULTRA_REFERRAL_PROJECT`, the only project the Jupiter Plugin pays. */
|
|
225
|
+
project?: PublicKey;
|
|
226
|
+
name: string;
|
|
227
|
+
/** False when the referral account already exists (only token accounts are then created). */
|
|
228
|
+
createReferralAccount: boolean;
|
|
229
|
+
/** The v2 collection accounts to create (those found absent), in this order. */
|
|
230
|
+
tokenAccounts: readonly JupiterReferralSetupMint[];
|
|
231
|
+
blockhash: string;
|
|
232
|
+
lastValidBlockHeight: number;
|
|
233
|
+
/**
|
|
234
|
+
* Priority fee quote of the caller (`JUPITER_REFERRAL_SETUP_COMPUTE_UNITS`): a unit limit then
|
|
235
|
+
* a unit price are put first when its price is not 0; nothing otherwise.
|
|
236
|
+
*/
|
|
237
|
+
priorityFee?: Pick<PriorityFeeQuote, 'computeUnitLimit' | 'microLamports'>;
|
|
238
|
+
programId?: PublicKey;
|
|
239
|
+
}
|
|
240
|
+
export interface JupiterReferralSetupTokenAccount extends JupiterReferralSetupMint {
|
|
241
|
+
tokenAccount: PublicKey;
|
|
242
|
+
}
|
|
243
|
+
export interface JupiterReferralSetupTx {
|
|
244
|
+
/** Unsigned legacy transaction (fee payer = payer, blockhash set). */
|
|
245
|
+
transaction: Transaction;
|
|
246
|
+
lastValidBlockHeight: number;
|
|
247
|
+
referralAccount: PublicKey;
|
|
248
|
+
project: PublicKey;
|
|
249
|
+
name: string;
|
|
250
|
+
/** The token accounts the transaction creates (same order as the input). */
|
|
251
|
+
tokenAccounts: JupiterReferralSetupTokenAccount[];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Unsigned transaction setting up FORGE's Jupiter referral account: the optional compute budget,
|
|
255
|
+
* `initialize_referral_account_with_name` when `createReferralAccount`, then one v2 collection
|
|
256
|
+
* account creation per `tokenAccounts` entry. Refuses an empty plan and a duplicate mint. Does
|
|
257
|
+
* not read the chain: inspect first (`readJupiterReferralSetup`). Mainnet-beta is the only
|
|
258
|
+
* cluster where the program and the Ultra project exist; the read helper enforces it.
|
|
259
|
+
*/
|
|
260
|
+
export declare function buildJupiterReferralSetupTx(p: BuildJupiterReferralSetupTxParams): JupiterReferralSetupTx;
|
|
261
|
+
export type JupiterReferralAccountMismatch = 'not_a_referral_account' | 'partner_mismatch' | 'project_mismatch' | 'name_mismatch';
|
|
262
|
+
export type JupiterReferralAccountStatus = {
|
|
263
|
+
status: 'absent';
|
|
264
|
+
} | {
|
|
265
|
+
status: 'ready';
|
|
266
|
+
account: JupiterReferralAccount;
|
|
267
|
+
} | {
|
|
268
|
+
status: 'mismatch';
|
|
269
|
+
reason: JupiterReferralAccountMismatch;
|
|
270
|
+
detail: string;
|
|
271
|
+
};
|
|
272
|
+
export interface JupiterReferralAccountExpectation {
|
|
273
|
+
partner: PublicKey;
|
|
274
|
+
project: PublicKey;
|
|
275
|
+
name: string;
|
|
276
|
+
programId?: PublicKey;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* What the referral account address holds, against the expected one: absent, ready (a referral
|
|
280
|
+
* account of `project` with `partner` and exactly `name`), or a mismatch with its reason. The
|
|
281
|
+
* caller derives the address as the PDA of the project and the name.
|
|
282
|
+
*/
|
|
283
|
+
export declare function inspectJupiterReferralAccount(info: AccountInfo<Buffer> | null, expected: JupiterReferralAccountExpectation): JupiterReferralAccountStatus;
|
|
284
|
+
export type JupiterReferralTokenAccountMismatch = 'not_a_token_account' | 'wrong_mint' | 'wrong_owner';
|
|
285
|
+
export type JupiterReferralTokenAccountStatus = {
|
|
286
|
+
status: 'absent';
|
|
287
|
+
} | {
|
|
288
|
+
status: 'ready';
|
|
289
|
+
amount: bigint;
|
|
290
|
+
} | {
|
|
291
|
+
status: 'mismatch';
|
|
292
|
+
reason: JupiterReferralTokenAccountMismatch;
|
|
293
|
+
detail: string;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* What the v2 collection account address holds: absent, a token account of `mint` owned by the
|
|
297
|
+
* referral account, or not.
|
|
298
|
+
*/
|
|
299
|
+
export declare function inspectJupiterReferralTokenAccountV2(address: PublicKey, info: AccountInfo<Buffer> | null, expected: {
|
|
300
|
+
referralAccount: PublicKey;
|
|
301
|
+
mint: PublicKey;
|
|
302
|
+
tokenProgram: PublicKey;
|
|
303
|
+
}): JupiterReferralTokenAccountStatus;
|
|
304
|
+
export interface ReadJupiterReferralSetupParams {
|
|
305
|
+
connection: Connection;
|
|
306
|
+
partner: PublicKey;
|
|
307
|
+
name: string;
|
|
308
|
+
/** The currencies whose v2 collection accounts are wanted (e.g. wrapped SOL and USDC). */
|
|
309
|
+
mints: readonly PublicKey[];
|
|
310
|
+
/** Default: `JUPITER_ULTRA_REFERRAL_PROJECT`. */
|
|
311
|
+
project?: PublicKey;
|
|
312
|
+
programId?: PublicKey;
|
|
313
|
+
commitment?: Commitment;
|
|
314
|
+
retry?: RetryOptions;
|
|
315
|
+
}
|
|
316
|
+
export interface JupiterReferralSetupTokenAccountState extends JupiterReferralSetupTokenAccount {
|
|
317
|
+
status: JupiterReferralTokenAccountStatus;
|
|
318
|
+
}
|
|
319
|
+
export interface JupiterReferralSetupState {
|
|
320
|
+
project: PublicKey;
|
|
321
|
+
/** The project as decoded on-chain (its admin and default share). */
|
|
322
|
+
projectAccount: JupiterProject;
|
|
323
|
+
name: string;
|
|
324
|
+
referralAccount: PublicKey;
|
|
325
|
+
referral: JupiterReferralAccountStatus;
|
|
326
|
+
tokenAccounts: JupiterReferralSetupTokenAccountState[];
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Reads what the setup needs: the project (must exist and decode), the mints (their token
|
|
330
|
+
* program), the named referral account and its v2 collection accounts, each inspected. Mainnet
|
|
331
|
+
* only (`wrong_cluster` on any other cluster, before any read). The caller decides what to
|
|
332
|
+
* create (the absent ones) and refuses on any mismatch.
|
|
333
|
+
*/
|
|
334
|
+
export declare function readJupiterReferralSetup(p: ReadJupiterReferralSetupParams): Promise<JupiterReferralSetupState>;
|