@whetstone-research/doppler-sdk 1.0.30 → 1.0.32
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 +24 -0
- package/dist/evm/index.cjs +764 -402
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +1803 -382
- package/dist/evm/index.d.ts +1803 -382
- package/dist/evm/index.js +760 -404
- package/dist/evm/index.js.map +1 -1
- package/dist/solana/index.cjs +208 -135
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +150 -114
- package/dist/solana/index.d.ts +150 -114
- package/dist/solana/index.js +217 -145
- package/dist/solana/index.js.map +1 -1
- package/package.json +4 -1
package/dist/solana/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
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';
|
|
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-AFXFT3BD.js';
|
|
3
3
|
import { __export } from '../chunk-PZ5AY32C.js';
|
|
4
|
-
import { getAddressCodec, getProgramDerivedAddress, createNoopSigner,
|
|
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';
|
|
6
|
+
import { SYSTEM_PROGRAM_ADDRESS, getTransferSolInstruction } from '@solana-program/system';
|
|
6
7
|
import { keccak_256 } from '@noble/hashes/sha3.js';
|
|
7
8
|
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
9
|
import { SYSVAR_RENT_ADDRESS } from '@solana/sysvars';
|
|
10
10
|
import { findAddressLookupTablePda, getCreateLookupTableInstruction, getExtendLookupTableInstruction } from '@solana-program/address-lookup-table';
|
|
11
11
|
|
|
@@ -731,32 +731,32 @@ async function fetchConfigWithAddress(rpc, programId = CPMM_PROGRAM_ID, commitme
|
|
|
731
731
|
return { address: configAddress, account };
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
// src/solana/
|
|
735
|
-
var
|
|
736
|
-
__export(
|
|
734
|
+
// src/solana/dopplerLaunchHookV1/index.ts
|
|
735
|
+
var dopplerLaunchHookV1_exports = {};
|
|
736
|
+
__export(dopplerLaunchHookV1_exports, {
|
|
737
737
|
ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR,
|
|
738
738
|
COSIGNER_CONFIG_DISCRIMINATOR: () => COSIGNER_CONFIG_DISCRIMINATOR,
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
CpmmHookInstruction: () => CpmmHookInstruction,
|
|
754
|
-
DEVNET_CPMM_HOOK_PROGRAM_ID: () => DEVNET_CPMM_HOOK_PROGRAM_ID,
|
|
739
|
+
DEVNET_DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID: () => DEVNET_DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID,
|
|
740
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__ARITHMETIC_OVERFLOW: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__ARITHMETIC_OVERFLOW,
|
|
741
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_ALREADY_EXISTS: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_ALREADY_EXISTS,
|
|
742
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_LIST_FULL: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_LIST_FULL,
|
|
743
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_NOT_FOUND: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_NOT_FOUND,
|
|
744
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_AUTHORITY: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_AUTHORITY,
|
|
745
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_CONFIG: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_CONFIG,
|
|
746
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_COSIGNER: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_COSIGNER,
|
|
747
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_DURATION: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_DURATION,
|
|
748
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_FEE: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_FEE,
|
|
749
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_INSTRUCTION_DATA: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_INSTRUCTION_DATA,
|
|
750
|
+
DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_SCHEDULE_DATA: () => DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_SCHEDULE_DATA,
|
|
751
|
+
DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS: () => DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS,
|
|
752
|
+
DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID: () => DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID,
|
|
755
753
|
DYNAMIC_FEE_SCHEDULE_HEADER_LEN: () => DYNAMIC_FEE_SCHEDULE_HEADER_LEN,
|
|
756
754
|
DYNAMIC_FEE_SCHEDULE_LEN: () => DYNAMIC_FEE_SCHEDULE_LEN,
|
|
757
755
|
DYNAMIC_FEE_SCHEDULE_MAGIC: () => DYNAMIC_FEE_SCHEDULE_MAGIC,
|
|
758
756
|
DYNAMIC_FEE_SCHEDULE_MAX_BPS: () => DYNAMIC_FEE_SCHEDULE_MAX_BPS,
|
|
759
757
|
DYNAMIC_FEE_SCHEDULE_VERSION: () => DYNAMIC_FEE_SCHEDULE_VERSION,
|
|
758
|
+
DopplerLaunchHookV1Account: () => DopplerLaunchHookV1Account,
|
|
759
|
+
DopplerLaunchHookV1Instruction: () => DopplerLaunchHookV1Instruction,
|
|
760
760
|
GATE_EXPIRY_DISABLED: () => GATE_EXPIRY_DISABLED,
|
|
761
761
|
GATE_EXPIRY_HEADER_LEN: () => GATE_EXPIRY_HEADER_LEN,
|
|
762
762
|
GATE_EXPIRY_PAYLOAD_LEN: () => GATE_EXPIRY_PAYLOAD_LEN,
|
|
@@ -766,13 +766,13 @@ __export(cpmmHook_exports, {
|
|
|
766
766
|
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR2,
|
|
767
767
|
MAX_COSIGNERS: () => MAX_COSIGNERS,
|
|
768
768
|
REMOVE_COSIGNER_DISCRIMINATOR: () => REMOVE_COSIGNER_DISCRIMINATOR,
|
|
769
|
-
|
|
769
|
+
SEED_DOPPLER_LAUNCH_HOOK_V1_CONFIG: () => SEED_DOPPLER_LAUNCH_HOOK_V1_CONFIG,
|
|
770
770
|
SET_AUTHORITY_DISCRIMINATOR: () => SET_AUTHORITY_DISCRIMINATOR,
|
|
771
|
-
cpmmHookProgram: () => cpmmHookProgram,
|
|
772
771
|
decodeCosignerConfig: () => decodeCosignerConfig,
|
|
773
772
|
decodeCosignerGateExpiryPayload: () => decodeCosignerGateExpiryPayload,
|
|
773
|
+
dopplerLaunchHookV1Program: () => dopplerLaunchHookV1Program,
|
|
774
774
|
encodeCosignerGateExpiryPayload: () => encodeCosignerGateExpiryPayload,
|
|
775
|
-
|
|
775
|
+
encodeDopplerLaunchHookV1Payload: () => encodeDopplerLaunchHookV1Payload,
|
|
776
776
|
encodeDynamicFeeCosignerGatePayload: () => encodeDynamicFeeCosignerGatePayload,
|
|
777
777
|
encodeDynamicFeeSchedule: () => encodeDynamicFeeSchedule,
|
|
778
778
|
fetchAllCosignerConfig: () => fetchAllCosignerConfig,
|
|
@@ -794,10 +794,10 @@ __export(cpmmHook_exports, {
|
|
|
794
794
|
getCosignerConfigEncoder: () => getCosignerConfigEncoder,
|
|
795
795
|
getCosignerConfigSize: () => getCosignerConfigSize,
|
|
796
796
|
getCosignerGateStatus: () => getCosignerGateStatus,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
797
|
+
getDopplerLaunchHookV1ConfigAddress: () => getDopplerLaunchHookV1ConfigAddress,
|
|
798
|
+
getDopplerLaunchHookV1ErrorMessage: () => getDopplerLaunchHookV1ErrorMessage,
|
|
799
|
+
getDopplerLaunchHookV1RemainingAccountAddresses: () => getDopplerLaunchHookV1RemainingAccountAddresses,
|
|
800
|
+
getDopplerLaunchHookV1RemainingAccounts: () => getDopplerLaunchHookV1RemainingAccounts,
|
|
801
801
|
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec,
|
|
802
802
|
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder,
|
|
803
803
|
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder,
|
|
@@ -822,16 +822,18 @@ __export(cpmmHook_exports, {
|
|
|
822
822
|
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec,
|
|
823
823
|
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder,
|
|
824
824
|
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder,
|
|
825
|
-
|
|
826
|
-
|
|
825
|
+
identifyDopplerLaunchHookV1Account: () => identifyDopplerLaunchHookV1Account,
|
|
826
|
+
identifyDopplerLaunchHookV1Instruction: () => identifyDopplerLaunchHookV1Instruction,
|
|
827
827
|
isCosignerGateEnforced: () => isCosignerGateEnforced,
|
|
828
|
-
|
|
828
|
+
isDopplerLaunchHookV1Error: () => isDopplerLaunchHookV1Error,
|
|
829
829
|
isDynamicFeeSchedulePayload: () => isDynamicFeeSchedulePayload,
|
|
830
|
+
isResolvedManagedCosignerGate: () => isResolvedManagedCosignerGate,
|
|
830
831
|
parseAddCosignerInstruction: () => parseAddCosignerInstruction,
|
|
831
|
-
|
|
832
|
+
parseDopplerLaunchHookV1Instruction: () => parseDopplerLaunchHookV1Instruction,
|
|
832
833
|
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction2,
|
|
833
834
|
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction,
|
|
834
835
|
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction,
|
|
836
|
+
resolveManagedCosignerGate: () => resolveManagedCosignerGate,
|
|
835
837
|
validateDynamicFeeScheduleArgs: () => validateDynamicFeeScheduleArgs
|
|
836
838
|
});
|
|
837
839
|
var COSIGNER_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
@@ -947,7 +949,7 @@ function getAddCosignerInstructionDataCodec() {
|
|
|
947
949
|
);
|
|
948
950
|
}
|
|
949
951
|
async function getAddCosignerInstructionAsync(input, config) {
|
|
950
|
-
const programAddress = config?.programAddress ??
|
|
952
|
+
const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
951
953
|
const originalAccounts = {
|
|
952
954
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
953
955
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -998,7 +1000,7 @@ async function getAddCosignerInstructionAsync(input, config) {
|
|
|
998
1000
|
});
|
|
999
1001
|
}
|
|
1000
1002
|
function getAddCosignerInstruction(input, config) {
|
|
1001
|
-
const programAddress = config?.programAddress ??
|
|
1003
|
+
const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
1002
1004
|
const originalAccounts = {
|
|
1003
1005
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1004
1006
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1076,7 +1078,7 @@ function getInitializeConfigInstructionDataCodec2() {
|
|
|
1076
1078
|
);
|
|
1077
1079
|
}
|
|
1078
1080
|
async function getInitializeConfigInstructionAsync2(input, config) {
|
|
1079
|
-
const programAddress = config?.programAddress ??
|
|
1081
|
+
const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
1080
1082
|
const originalAccounts = {
|
|
1081
1083
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
1082
1084
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
@@ -1136,7 +1138,7 @@ async function getInitializeConfigInstructionAsync2(input, config) {
|
|
|
1136
1138
|
});
|
|
1137
1139
|
}
|
|
1138
1140
|
function getInitializeConfigInstruction2(input, config) {
|
|
1139
|
-
const programAddress = config?.programAddress ??
|
|
1141
|
+
const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
1140
1142
|
const originalAccounts = {
|
|
1141
1143
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
1142
1144
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
@@ -1229,7 +1231,7 @@ function getRemoveCosignerInstructionDataCodec() {
|
|
|
1229
1231
|
);
|
|
1230
1232
|
}
|
|
1231
1233
|
async function getRemoveCosignerInstructionAsync(input, config) {
|
|
1232
|
-
const programAddress = config?.programAddress ??
|
|
1234
|
+
const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
1233
1235
|
const originalAccounts = {
|
|
1234
1236
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1235
1237
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1280,7 +1282,7 @@ async function getRemoveCosignerInstructionAsync(input, config) {
|
|
|
1280
1282
|
});
|
|
1281
1283
|
}
|
|
1282
1284
|
function getRemoveCosignerInstruction(input, config) {
|
|
1283
|
-
const programAddress = config?.programAddress ??
|
|
1285
|
+
const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
1284
1286
|
const originalAccounts = {
|
|
1285
1287
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1286
1288
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1358,7 +1360,7 @@ function getSetAuthorityInstructionDataCodec() {
|
|
|
1358
1360
|
);
|
|
1359
1361
|
}
|
|
1360
1362
|
async function getSetAuthorityInstructionAsync(input, config) {
|
|
1361
|
-
const programAddress = config?.programAddress ??
|
|
1363
|
+
const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
1362
1364
|
const originalAccounts = {
|
|
1363
1365
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1364
1366
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1409,7 +1411,7 @@ async function getSetAuthorityInstructionAsync(input, config) {
|
|
|
1409
1411
|
});
|
|
1410
1412
|
}
|
|
1411
1413
|
function getSetAuthorityInstruction(input, config) {
|
|
1412
|
-
const programAddress = config?.programAddress ??
|
|
1414
|
+
const programAddress = config?.programAddress ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
1413
1415
|
const originalAccounts = {
|
|
1414
1416
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1415
1417
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1451,13 +1453,13 @@ function parseSetAuthorityInstruction(instruction) {
|
|
|
1451
1453
|
};
|
|
1452
1454
|
}
|
|
1453
1455
|
|
|
1454
|
-
// src/solana/generated/
|
|
1455
|
-
var
|
|
1456
|
-
var
|
|
1457
|
-
|
|
1458
|
-
return
|
|
1459
|
-
})(
|
|
1460
|
-
function
|
|
1456
|
+
// src/solana/generated/dopplerLaunchHookV1/programs/dopplerLaunchHookV1.ts
|
|
1457
|
+
var DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS = "HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i";
|
|
1458
|
+
var DopplerLaunchHookV1Account = /* @__PURE__ */ ((DopplerLaunchHookV1Account2) => {
|
|
1459
|
+
DopplerLaunchHookV1Account2[DopplerLaunchHookV1Account2["CosignerConfig"] = 0] = "CosignerConfig";
|
|
1460
|
+
return DopplerLaunchHookV1Account2;
|
|
1461
|
+
})(DopplerLaunchHookV1Account || {});
|
|
1462
|
+
function identifyDopplerLaunchHookV1Account(account) {
|
|
1461
1463
|
const data = "data" in account ? account.data : account;
|
|
1462
1464
|
if (containsBytes(
|
|
1463
1465
|
data,
|
|
@@ -1470,17 +1472,17 @@ function identifyCpmmHookAccount(account) {
|
|
|
1470
1472
|
}
|
|
1471
1473
|
throw new SolanaError(
|
|
1472
1474
|
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
1473
|
-
{ accountData: data, programName: "
|
|
1475
|
+
{ accountData: data, programName: "dopplerLaunchHookV1" }
|
|
1474
1476
|
);
|
|
1475
1477
|
}
|
|
1476
|
-
var
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
return
|
|
1482
|
-
})(
|
|
1483
|
-
function
|
|
1478
|
+
var DopplerLaunchHookV1Instruction = /* @__PURE__ */ ((DopplerLaunchHookV1Instruction2) => {
|
|
1479
|
+
DopplerLaunchHookV1Instruction2[DopplerLaunchHookV1Instruction2["AddCosigner"] = 0] = "AddCosigner";
|
|
1480
|
+
DopplerLaunchHookV1Instruction2[DopplerLaunchHookV1Instruction2["InitializeConfig"] = 1] = "InitializeConfig";
|
|
1481
|
+
DopplerLaunchHookV1Instruction2[DopplerLaunchHookV1Instruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
|
|
1482
|
+
DopplerLaunchHookV1Instruction2[DopplerLaunchHookV1Instruction2["SetAuthority"] = 3] = "SetAuthority";
|
|
1483
|
+
return DopplerLaunchHookV1Instruction2;
|
|
1484
|
+
})(DopplerLaunchHookV1Instruction || {});
|
|
1485
|
+
function identifyDopplerLaunchHookV1Instruction(instruction) {
|
|
1484
1486
|
const data = "data" in instruction ? instruction.data : instruction;
|
|
1485
1487
|
if (containsBytes(
|
|
1486
1488
|
data,
|
|
@@ -1520,11 +1522,11 @@ function identifyCpmmHookInstruction(instruction) {
|
|
|
1520
1522
|
}
|
|
1521
1523
|
throw new SolanaError(
|
|
1522
1524
|
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
1523
|
-
{ instructionData: data, programName: "
|
|
1525
|
+
{ instructionData: data, programName: "dopplerLaunchHookV1" }
|
|
1524
1526
|
);
|
|
1525
1527
|
}
|
|
1526
|
-
function
|
|
1527
|
-
const instructionType =
|
|
1528
|
+
function parseDopplerLaunchHookV1Instruction(instruction) {
|
|
1529
|
+
const instructionType = identifyDopplerLaunchHookV1Instruction(instruction);
|
|
1528
1530
|
switch (instructionType) {
|
|
1529
1531
|
case 0 /* AddCosigner */: {
|
|
1530
1532
|
assertIsInstructionWithAccounts(instruction);
|
|
@@ -1557,15 +1559,18 @@ function parseCpmmHookInstruction(instruction) {
|
|
|
1557
1559
|
default:
|
|
1558
1560
|
throw new SolanaError(
|
|
1559
1561
|
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
1560
|
-
{
|
|
1562
|
+
{
|
|
1563
|
+
instructionType,
|
|
1564
|
+
programName: "dopplerLaunchHookV1"
|
|
1565
|
+
}
|
|
1561
1566
|
);
|
|
1562
1567
|
}
|
|
1563
1568
|
}
|
|
1564
|
-
function
|
|
1569
|
+
function dopplerLaunchHookV1Program() {
|
|
1565
1570
|
return (client) => {
|
|
1566
1571
|
return {
|
|
1567
1572
|
...client,
|
|
1568
|
-
|
|
1573
|
+
dopplerLaunchHookV1: {
|
|
1569
1574
|
accounts: {
|
|
1570
1575
|
cosignerConfig: addSelfFetchFunctions(
|
|
1571
1576
|
client,
|
|
@@ -1598,45 +1603,45 @@ function cpmmHookProgram() {
|
|
|
1598
1603
|
};
|
|
1599
1604
|
}
|
|
1600
1605
|
|
|
1601
|
-
// src/solana/generated/
|
|
1602
|
-
var
|
|
1603
|
-
var
|
|
1604
|
-
var
|
|
1605
|
-
var
|
|
1606
|
-
var
|
|
1607
|
-
var
|
|
1608
|
-
var
|
|
1609
|
-
var
|
|
1610
|
-
var
|
|
1611
|
-
var
|
|
1612
|
-
var
|
|
1613
|
-
var
|
|
1606
|
+
// src/solana/generated/dopplerLaunchHookV1/errors/dopplerLaunchHookV1.ts
|
|
1607
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_INSTRUCTION_DATA = 6e3;
|
|
1608
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_SCHEDULE_DATA = 6001;
|
|
1609
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_FEE = 6002;
|
|
1610
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_DURATION = 6003;
|
|
1611
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__ARITHMETIC_OVERFLOW = 6004;
|
|
1612
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_AUTHORITY = 6005;
|
|
1613
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_CONFIG = 6006;
|
|
1614
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_COSIGNER = 6007;
|
|
1615
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_ALREADY_EXISTS = 6008;
|
|
1616
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_NOT_FOUND = 6009;
|
|
1617
|
+
var DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_LIST_FULL = 6010;
|
|
1618
|
+
var dopplerLaunchHookV1ErrorMessages;
|
|
1614
1619
|
if (process.env.NODE_ENV !== "production") {
|
|
1615
|
-
|
|
1616
|
-
[
|
|
1617
|
-
[
|
|
1618
|
-
[
|
|
1619
|
-
[
|
|
1620
|
-
[
|
|
1621
|
-
[
|
|
1622
|
-
[
|
|
1623
|
-
[
|
|
1624
|
-
[
|
|
1625
|
-
[
|
|
1626
|
-
[
|
|
1620
|
+
dopplerLaunchHookV1ErrorMessages = {
|
|
1621
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
1622
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_ALREADY_EXISTS]: `Cosigner already exists`,
|
|
1623
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
|
|
1624
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
|
|
1625
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
|
|
1626
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_CONFIG]: `Invalid cosigner hook config`,
|
|
1627
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_COSIGNER]: `Invalid cosigner key`,
|
|
1628
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_DURATION]: `Invalid fee duration`,
|
|
1629
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_FEE]: `Invalid fee`,
|
|
1630
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
|
|
1631
|
+
[DOPPLER_LAUNCH_HOOK_V1_ERROR__INVALID_SCHEDULE_DATA]: `Invalid schedule payload`
|
|
1627
1632
|
};
|
|
1628
1633
|
}
|
|
1629
|
-
function
|
|
1634
|
+
function getDopplerLaunchHookV1ErrorMessage(code) {
|
|
1630
1635
|
if (process.env.NODE_ENV !== "production") {
|
|
1631
|
-
return
|
|
1636
|
+
return dopplerLaunchHookV1ErrorMessages[code];
|
|
1632
1637
|
}
|
|
1633
1638
|
return "Error message not available in production bundles.";
|
|
1634
1639
|
}
|
|
1635
|
-
function
|
|
1640
|
+
function isDopplerLaunchHookV1Error(error, transactionMessage, code) {
|
|
1636
1641
|
return isProgramError(
|
|
1637
1642
|
error,
|
|
1638
1643
|
transactionMessage,
|
|
1639
|
-
|
|
1644
|
+
DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS,
|
|
1640
1645
|
code
|
|
1641
1646
|
);
|
|
1642
1647
|
}
|
|
@@ -1677,11 +1682,11 @@ function getSetAuthorityArgsCodec() {
|
|
|
1677
1682
|
getSetAuthorityArgsDecoder()
|
|
1678
1683
|
);
|
|
1679
1684
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
var
|
|
1684
|
-
var
|
|
1685
|
+
|
|
1686
|
+
// src/solana/dopplerLaunchHookV1/constants.ts
|
|
1687
|
+
var DEVNET_DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID = DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ADDRESS;
|
|
1688
|
+
var DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID = DEVNET_DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID;
|
|
1689
|
+
var SEED_DOPPLER_LAUNCH_HOOK_V1_CONFIG = "cosigner_hook_config";
|
|
1685
1690
|
var MAX_COSIGNERS = 32;
|
|
1686
1691
|
var GATE_EXPIRY_DISABLED = 0;
|
|
1687
1692
|
var GATE_EXPIRY_UNIX_TIMESTAMP = 1;
|
|
@@ -1703,6 +1708,66 @@ var DYNAMIC_FEE_SCHEDULE_VERSION = 1;
|
|
|
1703
1708
|
var DYNAMIC_FEE_SCHEDULE_LEN = 32;
|
|
1704
1709
|
var DYNAMIC_FEE_SCHEDULE_HEADER_LEN = 16;
|
|
1705
1710
|
var DYNAMIC_FEE_SCHEDULE_MAX_BPS = 1e4;
|
|
1711
|
+
var textEncoder2 = new TextEncoder();
|
|
1712
|
+
async function getDopplerLaunchHookV1ConfigAddress(programId = DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID) {
|
|
1713
|
+
return getProgramDerivedAddress({
|
|
1714
|
+
programAddress: programId,
|
|
1715
|
+
seeds: [textEncoder2.encode(SEED_DOPPLER_LAUNCH_HOOK_V1_CONFIG)]
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
// src/solana/dopplerLaunchHookV1/config.ts
|
|
1720
|
+
var resolvedManagedCosignerGateBrand = Symbol(
|
|
1721
|
+
"resolvedManagedCosignerGate"
|
|
1722
|
+
);
|
|
1723
|
+
function isResolvedManagedCosignerGate(value) {
|
|
1724
|
+
return typeof value === "object" && value !== null && value[resolvedManagedCosignerGateBrand] === true;
|
|
1725
|
+
}
|
|
1726
|
+
async function resolveManagedCosignerGate(rpc, input = {}) {
|
|
1727
|
+
const programId = input.programId ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID;
|
|
1728
|
+
const [config, expectedBump] = await getDopplerLaunchHookV1ConfigAddress(programId);
|
|
1729
|
+
const configAccount = await fetchMaybeCosignerConfig(rpc, config, {
|
|
1730
|
+
commitment: "confirmed"
|
|
1731
|
+
});
|
|
1732
|
+
if (!configAccount.exists) {
|
|
1733
|
+
throw new Error(`Doppler-managed cosigner config ${config} does not exist`);
|
|
1734
|
+
}
|
|
1735
|
+
if (configAccount.programAddress !== programId) {
|
|
1736
|
+
throw new Error(
|
|
1737
|
+
`Doppler-managed cosigner config ${config} is owned by ${configAccount.programAddress}, expected ${programId}`
|
|
1738
|
+
);
|
|
1739
|
+
}
|
|
1740
|
+
const { bump, cosignerCount, cosigners, version } = configAccount.data;
|
|
1741
|
+
if (version !== 1 || bump !== expectedBump || cosignerCount === 0 || cosignerCount > MAX_COSIGNERS || cosignerCount > cosigners.length) {
|
|
1742
|
+
throw new Error(
|
|
1743
|
+
`Doppler-managed cosigner config ${config} has no valid active cosigner`
|
|
1744
|
+
);
|
|
1745
|
+
}
|
|
1746
|
+
const activeCosigners = Object.freeze(cosigners.slice(0, cosignerCount));
|
|
1747
|
+
if (activeCosigners.some((candidate) => candidate === SYSTEM_PROGRAM_ADDRESS) || new Set(activeCosigners).size !== activeCosigners.length) {
|
|
1748
|
+
throw new Error(
|
|
1749
|
+
`Doppler-managed cosigner config ${config} contains invalid active cosigners`
|
|
1750
|
+
);
|
|
1751
|
+
}
|
|
1752
|
+
const cosigner = activeCosigners[0];
|
|
1753
|
+
if (!cosigner) {
|
|
1754
|
+
throw new Error(
|
|
1755
|
+
`Doppler-managed cosigner config ${config} has no active cosigner`
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1758
|
+
const resolvedGate = {
|
|
1759
|
+
[resolvedManagedCosignerGateBrand]: true,
|
|
1760
|
+
programId,
|
|
1761
|
+
config,
|
|
1762
|
+
cosigner,
|
|
1763
|
+
activeCosigners,
|
|
1764
|
+
...input.expiresAt !== void 0 ? { expiresAt: input.expiresAt } : {}
|
|
1765
|
+
};
|
|
1766
|
+
Object.defineProperty(resolvedGate, resolvedManagedCosignerGateBrand, {
|
|
1767
|
+
enumerable: false
|
|
1768
|
+
});
|
|
1769
|
+
return Object.freeze(resolvedGate);
|
|
1770
|
+
}
|
|
1706
1771
|
var MAX_U64 = (1n << 64n) - 1n;
|
|
1707
1772
|
function toBigInt(value) {
|
|
1708
1773
|
return typeof value === "bigint" ? value : BigInt(value);
|
|
@@ -2028,7 +2093,7 @@ function phaseLabel(phase) {
|
|
|
2028
2093
|
}
|
|
2029
2094
|
}
|
|
2030
2095
|
|
|
2031
|
-
// src/solana/
|
|
2096
|
+
// src/solana/dopplerLaunchHookV1/payload.ts
|
|
2032
2097
|
var MAX_I64 = (1n << 63n) - 1n;
|
|
2033
2098
|
var MAX_U32 = (1n << 32n) - 1n;
|
|
2034
2099
|
function toBigInt2(value) {
|
|
@@ -2081,7 +2146,7 @@ function encodeDynamicFeeSchedule(schedule) {
|
|
|
2081
2146
|
writeU32Le(payload, 28, durationSeconds);
|
|
2082
2147
|
return payload;
|
|
2083
2148
|
}
|
|
2084
|
-
function
|
|
2149
|
+
function encodeDopplerLaunchHookV1Payload(args = {}) {
|
|
2085
2150
|
const schedulePayload = args.schedule ? encodeDynamicFeeSchedule(args.schedule) : new Uint8Array();
|
|
2086
2151
|
const gatePayload = args.gateExpiry ? encodeCosignerGateExpiryPayload(args.gateExpiry) : new Uint8Array();
|
|
2087
2152
|
const payload = new Uint8Array(schedulePayload.length + gatePayload.length);
|
|
@@ -2092,7 +2157,7 @@ function encodeCpmmHookPayload(args = {}) {
|
|
|
2092
2157
|
function encodeDynamicFeeCosignerGatePayload(args) {
|
|
2093
2158
|
return encodeCosignerGateExpiryPayload(args);
|
|
2094
2159
|
}
|
|
2095
|
-
function
|
|
2160
|
+
function getDopplerLaunchHookV1RemainingAccounts({
|
|
2096
2161
|
namespace,
|
|
2097
2162
|
config,
|
|
2098
2163
|
cosigner
|
|
@@ -2115,12 +2180,12 @@ function getCpmmHookRemainingAccounts({
|
|
|
2115
2180
|
)
|
|
2116
2181
|
};
|
|
2117
2182
|
}
|
|
2118
|
-
function
|
|
2183
|
+
function getDopplerLaunchHookV1RemainingAccountAddresses({
|
|
2119
2184
|
namespace,
|
|
2120
2185
|
config,
|
|
2121
2186
|
cosigner
|
|
2122
2187
|
}) {
|
|
2123
|
-
return
|
|
2188
|
+
return getDopplerLaunchHookV1RemainingAccounts({
|
|
2124
2189
|
namespace,
|
|
2125
2190
|
config,
|
|
2126
2191
|
cosigner
|
|
@@ -2129,13 +2194,6 @@ function getCpmmHookRemainingAccountAddresses({
|
|
|
2129
2194
|
function isDynamicFeeSchedulePayload(payload) {
|
|
2130
2195
|
return payload.length >= DYNAMIC_FEE_SCHEDULE_LEN && DYNAMIC_FEE_SCHEDULE_MAGIC.every((byte, index) => payload[index] === byte);
|
|
2131
2196
|
}
|
|
2132
|
-
var textEncoder2 = new TextEncoder();
|
|
2133
|
-
async function getCpmmHookConfigAddress(programId = CPMM_HOOK_PROGRAM_ID) {
|
|
2134
|
-
return getProgramDerivedAddress({
|
|
2135
|
-
programAddress: programId,
|
|
2136
|
-
seeds: [textEncoder2.encode(SEED_CPMM_HOOK_CONFIG)]
|
|
2137
|
-
});
|
|
2138
|
-
}
|
|
2139
2197
|
|
|
2140
2198
|
// src/solana/initializer/index.ts
|
|
2141
2199
|
var initializer_exports = {};
|
|
@@ -3275,7 +3333,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
3275
3333
|
admin,
|
|
3276
3334
|
config,
|
|
3277
3335
|
programData,
|
|
3278
|
-
systemProgram = SYSTEM_PROGRAM_ADDRESS
|
|
3336
|
+
systemProgram = SYSTEM_PROGRAM_ADDRESS$1
|
|
3279
3337
|
} = accounts;
|
|
3280
3338
|
const keys = [
|
|
3281
3339
|
createAccountMeta(admin, AccountRole.WRITABLE_SIGNER),
|
|
@@ -5430,7 +5488,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5430
5488
|
migratorProgram,
|
|
5431
5489
|
baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
5432
5490
|
quoteTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
5433
|
-
systemProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
5491
|
+
systemProgram = SYSTEM_PROGRAM_ADDRESS$1,
|
|
5434
5492
|
rent,
|
|
5435
5493
|
metadataAccount,
|
|
5436
5494
|
metadataProgram = TOKEN_METADATA_PROGRAM_ID,
|
|
@@ -5562,7 +5620,7 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5562
5620
|
baseMint,
|
|
5563
5621
|
quoteMint,
|
|
5564
5622
|
user,
|
|
5565
|
-
hookProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
5623
|
+
hookProgram = SYSTEM_PROGRAM_ADDRESS$1,
|
|
5566
5624
|
launchFeeState,
|
|
5567
5625
|
baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
5568
5626
|
quoteTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
@@ -5606,7 +5664,7 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
5606
5664
|
payer,
|
|
5607
5665
|
baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
5608
5666
|
quoteTokenProgram = TOKEN_PROGRAM_ADDRESS,
|
|
5609
|
-
systemProgram = SYSTEM_PROGRAM_ADDRESS,
|
|
5667
|
+
systemProgram = SYSTEM_PROGRAM_ADDRESS$1,
|
|
5610
5668
|
rent
|
|
5611
5669
|
} = accounts;
|
|
5612
5670
|
const keys = [
|
|
@@ -6262,7 +6320,7 @@ async function createSpotPoolInstruction(input) {
|
|
|
6262
6320
|
{ address: accounts.token0Program, role: AccountRole.READONLY },
|
|
6263
6321
|
{ address: accounts.token1Program, role: AccountRole.READONLY },
|
|
6264
6322
|
{
|
|
6265
|
-
address: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS
|
|
6323
|
+
address: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS,
|
|
6266
6324
|
role: AccountRole.READONLY
|
|
6267
6325
|
},
|
|
6268
6326
|
{
|
|
@@ -6450,30 +6508,35 @@ function hashRemainingAccounts(accounts) {
|
|
|
6450
6508
|
function isCustomMigrationConfig(migration) {
|
|
6451
6509
|
return migration.kind === "custom";
|
|
6452
6510
|
}
|
|
6453
|
-
|
|
6454
|
-
const program = input.deployment?.
|
|
6455
|
-
if (
|
|
6456
|
-
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
6457
|
-
}
|
|
6458
|
-
if (!input.cosigner) {
|
|
6511
|
+
function getCreateLaunchHookContext(input) {
|
|
6512
|
+
const program = input.deployment?.dopplerLaunchHookV1Program ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID;
|
|
6513
|
+
if (!input.cosignerGate) {
|
|
6459
6514
|
return { program };
|
|
6460
6515
|
}
|
|
6461
|
-
|
|
6462
|
-
|
|
6516
|
+
if (!isResolvedManagedCosignerGate(input.cosignerGate)) {
|
|
6517
|
+
throw new Error(
|
|
6518
|
+
"cosignerGate must be returned by dopplerLaunchHookV1.resolveManagedCosignerGate"
|
|
6519
|
+
);
|
|
6520
|
+
}
|
|
6521
|
+
if (input.cosignerGate.programId !== program) {
|
|
6522
|
+
throw new Error(
|
|
6523
|
+
`managed cosigner gate was resolved for ${input.cosignerGate.programId}, expected ${program}`
|
|
6524
|
+
);
|
|
6525
|
+
}
|
|
6526
|
+
return { program, cosignerGate: input.cosignerGate };
|
|
6463
6527
|
}
|
|
6464
|
-
function
|
|
6528
|
+
function resolveDopplerLaunchHookV1Payload(input, hookContext) {
|
|
6465
6529
|
let gateExpiry = null;
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
}
|
|
6530
|
+
const cosignerGate = hookContext.cosignerGate;
|
|
6531
|
+
const expiresAt = cosignerGate?.expiresAt;
|
|
6532
|
+
if (cosignerGate && expiresAt !== void 0 && expiresAt !== null) {
|
|
6470
6533
|
gateExpiry = {
|
|
6471
6534
|
mode: GATE_EXPIRY_UNIX_TIMESTAMP,
|
|
6472
|
-
value:
|
|
6473
|
-
cosigner:
|
|
6535
|
+
value: expiresAt,
|
|
6536
|
+
cosigner: cosignerGate.cosigner
|
|
6474
6537
|
};
|
|
6475
6538
|
}
|
|
6476
|
-
return
|
|
6539
|
+
return encodeDopplerLaunchHookV1Payload({
|
|
6477
6540
|
schedule: input.dynamicFee ?? null,
|
|
6478
6541
|
gateExpiry
|
|
6479
6542
|
});
|
|
@@ -6483,17 +6546,17 @@ function resolveCreateLaunchHook({
|
|
|
6483
6546
|
namespace,
|
|
6484
6547
|
hookContext
|
|
6485
6548
|
}) {
|
|
6486
|
-
const hasCosigner =
|
|
6549
|
+
const hasCosigner = hookContext.cosignerGate !== void 0;
|
|
6487
6550
|
const hasSchedule = Boolean(input.dynamicFee);
|
|
6488
|
-
const remainingAccounts =
|
|
6551
|
+
const remainingAccounts = getDopplerLaunchHookV1RemainingAccounts({
|
|
6489
6552
|
namespace,
|
|
6490
|
-
config: hookContext.config,
|
|
6491
|
-
cosigner:
|
|
6553
|
+
config: hookContext.cosignerGate?.config,
|
|
6554
|
+
cosigner: hookContext.cosignerGate?.cosigner
|
|
6492
6555
|
});
|
|
6493
6556
|
return {
|
|
6494
6557
|
program: hookContext.program,
|
|
6495
6558
|
flags: HF_BEFORE_SWAP2 | (hasSchedule ? HF_BEFORE_CREATE : 0) | (hasCosigner ? HF_FORWARD_READONLY_SIGNERS2 : 0),
|
|
6496
|
-
payload:
|
|
6559
|
+
payload: resolveDopplerLaunchHookV1Payload(input, hookContext),
|
|
6497
6560
|
remainingAccountsHash: remainingAccounts.hookRemainingAccountsHash
|
|
6498
6561
|
};
|
|
6499
6562
|
}
|
|
@@ -6631,8 +6694,8 @@ async function getMigrationInitRemainingAccountsHash({
|
|
|
6631
6694
|
async function createLaunch(input) {
|
|
6632
6695
|
const programId = getInitializerProgramId(input);
|
|
6633
6696
|
const launchId = input.launchId ?? createLaunchId();
|
|
6634
|
-
const hookContext =
|
|
6635
|
-
const namespace = input.namespace ?? SYSTEM_PROGRAM_ADDRESS;
|
|
6697
|
+
const hookContext = getCreateLaunchHookContext(input);
|
|
6698
|
+
const namespace = input.namespace ?? SYSTEM_PROGRAM_ADDRESS$1;
|
|
6636
6699
|
const tokenPrograms = {
|
|
6637
6700
|
...launchTokenPrograms.splToken(),
|
|
6638
6701
|
...input.tokenPrograms
|
|
@@ -6678,7 +6741,7 @@ async function createLaunch(input) {
|
|
|
6678
6741
|
cpmmConfig: migration?.cpmmConfig,
|
|
6679
6742
|
baseTokenProgram: tokenPrograms.baseTokenProgram,
|
|
6680
6743
|
quoteTokenProgram: tokenPrograms.quoteTokenProgram,
|
|
6681
|
-
systemProgram: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS,
|
|
6744
|
+
systemProgram: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS$1,
|
|
6682
6745
|
rent: input.rent ?? SYSVAR_RENT_ADDRESS$1,
|
|
6683
6746
|
metadataAccount: addresses.metadataAccount,
|
|
6684
6747
|
metadataProgram: input.metadataProgram ?? TOKEN_METADATA_PROGRAM_ID
|
|
@@ -6725,7 +6788,8 @@ async function createLaunch(input) {
|
|
|
6725
6788
|
launchId,
|
|
6726
6789
|
addresses,
|
|
6727
6790
|
instruction: preparedInstruction,
|
|
6728
|
-
cpmmMigration: migration?.cpmmMigration
|
|
6791
|
+
cpmmMigration: migration?.cpmmMigration,
|
|
6792
|
+
...hookContext.cosignerGate ? { cosignerGate: hookContext.cosignerGate } : {}
|
|
6729
6793
|
};
|
|
6730
6794
|
}
|
|
6731
6795
|
var DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND = 20;
|
|
@@ -7679,7 +7743,7 @@ async function curveSwapExactIn(input) {
|
|
|
7679
7743
|
baseMint: input.baseMint,
|
|
7680
7744
|
quoteMint: input.quoteMint,
|
|
7681
7745
|
user,
|
|
7682
|
-
hookProgram: input.deployment?.
|
|
7746
|
+
hookProgram: input.deployment?.dopplerLaunchHookV1Program ?? DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID,
|
|
7683
7747
|
baseTokenProgram,
|
|
7684
7748
|
quoteTokenProgram,
|
|
7685
7749
|
remainingAccounts: input.remainingAccounts ? [...input.remainingAccounts] : void 0
|
|
@@ -7841,7 +7905,7 @@ function migrateLaunch(input) {
|
|
|
7841
7905
|
payer: input.payer,
|
|
7842
7906
|
baseTokenProgram,
|
|
7843
7907
|
quoteTokenProgram,
|
|
7844
|
-
systemProgram: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS,
|
|
7908
|
+
systemProgram: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS$1,
|
|
7845
7909
|
rent: input.rent ?? SYSVAR_RENT_ADDRESS$1
|
|
7846
7910
|
},
|
|
7847
7911
|
input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID
|
|
@@ -7906,13 +7970,21 @@ async function assertMigrationQuoteThreshold({
|
|
|
7906
7970
|
}
|
|
7907
7971
|
return progress;
|
|
7908
7972
|
}
|
|
7909
|
-
|
|
7910
|
-
// src/solana/deployment.ts
|
|
7911
7973
|
var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
7912
7974
|
cpmmProgram: CPMM_PROGRAM_ID,
|
|
7913
7975
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
7914
7976
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
7915
|
-
|
|
7977
|
+
dopplerLaunchHookV1Program: DOPPLER_LAUNCH_HOOK_V1_PROGRAM_ID
|
|
7978
|
+
};
|
|
7979
|
+
var DOPPLER_SOLANA_MAINNET_PROGRAM_ADDRESSES = {
|
|
7980
|
+
cpmmProgram: address("5pXzd9UiWrVxATCYWmgo5EbfxzXqHYhfSKGdCPXPz7vK"),
|
|
7981
|
+
initializerProgram: address("4carc9eePfE7jKUXdCAYMhcPf4awEFpZPrz1sTykdss1"),
|
|
7982
|
+
cpmmMigratorProgram: address(
|
|
7983
|
+
"H71WD4tsiCCipro4urykWHySH1ryvLTmqEdNbHTGwb3o"
|
|
7984
|
+
),
|
|
7985
|
+
dopplerLaunchHookV1Program: address(
|
|
7986
|
+
"BeyqffXEVgLpM3fQ1zjk8YnZzQN9sMVrCKtNKwSxNATr"
|
|
7987
|
+
)
|
|
7916
7988
|
};
|
|
7917
7989
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
7918
7990
|
const [cpmmConfig] = await getConfigAddress(programs.cpmmProgram);
|
|
@@ -7926,6 +7998,6 @@ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGR
|
|
|
7926
7998
|
};
|
|
7927
7999
|
}
|
|
7928
8000
|
|
|
7929
|
-
export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, assertMigrationQuoteThreshold, cpmm_exports as cpmm,
|
|
8001
|
+
export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, DOPPLER_SOLANA_MAINNET_PROGRAM_ADDRESSES, assertMigrationQuoteThreshold, cpmm_exports as cpmm, cpmmMigrator_exports as cpmmMigrator, createLaunch, curveSwapExactIn, deriveSolanaCpmmDeployment, dopplerLaunchHookV1_exports as dopplerLaunchHookV1, getMigrationQuoteProgress, initializer_exports as initializer, migrateLaunch, predictionMigrator_exports as predictionMigrator, swapExactIn, trustedOracle_exports as trustedOracle };
|
|
7930
8002
|
//# sourceMappingURL=index.js.map
|
|
7931
8003
|
//# sourceMappingURL=index.js.map
|