@whetstone-research/doppler-sdk 1.0.34 → 1.0.35
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/README.md +4 -0
- package/dist/{chunk-PSLY7M7C.js → chunk-4N5U2MXE.js} +305 -4
- package/dist/chunk-4N5U2MXE.js.map +1 -0
- package/dist/{chunk-7PXLEMBJ.cjs → chunk-AANZBN5X.cjs} +345 -36
- package/dist/chunk-AANZBN5X.cjs.map +1 -0
- package/dist/{chunk-4CI2M2F6.cjs → chunk-O2Z5ORGF.cjs} +39 -2
- package/dist/chunk-O2Z5ORGF.cjs.map +1 -0
- package/dist/{chunk-AFXFT3BD.js → chunk-PWBQLC5V.js} +39 -3
- package/dist/chunk-PWBQLC5V.js.map +1 -0
- package/dist/evm/index.cjs +343 -79
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +118 -5
- package/dist/evm/index.d.ts +118 -5
- package/dist/evm/index.js +341 -81
- package/dist/evm/index.js.map +1 -1
- package/dist/{pda-44IHEORD.cjs → pda-4VCQGO3F.cjs} +22 -18
- package/dist/{pda-44IHEORD.cjs.map → pda-4VCQGO3F.cjs.map} +1 -1
- package/dist/pda-IRVGRDQX.js +4 -0
- package/dist/pda-IRVGRDQX.js.map +1 -0
- package/dist/solana/index.cjs +481 -436
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +243 -11
- package/dist/solana/index.d.ts +243 -11
- package/dist/solana/index.js +62 -17
- 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-4CI2M2F6.cjs.map +0 -1
- package/dist/chunk-7PXLEMBJ.cjs.map +0 -1
- package/dist/chunk-AFXFT3BD.js.map +0 -1
- package/dist/chunk-PSLY7M7C.js.map +0 -1
- package/dist/pda-WJVDXQPW.js +0 -4
- package/dist/pda-WJVDXQPW.js.map +0 -1
package/dist/solana/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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 as SYSTEM_PROGRAM_ADDRESS$1, SYSVAR_INSTRUCTIONS_ADDRESS, TOKEN_2022_PROGRAM_ADDRESS, SEED_VAULT1, SEED_VAULT0, SYSVAR_RENT_ADDRESS as SYSVAR_RENT_ADDRESS$1 } 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, parseInitializeSpotPoolWithHookInstruction, 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, getInitializeSpotPoolWithHookInstructionDataEncoder, getInitializeSpotPoolWithHookInstructionDataDecoder, getInitializeSpotPoolWithHookInstructionDataCodec, getInitializeSpotPoolWithHookInstructionAsync, getInitializeSpotPoolWithHookInstruction, getInitializeSpotPoolWithHookDiscriminatorBytes, 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_WITH_HOOK_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-4N5U2MXE.js';
|
|
2
|
+
import { sortMints, getSwapAddresses, getSpotPoolAddress, getProtocolFeePositionAddress, getProtocolFeeOwnerAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getHookedSpotPoolAddress, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SPOT_HOOK_FLAG_MASK, 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 as SYSTEM_PROGRAM_ADDRESS$1, SYSVAR_INSTRUCTIONS_ADDRESS, TOKEN_2022_PROGRAM_ADDRESS, SEED_VAULT1, SEED_VAULT0, SYSVAR_RENT_ADDRESS as SYSVAR_RENT_ADDRESS$1 } from '../chunk-PWBQLC5V.js';
|
|
3
3
|
import { __export } from '../chunk-PZ5AY32C.js';
|
|
4
4
|
import { getAddressCodec, getProgramDerivedAddress, createNoopSigner, 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, address, 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';
|
|
@@ -37,6 +37,7 @@ __export(cpmm_exports, {
|
|
|
37
37
|
INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
38
38
|
INITIALIZE_POOL_DISCRIMINATOR: () => INITIALIZE_POOL_DISCRIMINATOR,
|
|
39
39
|
INITIALIZE_SPOT_POOL_DISCRIMINATOR: () => INITIALIZE_SPOT_POOL_DISCRIMINATOR,
|
|
40
|
+
INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR: () => INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR,
|
|
40
41
|
INSTRUCTION_DISCRIMINATORS: () => INSTRUCTION_DISCRIMINATORS,
|
|
41
42
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
42
43
|
MAX_HOOK_ALLOWLIST: () => MAX_HOOK_ALLOWLIST,
|
|
@@ -57,6 +58,7 @@ __export(cpmm_exports, {
|
|
|
57
58
|
SEED_SPOT_POOL: () => SEED_SPOT_POOL,
|
|
58
59
|
SET_FEES_DISCRIMINATOR: () => SET_FEES_DISCRIMINATOR,
|
|
59
60
|
SET_HOOK_DISCRIMINATOR: () => SET_HOOK_DISCRIMINATOR,
|
|
61
|
+
SPOT_HOOK_FLAG_MASK: () => SPOT_HOOK_FLAG_MASK,
|
|
60
62
|
SWAP_EXACT_IN_DISCRIMINATOR: () => SWAP_EXACT_IN_DISCRIMINATOR,
|
|
61
63
|
TOKEN_METADATA_PROGRAM_ID: () => TOKEN_METADATA_PROGRAM_ID,
|
|
62
64
|
TRANSFER_ADMIN_DISCRIMINATOR: () => TRANSFER_ADMIN_DISCRIMINATOR,
|
|
@@ -169,6 +171,7 @@ __export(cpmm_exports, {
|
|
|
169
171
|
getCreatePositionInstructionDataDecoder: () => getCreatePositionInstructionDataDecoder,
|
|
170
172
|
getCreatePositionInstructionDataEncoder: () => getCreatePositionInstructionDataEncoder,
|
|
171
173
|
getErrorMessage: () => getErrorMessage,
|
|
174
|
+
getHookedSpotPoolAddress: () => getHookedSpotPoolAddress,
|
|
172
175
|
getInitializeConfigDiscriminatorBytes: () => getInitializeConfigDiscriminatorBytes,
|
|
173
176
|
getInitializeConfigInstruction: () => getInitializeConfigInstruction,
|
|
174
177
|
getInitializeConfigInstructionAsync: () => getInitializeConfigInstructionAsync,
|
|
@@ -193,6 +196,12 @@ __export(cpmm_exports, {
|
|
|
193
196
|
getInitializeSpotPoolInstructionDataCodec: () => getInitializeSpotPoolInstructionDataCodec,
|
|
194
197
|
getInitializeSpotPoolInstructionDataDecoder: () => getInitializeSpotPoolInstructionDataDecoder,
|
|
195
198
|
getInitializeSpotPoolInstructionDataEncoder: () => getInitializeSpotPoolInstructionDataEncoder,
|
|
199
|
+
getInitializeSpotPoolWithHookDiscriminatorBytes: () => getInitializeSpotPoolWithHookDiscriminatorBytes,
|
|
200
|
+
getInitializeSpotPoolWithHookInstruction: () => getInitializeSpotPoolWithHookInstruction,
|
|
201
|
+
getInitializeSpotPoolWithHookInstructionAsync: () => getInitializeSpotPoolWithHookInstructionAsync,
|
|
202
|
+
getInitializeSpotPoolWithHookInstructionDataCodec: () => getInitializeSpotPoolWithHookInstructionDataCodec,
|
|
203
|
+
getInitializeSpotPoolWithHookInstructionDataDecoder: () => getInitializeSpotPoolWithHookInstructionDataDecoder,
|
|
204
|
+
getInitializeSpotPoolWithHookInstructionDataEncoder: () => getInitializeSpotPoolWithHookInstructionDataEncoder,
|
|
196
205
|
getK: () => getK,
|
|
197
206
|
getLiquidityAddresses: () => getLiquidityAddresses,
|
|
198
207
|
getMetadataAddress: () => getMetadataAddress,
|
|
@@ -322,6 +331,7 @@ __export(cpmm_exports, {
|
|
|
322
331
|
parseInitializeOracleInstruction: () => parseInitializeOracleInstruction,
|
|
323
332
|
parseInitializePoolInstruction: () => parseInitializePoolInstruction,
|
|
324
333
|
parseInitializeSpotPoolInstruction: () => parseInitializeSpotPoolInstruction,
|
|
334
|
+
parseInitializeSpotPoolWithHookInstruction: () => parseInitializeSpotPoolWithHookInstruction,
|
|
325
335
|
parseOracleConsultInstruction: () => parseOracleConsultInstruction,
|
|
326
336
|
parseOracleUpdateInstruction: () => parseOracleUpdateInstruction,
|
|
327
337
|
parsePauseInstruction: () => parsePauseInstruction,
|
|
@@ -5788,7 +5798,9 @@ function getCreateSpotPoolArgsEncoder() {
|
|
|
5788
5798
|
["positionId", getU64Encoder()],
|
|
5789
5799
|
["amount0Max", getU64Encoder()],
|
|
5790
5800
|
["amount1Max", getU64Encoder()],
|
|
5791
|
-
["minSharesOut", getU128Encoder()]
|
|
5801
|
+
["minSharesOut", getU128Encoder()],
|
|
5802
|
+
["hookProgram", getAddressEncoder()],
|
|
5803
|
+
["hookFlags", getU32Encoder()]
|
|
5792
5804
|
]);
|
|
5793
5805
|
}
|
|
5794
5806
|
function getCreateSpotPoolArgsDecoder() {
|
|
@@ -5797,7 +5809,9 @@ function getCreateSpotPoolArgsDecoder() {
|
|
|
5797
5809
|
["positionId", getU64Decoder()],
|
|
5798
5810
|
["amount0Max", getU64Decoder()],
|
|
5799
5811
|
["amount1Max", getU64Decoder()],
|
|
5800
|
-
["minSharesOut", getU128Decoder()]
|
|
5812
|
+
["minSharesOut", getU128Decoder()],
|
|
5813
|
+
["hookProgram", getAddressDecoder()],
|
|
5814
|
+
["hookFlags", getU32Decoder()]
|
|
5801
5815
|
]);
|
|
5802
5816
|
}
|
|
5803
5817
|
function getCreateSpotPoolArgsCodec() {
|
|
@@ -5959,7 +5973,9 @@ function getCreateSpotPoolInstructionDataEncoder() {
|
|
|
5959
5973
|
["positionId", getU64Encoder()],
|
|
5960
5974
|
["amount0Max", getU64Encoder()],
|
|
5961
5975
|
["amount1Max", getU64Encoder()],
|
|
5962
|
-
["minSharesOut", getU128Encoder()]
|
|
5976
|
+
["minSharesOut", getU128Encoder()],
|
|
5977
|
+
["hookProgram", getAddressEncoder()],
|
|
5978
|
+
["hookFlags", getU32Encoder()]
|
|
5963
5979
|
]),
|
|
5964
5980
|
(value) => ({ ...value, discriminator: CREATE_SPOT_POOL_DISCRIMINATOR })
|
|
5965
5981
|
);
|
|
@@ -5971,7 +5987,9 @@ function getCreateSpotPoolInstructionDataDecoder() {
|
|
|
5971
5987
|
["positionId", getU64Decoder()],
|
|
5972
5988
|
["amount0Max", getU64Decoder()],
|
|
5973
5989
|
["amount1Max", getU64Decoder()],
|
|
5974
|
-
["minSharesOut", getU128Decoder()]
|
|
5990
|
+
["minSharesOut", getU128Decoder()],
|
|
5991
|
+
["hookProgram", getAddressDecoder()],
|
|
5992
|
+
["hookFlags", getU32Decoder()]
|
|
5975
5993
|
]);
|
|
5976
5994
|
}
|
|
5977
5995
|
function getCreateSpotPoolInstructionDataCodec() {
|
|
@@ -6011,10 +6029,11 @@ async function getCreateSpotPoolInstructionAsync(input, config) {
|
|
|
6011
6029
|
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
6012
6030
|
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
6013
6031
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
6014
|
-
rent: { value: input.rent ?? null, isWritable: false }
|
|
6032
|
+
rent: { value: input.rent ?? null, isWritable: false },
|
|
6033
|
+
hookProgram: { value: input.hookProgram ?? null, isWritable: false }
|
|
6015
6034
|
};
|
|
6016
6035
|
const accounts = originalAccounts;
|
|
6017
|
-
const args = { ...input };
|
|
6036
|
+
const args = { ...input, hookProgram: input.hookProgramArg };
|
|
6018
6037
|
if (!accounts.cpmmProgram.value) {
|
|
6019
6038
|
accounts.cpmmProgram.value = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
|
|
6020
6039
|
}
|
|
@@ -6076,7 +6095,8 @@ async function getCreateSpotPoolInstructionAsync(input, config) {
|
|
|
6076
6095
|
getAccountMeta("token0Program", accounts.token0Program),
|
|
6077
6096
|
getAccountMeta("token1Program", accounts.token1Program),
|
|
6078
6097
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
6079
|
-
getAccountMeta("rent", accounts.rent)
|
|
6098
|
+
getAccountMeta("rent", accounts.rent),
|
|
6099
|
+
getAccountMeta("hookProgram", accounts.hookProgram)
|
|
6080
6100
|
],
|
|
6081
6101
|
data: getCreateSpotPoolInstructionDataEncoder().encode(
|
|
6082
6102
|
args
|
|
@@ -6115,10 +6135,11 @@ function getCreateSpotPoolInstruction(input, config) {
|
|
|
6115
6135
|
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
6116
6136
|
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
6117
6137
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
6118
|
-
rent: { value: input.rent ?? null, isWritable: false }
|
|
6138
|
+
rent: { value: input.rent ?? null, isWritable: false },
|
|
6139
|
+
hookProgram: { value: input.hookProgram ?? null, isWritable: false }
|
|
6119
6140
|
};
|
|
6120
6141
|
const accounts = originalAccounts;
|
|
6121
|
-
const args = { ...input };
|
|
6142
|
+
const args = { ...input, hookProgram: input.hookProgramArg };
|
|
6122
6143
|
if (!accounts.cpmmProgram.value) {
|
|
6123
6144
|
accounts.cpmmProgram.value = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
|
|
6124
6145
|
}
|
|
@@ -6150,7 +6171,8 @@ function getCreateSpotPoolInstruction(input, config) {
|
|
|
6150
6171
|
getAccountMeta("token0Program", accounts.token0Program),
|
|
6151
6172
|
getAccountMeta("token1Program", accounts.token1Program),
|
|
6152
6173
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
6153
|
-
getAccountMeta("rent", accounts.rent)
|
|
6174
|
+
getAccountMeta("rent", accounts.rent),
|
|
6175
|
+
getAccountMeta("hookProgram", accounts.hookProgram)
|
|
6154
6176
|
],
|
|
6155
6177
|
data: getCreateSpotPoolInstructionDataEncoder().encode(
|
|
6156
6178
|
args
|
|
@@ -6217,6 +6239,8 @@ async function deriveSpotPoolAccounts({
|
|
|
6217
6239
|
token0Account,
|
|
6218
6240
|
token1Account,
|
|
6219
6241
|
positionId = 0n,
|
|
6242
|
+
hookProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
6243
|
+
hookFlags = 0,
|
|
6220
6244
|
cpmmProgram = CPMM_PROGRAM_ID,
|
|
6221
6245
|
cpmmMigratorProgram = CPMM_MIGRATOR_PROGRAM_ID
|
|
6222
6246
|
}) {
|
|
@@ -6236,12 +6260,21 @@ async function deriveSpotPoolAccounts({
|
|
|
6236
6260
|
});
|
|
6237
6261
|
const user0 = token0Account ?? (token0IsA ? tokenAAccount ?? userA : tokenBAccount ?? userB);
|
|
6238
6262
|
const user1 = token1Account ?? (token0IsA ? tokenBAccount ?? userB : tokenAAccount ?? userA);
|
|
6239
|
-
const
|
|
6263
|
+
const hasHook = hookProgram !== SYSTEM_PROGRAM_ADDRESS;
|
|
6264
|
+
if (!hasHook && hookFlags !== 0) {
|
|
6265
|
+
throw new Error("hookFlags must be zero when hookProgram is not provided");
|
|
6266
|
+
}
|
|
6267
|
+
if (hasHook && (hookProgram === token0Program || hookProgram === token1Program)) {
|
|
6268
|
+
throw new Error("hookProgram cannot be one of the pool token programs");
|
|
6269
|
+
}
|
|
6270
|
+
const [pool] = hasHook ? await getHookedSpotPoolAddress(
|
|
6240
6271
|
token0Mint,
|
|
6241
6272
|
token1Mint,
|
|
6242
6273
|
swapFeeBps,
|
|
6274
|
+
hookProgram,
|
|
6275
|
+
hookFlags,
|
|
6243
6276
|
cpmmProgram
|
|
6244
|
-
);
|
|
6277
|
+
) : await getSpotPoolAddress(token0Mint, token1Mint, swapFeeBps, cpmmProgram);
|
|
6245
6278
|
const protocolFeeOwner = await pda(cpmmProgram, [
|
|
6246
6279
|
seed(SEED_PROTOCOL_FEE_OWNER),
|
|
6247
6280
|
addressSeed(pool)
|
|
@@ -6298,6 +6331,9 @@ async function createSpotPoolInstruction(input) {
|
|
|
6298
6331
|
positionId
|
|
6299
6332
|
});
|
|
6300
6333
|
const token0IsA = accounts.token0Mint === input.tokenAMint;
|
|
6334
|
+
const hookProgram = input.hookProgram ?? SYSTEM_PROGRAM_ADDRESS;
|
|
6335
|
+
const hookFlags = input.hookFlags ?? 0;
|
|
6336
|
+
const hookProgramAccount = hookProgram === SYSTEM_PROGRAM_ADDRESS ? [] : [{ address: hookProgram, role: AccountRole.READONLY }];
|
|
6301
6337
|
return {
|
|
6302
6338
|
programAddress: cpmmMigratorProgram,
|
|
6303
6339
|
accounts: [
|
|
@@ -6326,14 +6362,17 @@ async function createSpotPoolInstruction(input) {
|
|
|
6326
6362
|
{
|
|
6327
6363
|
address: input.rent ?? SYSVAR_RENT_ADDRESS,
|
|
6328
6364
|
role: AccountRole.READONLY
|
|
6329
|
-
}
|
|
6365
|
+
},
|
|
6366
|
+
...hookProgramAccount
|
|
6330
6367
|
],
|
|
6331
6368
|
data: getCreateSpotPoolInstructionDataEncoder().encode({
|
|
6332
6369
|
swapFeeBps: input.swapFeeBps,
|
|
6333
6370
|
positionId,
|
|
6334
6371
|
amount0Max: token0IsA ? input.tokenAAmount : input.tokenBAmount,
|
|
6335
6372
|
amount1Max: token0IsA ? input.tokenBAmount : input.tokenAAmount,
|
|
6336
|
-
minSharesOut
|
|
6373
|
+
minSharesOut,
|
|
6374
|
+
hookProgram,
|
|
6375
|
+
hookFlags
|
|
6337
6376
|
})
|
|
6338
6377
|
};
|
|
6339
6378
|
}
|
|
@@ -6433,7 +6472,13 @@ function encodeCreateSpotPoolPayload(args) {
|
|
|
6433
6472
|
assertSafeInteger("amount0Max", args.amount0Max);
|
|
6434
6473
|
assertSafeInteger("amount1Max", args.amount1Max);
|
|
6435
6474
|
assertSafeInteger("minSharesOut", args.minSharesOut);
|
|
6436
|
-
const encoded = new Uint8Array(
|
|
6475
|
+
const encoded = new Uint8Array(
|
|
6476
|
+
getCreateSpotPoolArgsEncoder().encode({
|
|
6477
|
+
...args,
|
|
6478
|
+
hookProgram: args.hookProgram ?? SYSTEM_PROGRAM_ADDRESS,
|
|
6479
|
+
hookFlags: args.hookFlags ?? 0
|
|
6480
|
+
})
|
|
6481
|
+
);
|
|
6437
6482
|
return mergeBytes([
|
|
6438
6483
|
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.createSpotPool,
|
|
6439
6484
|
encoded
|