@whetstone-research/doppler-sdk 1.0.28 → 1.0.29
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/dist/{chunk-U6B52TBT.cjs → chunk-4CI2M2F6.cjs} +27 -2
- package/dist/chunk-4CI2M2F6.cjs.map +1 -0
- package/dist/{chunk-4WY5GNZD.cjs → chunk-7PXLEMBJ.cjs} +336 -36
- package/dist/chunk-7PXLEMBJ.cjs.map +1 -0
- package/dist/{chunk-WD5VOZGI.js → chunk-AFXFT3BD.js} +24 -3
- package/dist/chunk-AFXFT3BD.js.map +1 -0
- package/dist/{chunk-AYVFWD5P.js → chunk-PSLY7M7C.js} +296 -4
- package/dist/chunk-PSLY7M7C.js.map +1 -0
- package/dist/{pda-H6VMGONM.cjs → pda-44IHEORD.cjs} +21 -17
- package/dist/pda-44IHEORD.cjs.map +1 -0
- package/dist/{pda-UJLXCO6I.js → pda-WJVDXQPW.js} +3 -3
- package/dist/pda-WJVDXQPW.js.map +1 -0
- package/dist/solana/index.cjs +1360 -1937
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1293 -1376
- package/dist/solana/index.d.ts +1293 -1376
- package/dist/solana/index.js +967 -1543
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +45 -45
- package/dist/solana/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-4WY5GNZD.cjs.map +0 -1
- package/dist/chunk-AYVFWD5P.js.map +0 -1
- package/dist/chunk-U6B52TBT.cjs.map +0 -1
- package/dist/chunk-WD5VOZGI.js.map +0 -1
- package/dist/pda-H6VMGONM.cjs.map +0 -1
- package/dist/pda-UJLXCO6I.js.map +0 -1
package/dist/solana/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { warnAccountDecodeFailure, transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setHookArgsCodec, setFeesArgsCodec, removeLiquidityArgsCodec, ratioToNumber, q64ToNumber, q64Mul, q64Div, positionDataCodec, poolExists, poolDataCodec, parseWithdrawVaultExcessInstruction, parseUpdateConfigInstruction, parseUnpauseInstruction, parseTransferAdminInstruction, parseSwapExactInInstruction, parseSetHookInstruction, parseSetFeesInstruction, parseRemoveLiquidityInstruction, parseRedeemProtocolSharesInstruction, parsePreviewSwapExactInInstruction, parsePauseInstruction, parseOracleUpdateInstruction, parseOracleConsultInstruction, parseInitializePoolInstruction, parseInitializeOracleInstruction, parseInitializeConfigInstruction, parseCreatePositionInstruction, parseCollectProtocolFeesInstruction, parseCollectFeesInstruction, parseClosePositionInstruction, parseAddLiquidityInstruction, oracleStateDataCodec, oracleConsultArgsCodec, observationCodec, numberToQ64, normalizeProgramAccountsResponse, minBigInt, maxBigInt, isqrt, isTransactionSigner, isOracleStale, initializePoolArgsCodec, initializeOracleArgsCodec, initializeConfigArgsCodec, getWithdrawVaultExcessInstructionDataEncoder, getWithdrawVaultExcessInstructionDataDecoder, getWithdrawVaultExcessInstructionDataCodec, getWithdrawVaultExcessInstructionAsync, getWithdrawVaultExcessInstruction, getWithdrawVaultExcessDiscriminatorBytes, getUpdateConfigInstructionDataEncoder, getUpdateConfigInstructionDataDecoder, getUpdateConfigInstructionDataCodec, getUpdateConfigInstruction, getUpdateConfigDiscriminatorBytes, getUnpauseInstructionDataEncoder, getUnpauseInstructionDataDecoder, getUnpauseInstructionDataCodec, getUnpauseInstruction, getUnpauseDiscriminatorBytes, getTvl, getTransferAdminInstructionDataEncoder, getTransferAdminInstructionDataDecoder, getTransferAdminInstructionDataCodec, getTransferAdminInstruction, getTransferAdminDiscriminatorBytes, getSwapQuoteExactOut, getSwapQuote, getSwapExactInInstructionDataEncoder, getSwapExactInInstructionDataDecoder, getSwapExactInInstructionDataCodec, getSwapExactInInstructionAsync, getSwapExactInInstruction, getSwapExactInDiscriminatorBytes, getSpotPrice1, getSpotPrice0, getSetHookInstructionDataEncoder, getSetHookInstructionDataDecoder, getSetHookInstructionDataCodec, getSetHookInstruction, getSetHookDiscriminatorBytes, getSetFeesInstructionDataEncoder, getSetFeesInstructionDataDecoder, getSetFeesInstructionDataCodec, getSetFeesInstruction, getSetFeesDiscriminatorBytes, getRemoveLiquidityQuote, getRemoveLiquidityInstructionDataEncoder, getRemoveLiquidityInstructionDataDecoder, getRemoveLiquidityInstructionDataCodec, getRemoveLiquidityInstructionAsync, getRemoveLiquidityInstruction, getRemoveLiquidityDiscriminatorBytes, getRedeemProtocolSharesInstructionDataEncoder, getRedeemProtocolSharesInstructionDataDecoder, getRedeemProtocolSharesInstructionDataCodec, getRedeemProtocolSharesInstructionAsync, getRedeemProtocolSharesInstruction, getRedeemProtocolSharesDiscriminatorBytes, getPreviewSwapExactInInstructionDataEncoder, getPreviewSwapExactInInstructionDataDecoder, getPreviewSwapExactInInstructionDataCodec, getPreviewSwapExactInInstruction, getPreviewSwapExactInDiscriminatorBytes, getPositionValue, getPositionAddressFromParams, getPoolByMints, getPoolAddressFromMints, getPendingFees, getPauseInstructionDataEncoder, getPauseInstructionDataDecoder, getPauseInstructionDataCodec, getPauseInstruction, getPauseDiscriminatorBytes, getOracleUpdateInstructionDataEncoder, getOracleUpdateInstructionDataDecoder, getOracleUpdateInstructionDataCodec, getOracleUpdateInstructionAsync, getOracleUpdateInstruction, getOracleUpdateDiscriminatorBytes, getOracleSpotPrices, getOracleForPool, getOracleDeviation, getOracleConsultInstructionDataEncoder, getOracleConsultInstructionDataDecoder, getOracleConsultInstructionDataCodec, getOracleConsultInstructionAsync, getOracleConsultInstruction, getOracleConsultDiscriminatorBytes, getOracleBufferStats, getOracleAge, getOracleAddressFromPool, getK, getInitializePoolInstructionDataEncoder, getInitializePoolInstructionDataDecoder, getInitializePoolInstructionDataCodec, getInitializePoolInstructionAsync, getInitializePoolInstruction, getInitializePoolDiscriminatorBytes, getInitializeOracleInstructionDataEncoder, getInitializeOracleInstructionDataDecoder, getInitializeOracleInstructionDataCodec, getInitializeOracleInstructionAsync, getInitializeOracleInstruction, getInitializeOracleDiscriminatorBytes, getInitializeConfigInstructionDataEncoder, getInitializeConfigInstructionDataDecoder, getInitializeConfigInstructionDataCodec, getInitializeConfigInstructionAsync, getInitializeConfigInstruction, getInitializeConfigDiscriminatorBytes, getCreatePositionInstructionDataEncoder, getCreatePositionInstructionDataDecoder, getCreatePositionInstructionDataCodec, getCreatePositionInstructionAsync, getCreatePositionInstruction, getCreatePositionDiscriminatorBytes, getCollectProtocolFeesInstructionDataEncoder, getCollectProtocolFeesInstructionDataDecoder, getCollectProtocolFeesInstructionDataCodec, getCollectProtocolFeesInstructionAsync, getCollectProtocolFeesInstruction, getCollectProtocolFeesDiscriminatorBytes, getCollectFeesInstructionDataEncoder, getCollectFeesInstructionDataDecoder, getCollectFeesInstructionDataCodec, getCollectFeesInstructionAsync, getCollectFeesInstruction, getCollectFeesDiscriminatorBytes, getClosePositionInstructionDataEncoder, getClosePositionInstructionDataDecoder, getClosePositionInstructionDataCodec, getClosePositionInstruction, getClosePositionDiscriminatorBytes, getAddressFromRemainingAccount, getAddressFromAddressOrSigner, getAddLiquidityQuote, getAddLiquidityInstructionDataEncoder, getAddLiquidityInstructionDataDecoder, getAddLiquidityInstructionDataCodec, getAddLiquidityInstructionAsync, getAddLiquidityInstruction, getAddLiquidityDiscriminatorBytes, filterPoolsByMint, filterActivePositions, fetchUserPositions, fetchPositionsBatch, fetchPositionByParams, fetchPosition, fetchPoolsBatch, fetchPoolPositions, fetchPool, fetchOraclesBatch, fetchOracle, fetchAllPools, encodeTransferAdminArgs, encodeSwapExactInArgs, encodeSetHookArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, encodeOracleConsultArgs, encodeInstructionData, encodeInitializePoolArgs, encodeInitializeOracleArgs, encodeInitializeConfigArgs, encodeCreatePositionArgs, encodeCollectProtocolFeesArgs, encodeCollectFeesArgs, encodeAddLiquidityArgs, decodePosition, decodePool, decodeOracleState, decodeAmmConfig, createReadonlyRemainingAccountMeta, createPositionArgsCodec, createAccountMeta, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, bytesToBase64EncodedBytes, bytesToBase64, base64ToBytes, ammConfigDataCodec, addressToBase58EncodedBytes, addLiquidityArgsCodec, WITHDRAW_VAULT_EXCESS_DISCRIMINATOR, UPDATE_CONFIG_DISCRIMINATOR, UNPAUSE_DISCRIMINATOR, TRANSFER_ADMIN_DISCRIMINATOR, SWAP_EXACT_IN_DISCRIMINATOR, SET_HOOK_DISCRIMINATOR, SET_FEES_DISCRIMINATOR, REMOVE_LIQUIDITY_DISCRIMINATOR, REDEEM_PROTOCOL_SHARES_DISCRIMINATOR, PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR, PAUSE_DISCRIMINATOR, ORACLE_UPDATE_DISCRIMINATOR, ORACLE_CONSULT_DISCRIMINATOR, INITIALIZE_POOL_DISCRIMINATOR, INITIALIZE_ORACLE_DISCRIMINATOR, INITIALIZE_CONFIG_DISCRIMINATOR, CREATE_POSITION_DISCRIMINATOR, COLLECT_PROTOCOL_FEES_DISCRIMINATOR, COLLECT_FEES_DISCRIMINATOR, CLOSE_POSITION_DISCRIMINATOR, ADD_LIQUIDITY_DISCRIMINATOR, CPMM_PROGRAM_ADDRESS } from '../chunk-
|
|
2
|
-
import { sortMints, getSwapAddresses, getProtocolFeePositionAddress, getProtocolFeeOwnerAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SEED_PROTOCOL_FEE_OWNER, SEED_POSITION, SEED_POOL, SEED_ORACLE, SEED_CONFIG, SEED_AUTHORITY, Q64_ONE, MAX_ORACLE_OBSERVATIONS, MAX_HOOK_ALLOWLIST, INSTRUCTION_DISCRIMINATORS, HOOK_NO_CHANGE, HF_REQUIRE_ORACLE, HF_FORWARD_READONLY_SIGNERS, HF_BEFORE_SWAP, HF_BEFORE_REMOVE_LIQ, HF_BEFORE_ADD_LIQ, HF_AFTER_SWAP, HF_AFTER_REMOVE_LIQ, HF_AFTER_ADD_LIQ, BPS_DENOM, ACCOUNT_VERSION, ACCOUNT_DISCRIMINATORS, TOKEN_PROGRAM_ADDRESS, SYSTEM_PROGRAM_ADDRESS, SYSVAR_INSTRUCTIONS_ADDRESS, TOKEN_2022_PROGRAM_ADDRESS, SYSVAR_RENT_ADDRESS } from '../chunk-
|
|
1
|
+
import { warnAccountDecodeFailure, transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setHookArgsCodec, setFeesArgsCodec, removeLiquidityArgsCodec, ratioToNumber, q64ToNumber, q64Mul, q64Div, positionDataCodec, poolExists, poolDataCodec, parseWithdrawVaultExcessInstruction, parseUpdateConfigInstruction, parseUnpauseInstruction, parseTransferAdminInstruction, parseSwapExactInInstruction, parseSetHookInstruction, parseSetFeesInstruction, parseRemoveLiquidityInstruction, parseRedeemProtocolSharesInstruction, parsePreviewSwapExactInInstruction, parsePauseInstruction, parseOracleUpdateInstruction, parseOracleConsultInstruction, parseInitializeSpotPoolInstruction, parseInitializePoolInstruction, parseInitializeOracleInstruction, parseInitializeConfigInstruction, parseCreatePositionInstruction, parseCollectProtocolFeesInstruction, parseCollectFeesInstruction, parseClosePositionInstruction, parseAddLiquidityInstruction, oracleStateDataCodec, oracleConsultArgsCodec, observationCodec, numberToQ64, normalizeProgramAccountsResponse, minBigInt, maxBigInt, isqrt, isTransactionSigner, isOracleStale, initializePoolArgsCodec, initializeOracleArgsCodec, initializeConfigArgsCodec, getWithdrawVaultExcessInstructionDataEncoder, getWithdrawVaultExcessInstructionDataDecoder, getWithdrawVaultExcessInstructionDataCodec, getWithdrawVaultExcessInstructionAsync, getWithdrawVaultExcessInstruction, getWithdrawVaultExcessDiscriminatorBytes, getUpdateConfigInstructionDataEncoder, getUpdateConfigInstructionDataDecoder, getUpdateConfigInstructionDataCodec, getUpdateConfigInstruction, getUpdateConfigDiscriminatorBytes, getUnpauseInstructionDataEncoder, getUnpauseInstructionDataDecoder, getUnpauseInstructionDataCodec, getUnpauseInstruction, getUnpauseDiscriminatorBytes, getTvl, getTransferAdminInstructionDataEncoder, getTransferAdminInstructionDataDecoder, getTransferAdminInstructionDataCodec, getTransferAdminInstruction, getTransferAdminDiscriminatorBytes, getSwapQuoteExactOut, getSwapQuote, getSwapExactInInstructionDataEncoder, getSwapExactInInstructionDataDecoder, getSwapExactInInstructionDataCodec, getSwapExactInInstructionAsync, getSwapExactInInstruction, getSwapExactInDiscriminatorBytes, getSpotPrice1, getSpotPrice0, getSetHookInstructionDataEncoder, getSetHookInstructionDataDecoder, getSetHookInstructionDataCodec, getSetHookInstruction, getSetHookDiscriminatorBytes, getSetFeesInstructionDataEncoder, getSetFeesInstructionDataDecoder, getSetFeesInstructionDataCodec, getSetFeesInstruction, getSetFeesDiscriminatorBytes, getRemoveLiquidityQuote, getRemoveLiquidityInstructionDataEncoder, getRemoveLiquidityInstructionDataDecoder, getRemoveLiquidityInstructionDataCodec, getRemoveLiquidityInstructionAsync, getRemoveLiquidityInstruction, getRemoveLiquidityDiscriminatorBytes, getRedeemProtocolSharesInstructionDataEncoder, getRedeemProtocolSharesInstructionDataDecoder, getRedeemProtocolSharesInstructionDataCodec, getRedeemProtocolSharesInstructionAsync, getRedeemProtocolSharesInstruction, getRedeemProtocolSharesDiscriminatorBytes, getPreviewSwapExactInInstructionDataEncoder, getPreviewSwapExactInInstructionDataDecoder, getPreviewSwapExactInInstructionDataCodec, getPreviewSwapExactInInstruction, getPreviewSwapExactInDiscriminatorBytes, getPositionValue, getPositionAddressFromParams, getPoolByMints, getPoolAddressFromMints, getPendingFees, getPauseInstructionDataEncoder, getPauseInstructionDataDecoder, getPauseInstructionDataCodec, getPauseInstruction, getPauseDiscriminatorBytes, getOracleUpdateInstructionDataEncoder, getOracleUpdateInstructionDataDecoder, getOracleUpdateInstructionDataCodec, getOracleUpdateInstructionAsync, getOracleUpdateInstruction, getOracleUpdateDiscriminatorBytes, getOracleSpotPrices, getOracleForPool, getOracleDeviation, getOracleConsultInstructionDataEncoder, getOracleConsultInstructionDataDecoder, getOracleConsultInstructionDataCodec, getOracleConsultInstructionAsync, getOracleConsultInstruction, getOracleConsultDiscriminatorBytes, getOracleBufferStats, getOracleAge, getOracleAddressFromPool, getK, getInitializeSpotPoolInstructionDataEncoder, getInitializeSpotPoolInstructionDataDecoder, getInitializeSpotPoolInstructionDataCodec, getInitializeSpotPoolInstructionAsync, getInitializeSpotPoolInstruction, getInitializeSpotPoolDiscriminatorBytes, getInitializePoolInstructionDataEncoder, getInitializePoolInstructionDataDecoder, getInitializePoolInstructionDataCodec, getInitializePoolInstructionAsync, getInitializePoolInstruction, getInitializePoolDiscriminatorBytes, getInitializeOracleInstructionDataEncoder, getInitializeOracleInstructionDataDecoder, getInitializeOracleInstructionDataCodec, getInitializeOracleInstructionAsync, getInitializeOracleInstruction, getInitializeOracleDiscriminatorBytes, getInitializeConfigInstructionDataEncoder, getInitializeConfigInstructionDataDecoder, getInitializeConfigInstructionDataCodec, getInitializeConfigInstructionAsync, getInitializeConfigInstruction, getInitializeConfigDiscriminatorBytes, getCreatePositionInstructionDataEncoder, getCreatePositionInstructionDataDecoder, getCreatePositionInstructionDataCodec, getCreatePositionInstructionAsync, getCreatePositionInstruction, getCreatePositionDiscriminatorBytes, getCollectProtocolFeesInstructionDataEncoder, getCollectProtocolFeesInstructionDataDecoder, getCollectProtocolFeesInstructionDataCodec, getCollectProtocolFeesInstructionAsync, getCollectProtocolFeesInstruction, getCollectProtocolFeesDiscriminatorBytes, getCollectFeesInstructionDataEncoder, getCollectFeesInstructionDataDecoder, getCollectFeesInstructionDataCodec, getCollectFeesInstructionAsync, getCollectFeesInstruction, getCollectFeesDiscriminatorBytes, getClosePositionInstructionDataEncoder, getClosePositionInstructionDataDecoder, getClosePositionInstructionDataCodec, getClosePositionInstruction, getClosePositionDiscriminatorBytes, getAddressFromRemainingAccount, getAddressFromAddressOrSigner, getAddLiquidityQuote, getAddLiquidityInstructionDataEncoder, getAddLiquidityInstructionDataDecoder, getAddLiquidityInstructionDataCodec, getAddLiquidityInstructionAsync, getAddLiquidityInstruction, getAddLiquidityDiscriminatorBytes, filterPoolsByMint, filterActivePositions, fetchUserPositions, fetchPositionsBatch, fetchPositionByParams, fetchPosition, fetchPoolsBatch, fetchPoolPositions, fetchPool, fetchOraclesBatch, fetchOracle, fetchAllPools, encodeTransferAdminArgs, encodeSwapExactInArgs, encodeSetHookArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, encodeOracleConsultArgs, encodeInstructionData, encodeInitializePoolArgs, encodeInitializeOracleArgs, encodeInitializeConfigArgs, encodeCreatePositionArgs, encodeCollectProtocolFeesArgs, encodeCollectFeesArgs, encodeAddLiquidityArgs, decodePosition, decodePool, decodeOracleState, decodeAmmConfig, createReadonlyRemainingAccountMeta, createPositionArgsCodec, createAccountMeta, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, bytesToBase64EncodedBytes, bytesToBase64, base64ToBytes, ammConfigDataCodec, addressToBase58EncodedBytes, addLiquidityArgsCodec, WITHDRAW_VAULT_EXCESS_DISCRIMINATOR, UPDATE_CONFIG_DISCRIMINATOR, UNPAUSE_DISCRIMINATOR, TRANSFER_ADMIN_DISCRIMINATOR, SWAP_EXACT_IN_DISCRIMINATOR, SET_HOOK_DISCRIMINATOR, SET_FEES_DISCRIMINATOR, REMOVE_LIQUIDITY_DISCRIMINATOR, REDEEM_PROTOCOL_SHARES_DISCRIMINATOR, PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR, PAUSE_DISCRIMINATOR, ORACLE_UPDATE_DISCRIMINATOR, ORACLE_CONSULT_DISCRIMINATOR, INITIALIZE_SPOT_POOL_DISCRIMINATOR, INITIALIZE_POOL_DISCRIMINATOR, INITIALIZE_ORACLE_DISCRIMINATOR, INITIALIZE_CONFIG_DISCRIMINATOR, CREATE_POSITION_DISCRIMINATOR, COLLECT_PROTOCOL_FEES_DISCRIMINATOR, COLLECT_FEES_DISCRIMINATOR, CLOSE_POSITION_DISCRIMINATOR, ADD_LIQUIDITY_DISCRIMINATOR, CPMM_PROGRAM_ADDRESS } from '../chunk-PSLY7M7C.js';
|
|
2
|
+
import { sortMints, getSwapAddresses, getSpotPoolAddress, getProtocolFeePositionAddress, getProtocolFeeOwnerAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SEED_SPOT_POOL, SEED_PROTOCOL_FEE_OWNER, SEED_POSITION, SEED_POOL, SEED_ORACLE, SEED_CONFIG, SEED_AUTHORITY, Q64_ONE, MAX_ORACLE_OBSERVATIONS, MAX_HOOK_ALLOWLIST, INSTRUCTION_DISCRIMINATORS, HOOK_NO_CHANGE, HF_REQUIRE_ORACLE, HF_FORWARD_READONLY_SIGNERS, HF_BEFORE_SWAP, HF_BEFORE_REMOVE_LIQ, HF_BEFORE_ADD_LIQ, HF_AFTER_SWAP, HF_AFTER_REMOVE_LIQ, HF_AFTER_ADD_LIQ, BPS_DENOM, ACCOUNT_VERSION, ACCOUNT_DISCRIMINATORS, TOKEN_PROGRAM_ADDRESS, SYSTEM_PROGRAM_ADDRESS, SYSVAR_INSTRUCTIONS_ADDRESS, TOKEN_2022_PROGRAM_ADDRESS, SEED_VAULT1, SEED_VAULT0, SYSVAR_RENT_ADDRESS as SYSVAR_RENT_ADDRESS$1 } from '../chunk-AFXFT3BD.js';
|
|
3
3
|
import { __export } from '../chunk-PZ5AY32C.js';
|
|
4
|
-
import { getAddressCodec, getProgramDerivedAddress, createNoopSigner, address, fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getAddressEncoder, getU8Encoder, getArrayEncoder, getStructDecoder, fixDecoderSize, getAddressDecoder, getU8Decoder, getArrayDecoder, getBytesDecoder, combineCodec, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, containsBytes, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, assertIsInstructionWithAccounts, isProgramError, getU16Encoder, getU16Decoder, getU64Encoder, addEncoderSizePrefix, getU32Encoder, getUtf8Encoder, getU64Decoder, addDecoderSizePrefix, getU32Decoder, getUtf8Decoder, AccountRole, getStructCodec, getU64Codec,
|
|
4
|
+
import { getAddressCodec, getProgramDerivedAddress, createNoopSigner, address, fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getAddressEncoder, getU8Encoder, getArrayEncoder, getStructDecoder, fixDecoderSize, getAddressDecoder, getU8Decoder, getArrayDecoder, getBytesDecoder, combineCodec, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, containsBytes, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, assertIsInstructionWithAccounts, isProgramError, getU16Encoder, getU16Decoder, getU64Encoder, addEncoderSizePrefix, getU32Encoder, getUtf8Encoder, getU64Decoder, addDecoderSizePrefix, getU32Decoder, getUtf8Decoder, AccountRole, getStructCodec, getU64Codec, getU128Encoder, getU128Decoder, getOptionEncoder, getOptionDecoder, getBooleanEncoder, getBooleanDecoder, mergeBytes, compressTransactionMessageUsingAddressLookupTables, getTransactionMessageSize, getEnumEncoder } from '@solana/kit';
|
|
5
5
|
import { getAccountMetaFactory, addSelfPlanAndSendFunctions, addSelfFetchFunctions, getAddressFromResolvedInstructionAccount } from '@solana/program-client-core';
|
|
6
6
|
import { keccak_256 } from '@noble/hashes/sha3.js';
|
|
7
|
-
import { getCreateAssociatedTokenIdempotentInstruction, getSyncNativeInstruction
|
|
7
|
+
import { TOKEN_PROGRAM_ADDRESS as TOKEN_PROGRAM_ADDRESS$1, findAssociatedTokenPda, getCreateAssociatedTokenIdempotentInstruction, getSyncNativeInstruction } from '@solana-program/token';
|
|
8
|
+
import { SYSTEM_PROGRAM_ADDRESS as SYSTEM_PROGRAM_ADDRESS$1, getTransferSolInstruction } from '@solana-program/system';
|
|
9
|
+
import { SYSVAR_RENT_ADDRESS } from '@solana/sysvars';
|
|
8
10
|
import { findAddressLookupTablePda, getCreateLookupTableInstruction, getExtendLookupTableInstruction } from '@solana-program/address-lookup-table';
|
|
9
|
-
import { getTransferSolInstruction } from '@solana-program/system';
|
|
10
11
|
|
|
11
12
|
// src/solana/cpmm/index.ts
|
|
12
13
|
var cpmm_exports = {};
|
|
@@ -35,6 +36,7 @@ __export(cpmm_exports, {
|
|
|
35
36
|
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR,
|
|
36
37
|
INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
37
38
|
INITIALIZE_POOL_DISCRIMINATOR: () => INITIALIZE_POOL_DISCRIMINATOR,
|
|
39
|
+
INITIALIZE_SPOT_POOL_DISCRIMINATOR: () => INITIALIZE_SPOT_POOL_DISCRIMINATOR,
|
|
38
40
|
INSTRUCTION_DISCRIMINATORS: () => INSTRUCTION_DISCRIMINATORS,
|
|
39
41
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
40
42
|
MAX_HOOK_ALLOWLIST: () => MAX_HOOK_ALLOWLIST,
|
|
@@ -52,6 +54,7 @@ __export(cpmm_exports, {
|
|
|
52
54
|
SEED_POOL: () => SEED_POOL,
|
|
53
55
|
SEED_POSITION: () => SEED_POSITION,
|
|
54
56
|
SEED_PROTOCOL_FEE_OWNER: () => SEED_PROTOCOL_FEE_OWNER,
|
|
57
|
+
SEED_SPOT_POOL: () => SEED_SPOT_POOL,
|
|
55
58
|
SET_FEES_DISCRIMINATOR: () => SET_FEES_DISCRIMINATOR,
|
|
56
59
|
SET_HOOK_DISCRIMINATOR: () => SET_HOOK_DISCRIMINATOR,
|
|
57
60
|
SWAP_EXACT_IN_DISCRIMINATOR: () => SWAP_EXACT_IN_DISCRIMINATOR,
|
|
@@ -184,6 +187,12 @@ __export(cpmm_exports, {
|
|
|
184
187
|
getInitializePoolInstructionDataCodec: () => getInitializePoolInstructionDataCodec,
|
|
185
188
|
getInitializePoolInstructionDataDecoder: () => getInitializePoolInstructionDataDecoder,
|
|
186
189
|
getInitializePoolInstructionDataEncoder: () => getInitializePoolInstructionDataEncoder,
|
|
190
|
+
getInitializeSpotPoolDiscriminatorBytes: () => getInitializeSpotPoolDiscriminatorBytes,
|
|
191
|
+
getInitializeSpotPoolInstruction: () => getInitializeSpotPoolInstruction,
|
|
192
|
+
getInitializeSpotPoolInstructionAsync: () => getInitializeSpotPoolInstructionAsync,
|
|
193
|
+
getInitializeSpotPoolInstructionDataCodec: () => getInitializeSpotPoolInstructionDataCodec,
|
|
194
|
+
getInitializeSpotPoolInstructionDataDecoder: () => getInitializeSpotPoolInstructionDataDecoder,
|
|
195
|
+
getInitializeSpotPoolInstructionDataEncoder: () => getInitializeSpotPoolInstructionDataEncoder,
|
|
187
196
|
getK: () => getK,
|
|
188
197
|
getLiquidityAddresses: () => getLiquidityAddresses,
|
|
189
198
|
getMetadataAddress: () => getMetadataAddress,
|
|
@@ -252,6 +261,7 @@ __export(cpmm_exports, {
|
|
|
252
261
|
getSetHookInstructionDataCodec: () => getSetHookInstructionDataCodec,
|
|
253
262
|
getSetHookInstructionDataDecoder: () => getSetHookInstructionDataDecoder,
|
|
254
263
|
getSetHookInstructionDataEncoder: () => getSetHookInstructionDataEncoder,
|
|
264
|
+
getSpotPoolAddress: () => getSpotPoolAddress,
|
|
255
265
|
getSpotPrice0: () => getSpotPrice0,
|
|
256
266
|
getSpotPrice1: () => getSpotPrice1,
|
|
257
267
|
getSwapAddresses: () => getSwapAddresses,
|
|
@@ -311,6 +321,7 @@ __export(cpmm_exports, {
|
|
|
311
321
|
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction,
|
|
312
322
|
parseInitializeOracleInstruction: () => parseInitializeOracleInstruction,
|
|
313
323
|
parseInitializePoolInstruction: () => parseInitializePoolInstruction,
|
|
324
|
+
parseInitializeSpotPoolInstruction: () => parseInitializeSpotPoolInstruction,
|
|
314
325
|
parseOracleConsultInstruction: () => parseOracleConsultInstruction,
|
|
315
326
|
parseOracleUpdateInstruction: () => parseOracleUpdateInstruction,
|
|
316
327
|
parsePauseInstruction: () => parsePauseInstruction,
|
|
@@ -720,22 +731,32 @@ async function fetchConfigWithAddress(rpc, programId = CPMM_PROGRAM_ID, commitme
|
|
|
720
731
|
return { address: configAddress, account };
|
|
721
732
|
}
|
|
722
733
|
|
|
723
|
-
// src/solana/
|
|
724
|
-
var
|
|
725
|
-
__export(
|
|
734
|
+
// src/solana/cpmmHook/index.ts
|
|
735
|
+
var cpmmHook_exports = {};
|
|
736
|
+
__export(cpmmHook_exports, {
|
|
726
737
|
ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR,
|
|
727
738
|
COSIGNER_CONFIG_DISCRIMINATOR: () => COSIGNER_CONFIG_DISCRIMINATOR,
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
+
CPMM_HOOK_ERROR__ARITHMETIC_OVERFLOW: () => CPMM_HOOK_ERROR__ARITHMETIC_OVERFLOW,
|
|
740
|
+
CPMM_HOOK_ERROR__COSIGNER_ALREADY_EXISTS: () => CPMM_HOOK_ERROR__COSIGNER_ALREADY_EXISTS,
|
|
741
|
+
CPMM_HOOK_ERROR__COSIGNER_LIST_FULL: () => CPMM_HOOK_ERROR__COSIGNER_LIST_FULL,
|
|
742
|
+
CPMM_HOOK_ERROR__COSIGNER_NOT_FOUND: () => CPMM_HOOK_ERROR__COSIGNER_NOT_FOUND,
|
|
743
|
+
CPMM_HOOK_ERROR__INVALID_AUTHORITY: () => CPMM_HOOK_ERROR__INVALID_AUTHORITY,
|
|
744
|
+
CPMM_HOOK_ERROR__INVALID_CONFIG: () => CPMM_HOOK_ERROR__INVALID_CONFIG,
|
|
745
|
+
CPMM_HOOK_ERROR__INVALID_COSIGNER: () => CPMM_HOOK_ERROR__INVALID_COSIGNER,
|
|
746
|
+
CPMM_HOOK_ERROR__INVALID_DURATION: () => CPMM_HOOK_ERROR__INVALID_DURATION,
|
|
747
|
+
CPMM_HOOK_ERROR__INVALID_FEE: () => CPMM_HOOK_ERROR__INVALID_FEE,
|
|
748
|
+
CPMM_HOOK_ERROR__INVALID_INSTRUCTION_DATA: () => CPMM_HOOK_ERROR__INVALID_INSTRUCTION_DATA,
|
|
749
|
+
CPMM_HOOK_ERROR__INVALID_SCHEDULE_DATA: () => CPMM_HOOK_ERROR__INVALID_SCHEDULE_DATA,
|
|
750
|
+
CPMM_HOOK_PROGRAM_ADDRESS: () => CPMM_HOOK_PROGRAM_ADDRESS,
|
|
751
|
+
CPMM_HOOK_PROGRAM_ID: () => CPMM_HOOK_PROGRAM_ID,
|
|
752
|
+
CpmmHookAccount: () => CpmmHookAccount,
|
|
753
|
+
CpmmHookInstruction: () => CpmmHookInstruction,
|
|
754
|
+
DEVNET_CPMM_HOOK_PROGRAM_ID: () => DEVNET_CPMM_HOOK_PROGRAM_ID,
|
|
755
|
+
DYNAMIC_FEE_SCHEDULE_HEADER_LEN: () => DYNAMIC_FEE_SCHEDULE_HEADER_LEN,
|
|
756
|
+
DYNAMIC_FEE_SCHEDULE_LEN: () => DYNAMIC_FEE_SCHEDULE_LEN,
|
|
757
|
+
DYNAMIC_FEE_SCHEDULE_MAGIC: () => DYNAMIC_FEE_SCHEDULE_MAGIC,
|
|
758
|
+
DYNAMIC_FEE_SCHEDULE_MAX_BPS: () => DYNAMIC_FEE_SCHEDULE_MAX_BPS,
|
|
759
|
+
DYNAMIC_FEE_SCHEDULE_VERSION: () => DYNAMIC_FEE_SCHEDULE_VERSION,
|
|
739
760
|
GATE_EXPIRY_DISABLED: () => GATE_EXPIRY_DISABLED,
|
|
740
761
|
GATE_EXPIRY_HEADER_LEN: () => GATE_EXPIRY_HEADER_LEN,
|
|
741
762
|
GATE_EXPIRY_PAYLOAD_LEN: () => GATE_EXPIRY_PAYLOAD_LEN,
|
|
@@ -745,12 +766,15 @@ __export(cosignerHook_exports, {
|
|
|
745
766
|
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR2,
|
|
746
767
|
MAX_COSIGNERS: () => MAX_COSIGNERS,
|
|
747
768
|
REMOVE_COSIGNER_DISCRIMINATOR: () => REMOVE_COSIGNER_DISCRIMINATOR,
|
|
748
|
-
|
|
769
|
+
SEED_CPMM_HOOK_CONFIG: () => SEED_CPMM_HOOK_CONFIG,
|
|
749
770
|
SET_AUTHORITY_DISCRIMINATOR: () => SET_AUTHORITY_DISCRIMINATOR,
|
|
750
|
-
|
|
771
|
+
cpmmHookProgram: () => cpmmHookProgram,
|
|
751
772
|
decodeCosignerConfig: () => decodeCosignerConfig,
|
|
752
773
|
decodeCosignerGateExpiryPayload: () => decodeCosignerGateExpiryPayload,
|
|
753
774
|
encodeCosignerGateExpiryPayload: () => encodeCosignerGateExpiryPayload,
|
|
775
|
+
encodeCpmmHookPayload: () => encodeCpmmHookPayload,
|
|
776
|
+
encodeDynamicFeeCosignerGatePayload: () => encodeDynamicFeeCosignerGatePayload,
|
|
777
|
+
encodeDynamicFeeSchedule: () => encodeDynamicFeeSchedule,
|
|
754
778
|
fetchAllCosignerConfig: () => fetchAllCosignerConfig,
|
|
755
779
|
fetchAllMaybeCosignerConfig: () => fetchAllMaybeCosignerConfig,
|
|
756
780
|
fetchCosignerConfig: () => fetchCosignerConfig,
|
|
@@ -770,9 +794,10 @@ __export(cosignerHook_exports, {
|
|
|
770
794
|
getCosignerConfigEncoder: () => getCosignerConfigEncoder,
|
|
771
795
|
getCosignerConfigSize: () => getCosignerConfigSize,
|
|
772
796
|
getCosignerGateStatus: () => getCosignerGateStatus,
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
797
|
+
getCpmmHookConfigAddress: () => getCpmmHookConfigAddress,
|
|
798
|
+
getCpmmHookErrorMessage: () => getCpmmHookErrorMessage,
|
|
799
|
+
getCpmmHookRemainingAccountAddresses: () => getCpmmHookRemainingAccountAddresses,
|
|
800
|
+
getCpmmHookRemainingAccounts: () => getCpmmHookRemainingAccounts,
|
|
776
801
|
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec,
|
|
777
802
|
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder,
|
|
778
803
|
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder,
|
|
@@ -797,15 +822,17 @@ __export(cosignerHook_exports, {
|
|
|
797
822
|
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec,
|
|
798
823
|
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder,
|
|
799
824
|
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder,
|
|
800
|
-
|
|
801
|
-
|
|
825
|
+
identifyCpmmHookAccount: () => identifyCpmmHookAccount,
|
|
826
|
+
identifyCpmmHookInstruction: () => identifyCpmmHookInstruction,
|
|
802
827
|
isCosignerGateEnforced: () => isCosignerGateEnforced,
|
|
803
|
-
|
|
828
|
+
isCpmmHookError: () => isCpmmHookError,
|
|
829
|
+
isDynamicFeeSchedulePayload: () => isDynamicFeeSchedulePayload,
|
|
804
830
|
parseAddCosignerInstruction: () => parseAddCosignerInstruction,
|
|
805
|
-
|
|
831
|
+
parseCpmmHookInstruction: () => parseCpmmHookInstruction,
|
|
806
832
|
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction2,
|
|
807
833
|
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction,
|
|
808
|
-
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction
|
|
834
|
+
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction,
|
|
835
|
+
validateDynamicFeeScheduleArgs: () => validateDynamicFeeScheduleArgs
|
|
809
836
|
});
|
|
810
837
|
var COSIGNER_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
811
838
|
133,
|
|
@@ -856,13 +883,13 @@ function decodeCosignerConfig(encodedAccount) {
|
|
|
856
883
|
getCosignerConfigDecoder()
|
|
857
884
|
);
|
|
858
885
|
}
|
|
859
|
-
async function fetchCosignerConfig(rpc,
|
|
860
|
-
const maybeAccount = await fetchMaybeCosignerConfig(rpc,
|
|
886
|
+
async function fetchCosignerConfig(rpc, address6, config) {
|
|
887
|
+
const maybeAccount = await fetchMaybeCosignerConfig(rpc, address6, config);
|
|
861
888
|
assertAccountExists(maybeAccount);
|
|
862
889
|
return maybeAccount;
|
|
863
890
|
}
|
|
864
|
-
async function fetchMaybeCosignerConfig(rpc,
|
|
865
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
891
|
+
async function fetchMaybeCosignerConfig(rpc, address6, config) {
|
|
892
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
866
893
|
return decodeCosignerConfig(maybeAccount);
|
|
867
894
|
}
|
|
868
895
|
async function fetchAllCosignerConfig(rpc, addresses, config) {
|
|
@@ -920,7 +947,7 @@ function getAddCosignerInstructionDataCodec() {
|
|
|
920
947
|
);
|
|
921
948
|
}
|
|
922
949
|
async function getAddCosignerInstructionAsync(input, config) {
|
|
923
|
-
const programAddress = config?.programAddress ??
|
|
950
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
924
951
|
const originalAccounts = {
|
|
925
952
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
926
953
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -971,7 +998,7 @@ async function getAddCosignerInstructionAsync(input, config) {
|
|
|
971
998
|
});
|
|
972
999
|
}
|
|
973
1000
|
function getAddCosignerInstruction(input, config) {
|
|
974
|
-
const programAddress = config?.programAddress ??
|
|
1001
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
975
1002
|
const originalAccounts = {
|
|
976
1003
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
977
1004
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1002,9 +1029,9 @@ function parseAddCosignerInstruction(instruction) {
|
|
|
1002
1029
|
}
|
|
1003
1030
|
let accountIndex = 0;
|
|
1004
1031
|
const getNextAccount = () => {
|
|
1005
|
-
const
|
|
1032
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1006
1033
|
accountIndex += 1;
|
|
1007
|
-
return
|
|
1034
|
+
return accountMeta2;
|
|
1008
1035
|
};
|
|
1009
1036
|
return {
|
|
1010
1037
|
programAddress: instruction.programAddress,
|
|
@@ -1049,7 +1076,7 @@ function getInitializeConfigInstructionDataCodec2() {
|
|
|
1049
1076
|
);
|
|
1050
1077
|
}
|
|
1051
1078
|
async function getInitializeConfigInstructionAsync2(input, config) {
|
|
1052
|
-
const programAddress = config?.programAddress ??
|
|
1079
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1053
1080
|
const originalAccounts = {
|
|
1054
1081
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
1055
1082
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
@@ -1109,7 +1136,7 @@ async function getInitializeConfigInstructionAsync2(input, config) {
|
|
|
1109
1136
|
});
|
|
1110
1137
|
}
|
|
1111
1138
|
function getInitializeConfigInstruction2(input, config) {
|
|
1112
|
-
const programAddress = config?.programAddress ??
|
|
1139
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1113
1140
|
const originalAccounts = {
|
|
1114
1141
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
1115
1142
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
@@ -1149,9 +1176,9 @@ function parseInitializeConfigInstruction2(instruction) {
|
|
|
1149
1176
|
}
|
|
1150
1177
|
let accountIndex = 0;
|
|
1151
1178
|
const getNextAccount = () => {
|
|
1152
|
-
const
|
|
1179
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1153
1180
|
accountIndex += 1;
|
|
1154
|
-
return
|
|
1181
|
+
return accountMeta2;
|
|
1155
1182
|
};
|
|
1156
1183
|
return {
|
|
1157
1184
|
programAddress: instruction.programAddress,
|
|
@@ -1202,7 +1229,7 @@ function getRemoveCosignerInstructionDataCodec() {
|
|
|
1202
1229
|
);
|
|
1203
1230
|
}
|
|
1204
1231
|
async function getRemoveCosignerInstructionAsync(input, config) {
|
|
1205
|
-
const programAddress = config?.programAddress ??
|
|
1232
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1206
1233
|
const originalAccounts = {
|
|
1207
1234
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1208
1235
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1253,7 +1280,7 @@ async function getRemoveCosignerInstructionAsync(input, config) {
|
|
|
1253
1280
|
});
|
|
1254
1281
|
}
|
|
1255
1282
|
function getRemoveCosignerInstruction(input, config) {
|
|
1256
|
-
const programAddress = config?.programAddress ??
|
|
1283
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1257
1284
|
const originalAccounts = {
|
|
1258
1285
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1259
1286
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1284,9 +1311,9 @@ function parseRemoveCosignerInstruction(instruction) {
|
|
|
1284
1311
|
}
|
|
1285
1312
|
let accountIndex = 0;
|
|
1286
1313
|
const getNextAccount = () => {
|
|
1287
|
-
const
|
|
1314
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1288
1315
|
accountIndex += 1;
|
|
1289
|
-
return
|
|
1316
|
+
return accountMeta2;
|
|
1290
1317
|
};
|
|
1291
1318
|
return {
|
|
1292
1319
|
programAddress: instruction.programAddress,
|
|
@@ -1331,7 +1358,7 @@ function getSetAuthorityInstructionDataCodec() {
|
|
|
1331
1358
|
);
|
|
1332
1359
|
}
|
|
1333
1360
|
async function getSetAuthorityInstructionAsync(input, config) {
|
|
1334
|
-
const programAddress = config?.programAddress ??
|
|
1361
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1335
1362
|
const originalAccounts = {
|
|
1336
1363
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1337
1364
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1382,7 +1409,7 @@ async function getSetAuthorityInstructionAsync(input, config) {
|
|
|
1382
1409
|
});
|
|
1383
1410
|
}
|
|
1384
1411
|
function getSetAuthorityInstruction(input, config) {
|
|
1385
|
-
const programAddress = config?.programAddress ??
|
|
1412
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1386
1413
|
const originalAccounts = {
|
|
1387
1414
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1388
1415
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1413,9 +1440,9 @@ function parseSetAuthorityInstruction(instruction) {
|
|
|
1413
1440
|
}
|
|
1414
1441
|
let accountIndex = 0;
|
|
1415
1442
|
const getNextAccount = () => {
|
|
1416
|
-
const
|
|
1443
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1417
1444
|
accountIndex += 1;
|
|
1418
|
-
return
|
|
1445
|
+
return accountMeta2;
|
|
1419
1446
|
};
|
|
1420
1447
|
return {
|
|
1421
1448
|
programAddress: instruction.programAddress,
|
|
@@ -1424,13 +1451,13 @@ function parseSetAuthorityInstruction(instruction) {
|
|
|
1424
1451
|
};
|
|
1425
1452
|
}
|
|
1426
1453
|
|
|
1427
|
-
// src/solana/generated/
|
|
1428
|
-
var
|
|
1429
|
-
var
|
|
1430
|
-
|
|
1431
|
-
return
|
|
1432
|
-
})(
|
|
1433
|
-
function
|
|
1454
|
+
// src/solana/generated/cpmmHook/programs/cpmmHook.ts
|
|
1455
|
+
var CPMM_HOOK_PROGRAM_ADDRESS = "HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i";
|
|
1456
|
+
var CpmmHookAccount = /* @__PURE__ */ ((CpmmHookAccount2) => {
|
|
1457
|
+
CpmmHookAccount2[CpmmHookAccount2["CosignerConfig"] = 0] = "CosignerConfig";
|
|
1458
|
+
return CpmmHookAccount2;
|
|
1459
|
+
})(CpmmHookAccount || {});
|
|
1460
|
+
function identifyCpmmHookAccount(account) {
|
|
1434
1461
|
const data = "data" in account ? account.data : account;
|
|
1435
1462
|
if (containsBytes(
|
|
1436
1463
|
data,
|
|
@@ -1443,17 +1470,17 @@ function identifyCosignerHookAccount(account) {
|
|
|
1443
1470
|
}
|
|
1444
1471
|
throw new SolanaError(
|
|
1445
1472
|
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
1446
|
-
{ accountData: data, programName: "
|
|
1473
|
+
{ accountData: data, programName: "cpmmHook" }
|
|
1447
1474
|
);
|
|
1448
1475
|
}
|
|
1449
|
-
var
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
return
|
|
1455
|
-
})(
|
|
1456
|
-
function
|
|
1476
|
+
var CpmmHookInstruction = /* @__PURE__ */ ((CpmmHookInstruction2) => {
|
|
1477
|
+
CpmmHookInstruction2[CpmmHookInstruction2["AddCosigner"] = 0] = "AddCosigner";
|
|
1478
|
+
CpmmHookInstruction2[CpmmHookInstruction2["InitializeConfig"] = 1] = "InitializeConfig";
|
|
1479
|
+
CpmmHookInstruction2[CpmmHookInstruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
|
|
1480
|
+
CpmmHookInstruction2[CpmmHookInstruction2["SetAuthority"] = 3] = "SetAuthority";
|
|
1481
|
+
return CpmmHookInstruction2;
|
|
1482
|
+
})(CpmmHookInstruction || {});
|
|
1483
|
+
function identifyCpmmHookInstruction(instruction) {
|
|
1457
1484
|
const data = "data" in instruction ? instruction.data : instruction;
|
|
1458
1485
|
if (containsBytes(
|
|
1459
1486
|
data,
|
|
@@ -1493,11 +1520,11 @@ function identifyCosignerHookInstruction(instruction) {
|
|
|
1493
1520
|
}
|
|
1494
1521
|
throw new SolanaError(
|
|
1495
1522
|
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
1496
|
-
{ instructionData: data, programName: "
|
|
1523
|
+
{ instructionData: data, programName: "cpmmHook" }
|
|
1497
1524
|
);
|
|
1498
1525
|
}
|
|
1499
|
-
function
|
|
1500
|
-
const instructionType =
|
|
1526
|
+
function parseCpmmHookInstruction(instruction) {
|
|
1527
|
+
const instructionType = identifyCpmmHookInstruction(instruction);
|
|
1501
1528
|
switch (instructionType) {
|
|
1502
1529
|
case 0 /* AddCosigner */: {
|
|
1503
1530
|
assertIsInstructionWithAccounts(instruction);
|
|
@@ -1530,18 +1557,15 @@ function parseCosignerHookInstruction(instruction) {
|
|
|
1530
1557
|
default:
|
|
1531
1558
|
throw new SolanaError(
|
|
1532
1559
|
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
1533
|
-
{
|
|
1534
|
-
instructionType,
|
|
1535
|
-
programName: "cosignerHook"
|
|
1536
|
-
}
|
|
1560
|
+
{ instructionType, programName: "cpmmHook" }
|
|
1537
1561
|
);
|
|
1538
1562
|
}
|
|
1539
1563
|
}
|
|
1540
|
-
function
|
|
1564
|
+
function cpmmHookProgram() {
|
|
1541
1565
|
return (client) => {
|
|
1542
1566
|
return {
|
|
1543
1567
|
...client,
|
|
1544
|
-
|
|
1568
|
+
cpmmHook: {
|
|
1545
1569
|
accounts: {
|
|
1546
1570
|
cosignerConfig: addSelfFetchFunctions(
|
|
1547
1571
|
client,
|
|
@@ -1574,35 +1598,45 @@ function cosignerHookProgram() {
|
|
|
1574
1598
|
};
|
|
1575
1599
|
}
|
|
1576
1600
|
|
|
1577
|
-
// src/solana/generated/
|
|
1578
|
-
var
|
|
1579
|
-
var
|
|
1580
|
-
var
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1583
|
-
var
|
|
1584
|
-
var
|
|
1601
|
+
// src/solana/generated/cpmmHook/errors/cpmmHook.ts
|
|
1602
|
+
var CPMM_HOOK_ERROR__INVALID_INSTRUCTION_DATA = 6e3;
|
|
1603
|
+
var CPMM_HOOK_ERROR__INVALID_SCHEDULE_DATA = 6001;
|
|
1604
|
+
var CPMM_HOOK_ERROR__INVALID_FEE = 6002;
|
|
1605
|
+
var CPMM_HOOK_ERROR__INVALID_DURATION = 6003;
|
|
1606
|
+
var CPMM_HOOK_ERROR__ARITHMETIC_OVERFLOW = 6004;
|
|
1607
|
+
var CPMM_HOOK_ERROR__INVALID_AUTHORITY = 6005;
|
|
1608
|
+
var CPMM_HOOK_ERROR__INVALID_CONFIG = 6006;
|
|
1609
|
+
var CPMM_HOOK_ERROR__INVALID_COSIGNER = 6007;
|
|
1610
|
+
var CPMM_HOOK_ERROR__COSIGNER_ALREADY_EXISTS = 6008;
|
|
1611
|
+
var CPMM_HOOK_ERROR__COSIGNER_NOT_FOUND = 6009;
|
|
1612
|
+
var CPMM_HOOK_ERROR__COSIGNER_LIST_FULL = 6010;
|
|
1613
|
+
var cpmmHookErrorMessages;
|
|
1585
1614
|
if (process.env.NODE_ENV !== "production") {
|
|
1586
|
-
|
|
1587
|
-
[
|
|
1588
|
-
[
|
|
1589
|
-
[
|
|
1590
|
-
[
|
|
1591
|
-
[
|
|
1592
|
-
[
|
|
1615
|
+
cpmmHookErrorMessages = {
|
|
1616
|
+
[CPMM_HOOK_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
1617
|
+
[CPMM_HOOK_ERROR__COSIGNER_ALREADY_EXISTS]: `Cosigner already exists`,
|
|
1618
|
+
[CPMM_HOOK_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
|
|
1619
|
+
[CPMM_HOOK_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
|
|
1620
|
+
[CPMM_HOOK_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
|
|
1621
|
+
[CPMM_HOOK_ERROR__INVALID_CONFIG]: `Invalid cosigner hook config`,
|
|
1622
|
+
[CPMM_HOOK_ERROR__INVALID_COSIGNER]: `Invalid cosigner key`,
|
|
1623
|
+
[CPMM_HOOK_ERROR__INVALID_DURATION]: `Invalid fee duration`,
|
|
1624
|
+
[CPMM_HOOK_ERROR__INVALID_FEE]: `Invalid fee`,
|
|
1625
|
+
[CPMM_HOOK_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
|
|
1626
|
+
[CPMM_HOOK_ERROR__INVALID_SCHEDULE_DATA]: `Invalid schedule payload`
|
|
1593
1627
|
};
|
|
1594
1628
|
}
|
|
1595
|
-
function
|
|
1629
|
+
function getCpmmHookErrorMessage(code) {
|
|
1596
1630
|
if (process.env.NODE_ENV !== "production") {
|
|
1597
|
-
return
|
|
1631
|
+
return cpmmHookErrorMessages[code];
|
|
1598
1632
|
}
|
|
1599
1633
|
return "Error message not available in production bundles.";
|
|
1600
1634
|
}
|
|
1601
|
-
function
|
|
1635
|
+
function isCpmmHookError(error, transactionMessage, code) {
|
|
1602
1636
|
return isProgramError(
|
|
1603
1637
|
error,
|
|
1604
1638
|
transactionMessage,
|
|
1605
|
-
|
|
1639
|
+
CPMM_HOOK_PROGRAM_ADDRESS,
|
|
1606
1640
|
code
|
|
1607
1641
|
);
|
|
1608
1642
|
}
|
|
@@ -1643,11 +1677,11 @@ function getSetAuthorityArgsCodec() {
|
|
|
1643
1677
|
getSetAuthorityArgsDecoder()
|
|
1644
1678
|
);
|
|
1645
1679
|
}
|
|
1646
|
-
var
|
|
1647
|
-
"
|
|
1680
|
+
var DEVNET_CPMM_HOOK_PROGRAM_ID = address(
|
|
1681
|
+
"HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i"
|
|
1648
1682
|
);
|
|
1649
|
-
var
|
|
1650
|
-
var
|
|
1683
|
+
var CPMM_HOOK_PROGRAM_ID = DEVNET_CPMM_HOOK_PROGRAM_ID;
|
|
1684
|
+
var SEED_CPMM_HOOK_CONFIG = "cosigner_hook_config";
|
|
1651
1685
|
var MAX_COSIGNERS = 32;
|
|
1652
1686
|
var GATE_EXPIRY_DISABLED = 0;
|
|
1653
1687
|
var GATE_EXPIRY_UNIX_TIMESTAMP = 1;
|
|
@@ -1655,15 +1689,146 @@ var GATE_EXPIRY_SLOT = 2;
|
|
|
1655
1689
|
var GATE_EXPIRY_PAYLOAD_VERSION = 1;
|
|
1656
1690
|
var GATE_EXPIRY_HEADER_LEN = 10;
|
|
1657
1691
|
var GATE_EXPIRY_PAYLOAD_LEN = 42;
|
|
1692
|
+
var DYNAMIC_FEE_SCHEDULE_MAGIC = new Uint8Array([
|
|
1693
|
+
68,
|
|
1694
|
+
70,
|
|
1695
|
+
69,
|
|
1696
|
+
69,
|
|
1697
|
+
86,
|
|
1698
|
+
49,
|
|
1699
|
+
95,
|
|
1700
|
+
95
|
|
1701
|
+
]);
|
|
1702
|
+
var DYNAMIC_FEE_SCHEDULE_VERSION = 1;
|
|
1703
|
+
var DYNAMIC_FEE_SCHEDULE_LEN = 32;
|
|
1704
|
+
var DYNAMIC_FEE_SCHEDULE_HEADER_LEN = 16;
|
|
1705
|
+
var DYNAMIC_FEE_SCHEDULE_MAX_BPS = 1e4;
|
|
1706
|
+
var MAX_U64 = (1n << 64n) - 1n;
|
|
1707
|
+
function toBigInt(value) {
|
|
1708
|
+
return typeof value === "bigint" ? value : BigInt(value);
|
|
1709
|
+
}
|
|
1710
|
+
function isValidExpiryMode(mode) {
|
|
1711
|
+
return mode === GATE_EXPIRY_UNIX_TIMESTAMP || mode === GATE_EXPIRY_SLOT;
|
|
1712
|
+
}
|
|
1713
|
+
function readU64Le(bytes, offset) {
|
|
1714
|
+
let value = 0n;
|
|
1715
|
+
for (let i = 0; i < 8; i++) {
|
|
1716
|
+
value |= BigInt(bytes[offset + i] ?? 0) << BigInt(i * 8);
|
|
1717
|
+
}
|
|
1718
|
+
return value;
|
|
1719
|
+
}
|
|
1720
|
+
function writeU64Le(bytes, offset, value) {
|
|
1721
|
+
for (let i = 0; i < 8; i++) {
|
|
1722
|
+
bytes[offset + i] = Number(value >> BigInt(i * 8) & 0xffn);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
function encodeCosignerGateExpiryPayload(expiry) {
|
|
1726
|
+
if (expiry.mode === GATE_EXPIRY_DISABLED) {
|
|
1727
|
+
if (expiry.cosigner !== void 0) {
|
|
1728
|
+
throw new Error("Cosigner hint cannot be encoded for disabled gates");
|
|
1729
|
+
}
|
|
1730
|
+
return new Uint8Array();
|
|
1731
|
+
}
|
|
1732
|
+
if (!isValidExpiryMode(expiry.mode)) {
|
|
1733
|
+
throw new Error(`Invalid cosigner gate expiry mode: ${expiry.mode}`);
|
|
1734
|
+
}
|
|
1735
|
+
const value = toBigInt(expiry.value);
|
|
1736
|
+
if (value < 0n || value > MAX_U64) {
|
|
1737
|
+
throw new Error(`Invalid cosigner gate expiry value: ${expiry.value}`);
|
|
1738
|
+
}
|
|
1739
|
+
if (expiry.cosigner === void 0) {
|
|
1740
|
+
throw new Error("Cosigner hint is required for expiring gates");
|
|
1741
|
+
}
|
|
1742
|
+
const payload = new Uint8Array(GATE_EXPIRY_PAYLOAD_LEN);
|
|
1743
|
+
payload[0] = GATE_EXPIRY_PAYLOAD_VERSION;
|
|
1744
|
+
payload[1] = expiry.mode;
|
|
1745
|
+
writeU64Le(payload, 2, value);
|
|
1746
|
+
payload.set(
|
|
1747
|
+
getAddressEncoder().encode(expiry.cosigner),
|
|
1748
|
+
GATE_EXPIRY_HEADER_LEN
|
|
1749
|
+
);
|
|
1750
|
+
return payload;
|
|
1751
|
+
}
|
|
1752
|
+
function decodeCosignerGateExpiryPayload(payload) {
|
|
1753
|
+
if (!payload || payload.length === 0) {
|
|
1754
|
+
return { mode: GATE_EXPIRY_DISABLED, value: 0n };
|
|
1755
|
+
}
|
|
1756
|
+
if (payload.length !== GATE_EXPIRY_PAYLOAD_LEN || payload[0] !== GATE_EXPIRY_PAYLOAD_VERSION) {
|
|
1757
|
+
return null;
|
|
1758
|
+
}
|
|
1759
|
+
const mode = payload[1] ?? GATE_EXPIRY_DISABLED;
|
|
1760
|
+
if (!isValidExpiryMode(mode)) {
|
|
1761
|
+
return null;
|
|
1762
|
+
}
|
|
1763
|
+
return {
|
|
1764
|
+
mode,
|
|
1765
|
+
value: readU64Le(payload, 2),
|
|
1766
|
+
cosigner: getAddressDecoder().decode(
|
|
1767
|
+
payload.slice(GATE_EXPIRY_HEADER_LEN, GATE_EXPIRY_PAYLOAD_LEN)
|
|
1768
|
+
)
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
function getCosignerGateStatus(hookPayload, clock = {}) {
|
|
1772
|
+
const expiry = decodeCosignerGateExpiryPayload(hookPayload);
|
|
1773
|
+
if (!expiry) {
|
|
1774
|
+
return {
|
|
1775
|
+
gateEnforced: true,
|
|
1776
|
+
expiryMode: GATE_EXPIRY_DISABLED,
|
|
1777
|
+
expiryValue: 0n,
|
|
1778
|
+
reason: "invalid_expiry_payload"
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
if (expiry.mode === GATE_EXPIRY_DISABLED) {
|
|
1782
|
+
return {
|
|
1783
|
+
gateEnforced: true,
|
|
1784
|
+
expiryMode: expiry.mode,
|
|
1785
|
+
expiryValue: expiry.value,
|
|
1786
|
+
reason: "expiry_disabled"
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
if (expiry.mode === GATE_EXPIRY_UNIX_TIMESTAMP) {
|
|
1790
|
+
const unixTimestamp = clock.unixTimestamp === void 0 ? BigInt(Math.floor(Date.now() / 1e3)) : toBigInt(clock.unixTimestamp);
|
|
1791
|
+
const expired = unixTimestamp >= expiry.value;
|
|
1792
|
+
return {
|
|
1793
|
+
gateEnforced: !expired,
|
|
1794
|
+
expiryMode: expiry.mode,
|
|
1795
|
+
expiryValue: expiry.value,
|
|
1796
|
+
reason: expired ? "timestamp_expired" : "timestamp_pending"
|
|
1797
|
+
};
|
|
1798
|
+
}
|
|
1799
|
+
if (expiry.mode === GATE_EXPIRY_SLOT) {
|
|
1800
|
+
if (clock.slot === void 0) {
|
|
1801
|
+
return {
|
|
1802
|
+
gateEnforced: true,
|
|
1803
|
+
expiryMode: expiry.mode,
|
|
1804
|
+
expiryValue: expiry.value,
|
|
1805
|
+
reason: "slot_unavailable"
|
|
1806
|
+
};
|
|
1807
|
+
}
|
|
1808
|
+
const expired = toBigInt(clock.slot) >= expiry.value;
|
|
1809
|
+
return {
|
|
1810
|
+
gateEnforced: !expired,
|
|
1811
|
+
expiryMode: expiry.mode,
|
|
1812
|
+
expiryValue: expiry.value,
|
|
1813
|
+
reason: expired ? "slot_expired" : "slot_pending"
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
return {
|
|
1817
|
+
gateEnforced: true,
|
|
1818
|
+
expiryMode: expiry.mode,
|
|
1819
|
+
expiryValue: expiry.value,
|
|
1820
|
+
reason: "invalid_expiry_mode"
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
function isCosignerGateEnforced(hookPayload, clock = {}) {
|
|
1824
|
+
return getCosignerGateStatus(hookPayload, clock).gateEnforced;
|
|
1825
|
+
}
|
|
1658
1826
|
var INITIALIZER_PROGRAM_ID = address(
|
|
1659
1827
|
"4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1"
|
|
1660
1828
|
);
|
|
1661
1829
|
var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = address(
|
|
1662
1830
|
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
1663
1831
|
);
|
|
1664
|
-
var CPMM_HOOK_PROGRAM_ID = address(
|
|
1665
|
-
"2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
|
|
1666
|
-
);
|
|
1667
1832
|
var PREDICTION_HOOK_PROGRAM_ID = address(
|
|
1668
1833
|
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
1669
1834
|
);
|
|
@@ -1863,148 +2028,112 @@ function phaseLabel(phase) {
|
|
|
1863
2028
|
}
|
|
1864
2029
|
}
|
|
1865
2030
|
|
|
1866
|
-
// src/solana/
|
|
1867
|
-
var
|
|
1868
|
-
|
|
2031
|
+
// src/solana/cpmmHook/payload.ts
|
|
2032
|
+
var MAX_I64 = (1n << 63n) - 1n;
|
|
2033
|
+
var MAX_U32 = (1n << 32n) - 1n;
|
|
2034
|
+
function toBigInt2(value) {
|
|
1869
2035
|
return typeof value === "bigint" ? value : BigInt(value);
|
|
1870
2036
|
}
|
|
1871
|
-
function
|
|
1872
|
-
|
|
1873
|
-
}
|
|
1874
|
-
function readU64Le(bytes, offset) {
|
|
1875
|
-
let value = 0n;
|
|
1876
|
-
for (let i = 0; i < 8; i++) {
|
|
1877
|
-
value |= BigInt(bytes[offset + i] ?? 0) << BigInt(i * 8);
|
|
2037
|
+
function assertU16Bps(label, value) {
|
|
2038
|
+
if (!Number.isInteger(value) || value < 0 || value > DYNAMIC_FEE_SCHEDULE_MAX_BPS) {
|
|
2039
|
+
throw new Error(`${label} must be an integer between 0 and 10000`);
|
|
1878
2040
|
}
|
|
1879
|
-
return value;
|
|
1880
2041
|
}
|
|
1881
|
-
function
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
}
|
|
2042
|
+
function writeI64Le(bytes, offset, value) {
|
|
2043
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2044
|
+
view.setBigInt64(offset, value, true);
|
|
1885
2045
|
}
|
|
1886
|
-
function
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
2046
|
+
function writeU16Le(bytes, offset, value) {
|
|
2047
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2048
|
+
view.setUint16(offset, value, true);
|
|
2049
|
+
}
|
|
2050
|
+
function writeU32Le(bytes, offset, value) {
|
|
2051
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2052
|
+
view.setUint32(offset, Number(value), true);
|
|
2053
|
+
}
|
|
2054
|
+
function validateDynamicFeeScheduleArgs(schedule) {
|
|
2055
|
+
const startingTime = toBigInt2(schedule.startingTime);
|
|
2056
|
+
if (startingTime < 0n || startingTime > MAX_I64) {
|
|
2057
|
+
throw new Error("startingTime must be between 0 and i64::MAX");
|
|
1892
2058
|
}
|
|
1893
|
-
|
|
1894
|
-
|
|
2059
|
+
assertU16Bps("startFeeBps", schedule.startFeeBps);
|
|
2060
|
+
assertU16Bps("endFeeBps", schedule.endFeeBps);
|
|
2061
|
+
if (schedule.endFeeBps > schedule.startFeeBps) {
|
|
2062
|
+
throw new Error("endFeeBps must be less than or equal to startFeeBps");
|
|
1895
2063
|
}
|
|
1896
|
-
const
|
|
1897
|
-
if (
|
|
1898
|
-
throw new Error(
|
|
2064
|
+
const durationSeconds = toBigInt2(schedule.durationSeconds);
|
|
2065
|
+
if (durationSeconds < 0n || durationSeconds > MAX_U32) {
|
|
2066
|
+
throw new Error("durationSeconds must be between 0 and u32::MAX");
|
|
1899
2067
|
}
|
|
1900
|
-
if (
|
|
1901
|
-
throw new Error("
|
|
2068
|
+
if (schedule.startFeeBps > schedule.endFeeBps && durationSeconds === 0n) {
|
|
2069
|
+
throw new Error("durationSeconds must be nonzero for decaying schedules");
|
|
1902
2070
|
}
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
payload
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
);
|
|
2071
|
+
return { startingTime, durationSeconds };
|
|
2072
|
+
}
|
|
2073
|
+
function encodeDynamicFeeSchedule(schedule) {
|
|
2074
|
+
const { startingTime, durationSeconds } = validateDynamicFeeScheduleArgs(schedule);
|
|
2075
|
+
const payload = new Uint8Array(DYNAMIC_FEE_SCHEDULE_LEN);
|
|
2076
|
+
payload.set(DYNAMIC_FEE_SCHEDULE_MAGIC, 0);
|
|
2077
|
+
payload[8] = DYNAMIC_FEE_SCHEDULE_VERSION;
|
|
2078
|
+
writeI64Le(payload, DYNAMIC_FEE_SCHEDULE_HEADER_LEN, startingTime);
|
|
2079
|
+
writeU16Le(payload, 24, schedule.startFeeBps);
|
|
2080
|
+
writeU16Le(payload, 26, schedule.endFeeBps);
|
|
2081
|
+
writeU32Le(payload, 28, durationSeconds);
|
|
1911
2082
|
return payload;
|
|
1912
2083
|
}
|
|
1913
|
-
function
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
2084
|
+
function encodeCpmmHookPayload(args = {}) {
|
|
2085
|
+
const schedulePayload = args.schedule ? encodeDynamicFeeSchedule(args.schedule) : new Uint8Array();
|
|
2086
|
+
const gatePayload = args.gateExpiry ? encodeCosignerGateExpiryPayload(args.gateExpiry) : new Uint8Array();
|
|
2087
|
+
const payload = new Uint8Array(schedulePayload.length + gatePayload.length);
|
|
2088
|
+
payload.set(schedulePayload, 0);
|
|
2089
|
+
payload.set(gatePayload, schedulePayload.length);
|
|
2090
|
+
return payload;
|
|
2091
|
+
}
|
|
2092
|
+
function encodeDynamicFeeCosignerGatePayload(args) {
|
|
2093
|
+
return encodeCosignerGateExpiryPayload(args);
|
|
2094
|
+
}
|
|
2095
|
+
function getCpmmHookRemainingAccounts({
|
|
2096
|
+
namespace,
|
|
2097
|
+
config,
|
|
2098
|
+
cosigner
|
|
2099
|
+
}) {
|
|
2100
|
+
const signedHookRemainingAccounts = [namespace];
|
|
2101
|
+
if (config && config !== namespace) {
|
|
2102
|
+
signedHookRemainingAccounts.push(config);
|
|
1919
2103
|
}
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
return null;
|
|
2104
|
+
if (cosigner) {
|
|
2105
|
+
signedHookRemainingAccounts.push(cosigner);
|
|
1923
2106
|
}
|
|
2107
|
+
const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
|
|
2108
|
+
getAddressFromRemainingAccount
|
|
2109
|
+
);
|
|
1924
2110
|
return {
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2111
|
+
signedHookRemainingAccounts,
|
|
2112
|
+
unsignedHookRemainingAccounts,
|
|
2113
|
+
hookRemainingAccountsHash: computeRemainingAccountsHash(
|
|
2114
|
+
unsignedHookRemainingAccounts
|
|
1929
2115
|
)
|
|
1930
2116
|
};
|
|
1931
2117
|
}
|
|
1932
|
-
function
|
|
1933
|
-
const expiry = decodeCosignerGateExpiryPayload(hookPayload);
|
|
1934
|
-
if (!expiry) {
|
|
1935
|
-
return {
|
|
1936
|
-
gateEnforced: true,
|
|
1937
|
-
expiryMode: GATE_EXPIRY_DISABLED,
|
|
1938
|
-
expiryValue: 0n,
|
|
1939
|
-
reason: "invalid_expiry_payload"
|
|
1940
|
-
};
|
|
1941
|
-
}
|
|
1942
|
-
if (expiry.mode === GATE_EXPIRY_DISABLED) {
|
|
1943
|
-
return {
|
|
1944
|
-
gateEnforced: true,
|
|
1945
|
-
expiryMode: expiry.mode,
|
|
1946
|
-
expiryValue: expiry.value,
|
|
1947
|
-
reason: "expiry_disabled"
|
|
1948
|
-
};
|
|
1949
|
-
}
|
|
1950
|
-
if (expiry.mode === GATE_EXPIRY_UNIX_TIMESTAMP) {
|
|
1951
|
-
const unixTimestamp = clock.unixTimestamp === void 0 ? BigInt(Math.floor(Date.now() / 1e3)) : toBigInt(clock.unixTimestamp);
|
|
1952
|
-
const expired = unixTimestamp >= expiry.value;
|
|
1953
|
-
return {
|
|
1954
|
-
gateEnforced: !expired,
|
|
1955
|
-
expiryMode: expiry.mode,
|
|
1956
|
-
expiryValue: expiry.value,
|
|
1957
|
-
reason: expired ? "timestamp_expired" : "timestamp_pending"
|
|
1958
|
-
};
|
|
1959
|
-
}
|
|
1960
|
-
if (expiry.mode === GATE_EXPIRY_SLOT) {
|
|
1961
|
-
if (clock.slot === void 0) {
|
|
1962
|
-
return {
|
|
1963
|
-
gateEnforced: true,
|
|
1964
|
-
expiryMode: expiry.mode,
|
|
1965
|
-
expiryValue: expiry.value,
|
|
1966
|
-
reason: "slot_unavailable"
|
|
1967
|
-
};
|
|
1968
|
-
}
|
|
1969
|
-
const expired = toBigInt(clock.slot) >= expiry.value;
|
|
1970
|
-
return {
|
|
1971
|
-
gateEnforced: !expired,
|
|
1972
|
-
expiryMode: expiry.mode,
|
|
1973
|
-
expiryValue: expiry.value,
|
|
1974
|
-
reason: expired ? "slot_expired" : "slot_pending"
|
|
1975
|
-
};
|
|
1976
|
-
}
|
|
1977
|
-
return {
|
|
1978
|
-
gateEnforced: true,
|
|
1979
|
-
expiryMode: expiry.mode,
|
|
1980
|
-
expiryValue: expiry.value,
|
|
1981
|
-
reason: "invalid_expiry_mode"
|
|
1982
|
-
};
|
|
1983
|
-
}
|
|
1984
|
-
function isCosignerGateEnforced(hookPayload, clock = {}) {
|
|
1985
|
-
return getCosignerGateStatus(hookPayload, clock).gateEnforced;
|
|
1986
|
-
}
|
|
1987
|
-
function getCosignerHookRemainingAccounts({
|
|
2118
|
+
function getCpmmHookRemainingAccountAddresses({
|
|
1988
2119
|
namespace,
|
|
2120
|
+
config,
|
|
1989
2121
|
cosigner
|
|
1990
2122
|
}) {
|
|
1991
|
-
|
|
2123
|
+
return getCpmmHookRemainingAccounts({
|
|
1992
2124
|
namespace,
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
unsignedHookRemainingAccounts
|
|
2000
|
-
)
|
|
2001
|
-
};
|
|
2125
|
+
config,
|
|
2126
|
+
cosigner
|
|
2127
|
+
}).unsignedHookRemainingAccounts;
|
|
2128
|
+
}
|
|
2129
|
+
function isDynamicFeeSchedulePayload(payload) {
|
|
2130
|
+
return payload.length >= DYNAMIC_FEE_SCHEDULE_LEN && DYNAMIC_FEE_SCHEDULE_MAGIC.every((byte, index) => payload[index] === byte);
|
|
2002
2131
|
}
|
|
2003
2132
|
var textEncoder2 = new TextEncoder();
|
|
2004
|
-
async function
|
|
2133
|
+
async function getCpmmHookConfigAddress(programId = CPMM_HOOK_PROGRAM_ID) {
|
|
2005
2134
|
return getProgramDerivedAddress({
|
|
2006
2135
|
programAddress: programId,
|
|
2007
|
-
seeds: [textEncoder2.encode(
|
|
2136
|
+
seeds: [textEncoder2.encode(SEED_CPMM_HOOK_CONFIG)]
|
|
2008
2137
|
});
|
|
2009
2138
|
}
|
|
2010
2139
|
|
|
@@ -2012,7 +2141,6 @@ async function getCosignerHookConfigAddress(programId = COSIGNER_HOOK_PROGRAM_ID
|
|
|
2012
2141
|
var initializer_exports = {};
|
|
2013
2142
|
__export(initializer_exports, {
|
|
2014
2143
|
BPF_LOADER_UPGRADEABLE_PROGRAM_ID: () => BPF_LOADER_UPGRADEABLE_PROGRAM_ID,
|
|
2015
|
-
CPMM_HOOK_PROGRAM_ID: () => CPMM_HOOK_PROGRAM_ID,
|
|
2016
2144
|
CURVE_KIND_XYK: () => CURVE_KIND_XYK,
|
|
2017
2145
|
CURVE_PARAMS_FORMAT_XYK_V0: () => CURVE_PARAMS_FORMAT_XYK_V0,
|
|
2018
2146
|
DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND: () => DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND,
|
|
@@ -3176,6 +3304,17 @@ var SEED_STATE = "state";
|
|
|
3176
3304
|
var SEED_MIGRATION_AUTHORITY = "migration_authority";
|
|
3177
3305
|
var MAX_RECIPIENTS = 2;
|
|
3178
3306
|
var CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS = {
|
|
3307
|
+
// SHA256("global:create_spot_pool")[0:8]
|
|
3308
|
+
createSpotPool: new Uint8Array([
|
|
3309
|
+
13,
|
|
3310
|
+
137,
|
|
3311
|
+
16,
|
|
3312
|
+
26,
|
|
3313
|
+
40,
|
|
3314
|
+
36,
|
|
3315
|
+
110,
|
|
3316
|
+
26
|
|
3317
|
+
]),
|
|
3179
3318
|
// SHA256("global:register_launch")[0:8]
|
|
3180
3319
|
registerLaunch: new Uint8Array([
|
|
3181
3320
|
114,
|
|
@@ -3266,13 +3405,13 @@ function decodeClaimReceipt(encodedAccount) {
|
|
|
3266
3405
|
getClaimReceiptDecoder()
|
|
3267
3406
|
);
|
|
3268
3407
|
}
|
|
3269
|
-
async function fetchClaimReceipt(rpc,
|
|
3270
|
-
const maybeAccount = await fetchMaybeClaimReceipt(rpc,
|
|
3408
|
+
async function fetchClaimReceipt(rpc, address6, config) {
|
|
3409
|
+
const maybeAccount = await fetchMaybeClaimReceipt(rpc, address6, config);
|
|
3271
3410
|
assertAccountExists(maybeAccount);
|
|
3272
3411
|
return maybeAccount;
|
|
3273
3412
|
}
|
|
3274
|
-
async function fetchMaybeClaimReceipt(rpc,
|
|
3275
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
3413
|
+
async function fetchMaybeClaimReceipt(rpc, address6, config) {
|
|
3414
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
3276
3415
|
return decodeClaimReceipt(maybeAccount);
|
|
3277
3416
|
}
|
|
3278
3417
|
async function fetchAllClaimReceipt(rpc, addresses, config) {
|
|
@@ -3336,13 +3475,13 @@ function decodeEntry(encodedAccount) {
|
|
|
3336
3475
|
getEntryDecoder()
|
|
3337
3476
|
);
|
|
3338
3477
|
}
|
|
3339
|
-
async function fetchEntry(rpc,
|
|
3340
|
-
const maybeAccount = await fetchMaybeEntry(rpc,
|
|
3478
|
+
async function fetchEntry(rpc, address6, config) {
|
|
3479
|
+
const maybeAccount = await fetchMaybeEntry(rpc, address6, config);
|
|
3341
3480
|
assertAccountExists(maybeAccount);
|
|
3342
3481
|
return maybeAccount;
|
|
3343
3482
|
}
|
|
3344
|
-
async function fetchMaybeEntry(rpc,
|
|
3345
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
3483
|
+
async function fetchMaybeEntry(rpc, address6, config) {
|
|
3484
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
3346
3485
|
return decodeEntry(maybeAccount);
|
|
3347
3486
|
}
|
|
3348
3487
|
async function fetchAllEntry(rpc, addresses, config) {
|
|
@@ -3404,13 +3543,13 @@ function decodeEntryByMint(encodedAccount) {
|
|
|
3404
3543
|
getEntryByMintDecoder()
|
|
3405
3544
|
);
|
|
3406
3545
|
}
|
|
3407
|
-
async function fetchEntryByMint(rpc,
|
|
3408
|
-
const maybeAccount = await fetchMaybeEntryByMint(rpc,
|
|
3546
|
+
async function fetchEntryByMint(rpc, address6, config) {
|
|
3547
|
+
const maybeAccount = await fetchMaybeEntryByMint(rpc, address6, config);
|
|
3409
3548
|
assertAccountExists(maybeAccount);
|
|
3410
3549
|
return maybeAccount;
|
|
3411
3550
|
}
|
|
3412
|
-
async function fetchMaybeEntryByMint(rpc,
|
|
3413
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
3551
|
+
async function fetchMaybeEntryByMint(rpc, address6, config) {
|
|
3552
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
3414
3553
|
return decodeEntryByMint(maybeAccount);
|
|
3415
3554
|
}
|
|
3416
3555
|
async function fetchAllEntryByMint(rpc, addresses, config) {
|
|
@@ -3482,13 +3621,13 @@ function decodeInitConfig(encodedAccount) {
|
|
|
3482
3621
|
getInitConfigDecoder2()
|
|
3483
3622
|
);
|
|
3484
3623
|
}
|
|
3485
|
-
async function fetchInitConfig(rpc,
|
|
3486
|
-
const maybeAccount = await fetchMaybeInitConfig(rpc,
|
|
3624
|
+
async function fetchInitConfig(rpc, address6, config) {
|
|
3625
|
+
const maybeAccount = await fetchMaybeInitConfig(rpc, address6, config);
|
|
3487
3626
|
assertAccountExists(maybeAccount);
|
|
3488
3627
|
return maybeAccount;
|
|
3489
3628
|
}
|
|
3490
|
-
async function fetchMaybeInitConfig(rpc,
|
|
3491
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
3629
|
+
async function fetchMaybeInitConfig(rpc, address6, config) {
|
|
3630
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
3492
3631
|
return decodeInitConfig(maybeAccount);
|
|
3493
3632
|
}
|
|
3494
3633
|
async function fetchAllInitConfig(rpc, addresses, config) {
|
|
@@ -3788,13 +3927,13 @@ function decodeLaunch(encodedAccount) {
|
|
|
3788
3927
|
getLaunchDecoder2()
|
|
3789
3928
|
);
|
|
3790
3929
|
}
|
|
3791
|
-
async function fetchLaunch(rpc,
|
|
3792
|
-
const maybeAccount = await fetchMaybeLaunch(rpc,
|
|
3930
|
+
async function fetchLaunch(rpc, address6, config) {
|
|
3931
|
+
const maybeAccount = await fetchMaybeLaunch(rpc, address6, config);
|
|
3793
3932
|
assertAccountExists(maybeAccount);
|
|
3794
3933
|
return maybeAccount;
|
|
3795
3934
|
}
|
|
3796
|
-
async function fetchMaybeLaunch(rpc,
|
|
3797
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
3935
|
+
async function fetchMaybeLaunch(rpc, address6, config) {
|
|
3936
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
3798
3937
|
return decodeLaunch(maybeAccount);
|
|
3799
3938
|
}
|
|
3800
3939
|
async function fetchAllLaunch(rpc, addresses, config) {
|
|
@@ -3868,13 +4007,13 @@ function decodeMarket(encodedAccount) {
|
|
|
3868
4007
|
getMarketDecoder()
|
|
3869
4008
|
);
|
|
3870
4009
|
}
|
|
3871
|
-
async function fetchMarket(rpc,
|
|
3872
|
-
const maybeAccount = await fetchMaybeMarket(rpc,
|
|
4010
|
+
async function fetchMarket(rpc, address6, config) {
|
|
4011
|
+
const maybeAccount = await fetchMaybeMarket(rpc, address6, config);
|
|
3873
4012
|
assertAccountExists(maybeAccount);
|
|
3874
4013
|
return maybeAccount;
|
|
3875
4014
|
}
|
|
3876
|
-
async function fetchMaybeMarket(rpc,
|
|
3877
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
4015
|
+
async function fetchMaybeMarket(rpc, address6, config) {
|
|
4016
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
3878
4017
|
return decodeMarket(maybeAccount);
|
|
3879
4018
|
}
|
|
3880
4019
|
async function fetchAllMarket(rpc, addresses, config) {
|
|
@@ -3940,13 +4079,13 @@ function decodeOracleState2(encodedAccount) {
|
|
|
3940
4079
|
getOracleStateDecoder()
|
|
3941
4080
|
);
|
|
3942
4081
|
}
|
|
3943
|
-
async function fetchOracleState(rpc,
|
|
3944
|
-
const maybeAccount = await fetchMaybeOracleState(rpc,
|
|
4082
|
+
async function fetchOracleState(rpc, address6, config) {
|
|
4083
|
+
const maybeAccount = await fetchMaybeOracleState(rpc, address6, config);
|
|
3945
4084
|
assertAccountExists(maybeAccount);
|
|
3946
4085
|
return maybeAccount;
|
|
3947
4086
|
}
|
|
3948
|
-
async function fetchMaybeOracleState(rpc,
|
|
3949
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
4087
|
+
async function fetchMaybeOracleState(rpc, address6, config) {
|
|
4088
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
3950
4089
|
return decodeOracleState2(maybeAccount);
|
|
3951
4090
|
}
|
|
3952
4091
|
async function fetchAllOracleState(rpc, addresses, config) {
|
|
@@ -4216,9 +4355,9 @@ function parseClaimInstruction(instruction) {
|
|
|
4216
4355
|
}
|
|
4217
4356
|
let accountIndex = 0;
|
|
4218
4357
|
const getNextAccount = () => {
|
|
4219
|
-
const
|
|
4358
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4220
4359
|
accountIndex += 1;
|
|
4221
|
-
return
|
|
4360
|
+
return accountMeta2;
|
|
4222
4361
|
};
|
|
4223
4362
|
return {
|
|
4224
4363
|
programAddress: instruction.programAddress,
|
|
@@ -4524,9 +4663,9 @@ function parseMigrateEntryInstruction(instruction) {
|
|
|
4524
4663
|
}
|
|
4525
4664
|
let accountIndex = 0;
|
|
4526
4665
|
const getNextAccount = () => {
|
|
4527
|
-
const
|
|
4666
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4528
4667
|
accountIndex += 1;
|
|
4529
|
-
return
|
|
4668
|
+
return accountMeta2;
|
|
4530
4669
|
};
|
|
4531
4670
|
return {
|
|
4532
4671
|
programAddress: instruction.programAddress,
|
|
@@ -4626,9 +4765,9 @@ function parsePreviewPayoutIfWinnerInstruction(instruction) {
|
|
|
4626
4765
|
}
|
|
4627
4766
|
let accountIndex = 0;
|
|
4628
4767
|
const getNextAccount = () => {
|
|
4629
|
-
const
|
|
4768
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4630
4769
|
accountIndex += 1;
|
|
4631
|
-
return
|
|
4770
|
+
return accountMeta2;
|
|
4632
4771
|
};
|
|
4633
4772
|
return {
|
|
4634
4773
|
programAddress: instruction.programAddress,
|
|
@@ -4937,9 +5076,9 @@ function parseRegisterEntryInstruction(instruction) {
|
|
|
4937
5076
|
}
|
|
4938
5077
|
let accountIndex = 0;
|
|
4939
5078
|
const getNextAccount = () => {
|
|
4940
|
-
const
|
|
5079
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4941
5080
|
accountIndex += 1;
|
|
4942
|
-
return
|
|
5081
|
+
return accountMeta2;
|
|
4943
5082
|
};
|
|
4944
5083
|
return {
|
|
4945
5084
|
programAddress: instruction.programAddress,
|
|
@@ -5523,1178 +5662,144 @@ function decodePreviewMigrationResult(data) {
|
|
|
5523
5662
|
return previewMigrationResultCodec.decode(data);
|
|
5524
5663
|
}
|
|
5525
5664
|
|
|
5526
|
-
// src/solana/
|
|
5527
|
-
var
|
|
5528
|
-
__export(
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
fetchMaybeCosignerConfig: () => fetchMaybeCosignerConfig2,
|
|
5566
|
-
getAddCosignerDiscriminatorBytes: () => getAddCosignerDiscriminatorBytes2,
|
|
5567
|
-
getAddCosignerInstruction: () => getAddCosignerInstruction2,
|
|
5568
|
-
getAddCosignerInstructionAsync: () => getAddCosignerInstructionAsync2,
|
|
5569
|
-
getAddCosignerInstructionDataCodec: () => getAddCosignerInstructionDataCodec2,
|
|
5570
|
-
getAddCosignerInstructionDataDecoder: () => getAddCosignerInstructionDataDecoder2,
|
|
5571
|
-
getAddCosignerInstructionDataEncoder: () => getAddCosignerInstructionDataEncoder2,
|
|
5572
|
-
getCosignerArgCodec: () => getCosignerArgCodec2,
|
|
5573
|
-
getCosignerArgDecoder: () => getCosignerArgDecoder2,
|
|
5574
|
-
getCosignerArgEncoder: () => getCosignerArgEncoder2,
|
|
5575
|
-
getCosignerConfigCodec: () => getCosignerConfigCodec2,
|
|
5576
|
-
getCosignerConfigDecoder: () => getCosignerConfigDecoder2,
|
|
5577
|
-
getCosignerConfigDiscriminatorBytes: () => getCosignerConfigDiscriminatorBytes2,
|
|
5578
|
-
getCosignerConfigEncoder: () => getCosignerConfigEncoder2,
|
|
5579
|
-
getCosignerConfigSize: () => getCosignerConfigSize2,
|
|
5580
|
-
getDynamicFeeHookConfigAddress: () => getDynamicFeeHookConfigAddress,
|
|
5581
|
-
getDynamicFeeHookErrorMessage: () => getDynamicFeeHookErrorMessage,
|
|
5582
|
-
getDynamicFeeHookRemainingAccountAddresses: () => getDynamicFeeHookRemainingAccountAddresses,
|
|
5583
|
-
getDynamicFeeHookRemainingAccounts: () => getDynamicFeeHookRemainingAccounts,
|
|
5584
|
-
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec3,
|
|
5585
|
-
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder3,
|
|
5586
|
-
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder3,
|
|
5587
|
-
getInitializeConfigDiscriminatorBytes: () => getInitializeConfigDiscriminatorBytes3,
|
|
5588
|
-
getInitializeConfigInstruction: () => getInitializeConfigInstruction3,
|
|
5589
|
-
getInitializeConfigInstructionAsync: () => getInitializeConfigInstructionAsync4,
|
|
5590
|
-
getInitializeConfigInstructionDataCodec: () => getInitializeConfigInstructionDataCodec3,
|
|
5591
|
-
getInitializeConfigInstructionDataDecoder: () => getInitializeConfigInstructionDataDecoder3,
|
|
5592
|
-
getInitializeConfigInstructionDataEncoder: () => getInitializeConfigInstructionDataEncoder4,
|
|
5593
|
-
getRemoveCosignerDiscriminatorBytes: () => getRemoveCosignerDiscriminatorBytes2,
|
|
5594
|
-
getRemoveCosignerInstruction: () => getRemoveCosignerInstruction2,
|
|
5595
|
-
getRemoveCosignerInstructionAsync: () => getRemoveCosignerInstructionAsync2,
|
|
5596
|
-
getRemoveCosignerInstructionDataCodec: () => getRemoveCosignerInstructionDataCodec2,
|
|
5597
|
-
getRemoveCosignerInstructionDataDecoder: () => getRemoveCosignerInstructionDataDecoder2,
|
|
5598
|
-
getRemoveCosignerInstructionDataEncoder: () => getRemoveCosignerInstructionDataEncoder2,
|
|
5599
|
-
getSetAuthorityArgsCodec: () => getSetAuthorityArgsCodec2,
|
|
5600
|
-
getSetAuthorityArgsDecoder: () => getSetAuthorityArgsDecoder2,
|
|
5601
|
-
getSetAuthorityArgsEncoder: () => getSetAuthorityArgsEncoder2,
|
|
5602
|
-
getSetAuthorityDiscriminatorBytes: () => getSetAuthorityDiscriminatorBytes2,
|
|
5603
|
-
getSetAuthorityInstruction: () => getSetAuthorityInstruction2,
|
|
5604
|
-
getSetAuthorityInstructionAsync: () => getSetAuthorityInstructionAsync2,
|
|
5605
|
-
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec2,
|
|
5606
|
-
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder2,
|
|
5607
|
-
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder2,
|
|
5608
|
-
identifyDynamicFeeHookAccount: () => identifyDynamicFeeHookAccount,
|
|
5609
|
-
identifyDynamicFeeHookInstruction: () => identifyDynamicFeeHookInstruction,
|
|
5610
|
-
isDynamicFeeHookError: () => isDynamicFeeHookError,
|
|
5611
|
-
isDynamicFeeSchedulePayload: () => isDynamicFeeSchedulePayload,
|
|
5612
|
-
parseAddCosignerInstruction: () => parseAddCosignerInstruction2,
|
|
5613
|
-
parseDynamicFeeHookInstruction: () => parseDynamicFeeHookInstruction,
|
|
5614
|
-
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction4,
|
|
5615
|
-
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction2,
|
|
5616
|
-
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction2,
|
|
5617
|
-
validateDynamicFeeScheduleArgs: () => validateDynamicFeeScheduleArgs
|
|
5665
|
+
// src/solana/migrators/cpmmMigrator/index.ts
|
|
5666
|
+
var cpmmMigrator_exports = {};
|
|
5667
|
+
__export(cpmmMigrator_exports, {
|
|
5668
|
+
CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
|
|
5669
|
+
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
|
|
5670
|
+
CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
|
|
5671
|
+
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
5672
|
+
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
5673
|
+
SEED_STATE: () => SEED_STATE,
|
|
5674
|
+
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
5675
|
+
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
5676
|
+
createSpotPoolInstruction: () => createSpotPoolInstruction,
|
|
5677
|
+
deriveSpotPoolAccounts: () => deriveSpotPoolAccounts,
|
|
5678
|
+
encodeCreateSpotPoolPayload: () => encodeCreateSpotPoolPayload,
|
|
5679
|
+
encodeMigratePayload: () => encodeMigratePayload,
|
|
5680
|
+
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
5681
|
+
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
5682
|
+
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
5683
|
+
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
5684
|
+
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
5685
|
+
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|
|
5686
|
+
getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
|
|
5687
|
+
getCreateSpotPoolArgsCodec: () => getCreateSpotPoolArgsCodec,
|
|
5688
|
+
getCreateSpotPoolArgsDecoder: () => getCreateSpotPoolArgsDecoder,
|
|
5689
|
+
getCreateSpotPoolArgsEncoder: () => getCreateSpotPoolArgsEncoder,
|
|
5690
|
+
getCreateSpotPoolInstruction: () => getCreateSpotPoolInstruction,
|
|
5691
|
+
getCreateSpotPoolInstructionAsync: () => getCreateSpotPoolInstructionAsync,
|
|
5692
|
+
getCreateSpotPoolInstructionDataCodec: () => getCreateSpotPoolInstructionDataCodec,
|
|
5693
|
+
getCreateSpotPoolInstructionDataDecoder: () => getCreateSpotPoolInstructionDataDecoder,
|
|
5694
|
+
getCreateSpotPoolInstructionDataEncoder: () => getCreateSpotPoolInstructionDataEncoder,
|
|
5695
|
+
getMigrateArgsCodec: () => getMigrateArgsCodec,
|
|
5696
|
+
getMigrateArgsDecoder: () => getMigrateArgsDecoder,
|
|
5697
|
+
getMigrateArgsEncoder: () => getMigrateArgsEncoder,
|
|
5698
|
+
getRecipientCodec: () => getRecipientCodec,
|
|
5699
|
+
getRecipientDecoder: () => getRecipientDecoder,
|
|
5700
|
+
getRecipientEncoder: () => getRecipientEncoder,
|
|
5701
|
+
getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
|
|
5702
|
+
getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
|
|
5703
|
+
getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
|
|
5618
5704
|
});
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
183
|
|
5628
|
-
]);
|
|
5629
|
-
function getCosignerConfigDiscriminatorBytes2() {
|
|
5630
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
5631
|
-
COSIGNER_CONFIG_DISCRIMINATOR2
|
|
5632
|
-
);
|
|
5633
|
-
}
|
|
5634
|
-
function getCosignerConfigEncoder2() {
|
|
5635
|
-
return transformEncoder(
|
|
5636
|
-
getStructEncoder([
|
|
5637
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
5638
|
-
["adminAuthority", getAddressEncoder()],
|
|
5639
|
-
["cosignerCount", getU8Encoder()],
|
|
5640
|
-
["bump", getU8Encoder()],
|
|
5641
|
-
["version", getU8Encoder()],
|
|
5642
|
-
["reserved", fixEncoderSize(getBytesEncoder(), 37)],
|
|
5643
|
-
["cosigners", getArrayEncoder(getAddressEncoder(), { size: 32 })]
|
|
5644
|
-
]),
|
|
5645
|
-
(value) => ({ ...value, discriminator: COSIGNER_CONFIG_DISCRIMINATOR2 })
|
|
5646
|
-
);
|
|
5705
|
+
function getCreateSpotPoolArgsEncoder() {
|
|
5706
|
+
return getStructEncoder([
|
|
5707
|
+
["swapFeeBps", getU16Encoder()],
|
|
5708
|
+
["positionId", getU64Encoder()],
|
|
5709
|
+
["amount0Max", getU64Encoder()],
|
|
5710
|
+
["amount1Max", getU64Encoder()],
|
|
5711
|
+
["minSharesOut", getU128Encoder()]
|
|
5712
|
+
]);
|
|
5647
5713
|
}
|
|
5648
|
-
function
|
|
5714
|
+
function getCreateSpotPoolArgsDecoder() {
|
|
5649
5715
|
return getStructDecoder([
|
|
5650
|
-
["
|
|
5651
|
-
["
|
|
5652
|
-
["
|
|
5653
|
-
["
|
|
5654
|
-
["
|
|
5655
|
-
["reserved", fixDecoderSize(getBytesDecoder(), 37)],
|
|
5656
|
-
["cosigners", getArrayDecoder(getAddressDecoder(), { size: 32 })]
|
|
5716
|
+
["swapFeeBps", getU16Decoder()],
|
|
5717
|
+
["positionId", getU64Decoder()],
|
|
5718
|
+
["amount0Max", getU64Decoder()],
|
|
5719
|
+
["amount1Max", getU64Decoder()],
|
|
5720
|
+
["minSharesOut", getU128Decoder()]
|
|
5657
5721
|
]);
|
|
5658
5722
|
}
|
|
5659
|
-
function
|
|
5660
|
-
return combineCodec(
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
return decodeAccount(
|
|
5664
|
-
encodedAccount,
|
|
5665
|
-
getCosignerConfigDecoder2()
|
|
5723
|
+
function getCreateSpotPoolArgsCodec() {
|
|
5724
|
+
return combineCodec(
|
|
5725
|
+
getCreateSpotPoolArgsEncoder(),
|
|
5726
|
+
getCreateSpotPoolArgsDecoder()
|
|
5666
5727
|
);
|
|
5667
5728
|
}
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5729
|
+
function getMigrateArgsEncoder() {
|
|
5730
|
+
return getStructEncoder([
|
|
5731
|
+
["baseForDistribution", getU64Encoder()],
|
|
5732
|
+
["baseForLiquidity", getU64Encoder()]
|
|
5733
|
+
]);
|
|
5672
5734
|
}
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5735
|
+
function getMigrateArgsDecoder() {
|
|
5736
|
+
return getStructDecoder([
|
|
5737
|
+
["baseForDistribution", getU64Decoder()],
|
|
5738
|
+
["baseForLiquidity", getU64Decoder()]
|
|
5739
|
+
]);
|
|
5676
5740
|
}
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
rpc,
|
|
5680
|
-
addresses,
|
|
5681
|
-
config
|
|
5682
|
-
);
|
|
5683
|
-
assertAccountsExist(maybeAccounts);
|
|
5684
|
-
return maybeAccounts;
|
|
5741
|
+
function getMigrateArgsCodec() {
|
|
5742
|
+
return combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
|
|
5685
5743
|
}
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
);
|
|
5744
|
+
function getMigratedPoolHookConfigEncoder() {
|
|
5745
|
+
return getStructEncoder([
|
|
5746
|
+
["hookProgram", getAddressEncoder()],
|
|
5747
|
+
["hookFlags", getU32Encoder()]
|
|
5748
|
+
]);
|
|
5691
5749
|
}
|
|
5692
|
-
function
|
|
5693
|
-
return
|
|
5750
|
+
function getMigratedPoolHookConfigDecoder() {
|
|
5751
|
+
return getStructDecoder([
|
|
5752
|
+
["hookProgram", getAddressDecoder()],
|
|
5753
|
+
["hookFlags", getU32Decoder()]
|
|
5754
|
+
]);
|
|
5694
5755
|
}
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
202,
|
|
5701
|
-
255,
|
|
5702
|
-
218,
|
|
5703
|
-
233
|
|
5704
|
-
]);
|
|
5705
|
-
function getAddCosignerDiscriminatorBytes2() {
|
|
5706
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
5707
|
-
ADD_COSIGNER_DISCRIMINATOR2
|
|
5708
|
-
);
|
|
5756
|
+
function getRecipientEncoder() {
|
|
5757
|
+
return getStructEncoder([
|
|
5758
|
+
["wallet", getAddressEncoder()],
|
|
5759
|
+
["amount", getU64Encoder()]
|
|
5760
|
+
]);
|
|
5709
5761
|
}
|
|
5710
|
-
function
|
|
5711
|
-
return
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
);
|
|
5762
|
+
function getRecipientDecoder() {
|
|
5763
|
+
return getStructDecoder([
|
|
5764
|
+
["wallet", getAddressDecoder()],
|
|
5765
|
+
["amount", getU64Decoder()]
|
|
5766
|
+
]);
|
|
5767
|
+
}
|
|
5768
|
+
function getRecipientCodec() {
|
|
5769
|
+
return combineCodec(getRecipientEncoder(), getRecipientDecoder());
|
|
5770
|
+
}
|
|
5771
|
+
function getRegisterLaunchArgsEncoder() {
|
|
5772
|
+
return getStructEncoder([
|
|
5773
|
+
["cpmmConfig", getAddressEncoder()],
|
|
5774
|
+
["initialSwapFeeBps", getU16Encoder()],
|
|
5775
|
+
["initialFeeSplitBps", getU16Encoder()],
|
|
5776
|
+
["recipients", getArrayEncoder(getRecipientEncoder())],
|
|
5777
|
+
["minRaiseQuote", getU64Encoder()],
|
|
5778
|
+
["minMigrationPriceQ64Opt", getOptionEncoder(getU128Encoder())],
|
|
5779
|
+
[
|
|
5780
|
+
"migratedPoolHookConfig",
|
|
5781
|
+
getOptionEncoder(getMigratedPoolHookConfigEncoder())
|
|
5782
|
+
]
|
|
5783
|
+
]);
|
|
5718
5784
|
}
|
|
5719
|
-
function
|
|
5785
|
+
function getRegisterLaunchArgsDecoder() {
|
|
5720
5786
|
return getStructDecoder([
|
|
5721
|
-
["
|
|
5722
|
-
["
|
|
5787
|
+
["cpmmConfig", getAddressDecoder()],
|
|
5788
|
+
["initialSwapFeeBps", getU16Decoder()],
|
|
5789
|
+
["initialFeeSplitBps", getU16Decoder()],
|
|
5790
|
+
["recipients", getArrayDecoder(getRecipientDecoder())],
|
|
5791
|
+
["minRaiseQuote", getU64Decoder()],
|
|
5792
|
+
["minMigrationPriceQ64Opt", getOptionDecoder(getU128Decoder())],
|
|
5793
|
+
[
|
|
5794
|
+
"migratedPoolHookConfig",
|
|
5795
|
+
getOptionDecoder(getMigratedPoolHookConfigDecoder())
|
|
5796
|
+
]
|
|
5723
5797
|
]);
|
|
5724
5798
|
}
|
|
5725
|
-
function
|
|
5799
|
+
function getRegisterLaunchArgsCodec() {
|
|
5726
5800
|
return combineCodec(
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
);
|
|
5730
|
-
}
|
|
5731
|
-
async function getAddCosignerInstructionAsync2(input, config) {
|
|
5732
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5733
|
-
const originalAccounts = {
|
|
5734
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5735
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
5736
|
-
};
|
|
5737
|
-
const accounts = originalAccounts;
|
|
5738
|
-
const args = { ...input };
|
|
5739
|
-
if (!accounts.config.value) {
|
|
5740
|
-
accounts.config.value = await getProgramDerivedAddress({
|
|
5741
|
-
programAddress,
|
|
5742
|
-
seeds: [
|
|
5743
|
-
getBytesEncoder().encode(
|
|
5744
|
-
new Uint8Array([
|
|
5745
|
-
99,
|
|
5746
|
-
111,
|
|
5747
|
-
115,
|
|
5748
|
-
105,
|
|
5749
|
-
103,
|
|
5750
|
-
110,
|
|
5751
|
-
101,
|
|
5752
|
-
114,
|
|
5753
|
-
95,
|
|
5754
|
-
104,
|
|
5755
|
-
111,
|
|
5756
|
-
111,
|
|
5757
|
-
107,
|
|
5758
|
-
95,
|
|
5759
|
-
99,
|
|
5760
|
-
111,
|
|
5761
|
-
110,
|
|
5762
|
-
102,
|
|
5763
|
-
105,
|
|
5764
|
-
103
|
|
5765
|
-
])
|
|
5766
|
-
)
|
|
5767
|
-
]
|
|
5768
|
-
});
|
|
5769
|
-
}
|
|
5770
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5771
|
-
return Object.freeze({
|
|
5772
|
-
accounts: [
|
|
5773
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5774
|
-
getAccountMeta("config", accounts.config)
|
|
5775
|
-
],
|
|
5776
|
-
data: getAddCosignerInstructionDataEncoder2().encode(
|
|
5777
|
-
args
|
|
5778
|
-
),
|
|
5779
|
-
programAddress
|
|
5780
|
-
});
|
|
5781
|
-
}
|
|
5782
|
-
function getAddCosignerInstruction2(input, config) {
|
|
5783
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5784
|
-
const originalAccounts = {
|
|
5785
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5786
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
5787
|
-
};
|
|
5788
|
-
const accounts = originalAccounts;
|
|
5789
|
-
const args = { ...input };
|
|
5790
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5791
|
-
return Object.freeze({
|
|
5792
|
-
accounts: [
|
|
5793
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5794
|
-
getAccountMeta("config", accounts.config)
|
|
5795
|
-
],
|
|
5796
|
-
data: getAddCosignerInstructionDataEncoder2().encode(
|
|
5797
|
-
args
|
|
5798
|
-
),
|
|
5799
|
-
programAddress
|
|
5800
|
-
});
|
|
5801
|
-
}
|
|
5802
|
-
function parseAddCosignerInstruction2(instruction) {
|
|
5803
|
-
if (instruction.accounts.length < 2) {
|
|
5804
|
-
throw new SolanaError(
|
|
5805
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
5806
|
-
{
|
|
5807
|
-
actualAccountMetas: instruction.accounts.length,
|
|
5808
|
-
expectedAccountMetas: 2
|
|
5809
|
-
}
|
|
5810
|
-
);
|
|
5811
|
-
}
|
|
5812
|
-
let accountIndex = 0;
|
|
5813
|
-
const getNextAccount = () => {
|
|
5814
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
5815
|
-
accountIndex += 1;
|
|
5816
|
-
return accountMeta;
|
|
5817
|
-
};
|
|
5818
|
-
return {
|
|
5819
|
-
programAddress: instruction.programAddress,
|
|
5820
|
-
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
5821
|
-
data: getAddCosignerInstructionDataDecoder2().decode(instruction.data)
|
|
5822
|
-
};
|
|
5823
|
-
}
|
|
5824
|
-
var INITIALIZE_CONFIG_DISCRIMINATOR4 = new Uint8Array([
|
|
5825
|
-
208,
|
|
5826
|
-
127,
|
|
5827
|
-
21,
|
|
5828
|
-
1,
|
|
5829
|
-
194,
|
|
5830
|
-
190,
|
|
5831
|
-
196,
|
|
5832
|
-
70
|
|
5833
|
-
]);
|
|
5834
|
-
function getInitializeConfigDiscriminatorBytes3() {
|
|
5835
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
5836
|
-
INITIALIZE_CONFIG_DISCRIMINATOR4
|
|
5837
|
-
);
|
|
5838
|
-
}
|
|
5839
|
-
function getInitializeConfigInstructionDataEncoder4() {
|
|
5840
|
-
return transformEncoder(
|
|
5841
|
-
getStructEncoder([
|
|
5842
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
5843
|
-
["cosigners", getArrayEncoder(getAddressEncoder())]
|
|
5844
|
-
]),
|
|
5845
|
-
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR4 })
|
|
5846
|
-
);
|
|
5847
|
-
}
|
|
5848
|
-
function getInitializeConfigInstructionDataDecoder3() {
|
|
5849
|
-
return getStructDecoder([
|
|
5850
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
5851
|
-
["cosigners", getArrayDecoder(getAddressDecoder())]
|
|
5852
|
-
]);
|
|
5853
|
-
}
|
|
5854
|
-
function getInitializeConfigInstructionDataCodec3() {
|
|
5855
|
-
return combineCodec(
|
|
5856
|
-
getInitializeConfigInstructionDataEncoder4(),
|
|
5857
|
-
getInitializeConfigInstructionDataDecoder3()
|
|
5858
|
-
);
|
|
5859
|
-
}
|
|
5860
|
-
async function getInitializeConfigInstructionAsync4(input, config) {
|
|
5861
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5862
|
-
const originalAccounts = {
|
|
5863
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
5864
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5865
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
5866
|
-
programData: { value: input.programData ?? null, isWritable: false },
|
|
5867
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
5868
|
-
};
|
|
5869
|
-
const accounts = originalAccounts;
|
|
5870
|
-
const args = { ...input };
|
|
5871
|
-
if (!accounts.config.value) {
|
|
5872
|
-
accounts.config.value = await getProgramDerivedAddress({
|
|
5873
|
-
programAddress,
|
|
5874
|
-
seeds: [
|
|
5875
|
-
getBytesEncoder().encode(
|
|
5876
|
-
new Uint8Array([
|
|
5877
|
-
99,
|
|
5878
|
-
111,
|
|
5879
|
-
115,
|
|
5880
|
-
105,
|
|
5881
|
-
103,
|
|
5882
|
-
110,
|
|
5883
|
-
101,
|
|
5884
|
-
114,
|
|
5885
|
-
95,
|
|
5886
|
-
104,
|
|
5887
|
-
111,
|
|
5888
|
-
111,
|
|
5889
|
-
107,
|
|
5890
|
-
95,
|
|
5891
|
-
99,
|
|
5892
|
-
111,
|
|
5893
|
-
110,
|
|
5894
|
-
102,
|
|
5895
|
-
105,
|
|
5896
|
-
103
|
|
5897
|
-
])
|
|
5898
|
-
)
|
|
5899
|
-
]
|
|
5900
|
-
});
|
|
5901
|
-
}
|
|
5902
|
-
if (!accounts.systemProgram.value) {
|
|
5903
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5904
|
-
}
|
|
5905
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5906
|
-
return Object.freeze({
|
|
5907
|
-
accounts: [
|
|
5908
|
-
getAccountMeta("payer", accounts.payer),
|
|
5909
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5910
|
-
getAccountMeta("config", accounts.config),
|
|
5911
|
-
getAccountMeta("programData", accounts.programData),
|
|
5912
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
5913
|
-
],
|
|
5914
|
-
data: getInitializeConfigInstructionDataEncoder4().encode(
|
|
5915
|
-
args
|
|
5916
|
-
),
|
|
5917
|
-
programAddress
|
|
5918
|
-
});
|
|
5919
|
-
}
|
|
5920
|
-
function getInitializeConfigInstruction3(input, config) {
|
|
5921
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5922
|
-
const originalAccounts = {
|
|
5923
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
5924
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5925
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
5926
|
-
programData: { value: input.programData ?? null, isWritable: false },
|
|
5927
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
5928
|
-
};
|
|
5929
|
-
const accounts = originalAccounts;
|
|
5930
|
-
const args = { ...input };
|
|
5931
|
-
if (!accounts.systemProgram.value) {
|
|
5932
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5933
|
-
}
|
|
5934
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5935
|
-
return Object.freeze({
|
|
5936
|
-
accounts: [
|
|
5937
|
-
getAccountMeta("payer", accounts.payer),
|
|
5938
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5939
|
-
getAccountMeta("config", accounts.config),
|
|
5940
|
-
getAccountMeta("programData", accounts.programData),
|
|
5941
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
5942
|
-
],
|
|
5943
|
-
data: getInitializeConfigInstructionDataEncoder4().encode(
|
|
5944
|
-
args
|
|
5945
|
-
),
|
|
5946
|
-
programAddress
|
|
5947
|
-
});
|
|
5948
|
-
}
|
|
5949
|
-
function parseInitializeConfigInstruction4(instruction) {
|
|
5950
|
-
if (instruction.accounts.length < 5) {
|
|
5951
|
-
throw new SolanaError(
|
|
5952
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
5953
|
-
{
|
|
5954
|
-
actualAccountMetas: instruction.accounts.length,
|
|
5955
|
-
expectedAccountMetas: 5
|
|
5956
|
-
}
|
|
5957
|
-
);
|
|
5958
|
-
}
|
|
5959
|
-
let accountIndex = 0;
|
|
5960
|
-
const getNextAccount = () => {
|
|
5961
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
5962
|
-
accountIndex += 1;
|
|
5963
|
-
return accountMeta;
|
|
5964
|
-
};
|
|
5965
|
-
return {
|
|
5966
|
-
programAddress: instruction.programAddress,
|
|
5967
|
-
accounts: {
|
|
5968
|
-
payer: getNextAccount(),
|
|
5969
|
-
adminAuthority: getNextAccount(),
|
|
5970
|
-
config: getNextAccount(),
|
|
5971
|
-
programData: getNextAccount(),
|
|
5972
|
-
systemProgram: getNextAccount()
|
|
5973
|
-
},
|
|
5974
|
-
data: getInitializeConfigInstructionDataDecoder3().decode(instruction.data)
|
|
5975
|
-
};
|
|
5976
|
-
}
|
|
5977
|
-
var REMOVE_COSIGNER_DISCRIMINATOR2 = new Uint8Array([
|
|
5978
|
-
174,
|
|
5979
|
-
11,
|
|
5980
|
-
171,
|
|
5981
|
-
252,
|
|
5982
|
-
179,
|
|
5983
|
-
99,
|
|
5984
|
-
220,
|
|
5985
|
-
27
|
|
5986
|
-
]);
|
|
5987
|
-
function getRemoveCosignerDiscriminatorBytes2() {
|
|
5988
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
5989
|
-
REMOVE_COSIGNER_DISCRIMINATOR2
|
|
5990
|
-
);
|
|
5991
|
-
}
|
|
5992
|
-
function getRemoveCosignerInstructionDataEncoder2() {
|
|
5993
|
-
return transformEncoder(
|
|
5994
|
-
getStructEncoder([
|
|
5995
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
5996
|
-
["cosigner", getAddressEncoder()]
|
|
5997
|
-
]),
|
|
5998
|
-
(value) => ({ ...value, discriminator: REMOVE_COSIGNER_DISCRIMINATOR2 })
|
|
5999
|
-
);
|
|
6000
|
-
}
|
|
6001
|
-
function getRemoveCosignerInstructionDataDecoder2() {
|
|
6002
|
-
return getStructDecoder([
|
|
6003
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
6004
|
-
["cosigner", getAddressDecoder()]
|
|
6005
|
-
]);
|
|
6006
|
-
}
|
|
6007
|
-
function getRemoveCosignerInstructionDataCodec2() {
|
|
6008
|
-
return combineCodec(
|
|
6009
|
-
getRemoveCosignerInstructionDataEncoder2(),
|
|
6010
|
-
getRemoveCosignerInstructionDataDecoder2()
|
|
6011
|
-
);
|
|
6012
|
-
}
|
|
6013
|
-
async function getRemoveCosignerInstructionAsync2(input, config) {
|
|
6014
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6015
|
-
const originalAccounts = {
|
|
6016
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6017
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
6018
|
-
};
|
|
6019
|
-
const accounts = originalAccounts;
|
|
6020
|
-
const args = { ...input };
|
|
6021
|
-
if (!accounts.config.value) {
|
|
6022
|
-
accounts.config.value = await getProgramDerivedAddress({
|
|
6023
|
-
programAddress,
|
|
6024
|
-
seeds: [
|
|
6025
|
-
getBytesEncoder().encode(
|
|
6026
|
-
new Uint8Array([
|
|
6027
|
-
99,
|
|
6028
|
-
111,
|
|
6029
|
-
115,
|
|
6030
|
-
105,
|
|
6031
|
-
103,
|
|
6032
|
-
110,
|
|
6033
|
-
101,
|
|
6034
|
-
114,
|
|
6035
|
-
95,
|
|
6036
|
-
104,
|
|
6037
|
-
111,
|
|
6038
|
-
111,
|
|
6039
|
-
107,
|
|
6040
|
-
95,
|
|
6041
|
-
99,
|
|
6042
|
-
111,
|
|
6043
|
-
110,
|
|
6044
|
-
102,
|
|
6045
|
-
105,
|
|
6046
|
-
103
|
|
6047
|
-
])
|
|
6048
|
-
)
|
|
6049
|
-
]
|
|
6050
|
-
});
|
|
6051
|
-
}
|
|
6052
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6053
|
-
return Object.freeze({
|
|
6054
|
-
accounts: [
|
|
6055
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6056
|
-
getAccountMeta("config", accounts.config)
|
|
6057
|
-
],
|
|
6058
|
-
data: getRemoveCosignerInstructionDataEncoder2().encode(
|
|
6059
|
-
args
|
|
6060
|
-
),
|
|
6061
|
-
programAddress
|
|
6062
|
-
});
|
|
6063
|
-
}
|
|
6064
|
-
function getRemoveCosignerInstruction2(input, config) {
|
|
6065
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6066
|
-
const originalAccounts = {
|
|
6067
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6068
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
6069
|
-
};
|
|
6070
|
-
const accounts = originalAccounts;
|
|
6071
|
-
const args = { ...input };
|
|
6072
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6073
|
-
return Object.freeze({
|
|
6074
|
-
accounts: [
|
|
6075
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6076
|
-
getAccountMeta("config", accounts.config)
|
|
6077
|
-
],
|
|
6078
|
-
data: getRemoveCosignerInstructionDataEncoder2().encode(
|
|
6079
|
-
args
|
|
6080
|
-
),
|
|
6081
|
-
programAddress
|
|
6082
|
-
});
|
|
6083
|
-
}
|
|
6084
|
-
function parseRemoveCosignerInstruction2(instruction) {
|
|
6085
|
-
if (instruction.accounts.length < 2) {
|
|
6086
|
-
throw new SolanaError(
|
|
6087
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
6088
|
-
{
|
|
6089
|
-
actualAccountMetas: instruction.accounts.length,
|
|
6090
|
-
expectedAccountMetas: 2
|
|
6091
|
-
}
|
|
6092
|
-
);
|
|
6093
|
-
}
|
|
6094
|
-
let accountIndex = 0;
|
|
6095
|
-
const getNextAccount = () => {
|
|
6096
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
6097
|
-
accountIndex += 1;
|
|
6098
|
-
return accountMeta;
|
|
6099
|
-
};
|
|
6100
|
-
return {
|
|
6101
|
-
programAddress: instruction.programAddress,
|
|
6102
|
-
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
6103
|
-
data: getRemoveCosignerInstructionDataDecoder2().decode(instruction.data)
|
|
6104
|
-
};
|
|
6105
|
-
}
|
|
6106
|
-
var SET_AUTHORITY_DISCRIMINATOR2 = new Uint8Array([
|
|
6107
|
-
133,
|
|
6108
|
-
250,
|
|
6109
|
-
37,
|
|
6110
|
-
21,
|
|
6111
|
-
110,
|
|
6112
|
-
163,
|
|
6113
|
-
26,
|
|
6114
|
-
121
|
|
6115
|
-
]);
|
|
6116
|
-
function getSetAuthorityDiscriminatorBytes2() {
|
|
6117
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
6118
|
-
SET_AUTHORITY_DISCRIMINATOR2
|
|
6119
|
-
);
|
|
6120
|
-
}
|
|
6121
|
-
function getSetAuthorityInstructionDataEncoder2() {
|
|
6122
|
-
return transformEncoder(
|
|
6123
|
-
getStructEncoder([
|
|
6124
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
6125
|
-
["adminAuthority", getAddressEncoder()]
|
|
6126
|
-
]),
|
|
6127
|
-
(value) => ({ ...value, discriminator: SET_AUTHORITY_DISCRIMINATOR2 })
|
|
6128
|
-
);
|
|
6129
|
-
}
|
|
6130
|
-
function getSetAuthorityInstructionDataDecoder2() {
|
|
6131
|
-
return getStructDecoder([
|
|
6132
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
6133
|
-
["adminAuthority", getAddressDecoder()]
|
|
6134
|
-
]);
|
|
6135
|
-
}
|
|
6136
|
-
function getSetAuthorityInstructionDataCodec2() {
|
|
6137
|
-
return combineCodec(
|
|
6138
|
-
getSetAuthorityInstructionDataEncoder2(),
|
|
6139
|
-
getSetAuthorityInstructionDataDecoder2()
|
|
6140
|
-
);
|
|
6141
|
-
}
|
|
6142
|
-
async function getSetAuthorityInstructionAsync2(input, config) {
|
|
6143
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6144
|
-
const originalAccounts = {
|
|
6145
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6146
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
6147
|
-
};
|
|
6148
|
-
const accounts = originalAccounts;
|
|
6149
|
-
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
6150
|
-
if (!accounts.config.value) {
|
|
6151
|
-
accounts.config.value = await getProgramDerivedAddress({
|
|
6152
|
-
programAddress,
|
|
6153
|
-
seeds: [
|
|
6154
|
-
getBytesEncoder().encode(
|
|
6155
|
-
new Uint8Array([
|
|
6156
|
-
99,
|
|
6157
|
-
111,
|
|
6158
|
-
115,
|
|
6159
|
-
105,
|
|
6160
|
-
103,
|
|
6161
|
-
110,
|
|
6162
|
-
101,
|
|
6163
|
-
114,
|
|
6164
|
-
95,
|
|
6165
|
-
104,
|
|
6166
|
-
111,
|
|
6167
|
-
111,
|
|
6168
|
-
107,
|
|
6169
|
-
95,
|
|
6170
|
-
99,
|
|
6171
|
-
111,
|
|
6172
|
-
110,
|
|
6173
|
-
102,
|
|
6174
|
-
105,
|
|
6175
|
-
103
|
|
6176
|
-
])
|
|
6177
|
-
)
|
|
6178
|
-
]
|
|
6179
|
-
});
|
|
6180
|
-
}
|
|
6181
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6182
|
-
return Object.freeze({
|
|
6183
|
-
accounts: [
|
|
6184
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6185
|
-
getAccountMeta("config", accounts.config)
|
|
6186
|
-
],
|
|
6187
|
-
data: getSetAuthorityInstructionDataEncoder2().encode(
|
|
6188
|
-
args
|
|
6189
|
-
),
|
|
6190
|
-
programAddress
|
|
6191
|
-
});
|
|
6192
|
-
}
|
|
6193
|
-
function getSetAuthorityInstruction2(input, config) {
|
|
6194
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6195
|
-
const originalAccounts = {
|
|
6196
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6197
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
6198
|
-
};
|
|
6199
|
-
const accounts = originalAccounts;
|
|
6200
|
-
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
6201
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6202
|
-
return Object.freeze({
|
|
6203
|
-
accounts: [
|
|
6204
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6205
|
-
getAccountMeta("config", accounts.config)
|
|
6206
|
-
],
|
|
6207
|
-
data: getSetAuthorityInstructionDataEncoder2().encode(
|
|
6208
|
-
args
|
|
6209
|
-
),
|
|
6210
|
-
programAddress
|
|
6211
|
-
});
|
|
6212
|
-
}
|
|
6213
|
-
function parseSetAuthorityInstruction2(instruction) {
|
|
6214
|
-
if (instruction.accounts.length < 2) {
|
|
6215
|
-
throw new SolanaError(
|
|
6216
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
6217
|
-
{
|
|
6218
|
-
actualAccountMetas: instruction.accounts.length,
|
|
6219
|
-
expectedAccountMetas: 2
|
|
6220
|
-
}
|
|
6221
|
-
);
|
|
6222
|
-
}
|
|
6223
|
-
let accountIndex = 0;
|
|
6224
|
-
const getNextAccount = () => {
|
|
6225
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
6226
|
-
accountIndex += 1;
|
|
6227
|
-
return accountMeta;
|
|
6228
|
-
};
|
|
6229
|
-
return {
|
|
6230
|
-
programAddress: instruction.programAddress,
|
|
6231
|
-
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
6232
|
-
data: getSetAuthorityInstructionDataDecoder2().decode(instruction.data)
|
|
6233
|
-
};
|
|
6234
|
-
}
|
|
6235
|
-
|
|
6236
|
-
// src/solana/generated/dynamicFeeHook/programs/dynamicFeeHook.ts
|
|
6237
|
-
var DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS = "HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i";
|
|
6238
|
-
var DynamicFeeHookAccount = /* @__PURE__ */ ((DynamicFeeHookAccount2) => {
|
|
6239
|
-
DynamicFeeHookAccount2[DynamicFeeHookAccount2["CosignerConfig"] = 0] = "CosignerConfig";
|
|
6240
|
-
return DynamicFeeHookAccount2;
|
|
6241
|
-
})(DynamicFeeHookAccount || {});
|
|
6242
|
-
function identifyDynamicFeeHookAccount(account) {
|
|
6243
|
-
const data = "data" in account ? account.data : account;
|
|
6244
|
-
if (containsBytes(
|
|
6245
|
-
data,
|
|
6246
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
6247
|
-
new Uint8Array([133, 227, 177, 74, 145, 74, 247, 183])
|
|
6248
|
-
),
|
|
6249
|
-
0
|
|
6250
|
-
)) {
|
|
6251
|
-
return 0 /* CosignerConfig */;
|
|
6252
|
-
}
|
|
6253
|
-
throw new SolanaError(
|
|
6254
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
6255
|
-
{ accountData: data, programName: "dynamicFeeHook" }
|
|
6256
|
-
);
|
|
6257
|
-
}
|
|
6258
|
-
var DynamicFeeHookInstruction = /* @__PURE__ */ ((DynamicFeeHookInstruction2) => {
|
|
6259
|
-
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["AddCosigner"] = 0] = "AddCosigner";
|
|
6260
|
-
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["InitializeConfig"] = 1] = "InitializeConfig";
|
|
6261
|
-
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
|
|
6262
|
-
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["SetAuthority"] = 3] = "SetAuthority";
|
|
6263
|
-
return DynamicFeeHookInstruction2;
|
|
6264
|
-
})(DynamicFeeHookInstruction || {});
|
|
6265
|
-
function identifyDynamicFeeHookInstruction(instruction) {
|
|
6266
|
-
const data = "data" in instruction ? instruction.data : instruction;
|
|
6267
|
-
if (containsBytes(
|
|
6268
|
-
data,
|
|
6269
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
6270
|
-
new Uint8Array([17, 34, 183, 119, 202, 255, 218, 233])
|
|
6271
|
-
),
|
|
6272
|
-
0
|
|
6273
|
-
)) {
|
|
6274
|
-
return 0 /* AddCosigner */;
|
|
6275
|
-
}
|
|
6276
|
-
if (containsBytes(
|
|
6277
|
-
data,
|
|
6278
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
6279
|
-
new Uint8Array([208, 127, 21, 1, 194, 190, 196, 70])
|
|
6280
|
-
),
|
|
6281
|
-
0
|
|
6282
|
-
)) {
|
|
6283
|
-
return 1 /* InitializeConfig */;
|
|
6284
|
-
}
|
|
6285
|
-
if (containsBytes(
|
|
6286
|
-
data,
|
|
6287
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
6288
|
-
new Uint8Array([174, 11, 171, 252, 179, 99, 220, 27])
|
|
6289
|
-
),
|
|
6290
|
-
0
|
|
6291
|
-
)) {
|
|
6292
|
-
return 2 /* RemoveCosigner */;
|
|
6293
|
-
}
|
|
6294
|
-
if (containsBytes(
|
|
6295
|
-
data,
|
|
6296
|
-
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
6297
|
-
new Uint8Array([133, 250, 37, 21, 110, 163, 26, 121])
|
|
6298
|
-
),
|
|
6299
|
-
0
|
|
6300
|
-
)) {
|
|
6301
|
-
return 3 /* SetAuthority */;
|
|
6302
|
-
}
|
|
6303
|
-
throw new SolanaError(
|
|
6304
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
6305
|
-
{ instructionData: data, programName: "dynamicFeeHook" }
|
|
6306
|
-
);
|
|
6307
|
-
}
|
|
6308
|
-
function parseDynamicFeeHookInstruction(instruction) {
|
|
6309
|
-
const instructionType = identifyDynamicFeeHookInstruction(instruction);
|
|
6310
|
-
switch (instructionType) {
|
|
6311
|
-
case 0 /* AddCosigner */: {
|
|
6312
|
-
assertIsInstructionWithAccounts(instruction);
|
|
6313
|
-
return {
|
|
6314
|
-
instructionType: 0 /* AddCosigner */,
|
|
6315
|
-
...parseAddCosignerInstruction2(instruction)
|
|
6316
|
-
};
|
|
6317
|
-
}
|
|
6318
|
-
case 1 /* InitializeConfig */: {
|
|
6319
|
-
assertIsInstructionWithAccounts(instruction);
|
|
6320
|
-
return {
|
|
6321
|
-
instructionType: 1 /* InitializeConfig */,
|
|
6322
|
-
...parseInitializeConfigInstruction4(instruction)
|
|
6323
|
-
};
|
|
6324
|
-
}
|
|
6325
|
-
case 2 /* RemoveCosigner */: {
|
|
6326
|
-
assertIsInstructionWithAccounts(instruction);
|
|
6327
|
-
return {
|
|
6328
|
-
instructionType: 2 /* RemoveCosigner */,
|
|
6329
|
-
...parseRemoveCosignerInstruction2(instruction)
|
|
6330
|
-
};
|
|
6331
|
-
}
|
|
6332
|
-
case 3 /* SetAuthority */: {
|
|
6333
|
-
assertIsInstructionWithAccounts(instruction);
|
|
6334
|
-
return {
|
|
6335
|
-
instructionType: 3 /* SetAuthority */,
|
|
6336
|
-
...parseSetAuthorityInstruction2(instruction)
|
|
6337
|
-
};
|
|
6338
|
-
}
|
|
6339
|
-
default:
|
|
6340
|
-
throw new SolanaError(
|
|
6341
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
6342
|
-
{
|
|
6343
|
-
instructionType,
|
|
6344
|
-
programName: "dynamicFeeHook"
|
|
6345
|
-
}
|
|
6346
|
-
);
|
|
6347
|
-
}
|
|
6348
|
-
}
|
|
6349
|
-
function dynamicFeeHookProgram() {
|
|
6350
|
-
return (client) => {
|
|
6351
|
-
return {
|
|
6352
|
-
...client,
|
|
6353
|
-
dynamicFeeHook: {
|
|
6354
|
-
accounts: {
|
|
6355
|
-
cosignerConfig: addSelfFetchFunctions(
|
|
6356
|
-
client,
|
|
6357
|
-
getCosignerConfigCodec2()
|
|
6358
|
-
)
|
|
6359
|
-
},
|
|
6360
|
-
instructions: {
|
|
6361
|
-
addCosigner: (input) => addSelfPlanAndSendFunctions(
|
|
6362
|
-
client,
|
|
6363
|
-
getAddCosignerInstructionAsync2(input)
|
|
6364
|
-
),
|
|
6365
|
-
initializeConfig: (input) => addSelfPlanAndSendFunctions(
|
|
6366
|
-
client,
|
|
6367
|
-
getInitializeConfigInstructionAsync4({
|
|
6368
|
-
...input,
|
|
6369
|
-
payer: input.payer ?? client.payer
|
|
6370
|
-
})
|
|
6371
|
-
),
|
|
6372
|
-
removeCosigner: (input) => addSelfPlanAndSendFunctions(
|
|
6373
|
-
client,
|
|
6374
|
-
getRemoveCosignerInstructionAsync2(input)
|
|
6375
|
-
),
|
|
6376
|
-
setAuthority: (input) => addSelfPlanAndSendFunctions(
|
|
6377
|
-
client,
|
|
6378
|
-
getSetAuthorityInstructionAsync2(input)
|
|
6379
|
-
)
|
|
6380
|
-
}
|
|
6381
|
-
}
|
|
6382
|
-
};
|
|
6383
|
-
};
|
|
6384
|
-
}
|
|
6385
|
-
|
|
6386
|
-
// src/solana/generated/dynamicFeeHook/errors/dynamicFeeHook.ts
|
|
6387
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_INSTRUCTION_DATA = 6e3;
|
|
6388
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_SCHEDULE_DATA = 6001;
|
|
6389
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_FEE = 6002;
|
|
6390
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_DURATION = 6003;
|
|
6391
|
-
var DYNAMIC_FEE_HOOK_ERROR__ARITHMETIC_OVERFLOW = 6004;
|
|
6392
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_AUTHORITY = 6005;
|
|
6393
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_CONFIG = 6006;
|
|
6394
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_COSIGNER = 6007;
|
|
6395
|
-
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_ALREADY_EXISTS = 6008;
|
|
6396
|
-
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_NOT_FOUND = 6009;
|
|
6397
|
-
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_LIST_FULL = 6010;
|
|
6398
|
-
var dynamicFeeHookErrorMessages;
|
|
6399
|
-
if (process.env.NODE_ENV !== "production") {
|
|
6400
|
-
dynamicFeeHookErrorMessages = {
|
|
6401
|
-
[DYNAMIC_FEE_HOOK_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
6402
|
-
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_ALREADY_EXISTS]: `Cosigner already exists`,
|
|
6403
|
-
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
|
|
6404
|
-
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
|
|
6405
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
|
|
6406
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_CONFIG]: `Invalid cosigner hook config`,
|
|
6407
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_COSIGNER]: `Invalid cosigner key`,
|
|
6408
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_DURATION]: `Invalid fee duration`,
|
|
6409
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_FEE]: `Invalid fee`,
|
|
6410
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
|
|
6411
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_SCHEDULE_DATA]: `Invalid schedule payload`
|
|
6412
|
-
};
|
|
6413
|
-
}
|
|
6414
|
-
function getDynamicFeeHookErrorMessage(code) {
|
|
6415
|
-
if (process.env.NODE_ENV !== "production") {
|
|
6416
|
-
return dynamicFeeHookErrorMessages[code];
|
|
6417
|
-
}
|
|
6418
|
-
return "Error message not available in production bundles.";
|
|
6419
|
-
}
|
|
6420
|
-
function isDynamicFeeHookError(error, transactionMessage, code) {
|
|
6421
|
-
return isProgramError(
|
|
6422
|
-
error,
|
|
6423
|
-
transactionMessage,
|
|
6424
|
-
DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS,
|
|
6425
|
-
code
|
|
6426
|
-
);
|
|
6427
|
-
}
|
|
6428
|
-
function getCosignerArgEncoder2() {
|
|
6429
|
-
return getStructEncoder([["cosigner", getAddressEncoder()]]);
|
|
6430
|
-
}
|
|
6431
|
-
function getCosignerArgDecoder2() {
|
|
6432
|
-
return getStructDecoder([["cosigner", getAddressDecoder()]]);
|
|
6433
|
-
}
|
|
6434
|
-
function getCosignerArgCodec2() {
|
|
6435
|
-
return combineCodec(getCosignerArgEncoder2(), getCosignerArgDecoder2());
|
|
6436
|
-
}
|
|
6437
|
-
function getInitializeConfigArgsEncoder3() {
|
|
6438
|
-
return getStructEncoder([
|
|
6439
|
-
["cosigners", getArrayEncoder(getAddressEncoder())]
|
|
6440
|
-
]);
|
|
6441
|
-
}
|
|
6442
|
-
function getInitializeConfigArgsDecoder3() {
|
|
6443
|
-
return getStructDecoder([
|
|
6444
|
-
["cosigners", getArrayDecoder(getAddressDecoder())]
|
|
6445
|
-
]);
|
|
6446
|
-
}
|
|
6447
|
-
function getInitializeConfigArgsCodec3() {
|
|
6448
|
-
return combineCodec(
|
|
6449
|
-
getInitializeConfigArgsEncoder3(),
|
|
6450
|
-
getInitializeConfigArgsDecoder3()
|
|
6451
|
-
);
|
|
6452
|
-
}
|
|
6453
|
-
function getSetAuthorityArgsEncoder2() {
|
|
6454
|
-
return getStructEncoder([["adminAuthority", getAddressEncoder()]]);
|
|
6455
|
-
}
|
|
6456
|
-
function getSetAuthorityArgsDecoder2() {
|
|
6457
|
-
return getStructDecoder([["adminAuthority", getAddressDecoder()]]);
|
|
6458
|
-
}
|
|
6459
|
-
function getSetAuthorityArgsCodec2() {
|
|
6460
|
-
return combineCodec(
|
|
6461
|
-
getSetAuthorityArgsEncoder2(),
|
|
6462
|
-
getSetAuthorityArgsDecoder2()
|
|
6463
|
-
);
|
|
6464
|
-
}
|
|
6465
|
-
var DEVNET_DYNAMIC_FEE_HOOK_PROGRAM_ID = address(
|
|
6466
|
-
"HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i"
|
|
6467
|
-
);
|
|
6468
|
-
var DYNAMIC_FEE_HOOK_PROGRAM_ID = DEVNET_DYNAMIC_FEE_HOOK_PROGRAM_ID;
|
|
6469
|
-
var SEED_DYNAMIC_FEE_HOOK_CONFIG = "cosigner_hook_config";
|
|
6470
|
-
var MAX_COSIGNERS2 = 32;
|
|
6471
|
-
var DYNAMIC_FEE_SCHEDULE_MAGIC = new Uint8Array([
|
|
6472
|
-
68,
|
|
6473
|
-
70,
|
|
6474
|
-
69,
|
|
6475
|
-
69,
|
|
6476
|
-
86,
|
|
6477
|
-
49,
|
|
6478
|
-
95,
|
|
6479
|
-
95
|
|
6480
|
-
]);
|
|
6481
|
-
var DYNAMIC_FEE_SCHEDULE_VERSION = 1;
|
|
6482
|
-
var DYNAMIC_FEE_SCHEDULE_LEN = 32;
|
|
6483
|
-
var DYNAMIC_FEE_SCHEDULE_HEADER_LEN = 16;
|
|
6484
|
-
var DYNAMIC_FEE_SCHEDULE_MAX_BPS = 1e4;
|
|
6485
|
-
|
|
6486
|
-
// src/solana/dynamicFeeHook/payload.ts
|
|
6487
|
-
var MAX_I64 = (1n << 63n) - 1n;
|
|
6488
|
-
var MAX_U32 = (1n << 32n) - 1n;
|
|
6489
|
-
function toBigInt2(value) {
|
|
6490
|
-
return typeof value === "bigint" ? value : BigInt(value);
|
|
6491
|
-
}
|
|
6492
|
-
function assertU16Bps(label, value) {
|
|
6493
|
-
if (!Number.isInteger(value) || value < 0 || value > DYNAMIC_FEE_SCHEDULE_MAX_BPS) {
|
|
6494
|
-
throw new Error(`${label} must be an integer between 0 and 10000`);
|
|
6495
|
-
}
|
|
6496
|
-
}
|
|
6497
|
-
function writeI64Le(bytes, offset, value) {
|
|
6498
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6499
|
-
view.setBigInt64(offset, value, true);
|
|
6500
|
-
}
|
|
6501
|
-
function writeU16Le(bytes, offset, value) {
|
|
6502
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6503
|
-
view.setUint16(offset, value, true);
|
|
6504
|
-
}
|
|
6505
|
-
function writeU32Le(bytes, offset, value) {
|
|
6506
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6507
|
-
view.setUint32(offset, Number(value), true);
|
|
6508
|
-
}
|
|
6509
|
-
function validateDynamicFeeScheduleArgs(schedule) {
|
|
6510
|
-
const startingTime = toBigInt2(schedule.startingTime);
|
|
6511
|
-
if (startingTime < 0n || startingTime > MAX_I64) {
|
|
6512
|
-
throw new Error("startingTime must be between 0 and i64::MAX");
|
|
6513
|
-
}
|
|
6514
|
-
assertU16Bps("startFeeBps", schedule.startFeeBps);
|
|
6515
|
-
assertU16Bps("endFeeBps", schedule.endFeeBps);
|
|
6516
|
-
if (schedule.endFeeBps > schedule.startFeeBps) {
|
|
6517
|
-
throw new Error("endFeeBps must be less than or equal to startFeeBps");
|
|
6518
|
-
}
|
|
6519
|
-
const durationSeconds = toBigInt2(schedule.durationSeconds);
|
|
6520
|
-
if (durationSeconds < 0n || durationSeconds > MAX_U32) {
|
|
6521
|
-
throw new Error("durationSeconds must be between 0 and u32::MAX");
|
|
6522
|
-
}
|
|
6523
|
-
if (schedule.startFeeBps > schedule.endFeeBps && durationSeconds === 0n) {
|
|
6524
|
-
throw new Error("durationSeconds must be nonzero for decaying schedules");
|
|
6525
|
-
}
|
|
6526
|
-
return { startingTime, durationSeconds };
|
|
6527
|
-
}
|
|
6528
|
-
function encodeDynamicFeeSchedule(schedule) {
|
|
6529
|
-
const { startingTime, durationSeconds } = validateDynamicFeeScheduleArgs(schedule);
|
|
6530
|
-
const payload = new Uint8Array(DYNAMIC_FEE_SCHEDULE_LEN);
|
|
6531
|
-
payload.set(DYNAMIC_FEE_SCHEDULE_MAGIC, 0);
|
|
6532
|
-
payload[8] = DYNAMIC_FEE_SCHEDULE_VERSION;
|
|
6533
|
-
writeI64Le(payload, DYNAMIC_FEE_SCHEDULE_HEADER_LEN, startingTime);
|
|
6534
|
-
writeU16Le(payload, 24, schedule.startFeeBps);
|
|
6535
|
-
writeU16Le(payload, 26, schedule.endFeeBps);
|
|
6536
|
-
writeU32Le(payload, 28, durationSeconds);
|
|
6537
|
-
return payload;
|
|
6538
|
-
}
|
|
6539
|
-
function encodeDynamicFeeHookPayload(args = {}) {
|
|
6540
|
-
const schedulePayload = args.schedule ? encodeDynamicFeeSchedule(args.schedule) : new Uint8Array();
|
|
6541
|
-
const gatePayload = args.gateExpiry ? encodeCosignerGateExpiryPayload(args.gateExpiry) : new Uint8Array();
|
|
6542
|
-
const payload = new Uint8Array(schedulePayload.length + gatePayload.length);
|
|
6543
|
-
payload.set(schedulePayload, 0);
|
|
6544
|
-
payload.set(gatePayload, schedulePayload.length);
|
|
6545
|
-
return payload;
|
|
6546
|
-
}
|
|
6547
|
-
function encodeDynamicFeeCosignerGatePayload(args) {
|
|
6548
|
-
return encodeCosignerGateExpiryPayload(args);
|
|
6549
|
-
}
|
|
6550
|
-
function getDynamicFeeHookRemainingAccounts({
|
|
6551
|
-
namespace,
|
|
6552
|
-
config,
|
|
6553
|
-
cosigner
|
|
6554
|
-
}) {
|
|
6555
|
-
const signedHookRemainingAccounts = [namespace];
|
|
6556
|
-
if (config && config !== namespace) {
|
|
6557
|
-
signedHookRemainingAccounts.push(config);
|
|
6558
|
-
}
|
|
6559
|
-
if (cosigner) {
|
|
6560
|
-
signedHookRemainingAccounts.push(cosigner);
|
|
6561
|
-
}
|
|
6562
|
-
const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
|
|
6563
|
-
getAddressFromRemainingAccount
|
|
6564
|
-
);
|
|
6565
|
-
return {
|
|
6566
|
-
signedHookRemainingAccounts,
|
|
6567
|
-
unsignedHookRemainingAccounts,
|
|
6568
|
-
hookRemainingAccountsHash: computeRemainingAccountsHash(
|
|
6569
|
-
unsignedHookRemainingAccounts
|
|
6570
|
-
)
|
|
6571
|
-
};
|
|
6572
|
-
}
|
|
6573
|
-
function getDynamicFeeHookRemainingAccountAddresses({
|
|
6574
|
-
namespace,
|
|
6575
|
-
config,
|
|
6576
|
-
cosigner
|
|
6577
|
-
}) {
|
|
6578
|
-
return getDynamicFeeHookRemainingAccounts({
|
|
6579
|
-
namespace,
|
|
6580
|
-
config,
|
|
6581
|
-
cosigner
|
|
6582
|
-
}).unsignedHookRemainingAccounts;
|
|
6583
|
-
}
|
|
6584
|
-
function isDynamicFeeSchedulePayload(payload) {
|
|
6585
|
-
return payload.length >= DYNAMIC_FEE_SCHEDULE_LEN && DYNAMIC_FEE_SCHEDULE_MAGIC.every((byte, index) => payload[index] === byte);
|
|
6586
|
-
}
|
|
6587
|
-
var textEncoder6 = new TextEncoder();
|
|
6588
|
-
async function getDynamicFeeHookConfigAddress(programId = DYNAMIC_FEE_HOOK_PROGRAM_ID) {
|
|
6589
|
-
return getProgramDerivedAddress({
|
|
6590
|
-
programAddress: programId,
|
|
6591
|
-
seeds: [textEncoder6.encode(SEED_DYNAMIC_FEE_HOOK_CONFIG)]
|
|
6592
|
-
});
|
|
6593
|
-
}
|
|
6594
|
-
|
|
6595
|
-
// src/solana/migrators/cpmmMigrator/index.ts
|
|
6596
|
-
var cpmmMigrator_exports = {};
|
|
6597
|
-
__export(cpmmMigrator_exports, {
|
|
6598
|
-
CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
|
|
6599
|
-
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
|
|
6600
|
-
CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
|
|
6601
|
-
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
6602
|
-
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
6603
|
-
SEED_STATE: () => SEED_STATE,
|
|
6604
|
-
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
6605
|
-
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
6606
|
-
encodeMigratePayload: () => encodeMigratePayload,
|
|
6607
|
-
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
6608
|
-
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
6609
|
-
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
6610
|
-
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
6611
|
-
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
6612
|
-
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|
|
6613
|
-
getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
|
|
6614
|
-
getMigrateArgsCodec: () => getMigrateArgsCodec,
|
|
6615
|
-
getMigrateArgsDecoder: () => getMigrateArgsDecoder,
|
|
6616
|
-
getMigrateArgsEncoder: () => getMigrateArgsEncoder,
|
|
6617
|
-
getRecipientCodec: () => getRecipientCodec,
|
|
6618
|
-
getRecipientDecoder: () => getRecipientDecoder,
|
|
6619
|
-
getRecipientEncoder: () => getRecipientEncoder,
|
|
6620
|
-
getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
|
|
6621
|
-
getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
|
|
6622
|
-
getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
|
|
6623
|
-
});
|
|
6624
|
-
function getMigrateArgsEncoder() {
|
|
6625
|
-
return getStructEncoder([
|
|
6626
|
-
["baseForDistribution", getU64Encoder()],
|
|
6627
|
-
["baseForLiquidity", getU64Encoder()]
|
|
6628
|
-
]);
|
|
6629
|
-
}
|
|
6630
|
-
function getMigrateArgsDecoder() {
|
|
6631
|
-
return getStructDecoder([
|
|
6632
|
-
["baseForDistribution", getU64Decoder()],
|
|
6633
|
-
["baseForLiquidity", getU64Decoder()]
|
|
6634
|
-
]);
|
|
6635
|
-
}
|
|
6636
|
-
function getMigrateArgsCodec() {
|
|
6637
|
-
return combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
|
|
6638
|
-
}
|
|
6639
|
-
function getMigratedPoolHookConfigEncoder() {
|
|
6640
|
-
return getStructEncoder([
|
|
6641
|
-
["hookProgram", getAddressEncoder()],
|
|
6642
|
-
["hookFlags", getU32Encoder()]
|
|
6643
|
-
]);
|
|
6644
|
-
}
|
|
6645
|
-
function getMigratedPoolHookConfigDecoder() {
|
|
6646
|
-
return getStructDecoder([
|
|
6647
|
-
["hookProgram", getAddressDecoder()],
|
|
6648
|
-
["hookFlags", getU32Decoder()]
|
|
6649
|
-
]);
|
|
6650
|
-
}
|
|
6651
|
-
function getRecipientEncoder() {
|
|
6652
|
-
return getStructEncoder([
|
|
6653
|
-
["wallet", getAddressEncoder()],
|
|
6654
|
-
["amount", getU64Encoder()]
|
|
6655
|
-
]);
|
|
6656
|
-
}
|
|
6657
|
-
function getRecipientDecoder() {
|
|
6658
|
-
return getStructDecoder([
|
|
6659
|
-
["wallet", getAddressDecoder()],
|
|
6660
|
-
["amount", getU64Decoder()]
|
|
6661
|
-
]);
|
|
6662
|
-
}
|
|
6663
|
-
function getRecipientCodec() {
|
|
6664
|
-
return combineCodec(getRecipientEncoder(), getRecipientDecoder());
|
|
6665
|
-
}
|
|
6666
|
-
function getRegisterLaunchArgsEncoder() {
|
|
6667
|
-
return getStructEncoder([
|
|
6668
|
-
["cpmmConfig", getAddressEncoder()],
|
|
6669
|
-
["initialSwapFeeBps", getU16Encoder()],
|
|
6670
|
-
["initialFeeSplitBps", getU16Encoder()],
|
|
6671
|
-
["recipients", getArrayEncoder(getRecipientEncoder())],
|
|
6672
|
-
["minRaiseQuote", getU64Encoder()],
|
|
6673
|
-
["minMigrationPriceQ64Opt", getOptionEncoder(getU128Encoder())],
|
|
6674
|
-
[
|
|
6675
|
-
"migratedPoolHookConfig",
|
|
6676
|
-
getOptionEncoder(getMigratedPoolHookConfigEncoder())
|
|
6677
|
-
]
|
|
6678
|
-
]);
|
|
6679
|
-
}
|
|
6680
|
-
function getRegisterLaunchArgsDecoder() {
|
|
6681
|
-
return getStructDecoder([
|
|
6682
|
-
["cpmmConfig", getAddressDecoder()],
|
|
6683
|
-
["initialSwapFeeBps", getU16Decoder()],
|
|
6684
|
-
["initialFeeSplitBps", getU16Decoder()],
|
|
6685
|
-
["recipients", getArrayDecoder(getRecipientDecoder())],
|
|
6686
|
-
["minRaiseQuote", getU64Decoder()],
|
|
6687
|
-
["minMigrationPriceQ64Opt", getOptionDecoder(getU128Decoder())],
|
|
6688
|
-
[
|
|
6689
|
-
"migratedPoolHookConfig",
|
|
6690
|
-
getOptionDecoder(getMigratedPoolHookConfigDecoder())
|
|
6691
|
-
]
|
|
6692
|
-
]);
|
|
6693
|
-
}
|
|
6694
|
-
function getRegisterLaunchArgsCodec() {
|
|
6695
|
-
return combineCodec(
|
|
6696
|
-
getRegisterLaunchArgsEncoder(),
|
|
6697
|
-
getRegisterLaunchArgsDecoder()
|
|
5801
|
+
getRegisterLaunchArgsEncoder(),
|
|
5802
|
+
getRegisterLaunchArgsDecoder()
|
|
6698
5803
|
);
|
|
6699
5804
|
}
|
|
6700
5805
|
|
|
@@ -6756,11 +5861,406 @@ function getCpmmMigratorStateCodec() {
|
|
|
6756
5861
|
getCpmmMigratorStateDecoder()
|
|
6757
5862
|
);
|
|
6758
5863
|
}
|
|
5864
|
+
var CREATE_SPOT_POOL_DISCRIMINATOR = new Uint8Array([
|
|
5865
|
+
13,
|
|
5866
|
+
137,
|
|
5867
|
+
16,
|
|
5868
|
+
26,
|
|
5869
|
+
40,
|
|
5870
|
+
36,
|
|
5871
|
+
110,
|
|
5872
|
+
26
|
|
5873
|
+
]);
|
|
5874
|
+
function getCreateSpotPoolInstructionDataEncoder() {
|
|
5875
|
+
return transformEncoder(
|
|
5876
|
+
getStructEncoder([
|
|
5877
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
5878
|
+
["swapFeeBps", getU16Encoder()],
|
|
5879
|
+
["positionId", getU64Encoder()],
|
|
5880
|
+
["amount0Max", getU64Encoder()],
|
|
5881
|
+
["amount1Max", getU64Encoder()],
|
|
5882
|
+
["minSharesOut", getU128Encoder()]
|
|
5883
|
+
]),
|
|
5884
|
+
(value) => ({ ...value, discriminator: CREATE_SPOT_POOL_DISCRIMINATOR })
|
|
5885
|
+
);
|
|
5886
|
+
}
|
|
5887
|
+
function getCreateSpotPoolInstructionDataDecoder() {
|
|
5888
|
+
return getStructDecoder([
|
|
5889
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
5890
|
+
["swapFeeBps", getU16Decoder()],
|
|
5891
|
+
["positionId", getU64Decoder()],
|
|
5892
|
+
["amount0Max", getU64Decoder()],
|
|
5893
|
+
["amount1Max", getU64Decoder()],
|
|
5894
|
+
["minSharesOut", getU128Decoder()]
|
|
5895
|
+
]);
|
|
5896
|
+
}
|
|
5897
|
+
function getCreateSpotPoolInstructionDataCodec() {
|
|
5898
|
+
return combineCodec(
|
|
5899
|
+
getCreateSpotPoolInstructionDataEncoder(),
|
|
5900
|
+
getCreateSpotPoolInstructionDataDecoder()
|
|
5901
|
+
);
|
|
5902
|
+
}
|
|
5903
|
+
async function getCreateSpotPoolInstructionAsync(input, config) {
|
|
5904
|
+
const programAddress = config?.programAddress ?? CPMM_MIGRATOR_PROGRAM_ADDRESS;
|
|
5905
|
+
const originalAccounts = {
|
|
5906
|
+
cpmmConfig: { value: input.cpmmConfig ?? null, isWritable: false },
|
|
5907
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
5908
|
+
liquidityOwner: { value: input.liquidityOwner ?? null, isWritable: false },
|
|
5909
|
+
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
5910
|
+
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
5911
|
+
pool: { value: input.pool ?? null, isWritable: true },
|
|
5912
|
+
poolAuthority: { value: input.poolAuthority ?? null, isWritable: false },
|
|
5913
|
+
poolVault0: { value: input.poolVault0 ?? null, isWritable: true },
|
|
5914
|
+
poolVault1: { value: input.poolVault1 ?? null, isWritable: true },
|
|
5915
|
+
protocolFeeOwner: {
|
|
5916
|
+
value: input.protocolFeeOwner ?? null,
|
|
5917
|
+
isWritable: false
|
|
5918
|
+
},
|
|
5919
|
+
protocolFeePosition: {
|
|
5920
|
+
value: input.protocolFeePosition ?? null,
|
|
5921
|
+
isWritable: true
|
|
5922
|
+
},
|
|
5923
|
+
position: { value: input.position ?? null, isWritable: true },
|
|
5924
|
+
user0: { value: input.user0 ?? null, isWritable: true },
|
|
5925
|
+
user1: { value: input.user1 ?? null, isWritable: true },
|
|
5926
|
+
cpmmProgram: { value: input.cpmmProgram ?? null, isWritable: false },
|
|
5927
|
+
migrationAuthority: {
|
|
5928
|
+
value: input.migrationAuthority ?? null,
|
|
5929
|
+
isWritable: false
|
|
5930
|
+
},
|
|
5931
|
+
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
5932
|
+
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
5933
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
5934
|
+
rent: { value: input.rent ?? null, isWritable: false }
|
|
5935
|
+
};
|
|
5936
|
+
const accounts = originalAccounts;
|
|
5937
|
+
const args = { ...input };
|
|
5938
|
+
if (!accounts.cpmmProgram.value) {
|
|
5939
|
+
accounts.cpmmProgram.value = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
|
|
5940
|
+
}
|
|
5941
|
+
if (!accounts.migrationAuthority.value) {
|
|
5942
|
+
accounts.migrationAuthority.value = await getProgramDerivedAddress({
|
|
5943
|
+
programAddress,
|
|
5944
|
+
seeds: [
|
|
5945
|
+
getBytesEncoder().encode(
|
|
5946
|
+
new Uint8Array([
|
|
5947
|
+
109,
|
|
5948
|
+
105,
|
|
5949
|
+
103,
|
|
5950
|
+
114,
|
|
5951
|
+
97,
|
|
5952
|
+
116,
|
|
5953
|
+
105,
|
|
5954
|
+
111,
|
|
5955
|
+
110,
|
|
5956
|
+
95,
|
|
5957
|
+
97,
|
|
5958
|
+
117,
|
|
5959
|
+
116,
|
|
5960
|
+
104,
|
|
5961
|
+
111,
|
|
5962
|
+
114,
|
|
5963
|
+
105,
|
|
5964
|
+
116,
|
|
5965
|
+
121
|
|
5966
|
+
])
|
|
5967
|
+
)
|
|
5968
|
+
]
|
|
5969
|
+
});
|
|
5970
|
+
}
|
|
5971
|
+
if (!accounts.systemProgram.value) {
|
|
5972
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5973
|
+
}
|
|
5974
|
+
if (!accounts.rent.value) {
|
|
5975
|
+
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
5976
|
+
}
|
|
5977
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
5978
|
+
return Object.freeze({
|
|
5979
|
+
accounts: [
|
|
5980
|
+
getAccountMeta("cpmmConfig", accounts.cpmmConfig),
|
|
5981
|
+
getAccountMeta("payer", accounts.payer),
|
|
5982
|
+
getAccountMeta("liquidityOwner", accounts.liquidityOwner),
|
|
5983
|
+
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
5984
|
+
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
5985
|
+
getAccountMeta("pool", accounts.pool),
|
|
5986
|
+
getAccountMeta("poolAuthority", accounts.poolAuthority),
|
|
5987
|
+
getAccountMeta("poolVault0", accounts.poolVault0),
|
|
5988
|
+
getAccountMeta("poolVault1", accounts.poolVault1),
|
|
5989
|
+
getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
|
|
5990
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
5991
|
+
getAccountMeta("position", accounts.position),
|
|
5992
|
+
getAccountMeta("user0", accounts.user0),
|
|
5993
|
+
getAccountMeta("user1", accounts.user1),
|
|
5994
|
+
getAccountMeta("cpmmProgram", accounts.cpmmProgram),
|
|
5995
|
+
getAccountMeta("migrationAuthority", accounts.migrationAuthority),
|
|
5996
|
+
getAccountMeta("token0Program", accounts.token0Program),
|
|
5997
|
+
getAccountMeta("token1Program", accounts.token1Program),
|
|
5998
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
5999
|
+
getAccountMeta("rent", accounts.rent)
|
|
6000
|
+
],
|
|
6001
|
+
data: getCreateSpotPoolInstructionDataEncoder().encode(
|
|
6002
|
+
args
|
|
6003
|
+
),
|
|
6004
|
+
programAddress
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
function getCreateSpotPoolInstruction(input, config) {
|
|
6008
|
+
const programAddress = config?.programAddress ?? CPMM_MIGRATOR_PROGRAM_ADDRESS;
|
|
6009
|
+
const originalAccounts = {
|
|
6010
|
+
cpmmConfig: { value: input.cpmmConfig ?? null, isWritable: false },
|
|
6011
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
6012
|
+
liquidityOwner: { value: input.liquidityOwner ?? null, isWritable: false },
|
|
6013
|
+
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
6014
|
+
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
6015
|
+
pool: { value: input.pool ?? null, isWritable: true },
|
|
6016
|
+
poolAuthority: { value: input.poolAuthority ?? null, isWritable: false },
|
|
6017
|
+
poolVault0: { value: input.poolVault0 ?? null, isWritable: true },
|
|
6018
|
+
poolVault1: { value: input.poolVault1 ?? null, isWritable: true },
|
|
6019
|
+
protocolFeeOwner: {
|
|
6020
|
+
value: input.protocolFeeOwner ?? null,
|
|
6021
|
+
isWritable: false
|
|
6022
|
+
},
|
|
6023
|
+
protocolFeePosition: {
|
|
6024
|
+
value: input.protocolFeePosition ?? null,
|
|
6025
|
+
isWritable: true
|
|
6026
|
+
},
|
|
6027
|
+
position: { value: input.position ?? null, isWritable: true },
|
|
6028
|
+
user0: { value: input.user0 ?? null, isWritable: true },
|
|
6029
|
+
user1: { value: input.user1 ?? null, isWritable: true },
|
|
6030
|
+
cpmmProgram: { value: input.cpmmProgram ?? null, isWritable: false },
|
|
6031
|
+
migrationAuthority: {
|
|
6032
|
+
value: input.migrationAuthority ?? null,
|
|
6033
|
+
isWritable: false
|
|
6034
|
+
},
|
|
6035
|
+
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
6036
|
+
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
6037
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
6038
|
+
rent: { value: input.rent ?? null, isWritable: false }
|
|
6039
|
+
};
|
|
6040
|
+
const accounts = originalAccounts;
|
|
6041
|
+
const args = { ...input };
|
|
6042
|
+
if (!accounts.cpmmProgram.value) {
|
|
6043
|
+
accounts.cpmmProgram.value = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
|
|
6044
|
+
}
|
|
6045
|
+
if (!accounts.systemProgram.value) {
|
|
6046
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
6047
|
+
}
|
|
6048
|
+
if (!accounts.rent.value) {
|
|
6049
|
+
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
6050
|
+
}
|
|
6051
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
6052
|
+
return Object.freeze({
|
|
6053
|
+
accounts: [
|
|
6054
|
+
getAccountMeta("cpmmConfig", accounts.cpmmConfig),
|
|
6055
|
+
getAccountMeta("payer", accounts.payer),
|
|
6056
|
+
getAccountMeta("liquidityOwner", accounts.liquidityOwner),
|
|
6057
|
+
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
6058
|
+
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
6059
|
+
getAccountMeta("pool", accounts.pool),
|
|
6060
|
+
getAccountMeta("poolAuthority", accounts.poolAuthority),
|
|
6061
|
+
getAccountMeta("poolVault0", accounts.poolVault0),
|
|
6062
|
+
getAccountMeta("poolVault1", accounts.poolVault1),
|
|
6063
|
+
getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
|
|
6064
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
6065
|
+
getAccountMeta("position", accounts.position),
|
|
6066
|
+
getAccountMeta("user0", accounts.user0),
|
|
6067
|
+
getAccountMeta("user1", accounts.user1),
|
|
6068
|
+
getAccountMeta("cpmmProgram", accounts.cpmmProgram),
|
|
6069
|
+
getAccountMeta("migrationAuthority", accounts.migrationAuthority),
|
|
6070
|
+
getAccountMeta("token0Program", accounts.token0Program),
|
|
6071
|
+
getAccountMeta("token1Program", accounts.token1Program),
|
|
6072
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
6073
|
+
getAccountMeta("rent", accounts.rent)
|
|
6074
|
+
],
|
|
6075
|
+
data: getCreateSpotPoolInstructionDataEncoder().encode(
|
|
6076
|
+
args
|
|
6077
|
+
),
|
|
6078
|
+
programAddress
|
|
6079
|
+
});
|
|
6080
|
+
}
|
|
6081
|
+
|
|
6082
|
+
// src/solana/generated/cpmmMigrator/programs/cpmmMigrator.ts
|
|
6083
|
+
var CPMM_MIGRATOR_PROGRAM_ADDRESS = "7WMUTNC41eMCo6eGH5Sy2xbgE3AycvLbFPo95AU9CSUd";
|
|
6759
6084
|
if (process.env.NODE_ENV !== "production") ;
|
|
6085
|
+
var addressCodec5 = getAddressCodec();
|
|
6086
|
+
var textEncoder6 = new TextEncoder();
|
|
6087
|
+
var U64_MAX = (1n << 64n) - 1n;
|
|
6088
|
+
var PROTOCOL_FEE_POSITION_ID = 0n;
|
|
6089
|
+
async function pda(programAddress, seeds) {
|
|
6090
|
+
const [derived] = await getProgramDerivedAddress({
|
|
6091
|
+
programAddress,
|
|
6092
|
+
seeds
|
|
6093
|
+
});
|
|
6094
|
+
return derived;
|
|
6095
|
+
}
|
|
6096
|
+
function seed(value) {
|
|
6097
|
+
return textEncoder6.encode(value);
|
|
6098
|
+
}
|
|
6099
|
+
function addressSeed(value) {
|
|
6100
|
+
return addressCodec5.encode(value);
|
|
6101
|
+
}
|
|
6102
|
+
function assertSafeInteger(name, value) {
|
|
6103
|
+
if (typeof value === "number" && !Number.isSafeInteger(value)) {
|
|
6104
|
+
throw new RangeError(
|
|
6105
|
+
`${name} must be a safe integer when provided as a number; use bigint for values above Number.MAX_SAFE_INTEGER`
|
|
6106
|
+
);
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
function u64Seed(value) {
|
|
6110
|
+
assertSafeInteger("positionId", value);
|
|
6111
|
+
const bigintValue = BigInt(value);
|
|
6112
|
+
if (bigintValue < 0n || bigintValue > U64_MAX) {
|
|
6113
|
+
throw new RangeError("u64 position ID must be between 0 and 2^64 - 1");
|
|
6114
|
+
}
|
|
6115
|
+
const bytes = new Uint8Array(8);
|
|
6116
|
+
new DataView(bytes.buffer).setBigUint64(0, bigintValue, true);
|
|
6117
|
+
return bytes;
|
|
6118
|
+
}
|
|
6119
|
+
function addressOf(value) {
|
|
6120
|
+
return typeof value === "string" ? value : value.address;
|
|
6121
|
+
}
|
|
6122
|
+
function accountMeta(value, role) {
|
|
6123
|
+
if (typeof value === "string") {
|
|
6124
|
+
return { address: value, role };
|
|
6125
|
+
}
|
|
6126
|
+
return { address: value.address, role, signer: value };
|
|
6127
|
+
}
|
|
6128
|
+
async function deriveSpotPoolAccounts({
|
|
6129
|
+
tokenAMint,
|
|
6130
|
+
tokenBMint,
|
|
6131
|
+
swapFeeBps,
|
|
6132
|
+
liquidityOwner,
|
|
6133
|
+
tokenAProgram = TOKEN_PROGRAM_ADDRESS$1,
|
|
6134
|
+
tokenBProgram = TOKEN_PROGRAM_ADDRESS$1,
|
|
6135
|
+
tokenAAccount,
|
|
6136
|
+
tokenBAccount,
|
|
6137
|
+
token0Account,
|
|
6138
|
+
token1Account,
|
|
6139
|
+
positionId = 0n,
|
|
6140
|
+
cpmmProgram = CPMM_PROGRAM_ID,
|
|
6141
|
+
cpmmMigratorProgram = CPMM_MIGRATOR_PROGRAM_ID
|
|
6142
|
+
}) {
|
|
6143
|
+
const [token0Mint, token1Mint] = sortMints(tokenAMint, tokenBMint);
|
|
6144
|
+
const token0IsA = token0Mint === tokenAMint;
|
|
6145
|
+
const token0Program = token0IsA ? tokenAProgram : tokenBProgram;
|
|
6146
|
+
const token1Program = token0IsA ? tokenBProgram : tokenAProgram;
|
|
6147
|
+
const [userA] = await findAssociatedTokenPda({
|
|
6148
|
+
owner: liquidityOwner,
|
|
6149
|
+
mint: tokenAMint,
|
|
6150
|
+
tokenProgram: tokenAProgram
|
|
6151
|
+
});
|
|
6152
|
+
const [userB] = await findAssociatedTokenPda({
|
|
6153
|
+
owner: liquidityOwner,
|
|
6154
|
+
mint: tokenBMint,
|
|
6155
|
+
tokenProgram: tokenBProgram
|
|
6156
|
+
});
|
|
6157
|
+
const user0 = token0Account ?? (token0IsA ? tokenAAccount ?? userA : tokenBAccount ?? userB);
|
|
6158
|
+
const user1 = token1Account ?? (token0IsA ? tokenBAccount ?? userB : tokenAAccount ?? userA);
|
|
6159
|
+
const [pool] = await getSpotPoolAddress(
|
|
6160
|
+
token0Mint,
|
|
6161
|
+
token1Mint,
|
|
6162
|
+
swapFeeBps,
|
|
6163
|
+
cpmmProgram
|
|
6164
|
+
);
|
|
6165
|
+
const protocolFeeOwner = await pda(cpmmProgram, [
|
|
6166
|
+
seed(SEED_PROTOCOL_FEE_OWNER),
|
|
6167
|
+
addressSeed(pool)
|
|
6168
|
+
]);
|
|
6169
|
+
return {
|
|
6170
|
+
cpmmConfig: await pda(cpmmProgram, [seed(SEED_CONFIG)]),
|
|
6171
|
+
token0Mint,
|
|
6172
|
+
token1Mint,
|
|
6173
|
+
token0Program,
|
|
6174
|
+
token1Program,
|
|
6175
|
+
pool,
|
|
6176
|
+
poolAuthority: await pda(cpmmProgram, [
|
|
6177
|
+
seed(SEED_AUTHORITY),
|
|
6178
|
+
addressSeed(pool)
|
|
6179
|
+
]),
|
|
6180
|
+
poolVault0: await pda(cpmmProgram, [seed(SEED_VAULT0), addressSeed(pool)]),
|
|
6181
|
+
poolVault1: await pda(cpmmProgram, [seed(SEED_VAULT1), addressSeed(pool)]),
|
|
6182
|
+
protocolFeeOwner,
|
|
6183
|
+
protocolFeePosition: await pda(cpmmProgram, [
|
|
6184
|
+
seed(SEED_POSITION),
|
|
6185
|
+
addressSeed(pool),
|
|
6186
|
+
addressSeed(protocolFeeOwner),
|
|
6187
|
+
u64Seed(PROTOCOL_FEE_POSITION_ID)
|
|
6188
|
+
]),
|
|
6189
|
+
position: await pda(cpmmProgram, [
|
|
6190
|
+
seed(SEED_POSITION),
|
|
6191
|
+
addressSeed(pool),
|
|
6192
|
+
addressSeed(liquidityOwner),
|
|
6193
|
+
u64Seed(positionId)
|
|
6194
|
+
]),
|
|
6195
|
+
user0,
|
|
6196
|
+
user1,
|
|
6197
|
+
migrationAuthority: await pda(cpmmMigratorProgram, [
|
|
6198
|
+
seed(SEED_MIGRATION_AUTHORITY)
|
|
6199
|
+
])
|
|
6200
|
+
};
|
|
6201
|
+
}
|
|
6202
|
+
async function createSpotPoolInstruction(input) {
|
|
6203
|
+
const payer = input.payer;
|
|
6204
|
+
const liquidityOwner = input.liquidityOwner ?? payer;
|
|
6205
|
+
const positionId = input.positionId ?? 0n;
|
|
6206
|
+
const minSharesOut = input.minSharesOut ?? 1n;
|
|
6207
|
+
assertSafeInteger("positionId", positionId);
|
|
6208
|
+
assertSafeInteger("tokenAAmount", input.tokenAAmount);
|
|
6209
|
+
assertSafeInteger("tokenBAmount", input.tokenBAmount);
|
|
6210
|
+
assertSafeInteger("minSharesOut", minSharesOut);
|
|
6211
|
+
const cpmmProgram = input.cpmmProgram ?? CPMM_PROGRAM_ID;
|
|
6212
|
+
const cpmmMigratorProgram = input.cpmmMigratorProgram ?? CPMM_MIGRATOR_PROGRAM_ID;
|
|
6213
|
+
const accounts = await deriveSpotPoolAccounts({
|
|
6214
|
+
...input,
|
|
6215
|
+
liquidityOwner: addressOf(liquidityOwner),
|
|
6216
|
+
cpmmProgram,
|
|
6217
|
+
cpmmMigratorProgram,
|
|
6218
|
+
positionId
|
|
6219
|
+
});
|
|
6220
|
+
const token0IsA = accounts.token0Mint === input.tokenAMint;
|
|
6221
|
+
return {
|
|
6222
|
+
programAddress: cpmmMigratorProgram,
|
|
6223
|
+
accounts: [
|
|
6224
|
+
{ address: accounts.cpmmConfig, role: AccountRole.READONLY },
|
|
6225
|
+
accountMeta(payer, AccountRole.WRITABLE_SIGNER),
|
|
6226
|
+
accountMeta(liquidityOwner, AccountRole.READONLY_SIGNER),
|
|
6227
|
+
{ address: accounts.token0Mint, role: AccountRole.READONLY },
|
|
6228
|
+
{ address: accounts.token1Mint, role: AccountRole.READONLY },
|
|
6229
|
+
{ address: accounts.pool, role: AccountRole.WRITABLE },
|
|
6230
|
+
{ address: accounts.poolAuthority, role: AccountRole.READONLY },
|
|
6231
|
+
{ address: accounts.poolVault0, role: AccountRole.WRITABLE },
|
|
6232
|
+
{ address: accounts.poolVault1, role: AccountRole.WRITABLE },
|
|
6233
|
+
{ address: accounts.protocolFeeOwner, role: AccountRole.READONLY },
|
|
6234
|
+
{ address: accounts.protocolFeePosition, role: AccountRole.WRITABLE },
|
|
6235
|
+
{ address: accounts.position, role: AccountRole.WRITABLE },
|
|
6236
|
+
{ address: accounts.user0, role: AccountRole.WRITABLE },
|
|
6237
|
+
{ address: accounts.user1, role: AccountRole.WRITABLE },
|
|
6238
|
+
{ address: cpmmProgram, role: AccountRole.READONLY },
|
|
6239
|
+
{ address: accounts.migrationAuthority, role: AccountRole.READONLY },
|
|
6240
|
+
{ address: accounts.token0Program, role: AccountRole.READONLY },
|
|
6241
|
+
{ address: accounts.token1Program, role: AccountRole.READONLY },
|
|
6242
|
+
{
|
|
6243
|
+
address: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS$1,
|
|
6244
|
+
role: AccountRole.READONLY
|
|
6245
|
+
},
|
|
6246
|
+
{
|
|
6247
|
+
address: input.rent ?? SYSVAR_RENT_ADDRESS,
|
|
6248
|
+
role: AccountRole.READONLY
|
|
6249
|
+
}
|
|
6250
|
+
],
|
|
6251
|
+
data: getCreateSpotPoolInstructionDataEncoder().encode({
|
|
6252
|
+
swapFeeBps: input.swapFeeBps,
|
|
6253
|
+
positionId,
|
|
6254
|
+
amount0Max: token0IsA ? input.tokenAAmount : input.tokenBAmount,
|
|
6255
|
+
amount1Max: token0IsA ? input.tokenBAmount : input.tokenAAmount,
|
|
6256
|
+
minSharesOut
|
|
6257
|
+
})
|
|
6258
|
+
};
|
|
6259
|
+
}
|
|
6760
6260
|
|
|
6761
6261
|
// src/solana/migrators/cpmmMigrator/client.ts
|
|
6762
|
-
async function fetchCpmmMigratorState(rpc,
|
|
6763
|
-
const response = await rpc.getAccountInfo(
|
|
6262
|
+
async function fetchCpmmMigratorState(rpc, address6) {
|
|
6263
|
+
const response = await rpc.getAccountInfo(address6, { encoding: "base64" }).send();
|
|
6764
6264
|
if (!response.value) return null;
|
|
6765
6265
|
return getCpmmMigratorStateDecoder().decode(
|
|
6766
6266
|
base64ToBytes(response.value.data[0])
|
|
@@ -6823,8 +6323,8 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
6823
6323
|
{ address: migrationAuthority, role: AccountRole.READONLY },
|
|
6824
6324
|
{ address: adminBaseAta, role: AccountRole.WRITABLE },
|
|
6825
6325
|
{ address: adminQuoteAta, role: AccountRole.WRITABLE },
|
|
6826
|
-
...recipientAtas.map((
|
|
6827
|
-
address:
|
|
6326
|
+
...recipientAtas.map((address6) => ({
|
|
6327
|
+
address: address6,
|
|
6828
6328
|
role: AccountRole.WRITABLE
|
|
6829
6329
|
}))
|
|
6830
6330
|
],
|
|
@@ -6848,8 +6348,24 @@ async function buildCpmmMigrationRemainingAccountsHash(input) {
|
|
|
6848
6348
|
}
|
|
6849
6349
|
|
|
6850
6350
|
// src/solana/migrators/cpmmMigrator/index.ts
|
|
6351
|
+
function encodeCreateSpotPoolPayload(args) {
|
|
6352
|
+
assertSafeInteger("positionId", args.positionId);
|
|
6353
|
+
assertSafeInteger("amount0Max", args.amount0Max);
|
|
6354
|
+
assertSafeInteger("amount1Max", args.amount1Max);
|
|
6355
|
+
assertSafeInteger("minSharesOut", args.minSharesOut);
|
|
6356
|
+
const encoded = new Uint8Array(getCreateSpotPoolArgsEncoder().encode(args));
|
|
6357
|
+
return mergeBytes([
|
|
6358
|
+
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.createSpotPool,
|
|
6359
|
+
encoded
|
|
6360
|
+
]);
|
|
6361
|
+
}
|
|
6851
6362
|
function encodeRegisterLaunchPayload(args) {
|
|
6852
|
-
const encoded = new Uint8Array(
|
|
6363
|
+
const encoded = new Uint8Array(
|
|
6364
|
+
getRegisterLaunchArgsEncoder().encode({
|
|
6365
|
+
...args,
|
|
6366
|
+
migratedPoolHookConfig: args.migratedPoolHookConfig ?? null
|
|
6367
|
+
})
|
|
6368
|
+
);
|
|
6853
6369
|
return mergeBytes([
|
|
6854
6370
|
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.registerLaunch,
|
|
6855
6371
|
encoded
|
|
@@ -6912,67 +6428,18 @@ function hashRemainingAccounts(accounts) {
|
|
|
6912
6428
|
function isCustomMigrationConfig(migration) {
|
|
6913
6429
|
return migration.kind === "custom";
|
|
6914
6430
|
}
|
|
6915
|
-
function getCreateLaunchHookMode(input) {
|
|
6916
|
-
if (input.hook !== void 0 && input.hook !== null) {
|
|
6917
|
-
return input.hook;
|
|
6918
|
-
}
|
|
6919
|
-
if (input.dynamicFee) {
|
|
6920
|
-
return "dynamicFee";
|
|
6921
|
-
}
|
|
6922
|
-
return input.cosigner ? "cosigner" : "cpmm";
|
|
6923
|
-
}
|
|
6924
6431
|
async function getCreateLaunchHookContext(input) {
|
|
6925
|
-
const
|
|
6926
|
-
if (input.
|
|
6927
|
-
throw new Error(
|
|
6928
|
-
'dynamicFee requires hook to be unset or set to "dynamicFee"'
|
|
6929
|
-
);
|
|
6930
|
-
}
|
|
6931
|
-
if (mode !== "cosigner" && mode !== "dynamicFee") {
|
|
6932
|
-
return { mode };
|
|
6933
|
-
}
|
|
6934
|
-
if (mode === "dynamicFee") {
|
|
6935
|
-
if (!input.dynamicFee && !input.cosigner) {
|
|
6936
|
-
throw new Error(
|
|
6937
|
-
"dynamicFee hook mode requires dynamicFee or cosigner input"
|
|
6938
|
-
);
|
|
6939
|
-
}
|
|
6940
|
-
if (!input.cosigner) {
|
|
6941
|
-
return { mode };
|
|
6942
|
-
}
|
|
6943
|
-
const [dynamicFeeConfig] = await getDynamicFeeHookConfigAddress(
|
|
6944
|
-
input.deployment?.dynamicFeeHookProgram ?? DYNAMIC_FEE_HOOK_PROGRAM_ID
|
|
6945
|
-
);
|
|
6946
|
-
return { mode, dynamicFeeConfig };
|
|
6947
|
-
}
|
|
6948
|
-
const [cosignerConfig] = await getCosignerHookConfigAddress(
|
|
6949
|
-
input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
|
|
6950
|
-
);
|
|
6951
|
-
return { mode, cosignerConfig };
|
|
6952
|
-
}
|
|
6953
|
-
function getCosignerHookRemainingAccounts2({
|
|
6954
|
-
namespace,
|
|
6955
|
-
cosigner,
|
|
6956
|
-
cosignerConfig
|
|
6957
|
-
}) {
|
|
6958
|
-
const accounts = namespace === cosignerConfig ? [cosignerConfig] : [namespace, cosignerConfig];
|
|
6959
|
-
accounts.push(cosigner);
|
|
6960
|
-
return accounts;
|
|
6961
|
-
}
|
|
6962
|
-
function resolveCosignerHookPayload(input) {
|
|
6963
|
-
if (input.cosignGateExpiresAt === void 0 || input.cosignGateExpiresAt === null) {
|
|
6964
|
-
return new Uint8Array();
|
|
6432
|
+
const program = input.deployment?.cpmmHookProgram ?? CPMM_HOOK_PROGRAM_ID;
|
|
6433
|
+
if (input.cosignGateExpiresAt != null && !input.cosigner) {
|
|
6434
|
+
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
6965
6435
|
}
|
|
6966
6436
|
if (!input.cosigner) {
|
|
6967
|
-
|
|
6437
|
+
return { program };
|
|
6968
6438
|
}
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
value: input.cosignGateExpiresAt,
|
|
6972
|
-
cosigner: getSignerAddress(input.cosigner)
|
|
6973
|
-
});
|
|
6439
|
+
const [config] = await getCpmmHookConfigAddress(program);
|
|
6440
|
+
return { program, config };
|
|
6974
6441
|
}
|
|
6975
|
-
function
|
|
6442
|
+
function resolveCpmmHookPayload(input) {
|
|
6976
6443
|
let gateExpiry = null;
|
|
6977
6444
|
if (input.cosignGateExpiresAt !== void 0 && input.cosignGateExpiresAt !== null) {
|
|
6978
6445
|
if (!input.cosigner) {
|
|
@@ -6984,7 +6451,7 @@ function resolveDynamicFeeHookPayload(input) {
|
|
|
6984
6451
|
cosigner: getSignerAddress(input.cosigner)
|
|
6985
6452
|
};
|
|
6986
6453
|
}
|
|
6987
|
-
return
|
|
6454
|
+
return encodeCpmmHookPayload({
|
|
6988
6455
|
schedule: input.dynamicFee ?? null,
|
|
6989
6456
|
gateExpiry
|
|
6990
6457
|
});
|
|
@@ -6994,59 +6461,18 @@ function resolveCreateLaunchHook({
|
|
|
6994
6461
|
namespace,
|
|
6995
6462
|
hookContext
|
|
6996
6463
|
}) {
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
if (!input.cosigner) {
|
|
7005
|
-
throw new Error('cosigner is required when hook is "cosigner"');
|
|
7006
|
-
}
|
|
7007
|
-
if (!hookContext.cosignerConfig) {
|
|
7008
|
-
throw new Error("cosigner hook config could not be derived");
|
|
7009
|
-
}
|
|
7010
|
-
const remainingAccounts = getCosignerHookRemainingAccounts2({
|
|
7011
|
-
namespace,
|
|
7012
|
-
cosigner: input.cosigner,
|
|
7013
|
-
cosignerConfig: hookContext.cosignerConfig
|
|
7014
|
-
});
|
|
7015
|
-
return {
|
|
7016
|
-
program: input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
|
|
7017
|
-
flags: HF_BEFORE_SWAP2 | HF_FORWARD_READONLY_SIGNERS2,
|
|
7018
|
-
payload: resolveCosignerHookPayload(input),
|
|
7019
|
-
remainingAccounts,
|
|
7020
|
-
remainingAccountsHash: hashRemainingAccounts(remainingAccounts) ?? EMPTY_REMAINING_ACCOUNTS_HASH
|
|
7021
|
-
};
|
|
7022
|
-
}
|
|
7023
|
-
if (hookContext.mode === "dynamicFee") {
|
|
7024
|
-
const hasCosigner = Boolean(input.cosigner);
|
|
7025
|
-
const hasSchedule = Boolean(input.dynamicFee);
|
|
7026
|
-
if (input.cosignGateExpiresAt !== void 0 && input.cosignGateExpiresAt !== null && !input.cosigner) {
|
|
7027
|
-
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
7028
|
-
}
|
|
7029
|
-
if (hasCosigner && !hookContext.dynamicFeeConfig) {
|
|
7030
|
-
throw new Error("dynamic fee hook config could not be derived");
|
|
7031
|
-
}
|
|
7032
|
-
const remainingAccounts = getDynamicFeeHookRemainingAccounts({
|
|
7033
|
-
namespace,
|
|
7034
|
-
config: hookContext.dynamicFeeConfig,
|
|
7035
|
-
cosigner: input.cosigner
|
|
7036
|
-
});
|
|
7037
|
-
return {
|
|
7038
|
-
program: input.deployment?.dynamicFeeHookProgram ?? DYNAMIC_FEE_HOOK_PROGRAM_ID,
|
|
7039
|
-
flags: HF_BEFORE_SWAP2 | (hasSchedule ? HF_BEFORE_CREATE : 0) | (hasCosigner ? HF_FORWARD_READONLY_SIGNERS2 : 0),
|
|
7040
|
-
payload: resolveDynamicFeeHookPayload(input),
|
|
7041
|
-
remainingAccounts: remainingAccounts.signedHookRemainingAccounts,
|
|
7042
|
-
remainingAccountsHash: remainingAccounts.hookRemainingAccountsHash
|
|
7043
|
-
};
|
|
7044
|
-
}
|
|
6464
|
+
const hasCosigner = Boolean(input.cosigner);
|
|
6465
|
+
const hasSchedule = Boolean(input.dynamicFee);
|
|
6466
|
+
const remainingAccounts = getCpmmHookRemainingAccounts({
|
|
6467
|
+
namespace,
|
|
6468
|
+
config: hookContext.config,
|
|
6469
|
+
cosigner: input.cosigner
|
|
6470
|
+
});
|
|
7045
6471
|
return {
|
|
7046
|
-
program:
|
|
7047
|
-
flags: HF_BEFORE_SWAP2,
|
|
7048
|
-
payload:
|
|
7049
|
-
remainingAccountsHash:
|
|
6472
|
+
program: hookContext.program,
|
|
6473
|
+
flags: HF_BEFORE_SWAP2 | (hasSchedule ? HF_BEFORE_CREATE : 0) | (hasCosigner ? HF_FORWARD_READONLY_SIGNERS2 : 0),
|
|
6474
|
+
payload: resolveCpmmHookPayload(input),
|
|
6475
|
+
remainingAccountsHash: remainingAccounts.hookRemainingAccountsHash
|
|
7050
6476
|
};
|
|
7051
6477
|
}
|
|
7052
6478
|
async function getAssociatedTokenAddress({
|
|
@@ -7184,7 +6610,7 @@ async function createLaunch(input) {
|
|
|
7184
6610
|
const programId = getInitializerProgramId(input);
|
|
7185
6611
|
const launchId = input.launchId ?? createLaunchId();
|
|
7186
6612
|
const hookContext = await getCreateLaunchHookContext(input);
|
|
7187
|
-
const namespace = input.namespace ??
|
|
6613
|
+
const namespace = input.namespace ?? SYSTEM_PROGRAM_ADDRESS;
|
|
7188
6614
|
const tokenPrograms = {
|
|
7189
6615
|
...launchTokenPrograms.splToken(),
|
|
7190
6616
|
...input.tokenPrograms
|
|
@@ -7231,7 +6657,7 @@ async function createLaunch(input) {
|
|
|
7231
6657
|
baseTokenProgram: tokenPrograms.baseTokenProgram,
|
|
7232
6658
|
quoteTokenProgram: tokenPrograms.quoteTokenProgram,
|
|
7233
6659
|
systemProgram: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS,
|
|
7234
|
-
rent: input.rent ?? SYSVAR_RENT_ADDRESS,
|
|
6660
|
+
rent: input.rent ?? SYSVAR_RENT_ADDRESS$1,
|
|
7235
6661
|
metadataAccount: addresses.metadataAccount,
|
|
7236
6662
|
metadataProgram: input.metadataProgram ?? TOKEN_METADATA_PROGRAM_ID
|
|
7237
6663
|
},
|
|
@@ -7250,7 +6676,7 @@ async function createLaunch(input) {
|
|
|
7250
6676
|
allowBuy: input.allowBuy ?? true,
|
|
7251
6677
|
allowSell: input.allowSell ?? true,
|
|
7252
6678
|
hookFlags: hook.flags,
|
|
7253
|
-
hookPayload: hook.payload
|
|
6679
|
+
hookPayload: hook.payload,
|
|
7254
6680
|
migratorInitPayload: migration?.initPayload ?? new Uint8Array(),
|
|
7255
6681
|
migratorMigratePayload: migration?.migratePayload ?? new Uint8Array(),
|
|
7256
6682
|
hookRemainingAccountsHash: hook.remainingAccountsHash,
|
|
@@ -7384,9 +6810,9 @@ function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupT
|
|
|
7384
6810
|
);
|
|
7385
6811
|
return assertTransactionMessageFits(compressedMessage, options);
|
|
7386
6812
|
}
|
|
7387
|
-
var
|
|
7388
|
-
async function fetchLaunch2(rpc,
|
|
7389
|
-
const response = await rpc.getAccountInfo(
|
|
6813
|
+
var addressCodec6 = getAddressCodec();
|
|
6814
|
+
async function fetchLaunch2(rpc, address6, config) {
|
|
6815
|
+
const response = await rpc.getAccountInfo(address6, {
|
|
7390
6816
|
encoding: "base64",
|
|
7391
6817
|
commitment: config?.commitment
|
|
7392
6818
|
}).send();
|
|
@@ -7438,7 +6864,7 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
7438
6864
|
const authorityFilter = {
|
|
7439
6865
|
memcmp: {
|
|
7440
6866
|
offset: 8n,
|
|
7441
|
-
bytes: bytesToBase64EncodedBytes(
|
|
6867
|
+
bytes: bytesToBase64EncodedBytes(addressCodec6.encode(authority)),
|
|
7442
6868
|
encoding: "base64"
|
|
7443
6869
|
}
|
|
7444
6870
|
};
|
|
@@ -7791,13 +7217,13 @@ function decodeOracleState3(encodedAccount) {
|
|
|
7791
7217
|
getOracleStateDecoder2()
|
|
7792
7218
|
);
|
|
7793
7219
|
}
|
|
7794
|
-
async function fetchOracleState2(rpc,
|
|
7795
|
-
const maybeAccount = await fetchMaybeOracleState2(rpc,
|
|
7220
|
+
async function fetchOracleState2(rpc, address6, config) {
|
|
7221
|
+
const maybeAccount = await fetchMaybeOracleState2(rpc, address6, config);
|
|
7796
7222
|
assertAccountExists(maybeAccount);
|
|
7797
7223
|
return maybeAccount;
|
|
7798
7224
|
}
|
|
7799
|
-
async function fetchMaybeOracleState2(rpc,
|
|
7800
|
-
const maybeAccount = await fetchEncodedAccount(rpc,
|
|
7225
|
+
async function fetchMaybeOracleState2(rpc, address6, config) {
|
|
7226
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address6, config);
|
|
7801
7227
|
return decodeOracleState3(maybeAccount);
|
|
7802
7228
|
}
|
|
7803
7229
|
async function fetchAllOracleState2(rpc, addresses, config) {
|
|
@@ -7881,9 +7307,9 @@ function parseFinalizeInstruction(instruction) {
|
|
|
7881
7307
|
}
|
|
7882
7308
|
let accountIndex = 0;
|
|
7883
7309
|
const getNextAccount = () => {
|
|
7884
|
-
const
|
|
7310
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
7885
7311
|
accountIndex += 1;
|
|
7886
|
-
return
|
|
7312
|
+
return accountMeta2;
|
|
7887
7313
|
};
|
|
7888
7314
|
return {
|
|
7889
7315
|
programAddress: instruction.programAddress,
|
|
@@ -7969,9 +7395,9 @@ function parseInitializeOracleInstruction2(instruction) {
|
|
|
7969
7395
|
}
|
|
7970
7396
|
let accountIndex = 0;
|
|
7971
7397
|
const getNextAccount = () => {
|
|
7972
|
-
const
|
|
7398
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
7973
7399
|
accountIndex += 1;
|
|
7974
|
-
return
|
|
7400
|
+
return accountMeta2;
|
|
7975
7401
|
};
|
|
7976
7402
|
return {
|
|
7977
7403
|
programAddress: instruction.programAddress,
|
|
@@ -8231,7 +7657,7 @@ async function curveSwapExactIn(input) {
|
|
|
8231
7657
|
baseMint: input.baseMint,
|
|
8232
7658
|
quoteMint: input.quoteMint,
|
|
8233
7659
|
user,
|
|
8234
|
-
hookProgram: input.
|
|
7660
|
+
hookProgram: input.deployment?.cpmmHookProgram ?? CPMM_HOOK_PROGRAM_ID,
|
|
8235
7661
|
baseTokenProgram,
|
|
8236
7662
|
quoteTokenProgram,
|
|
8237
7663
|
remainingAccounts: input.remainingAccounts ? [...input.remainingAccounts] : void 0
|
|
@@ -8394,7 +7820,7 @@ function migrateLaunch(input) {
|
|
|
8394
7820
|
baseTokenProgram,
|
|
8395
7821
|
quoteTokenProgram,
|
|
8396
7822
|
systemProgram: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS,
|
|
8397
|
-
rent: input.rent ?? SYSVAR_RENT_ADDRESS
|
|
7823
|
+
rent: input.rent ?? SYSVAR_RENT_ADDRESS$1
|
|
8398
7824
|
},
|
|
8399
7825
|
input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID
|
|
8400
7826
|
);
|
|
@@ -8464,9 +7890,7 @@ var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
|
8464
7890
|
cpmmProgram: CPMM_PROGRAM_ID,
|
|
8465
7891
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
8466
7892
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
8467
|
-
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
|
|
8468
|
-
cosignerHookProgram: DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
|
|
8469
|
-
dynamicFeeHookProgram: DYNAMIC_FEE_HOOK_PROGRAM_ID
|
|
7893
|
+
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
|
|
8470
7894
|
};
|
|
8471
7895
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
8472
7896
|
const [cpmmConfig] = await getConfigAddress(programs.cpmmProgram);
|
|
@@ -8480,6 +7904,6 @@ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGR
|
|
|
8480
7904
|
};
|
|
8481
7905
|
}
|
|
8482
7906
|
|
|
8483
|
-
export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, assertMigrationQuoteThreshold,
|
|
7907
|
+
export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, assertMigrationQuoteThreshold, cpmm_exports as cpmm, cpmmHook_exports as cpmmHook, cpmmMigrator_exports as cpmmMigrator, createLaunch, curveSwapExactIn, deriveSolanaCpmmDeployment, getMigrationQuoteProgress, initializer_exports as initializer, migrateLaunch, predictionMigrator_exports as predictionMigrator, swapExactIn, trustedOracle_exports as trustedOracle };
|
|
8484
7908
|
//# sourceMappingURL=index.js.map
|
|
8485
7909
|
//# sourceMappingURL=index.js.map
|