@whetstone-research/doppler-sdk 1.0.25 → 1.0.26

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.
@@ -1,9 +1,10 @@
1
- import { 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, minBigInt, maxBigInt, isqrt, 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, 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, createPositionArgsCodec, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, ammConfigDataCodec, 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-BESE77DM.js';
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 } from '../chunk-ZUJKBFXW.js';
1
+ import { 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, minBigInt, maxBigInt, isqrt, 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, 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, createPositionArgsCodec, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, ammConfigDataCodec, 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-RVDRWCJN.js';
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-WD5VOZGI.js';
3
3
  import { __export } from '../chunk-PZ5AY32C.js';
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, compressTransactionMessageUsingAddressLookupTables, getTransactionMessageSize, getOptionEncoder, getU128Encoder, getOptionDecoder, getU128Decoder, getBooleanEncoder, getBooleanDecoder, mergeBytes, getEnumEncoder } from '@solana/kit';
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, getOptionEncoder, getU128Encoder, getOptionDecoder, getU128Decoder, 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 { findAssociatedTokenPda } from '@solana-program/token';
7
8
  import { findAddressLookupTablePda, getCreateLookupTableInstruction, getExtendLookupTableInstruction } from '@solana-program/address-lookup-table';
8
9
 
9
10
  // src/solana/cpmm/index.ts
@@ -746,6 +747,7 @@ __export(cosignerHook_exports, {
746
747
  COSIGNER_HOOK_PROGRAM_ID: () => COSIGNER_HOOK_PROGRAM_ID,
747
748
  CosignerHookAccount: () => CosignerHookAccount,
748
749
  CosignerHookInstruction: () => CosignerHookInstruction,
750
+ DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID: () => DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
749
751
  GATE_EXPIRY_DISABLED: () => GATE_EXPIRY_DISABLED,
750
752
  GATE_EXPIRY_HEADER_LEN: () => GATE_EXPIRY_HEADER_LEN,
751
753
  GATE_EXPIRY_PAYLOAD_LEN: () => GATE_EXPIRY_PAYLOAD_LEN,
@@ -782,6 +784,7 @@ __export(cosignerHook_exports, {
782
784
  getCosignerGateStatus: () => getCosignerGateStatus,
783
785
  getCosignerHookConfigAddress: () => getCosignerHookConfigAddress,
784
786
  getCosignerHookErrorMessage: () => getCosignerHookErrorMessage,
787
+ getCosignerHookRemainingAccounts: () => getCosignerHookRemainingAccounts,
785
788
  getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec,
786
789
  getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder,
787
790
  getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder,
@@ -865,13 +868,13 @@ function decodeCosignerConfig(encodedAccount) {
865
868
  getCosignerConfigDecoder()
866
869
  );
867
870
  }
868
- async function fetchCosignerConfig(rpc, address3, config) {
869
- const maybeAccount = await fetchMaybeCosignerConfig(rpc, address3, config);
871
+ async function fetchCosignerConfig(rpc, address4, config) {
872
+ const maybeAccount = await fetchMaybeCosignerConfig(rpc, address4, config);
870
873
  assertAccountExists(maybeAccount);
871
874
  return maybeAccount;
872
875
  }
873
- async function fetchMaybeCosignerConfig(rpc, address3, config) {
874
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
876
+ async function fetchMaybeCosignerConfig(rpc, address4, config) {
877
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
875
878
  return decodeCosignerConfig(maybeAccount);
876
879
  }
877
880
  async function fetchAllCosignerConfig(rpc, addresses, config) {
@@ -1652,9 +1655,10 @@ function getSetAuthorityArgsCodec() {
1652
1655
  getSetAuthorityArgsDecoder()
1653
1656
  );
1654
1657
  }
1655
-
1656
- // src/solana/cosignerHook/constants.ts
1657
- var COSIGNER_HOOK_PROGRAM_ID = COSIGNER_HOOK_PROGRAM_ADDRESS;
1658
+ var DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID = address(
1659
+ "5iWYdN9SEDeF3FTjKB48XYyCFAcVDuYHsz31Z4Wmq7Ch"
1660
+ );
1661
+ var COSIGNER_HOOK_PROGRAM_ID = DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID;
1658
1662
  var SEED_COSIGNER_HOOK_CONFIG = "cosigner_hook_config";
1659
1663
  var MAX_COSIGNERS = 32;
1660
1664
  var GATE_EXPIRY_DISABLED = 0;
@@ -1663,6 +1667,215 @@ var GATE_EXPIRY_SLOT = 2;
1663
1667
  var GATE_EXPIRY_PAYLOAD_VERSION = 1;
1664
1668
  var GATE_EXPIRY_HEADER_LEN = 10;
1665
1669
  var GATE_EXPIRY_PAYLOAD_LEN = 42;
1670
+ var INITIALIZER_PROGRAM_ID = address(
1671
+ "4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1"
1672
+ );
1673
+ var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = address(
1674
+ "BPFLoaderUpgradeab1e11111111111111111111111"
1675
+ );
1676
+ var CPMM_HOOK_PROGRAM_ID = address(
1677
+ "2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
1678
+ );
1679
+ var PREDICTION_HOOK_PROGRAM_ID = address(
1680
+ "7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
1681
+ );
1682
+ var SEED_CONFIG2 = "config";
1683
+ var SEED_LAUNCH = "launch";
1684
+ var SEED_LAUNCH_AUTHORITY = "launch_authority";
1685
+ var SEED_LAUNCH_FEE_STATE = "launch_fee_state";
1686
+ var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
1687
+ 232,
1688
+ 231,
1689
+ 118,
1690
+ 38,
1691
+ 88,
1692
+ 111,
1693
+ 115,
1694
+ 185,
1695
+ 85,
1696
+ 54,
1697
+ 76,
1698
+ 123,
1699
+ 75,
1700
+ 191,
1701
+ 11,
1702
+ 183,
1703
+ 247,
1704
+ 104,
1705
+ 94,
1706
+ 189,
1707
+ 64,
1708
+ 232,
1709
+ 82,
1710
+ 177,
1711
+ 100,
1712
+ 99,
1713
+ 58,
1714
+ 74,
1715
+ 203,
1716
+ 211,
1717
+ 36,
1718
+ 76
1719
+ ]);
1720
+ var MAX_MIGRATOR_ALLOWLIST = 32;
1721
+ var MAX_HOOK_ALLOWLIST2 = 32;
1722
+ var MAX_PAYLOAD = 256;
1723
+ var PHASE_TRADING = 0;
1724
+ var PHASE_MIGRATED = 1;
1725
+ var PHASE_ABORTED = 2;
1726
+ var TRADE_DIRECTION_BUY = 0;
1727
+ var TRADE_DIRECTION_SELL = 1;
1728
+ var CURVE_KIND_XYK = 0;
1729
+ var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
1730
+ var HF_BEFORE_SWAP2 = 1 << 0;
1731
+ var HF_AFTER_SWAP2 = 1 << 1;
1732
+ var HF_BEFORE_CREATE = 1 << 2;
1733
+ var HF_AFTER_CREATE = 1 << 3;
1734
+ var HF_BEFORE_MIGRATE = 1 << 4;
1735
+ var HF_AFTER_MIGRATE = 1 << 5;
1736
+ var HF_FORWARD_READONLY_SIGNERS2 = 1 << 6;
1737
+ var HOOK_NO_CHANGE2 = 65535;
1738
+ var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
1739
+ // SHA256("global:initialize_config")[0:8]
1740
+ initializeConfig: new Uint8Array([
1741
+ 208,
1742
+ 127,
1743
+ 21,
1744
+ 1,
1745
+ 194,
1746
+ 190,
1747
+ 196,
1748
+ 70
1749
+ ]),
1750
+ // SHA256("global:set_migrator_allowlist")[0:8]
1751
+ setMigratorAllowlist: new Uint8Array([
1752
+ 209,
1753
+ 90,
1754
+ 181,
1755
+ 104,
1756
+ 99,
1757
+ 108,
1758
+ 233,
1759
+ 168
1760
+ ]),
1761
+ // SHA256("global:set_hook_allowlist")[0:8]
1762
+ setHookAllowlist: new Uint8Array([
1763
+ 232,
1764
+ 28,
1765
+ 40,
1766
+ 143,
1767
+ 121,
1768
+ 182,
1769
+ 77,
1770
+ 103
1771
+ ]),
1772
+ // SHA256("global:initialize_launch")[0:8]
1773
+ initializeLaunch: new Uint8Array([
1774
+ 90,
1775
+ 201,
1776
+ 220,
1777
+ 142,
1778
+ 112,
1779
+ 253,
1780
+ 100,
1781
+ 13
1782
+ ]),
1783
+ // SHA256("global:curve_swap_exact_in")[0:8]
1784
+ curveSwapExactIn: new Uint8Array([
1785
+ 196,
1786
+ 247,
1787
+ 195,
1788
+ 126,
1789
+ 227,
1790
+ 27,
1791
+ 166,
1792
+ 93
1793
+ ]),
1794
+ // SHA256("global:migrate_launch")[0:8]
1795
+ migrateLaunch: new Uint8Array([
1796
+ 19,
1797
+ 199,
1798
+ 119,
1799
+ 103,
1800
+ 13,
1801
+ 30,
1802
+ 12,
1803
+ 205
1804
+ ]),
1805
+ // SHA256("global:preview_swap_exact_in")[0:8]
1806
+ previewSwapExactIn: new Uint8Array([
1807
+ 50,
1808
+ 130,
1809
+ 31,
1810
+ 69,
1811
+ 147,
1812
+ 58,
1813
+ 222,
1814
+ 178
1815
+ ]),
1816
+ // SHA256("global:preview_migration")[0:8]
1817
+ previewMigration: new Uint8Array([
1818
+ 216,
1819
+ 180,
1820
+ 209,
1821
+ 112,
1822
+ 62,
1823
+ 16,
1824
+ 15,
1825
+ 63
1826
+ ])
1827
+ };
1828
+ var INITIALIZER_ACCOUNT_DISCRIMINATORS = {
1829
+ // SHA256("account:InitConfig")[0:8]
1830
+ InitConfig: new Uint8Array([97, 166, 35, 7, 20, 2, 164, 126]),
1831
+ // SHA256("account:Launch")[0:8]
1832
+ Launch: new Uint8Array([144, 51, 51, 163, 206, 85, 213, 38]),
1833
+ // SHA256("account:LaunchFeeState")[0:8]
1834
+ LaunchFeeState: new Uint8Array([
1835
+ 1,
1836
+ 106,
1837
+ 55,
1838
+ 241,
1839
+ 179,
1840
+ 18,
1841
+ 230,
1842
+ 232
1843
+ ])
1844
+ };
1845
+
1846
+ // src/solana/initializer/helpers.ts
1847
+ function computeRemainingAccountsHash(addresses) {
1848
+ const addressEncoder = getAddressEncoder();
1849
+ const buf = new Uint8Array(4 + addresses.length * 32);
1850
+ new DataView(buf.buffer).setUint32(0, addresses.length, true);
1851
+ for (let i = 0; i < addresses.length; i++) {
1852
+ buf.set(addressEncoder.encode(addresses[i]), 4 + i * 32);
1853
+ }
1854
+ return keccak_256(buf);
1855
+ }
1856
+ function getCurveSwapFeeAmount(amountIn, swapFeeBps) {
1857
+ if (amountIn < 0n) {
1858
+ throw new Error("amountIn must be non-negative");
1859
+ }
1860
+ if (!Number.isInteger(swapFeeBps) || swapFeeBps < 0 || swapFeeBps > Number(BPS_DENOM)) {
1861
+ throw new Error("swapFeeBps must be an integer from 0 to 10000");
1862
+ }
1863
+ return ceilDiv(amountIn * BigInt(swapFeeBps), BPS_DENOM);
1864
+ }
1865
+ function phaseLabel(phase) {
1866
+ switch (phase) {
1867
+ case PHASE_TRADING:
1868
+ return "TRADING";
1869
+ case PHASE_MIGRATED:
1870
+ return "MIGRATED";
1871
+ case PHASE_ABORTED:
1872
+ return "ABORTED";
1873
+ default:
1874
+ return String(phase);
1875
+ }
1876
+ }
1877
+
1878
+ // src/solana/cosignerHook/gate.ts
1666
1879
  var MAX_U64 = (1n << 64n) - 1n;
1667
1880
  function toBigInt(value) {
1668
1881
  return typeof value === "bigint" ? value : BigInt(value);
@@ -1783,6 +1996,22 @@ function getCosignerGateStatus(hookPayload, clock = {}) {
1783
1996
  function isCosignerGateEnforced(hookPayload, clock = {}) {
1784
1997
  return getCosignerGateStatus(hookPayload, clock).gateEnforced;
1785
1998
  }
1999
+ function getCosignerHookRemainingAccounts({
2000
+ namespace,
2001
+ cosigner
2002
+ }) {
2003
+ const unsignedHookRemainingAccounts = [
2004
+ namespace,
2005
+ cosigner.address
2006
+ ];
2007
+ return {
2008
+ signedHookRemainingAccounts: [namespace, cosigner],
2009
+ unsignedHookRemainingAccounts,
2010
+ hookRemainingAccountsHash: computeRemainingAccountsHash(
2011
+ unsignedHookRemainingAccounts
2012
+ )
2013
+ };
2014
+ }
1786
2015
  var textEncoder2 = new TextEncoder();
1787
2016
  async function getCosignerHookConfigAddress(programId = COSIGNER_HOOK_PROGRAM_ID) {
1788
2017
  return getProgramDerivedAddress({
@@ -1833,6 +2062,7 @@ __export(initializer_exports, {
1833
2062
  createCurveSwapExactInInstruction: () => createCurveSwapExactInInstruction,
1834
2063
  createInitializeConfigInstruction: () => createInitializeConfigInstruction,
1835
2064
  createInitializeLaunchInstruction: () => createInitializeLaunchInstruction,
2065
+ createLaunchId: () => createLaunchId,
1836
2066
  createMigrateLaunchInstruction: () => createMigrateLaunchInstruction,
1837
2067
  createPreviewMigrationInstruction: () => createPreviewMigrationInstruction,
1838
2068
  createPreviewSwapExactInInstruction: () => createPreviewSwapExactInInstruction,
@@ -1840,12 +2070,14 @@ __export(initializer_exports, {
1840
2070
  createSetMigratorAllowlistInstruction: () => createSetMigratorAllowlistInstruction,
1841
2071
  decodePreviewMigrationResult: () => decodePreviewMigrationResult,
1842
2072
  decodePreviewSwapExactInResult: () => decodePreviewSwapExactInResult,
2073
+ deriveCreateLaunchAddresses: () => deriveCreateLaunchAddresses,
1843
2074
  encodeU64LE: () => encodeU64LE,
1844
2075
  fetchAllLaunches: () => fetchAllLaunches,
1845
2076
  fetchLaunch: () => fetchLaunch2,
1846
2077
  fetchLaunchesByAuthority: () => fetchLaunchesByAuthority,
1847
2078
  getClaimFeesInstructionAsync: () => getClaimFeesInstructionAsync,
1848
2079
  getConfigAddress: () => getConfigAddress2,
2080
+ getCurveSwapFeeAmount: () => getCurveSwapFeeAmount,
1849
2081
  getHarvestMigratedFeesInstructionAsync: () => getHarvestMigratedFeesInstructionAsync,
1850
2082
  getInitConfigCodec: () => getInitConfigCodec,
1851
2083
  getInitConfigDecoder: () => getInitConfigDecoder,
@@ -1872,185 +2104,11 @@ __export(initializer_exports, {
1872
2104
  getTokenMetadataAddress: () => getTokenMetadataAddress,
1873
2105
  launchExists: () => launchExists,
1874
2106
  launchIdFromU64: () => launchIdFromU64,
2107
+ launchTokenPrograms: () => launchTokenPrograms,
1875
2108
  measureTransactionMessageSize: () => measureTransactionMessageSize,
1876
2109
  measureTransactionMessageSizeWithLookupTable: () => measureTransactionMessageSizeWithLookupTable,
1877
2110
  phaseLabel: () => phaseLabel
1878
2111
  });
1879
- var INITIALIZER_PROGRAM_ID = address(
1880
- "4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1"
1881
- );
1882
- var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = address(
1883
- "BPFLoaderUpgradeab1e11111111111111111111111"
1884
- );
1885
- var CPMM_HOOK_PROGRAM_ID = address(
1886
- "2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
1887
- );
1888
- var PREDICTION_HOOK_PROGRAM_ID = address(
1889
- "7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
1890
- );
1891
- var SEED_CONFIG2 = "config";
1892
- var SEED_LAUNCH = "launch";
1893
- var SEED_LAUNCH_AUTHORITY = "launch_authority";
1894
- var SEED_LAUNCH_FEE_STATE = "launch_fee_state";
1895
- var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
1896
- 232,
1897
- 231,
1898
- 118,
1899
- 38,
1900
- 88,
1901
- 111,
1902
- 115,
1903
- 185,
1904
- 85,
1905
- 54,
1906
- 76,
1907
- 123,
1908
- 75,
1909
- 191,
1910
- 11,
1911
- 183,
1912
- 247,
1913
- 104,
1914
- 94,
1915
- 189,
1916
- 64,
1917
- 232,
1918
- 82,
1919
- 177,
1920
- 100,
1921
- 99,
1922
- 58,
1923
- 74,
1924
- 203,
1925
- 211,
1926
- 36,
1927
- 76
1928
- ]);
1929
- var MAX_MIGRATOR_ALLOWLIST = 32;
1930
- var MAX_HOOK_ALLOWLIST2 = 32;
1931
- var MAX_PAYLOAD = 256;
1932
- var PHASE_TRADING = 0;
1933
- var PHASE_MIGRATED = 1;
1934
- var PHASE_ABORTED = 2;
1935
- var TRADE_DIRECTION_BUY = 0;
1936
- var TRADE_DIRECTION_SELL = 1;
1937
- var CURVE_KIND_XYK = 0;
1938
- var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
1939
- var HF_BEFORE_SWAP2 = 1 << 0;
1940
- var HF_AFTER_SWAP2 = 1 << 1;
1941
- var HF_BEFORE_CREATE = 1 << 2;
1942
- var HF_AFTER_CREATE = 1 << 3;
1943
- var HF_BEFORE_MIGRATE = 1 << 4;
1944
- var HF_AFTER_MIGRATE = 1 << 5;
1945
- var HF_FORWARD_READONLY_SIGNERS2 = 1 << 6;
1946
- var HOOK_NO_CHANGE2 = 65535;
1947
- var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
1948
- // SHA256("global:initialize_config")[0:8]
1949
- initializeConfig: new Uint8Array([
1950
- 208,
1951
- 127,
1952
- 21,
1953
- 1,
1954
- 194,
1955
- 190,
1956
- 196,
1957
- 70
1958
- ]),
1959
- // SHA256("global:set_migrator_allowlist")[0:8]
1960
- setMigratorAllowlist: new Uint8Array([
1961
- 209,
1962
- 90,
1963
- 181,
1964
- 104,
1965
- 99,
1966
- 108,
1967
- 233,
1968
- 168
1969
- ]),
1970
- // SHA256("global:set_hook_allowlist")[0:8]
1971
- setHookAllowlist: new Uint8Array([
1972
- 232,
1973
- 28,
1974
- 40,
1975
- 143,
1976
- 121,
1977
- 182,
1978
- 77,
1979
- 103
1980
- ]),
1981
- // SHA256("global:initialize_launch")[0:8]
1982
- initializeLaunch: new Uint8Array([
1983
- 90,
1984
- 201,
1985
- 220,
1986
- 142,
1987
- 112,
1988
- 253,
1989
- 100,
1990
- 13
1991
- ]),
1992
- // SHA256("global:curve_swap_exact_in")[0:8]
1993
- curveSwapExactIn: new Uint8Array([
1994
- 196,
1995
- 247,
1996
- 195,
1997
- 126,
1998
- 227,
1999
- 27,
2000
- 166,
2001
- 93
2002
- ]),
2003
- // SHA256("global:migrate_launch")[0:8]
2004
- migrateLaunch: new Uint8Array([
2005
- 19,
2006
- 199,
2007
- 119,
2008
- 103,
2009
- 13,
2010
- 30,
2011
- 12,
2012
- 205
2013
- ]),
2014
- // SHA256("global:preview_swap_exact_in")[0:8]
2015
- previewSwapExactIn: new Uint8Array([
2016
- 50,
2017
- 130,
2018
- 31,
2019
- 69,
2020
- 147,
2021
- 58,
2022
- 222,
2023
- 178
2024
- ]),
2025
- // SHA256("global:preview_migration")[0:8]
2026
- previewMigration: new Uint8Array([
2027
- 216,
2028
- 180,
2029
- 209,
2030
- 112,
2031
- 62,
2032
- 16,
2033
- 15,
2034
- 63
2035
- ])
2036
- };
2037
- var INITIALIZER_ACCOUNT_DISCRIMINATORS = {
2038
- // SHA256("account:InitConfig")[0:8]
2039
- InitConfig: new Uint8Array([97, 166, 35, 7, 20, 2, 164, 126]),
2040
- // SHA256("account:Launch")[0:8]
2041
- Launch: new Uint8Array([144, 51, 51, 163, 206, 85, 213, 38]),
2042
- // SHA256("account:LaunchFeeState")[0:8]
2043
- LaunchFeeState: new Uint8Array([
2044
- 1,
2045
- 106,
2046
- 55,
2047
- 241,
2048
- 179,
2049
- 18,
2050
- 230,
2051
- 232
2052
- ])
2053
- };
2054
2112
  var INIT_CONFIG_DISCRIMINATOR = new Uint8Array([
2055
2113
  97,
2056
2114
  166,
@@ -3150,27 +3208,6 @@ function createSetHookAllowlistInstruction(accounts, allowlist, programId = INIT
3150
3208
  );
3151
3209
  return { programAddress: programId, accounts: keys, data };
3152
3210
  }
3153
- function computeRemainingAccountsHash(addresses) {
3154
- const addressEncoder = getAddressEncoder();
3155
- const buf = new Uint8Array(4 + addresses.length * 32);
3156
- new DataView(buf.buffer).setUint32(0, addresses.length, true);
3157
- for (let i = 0; i < addresses.length; i++) {
3158
- buf.set(addressEncoder.encode(addresses[i]), 4 + i * 32);
3159
- }
3160
- return keccak_256(buf);
3161
- }
3162
- function phaseLabel(phase) {
3163
- switch (phase) {
3164
- case PHASE_TRADING:
3165
- return "TRADING";
3166
- case PHASE_MIGRATED:
3167
- return "MIGRATED";
3168
- case PHASE_ABORTED:
3169
- return "ABORTED";
3170
- default:
3171
- return String(phase);
3172
- }
3173
- }
3174
3211
  var CPMM_MIGRATOR_PROGRAM_ID = address(
3175
3212
  "7WMUTNC41eMCo6eGH5Sy2xbgE3AycvLbFPo95AU9CSUd"
3176
3213
  );
@@ -3268,13 +3305,13 @@ function decodeClaimReceipt(encodedAccount) {
3268
3305
  getClaimReceiptDecoder()
3269
3306
  );
3270
3307
  }
3271
- async function fetchClaimReceipt(rpc, address3, config) {
3272
- const maybeAccount = await fetchMaybeClaimReceipt(rpc, address3, config);
3308
+ async function fetchClaimReceipt(rpc, address4, config) {
3309
+ const maybeAccount = await fetchMaybeClaimReceipt(rpc, address4, config);
3273
3310
  assertAccountExists(maybeAccount);
3274
3311
  return maybeAccount;
3275
3312
  }
3276
- async function fetchMaybeClaimReceipt(rpc, address3, config) {
3277
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
3313
+ async function fetchMaybeClaimReceipt(rpc, address4, config) {
3314
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
3278
3315
  return decodeClaimReceipt(maybeAccount);
3279
3316
  }
3280
3317
  async function fetchAllClaimReceipt(rpc, addresses, config) {
@@ -3338,13 +3375,13 @@ function decodeEntry(encodedAccount) {
3338
3375
  getEntryDecoder()
3339
3376
  );
3340
3377
  }
3341
- async function fetchEntry(rpc, address3, config) {
3342
- const maybeAccount = await fetchMaybeEntry(rpc, address3, config);
3378
+ async function fetchEntry(rpc, address4, config) {
3379
+ const maybeAccount = await fetchMaybeEntry(rpc, address4, config);
3343
3380
  assertAccountExists(maybeAccount);
3344
3381
  return maybeAccount;
3345
3382
  }
3346
- async function fetchMaybeEntry(rpc, address3, config) {
3347
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
3383
+ async function fetchMaybeEntry(rpc, address4, config) {
3384
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
3348
3385
  return decodeEntry(maybeAccount);
3349
3386
  }
3350
3387
  async function fetchAllEntry(rpc, addresses, config) {
@@ -3406,13 +3443,13 @@ function decodeEntryByMint(encodedAccount) {
3406
3443
  getEntryByMintDecoder()
3407
3444
  );
3408
3445
  }
3409
- async function fetchEntryByMint(rpc, address3, config) {
3410
- const maybeAccount = await fetchMaybeEntryByMint(rpc, address3, config);
3446
+ async function fetchEntryByMint(rpc, address4, config) {
3447
+ const maybeAccount = await fetchMaybeEntryByMint(rpc, address4, config);
3411
3448
  assertAccountExists(maybeAccount);
3412
3449
  return maybeAccount;
3413
3450
  }
3414
- async function fetchMaybeEntryByMint(rpc, address3, config) {
3415
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
3451
+ async function fetchMaybeEntryByMint(rpc, address4, config) {
3452
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
3416
3453
  return decodeEntryByMint(maybeAccount);
3417
3454
  }
3418
3455
  async function fetchAllEntryByMint(rpc, addresses, config) {
@@ -3484,13 +3521,13 @@ function decodeInitConfig(encodedAccount) {
3484
3521
  getInitConfigDecoder2()
3485
3522
  );
3486
3523
  }
3487
- async function fetchInitConfig(rpc, address3, config) {
3488
- const maybeAccount = await fetchMaybeInitConfig(rpc, address3, config);
3524
+ async function fetchInitConfig(rpc, address4, config) {
3525
+ const maybeAccount = await fetchMaybeInitConfig(rpc, address4, config);
3489
3526
  assertAccountExists(maybeAccount);
3490
3527
  return maybeAccount;
3491
3528
  }
3492
- async function fetchMaybeInitConfig(rpc, address3, config) {
3493
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
3529
+ async function fetchMaybeInitConfig(rpc, address4, config) {
3530
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
3494
3531
  return decodeInitConfig(maybeAccount);
3495
3532
  }
3496
3533
  async function fetchAllInitConfig(rpc, addresses, config) {
@@ -3790,13 +3827,13 @@ function decodeLaunch(encodedAccount) {
3790
3827
  getLaunchDecoder2()
3791
3828
  );
3792
3829
  }
3793
- async function fetchLaunch(rpc, address3, config) {
3794
- const maybeAccount = await fetchMaybeLaunch(rpc, address3, config);
3830
+ async function fetchLaunch(rpc, address4, config) {
3831
+ const maybeAccount = await fetchMaybeLaunch(rpc, address4, config);
3795
3832
  assertAccountExists(maybeAccount);
3796
3833
  return maybeAccount;
3797
3834
  }
3798
- async function fetchMaybeLaunch(rpc, address3, config) {
3799
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
3835
+ async function fetchMaybeLaunch(rpc, address4, config) {
3836
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
3800
3837
  return decodeLaunch(maybeAccount);
3801
3838
  }
3802
3839
  async function fetchAllLaunch(rpc, addresses, config) {
@@ -3870,13 +3907,13 @@ function decodeMarket(encodedAccount) {
3870
3907
  getMarketDecoder()
3871
3908
  );
3872
3909
  }
3873
- async function fetchMarket(rpc, address3, config) {
3874
- const maybeAccount = await fetchMaybeMarket(rpc, address3, config);
3910
+ async function fetchMarket(rpc, address4, config) {
3911
+ const maybeAccount = await fetchMaybeMarket(rpc, address4, config);
3875
3912
  assertAccountExists(maybeAccount);
3876
3913
  return maybeAccount;
3877
3914
  }
3878
- async function fetchMaybeMarket(rpc, address3, config) {
3879
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
3915
+ async function fetchMaybeMarket(rpc, address4, config) {
3916
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
3880
3917
  return decodeMarket(maybeAccount);
3881
3918
  }
3882
3919
  async function fetchAllMarket(rpc, addresses, config) {
@@ -3942,13 +3979,13 @@ function decodeOracleState2(encodedAccount) {
3942
3979
  getOracleStateDecoder()
3943
3980
  );
3944
3981
  }
3945
- async function fetchOracleState(rpc, address3, config) {
3946
- const maybeAccount = await fetchMaybeOracleState(rpc, address3, config);
3982
+ async function fetchOracleState(rpc, address4, config) {
3983
+ const maybeAccount = await fetchMaybeOracleState(rpc, address4, config);
3947
3984
  assertAccountExists(maybeAccount);
3948
3985
  return maybeAccount;
3949
3986
  }
3950
- async function fetchMaybeOracleState(rpc, address3, config) {
3951
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
3987
+ async function fetchMaybeOracleState(rpc, address4, config) {
3988
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
3952
3989
  return decodeOracleState2(maybeAccount);
3953
3990
  }
3954
3991
  async function fetchAllOracleState(rpc, addresses, config) {
@@ -5289,6 +5326,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
5289
5326
  const withMetadata = Boolean(
5290
5327
  args.metadataName && args.metadataName.length > 0
5291
5328
  );
5329
+ const withToken2022Metadata = withMetadata && baseTokenProgram === TOKEN_2022_PROGRAM_ADDRESS;
5292
5330
  if (withMetadata && !metadataAccount) {
5293
5331
  throw new Error(
5294
5332
  "metadataName is set but metadataAccount was not provided. Derive it with await initializer.getTokenMetadataAddress(baseMintAddress)."
@@ -5348,6 +5386,12 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
5348
5386
  const data = new Uint8Array(
5349
5387
  getInitializeLaunchInstructionDataEncoder().encode(encoderArgs)
5350
5388
  );
5389
+ if (withToken2022Metadata) {
5390
+ keys.push({
5391
+ address: SYSVAR_INSTRUCTIONS_ADDRESS,
5392
+ role: AccountRole.READONLY
5393
+ });
5394
+ }
5351
5395
  keys.push(
5352
5396
  ...hookCreateRemainingAccounts.map(
5353
5397
  (account) => createAccountMeta(
@@ -5573,254 +5617,47 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
5573
5617
  function decodePreviewMigrationResult(data) {
5574
5618
  return previewMigrationResultCodec.decode(data);
5575
5619
  }
5576
- var DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND = 20;
5577
- function getInstructionLookupTableAddresses(instructions) {
5578
- const seen = /* @__PURE__ */ new Set();
5579
- const addresses = [];
5580
- for (const instruction of Array.isArray(instructions) ? instructions : [instructions]) {
5581
- for (const account of instruction.accounts ?? []) {
5582
- if ("signer" in account || account.role === AccountRole.READONLY_SIGNER || account.role === AccountRole.WRITABLE_SIGNER) {
5583
- continue;
5584
- }
5585
- if (!seen.has(account.address)) {
5586
- seen.add(account.address);
5587
- addresses.push(account.address);
5588
- }
5589
- }
5590
- }
5591
- return addresses;
5620
+
5621
+ // src/solana/migrators/cpmmMigrator/index.ts
5622
+ var cpmmMigrator_exports = {};
5623
+ __export(cpmmMigrator_exports, {
5624
+ CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
5625
+ CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
5626
+ CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
5627
+ MAX_RECIPIENTS: () => MAX_RECIPIENTS,
5628
+ SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
5629
+ SEED_STATE: () => SEED_STATE,
5630
+ buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
5631
+ buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
5632
+ encodeMigratePayload: () => encodeMigratePayload,
5633
+ encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
5634
+ fetchCpmmMigratorState: () => fetchCpmmMigratorState,
5635
+ getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
5636
+ getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
5637
+ getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
5638
+ getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
5639
+ getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
5640
+ getMigrateArgsCodec: () => getMigrateArgsCodec,
5641
+ getMigrateArgsDecoder: () => getMigrateArgsDecoder,
5642
+ getMigrateArgsEncoder: () => getMigrateArgsEncoder,
5643
+ getRecipientCodec: () => getRecipientCodec,
5644
+ getRecipientDecoder: () => getRecipientDecoder,
5645
+ getRecipientEncoder: () => getRecipientEncoder,
5646
+ getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
5647
+ getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
5648
+ getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
5649
+ });
5650
+ function getMigrateArgsEncoder() {
5651
+ return getStructEncoder([
5652
+ ["baseForDistribution", getU64Encoder()],
5653
+ ["baseForLiquidity", getU64Encoder()]
5654
+ ]);
5592
5655
  }
5593
- async function buildAddressLookupTableSetupInstructions({
5594
- authority,
5595
- payer,
5596
- recentSlot,
5597
- addresses,
5598
- addressesPerExtendInstruction = DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND
5599
- }) {
5600
- if (addressesPerExtendInstruction <= 0) {
5601
- throw new Error("addressesPerExtendInstruction must be greater than zero");
5602
- }
5603
- const dedupedAddresses = [...new Set(addresses)];
5604
- const lookupTablePda = await findAddressLookupTablePda({
5605
- authority: authority.address,
5606
- recentSlot
5607
- });
5608
- const [lookupTableAddress] = lookupTablePda;
5609
- const createInstruction = getCreateLookupTableInstruction({
5610
- address: lookupTablePda,
5611
- authority: authority.address,
5612
- payer,
5613
- recentSlot
5614
- });
5615
- const extendInstructions = [];
5616
- for (let start = 0; start < dedupedAddresses.length; start += addressesPerExtendInstruction) {
5617
- extendInstructions.push(
5618
- getExtendLookupTableInstruction({
5619
- address: lookupTableAddress,
5620
- authority,
5621
- payer,
5622
- addresses: dedupedAddresses.slice(
5623
- start,
5624
- start + addressesPerExtendInstruction
5625
- )
5626
- })
5627
- );
5628
- }
5629
- return {
5630
- lookupTableAddress,
5631
- createInstruction,
5632
- extendInstructions,
5633
- addresses: dedupedAddresses
5634
- };
5635
- }
5636
- function compressTransactionMessageWithLookupTable(transactionMessage, {
5637
- lookupTableAddress,
5638
- addresses
5639
- }) {
5640
- return compressTransactionMessageUsingAddressLookupTables(
5641
- transactionMessage,
5642
- {
5643
- [lookupTableAddress]: [...addresses]
5644
- }
5645
- );
5646
- }
5647
- var SOLANA_TRANSACTION_SIZE_LIMIT = 1232;
5648
- function measureTransactionMessageSize(transactionMessage) {
5649
- const size = getTransactionMessageSize(transactionMessage);
5650
- const overBy = Math.max(0, size - SOLANA_TRANSACTION_SIZE_LIMIT);
5651
- return {
5652
- size,
5653
- limit: SOLANA_TRANSACTION_SIZE_LIMIT,
5654
- overBy,
5655
- fits: overBy === 0
5656
- };
5657
- }
5658
- function measureTransactionMessageSizeWithLookupTable(transactionMessage, lookupTable) {
5659
- return measureTransactionMessageSize(
5660
- compressTransactionMessageWithLookupTable(transactionMessage, lookupTable)
5661
- );
5662
- }
5663
- function assertTransactionMessageFits(transactionMessage, { label = "Transaction", metadataBytes } = {}) {
5664
- const report = measureTransactionMessageSize(transactionMessage);
5665
- if (report.fits) {
5666
- return report;
5667
- }
5668
- const metadataHint = metadataBytes && metadataBytes > 0 ? ` Metadata contributes ${metadataBytes} instruction-data bytes; address lookup tables do not compress metadata strings.` : "";
5669
- throw new Error(
5670
- `${label} is ${report.size} bytes, exceeding Solana's ${report.limit}-byte transaction limit by ${report.overBy} bytes.${metadataHint}`
5671
- );
5672
- }
5673
- function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupTable, options = {}) {
5674
- const compressedMessage = compressTransactionMessageWithLookupTable(
5675
- transactionMessage,
5676
- lookupTable
5677
- );
5678
- return assertTransactionMessageFits(compressedMessage, options);
5679
- }
5680
- var addressCodec5 = getAddressCodec();
5681
- function bytesToBase64(bytes) {
5682
- let binary = "";
5683
- for (let i = 0; i < bytes.length; i++) {
5684
- binary += String.fromCharCode(bytes[i]);
5685
- }
5686
- return btoa(binary);
5687
- }
5688
- function base64ToBytes2(base64) {
5689
- const binary = atob(base64);
5690
- const bytes = new Uint8Array(binary.length);
5691
- for (let i = 0; i < binary.length; i++) {
5692
- bytes[i] = binary.charCodeAt(i);
5693
- }
5694
- return bytes;
5695
- }
5696
- async function fetchLaunch2(rpc, address3, config) {
5697
- const response = await rpc.getAccountInfo(address3, {
5698
- encoding: "base64",
5699
- commitment: config?.commitment
5700
- }).send();
5701
- if (!response.value) {
5702
- return null;
5703
- }
5704
- return getLaunchDecoder().decode(base64ToBytes2(response.value.data[0]));
5705
- }
5706
- async function fetchAllLaunches(rpc, config) {
5707
- const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
5708
- const discriminatorFilter = {
5709
- memcmp: {
5710
- offset: 0n,
5711
- bytes: bytesToBase64(
5712
- INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
5713
- ),
5714
- encoding: "base64"
5715
- }
5716
- };
5717
- const response = await rpc.getProgramAccounts(programId, {
5718
- encoding: "base64",
5719
- commitment: config?.commitment,
5720
- filters: [discriminatorFilter]
5721
- }).send();
5722
- const accounts = Array.isArray(response) ? response : response.value;
5723
- const launches = [];
5724
- const decoder = getLaunchDecoder();
5725
- for (const account of accounts) {
5726
- try {
5727
- const launch = decoder.decode(base64ToBytes2(account.account.data[0]));
5728
- launches.push({ address: account.pubkey, account: launch });
5729
- } catch {
5730
- console.warn(`Failed to decode launch account: ${account.pubkey}`);
5731
- }
5732
- }
5733
- return launches;
5734
- }
5735
- async function fetchLaunchesByAuthority(rpc, authority, config) {
5736
- const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
5737
- const discriminatorFilter = {
5738
- memcmp: {
5739
- offset: 0n,
5740
- bytes: bytesToBase64(
5741
- INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
5742
- ),
5743
- encoding: "base64"
5744
- }
5745
- };
5746
- const authorityFilter = {
5747
- memcmp: {
5748
- offset: 8n,
5749
- bytes: bytesToBase64(
5750
- addressCodec5.encode(authority)
5751
- ),
5752
- encoding: "base64"
5753
- }
5754
- };
5755
- const response = await rpc.getProgramAccounts(programId, {
5756
- encoding: "base64",
5757
- commitment: config?.commitment,
5758
- filters: [discriminatorFilter, authorityFilter]
5759
- }).send();
5760
- const accounts = Array.isArray(response) ? response : response.value;
5761
- const launches = [];
5762
- const decoder = getLaunchDecoder();
5763
- for (const account of accounts) {
5764
- try {
5765
- const launch = decoder.decode(base64ToBytes2(account.account.data[0]));
5766
- launches.push({ address: account.pubkey, account: launch });
5767
- } catch {
5768
- console.warn(`Failed to decode launch account: ${account.pubkey}`);
5769
- }
5770
- }
5771
- return launches;
5772
- }
5773
- async function launchExists(rpc, namespace, launchId, config) {
5774
- const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
5775
- const [launchAddress] = await getLaunchAddress(
5776
- namespace,
5777
- launchId,
5778
- programId
5779
- );
5780
- const launch = await fetchLaunch2(rpc, launchAddress, config);
5781
- return launch !== null;
5782
- }
5783
-
5784
- // src/solana/migrators/cpmmMigrator/index.ts
5785
- var cpmmMigrator_exports = {};
5786
- __export(cpmmMigrator_exports, {
5787
- CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
5788
- CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
5789
- CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
5790
- MAX_RECIPIENTS: () => MAX_RECIPIENTS,
5791
- SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
5792
- SEED_STATE: () => SEED_STATE,
5793
- buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
5794
- buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
5795
- encodeMigratePayload: () => encodeMigratePayload,
5796
- encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
5797
- fetchCpmmMigratorState: () => fetchCpmmMigratorState,
5798
- getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
5799
- getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
5800
- getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
5801
- getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
5802
- getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
5803
- getMigrateArgsCodec: () => getMigrateArgsCodec,
5804
- getMigrateArgsDecoder: () => getMigrateArgsDecoder,
5805
- getMigrateArgsEncoder: () => getMigrateArgsEncoder,
5806
- getRecipientCodec: () => getRecipientCodec,
5807
- getRecipientDecoder: () => getRecipientDecoder,
5808
- getRecipientEncoder: () => getRecipientEncoder,
5809
- getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
5810
- getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
5811
- getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
5812
- });
5813
- function getMigrateArgsEncoder() {
5814
- return getStructEncoder([
5815
- ["baseForDistribution", getU64Encoder()],
5816
- ["baseForLiquidity", getU64Encoder()]
5817
- ]);
5818
- }
5819
- function getMigrateArgsDecoder() {
5820
- return getStructDecoder([
5821
- ["baseForDistribution", getU64Decoder()],
5822
- ["baseForLiquidity", getU64Decoder()]
5823
- ]);
5656
+ function getMigrateArgsDecoder() {
5657
+ return getStructDecoder([
5658
+ ["baseForDistribution", getU64Decoder()],
5659
+ ["baseForLiquidity", getU64Decoder()]
5660
+ ]);
5824
5661
  }
5825
5662
  function getMigrateArgsCodec() {
5826
5663
  return combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
@@ -5948,7 +5785,7 @@ function getCpmmMigratorStateCodec() {
5948
5785
  if (process.env.NODE_ENV !== "production") ;
5949
5786
 
5950
5787
  // src/solana/migrators/cpmmMigrator/client.ts
5951
- function base64ToBytes3(base64) {
5788
+ function base64ToBytes2(base64) {
5952
5789
  const binary = atob(base64);
5953
5790
  const bytes = new Uint8Array(binary.length);
5954
5791
  for (let i = 0; i < binary.length; i++) {
@@ -5956,11 +5793,11 @@ function base64ToBytes3(base64) {
5956
5793
  }
5957
5794
  return bytes;
5958
5795
  }
5959
- async function fetchCpmmMigratorState(rpc, address3) {
5960
- const response = await rpc.getAccountInfo(address3, { encoding: "base64" }).send();
5796
+ async function fetchCpmmMigratorState(rpc, address4) {
5797
+ const response = await rpc.getAccountInfo(address4, { encoding: "base64" }).send();
5961
5798
  if (!response.value) return null;
5962
5799
  return getCpmmMigratorStateDecoder().decode(
5963
- base64ToBytes3(response.value.data[0])
5800
+ base64ToBytes2(response.value.data[0])
5964
5801
  );
5965
5802
  }
5966
5803
  async function buildCpmmMigrationRemainingAccounts({
@@ -6020,13 +5857,16 @@ async function buildCpmmMigrationRemainingAccounts({
6020
5857
  { address: migrationAuthority, role: AccountRole.READONLY },
6021
5858
  { address: adminBaseAta, role: AccountRole.WRITABLE },
6022
5859
  { address: adminQuoteAta, role: AccountRole.WRITABLE },
6023
- ...recipientAtas.map((address3) => ({
6024
- address: address3,
5860
+ ...recipientAtas.map((address4) => ({
5861
+ address: address4,
6025
5862
  role: AccountRole.WRITABLE
6026
5863
  }))
6027
5864
  ],
6028
5865
  cpmmMigrationState,
6029
5866
  cpmmConfig: poolInit.config[0],
5867
+ adminBaseAta,
5868
+ adminQuoteAta,
5869
+ recipientAtas,
6030
5870
  pool,
6031
5871
  poolAuthority: poolInit.authority[0],
6032
5872
  poolVault0: poolInit.vault0[0],
@@ -6057,6 +5897,590 @@ function encodeMigratePayload(args) {
6057
5897
  ]);
6058
5898
  }
6059
5899
 
5900
+ // src/solana/initializer/createLaunch.ts
5901
+ var DEFAULT_CPMM_MIGRATION_FEE_SPLIT_BPS = 1e4;
5902
+ var launchIdCounter = 0n;
5903
+ var launchTokenPrograms = {
5904
+ splToken() {
5905
+ return {
5906
+ baseTokenProgram: TOKEN_PROGRAM_ADDRESS,
5907
+ quoteTokenProgram: TOKEN_PROGRAM_ADDRESS
5908
+ };
5909
+ },
5910
+ token2022Base() {
5911
+ return {
5912
+ baseTokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
5913
+ quoteTokenProgram: TOKEN_PROGRAM_ADDRESS
5914
+ };
5915
+ }
5916
+ };
5917
+ function createLaunchId() {
5918
+ const bytes = new Uint8Array(32);
5919
+ const view = new DataView(bytes.buffer);
5920
+ view.setBigUint64(0, BigInt(Date.now()), true);
5921
+ view.setBigUint64(8, launchIdCounter, true);
5922
+ launchIdCounter += 1n;
5923
+ bytes.set([68, 79, 80, 76], 28);
5924
+ return bytes;
5925
+ }
5926
+ function isTransactionSigner9(value) {
5927
+ return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
5928
+ }
5929
+ function getAccountAddress(account) {
5930
+ if (typeof account === "string") {
5931
+ return account;
5932
+ }
5933
+ return account.address;
5934
+ }
5935
+ function getSignerAddress(value) {
5936
+ return isTransactionSigner9(value) ? value.address : value;
5937
+ }
5938
+ function getRemainingAccountMeta(account) {
5939
+ if (typeof account === "string") {
5940
+ return { address: account, role: AccountRole.READONLY };
5941
+ }
5942
+ if (isTransactionSigner9(account)) {
5943
+ return {
5944
+ address: account.address,
5945
+ role: AccountRole.READONLY_SIGNER,
5946
+ signer: account
5947
+ };
5948
+ }
5949
+ return account;
5950
+ }
5951
+ function hasMetadata(metadata) {
5952
+ return Boolean(metadata?.metadataName);
5953
+ }
5954
+ function getInitializerProgramId(input) {
5955
+ return input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID;
5956
+ }
5957
+ function getInitializerConfig(input) {
5958
+ return input.config ?? input.deployment?.initializerConfig;
5959
+ }
5960
+ function hashRemainingAccounts(accounts) {
5961
+ if (!accounts) {
5962
+ return void 0;
5963
+ }
5964
+ return computeRemainingAccountsHash(accounts.map(getAccountAddress));
5965
+ }
5966
+ function isCustomMigrationConfig(migration) {
5967
+ return migration.kind === "custom";
5968
+ }
5969
+ function getCreateLaunchHookMode(input) {
5970
+ if (input.hook !== void 0 && input.hook !== null) {
5971
+ return input.hook;
5972
+ }
5973
+ return input.cosigner ? "cosigner" : "cpmm";
5974
+ }
5975
+ async function getCreateLaunchHookContext(input) {
5976
+ const mode = getCreateLaunchHookMode(input);
5977
+ if (mode !== "cosigner") {
5978
+ return { mode };
5979
+ }
5980
+ const [cosignerConfig] = await getCosignerHookConfigAddress(
5981
+ input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
5982
+ );
5983
+ return { mode, cosignerConfig };
5984
+ }
5985
+ function getCosignerHookRemainingAccounts2({
5986
+ namespace,
5987
+ cosigner,
5988
+ cosignerConfig
5989
+ }) {
5990
+ const accounts = namespace === cosignerConfig ? [cosignerConfig] : [namespace, cosignerConfig];
5991
+ accounts.push(cosigner);
5992
+ return accounts;
5993
+ }
5994
+ function resolveCosignerHookPayload(input) {
5995
+ if (input.cosignGateExpiresAt === void 0 || input.cosignGateExpiresAt === null) {
5996
+ return new Uint8Array();
5997
+ }
5998
+ if (!input.cosigner) {
5999
+ throw new Error("cosigner is required when cosignGateExpiresAt is set");
6000
+ }
6001
+ return encodeCosignerGateExpiryPayload({
6002
+ mode: GATE_EXPIRY_UNIX_TIMESTAMP,
6003
+ value: input.cosignGateExpiresAt,
6004
+ cosigner: getSignerAddress(input.cosigner)
6005
+ });
6006
+ }
6007
+ function resolveCreateLaunchHook({
6008
+ input,
6009
+ namespace,
6010
+ hookContext
6011
+ }) {
6012
+ if (hookContext.mode === false) {
6013
+ return {
6014
+ flags: 0,
6015
+ remainingAccountsHash: EMPTY_REMAINING_ACCOUNTS_HASH
6016
+ };
6017
+ }
6018
+ if (hookContext.mode === "cosigner") {
6019
+ if (!input.cosigner) {
6020
+ throw new Error('cosigner is required when hook is "cosigner"');
6021
+ }
6022
+ if (!hookContext.cosignerConfig) {
6023
+ throw new Error("cosigner hook config could not be derived");
6024
+ }
6025
+ const remainingAccounts = getCosignerHookRemainingAccounts2({
6026
+ namespace,
6027
+ cosigner: input.cosigner,
6028
+ cosignerConfig: hookContext.cosignerConfig
6029
+ });
6030
+ return {
6031
+ program: input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
6032
+ flags: HF_BEFORE_SWAP2 | HF_FORWARD_READONLY_SIGNERS2,
6033
+ payload: resolveCosignerHookPayload(input),
6034
+ remainingAccounts,
6035
+ remainingAccountsHash: hashRemainingAccounts(remainingAccounts) ?? EMPTY_REMAINING_ACCOUNTS_HASH
6036
+ };
6037
+ }
6038
+ return {
6039
+ program: input.deployment?.cpmmHookProgram ?? CPMM_HOOK_PROGRAM_ID,
6040
+ flags: HF_BEFORE_SWAP2,
6041
+ payload: new Uint8Array(),
6042
+ remainingAccountsHash: EMPTY_REMAINING_ACCOUNTS_HASH
6043
+ };
6044
+ }
6045
+ async function getAssociatedTokenAddress({
6046
+ owner,
6047
+ mint,
6048
+ tokenProgram
6049
+ }) {
6050
+ const [ata] = await findAssociatedTokenPda({
6051
+ owner,
6052
+ mint,
6053
+ tokenProgram
6054
+ });
6055
+ return ata;
6056
+ }
6057
+ async function resolveCreateLaunchMigration({
6058
+ addresses,
6059
+ input,
6060
+ tokenPrograms
6061
+ }) {
6062
+ const migration = input.migration === void 0 ? true : input.migration;
6063
+ if (migration === false || migration === null) {
6064
+ return null;
6065
+ }
6066
+ const cpmmMigratorProgram = input.deployment?.cpmmMigratorProgram ?? CPMM_MIGRATOR_PROGRAM_ID;
6067
+ if (migration !== true && isCustomMigrationConfig(migration)) {
6068
+ if (!migration.program) {
6069
+ throw new Error("custom launch migration requires a migrator program");
6070
+ }
6071
+ return migration;
6072
+ }
6073
+ const cpmmMigration = migration === true ? {} : migration;
6074
+ const admin = cpmmMigration.admin ?? getSignerAddress(input.payer);
6075
+ const baseMint = getSignerAddress(input.launchAccounts.baseMint);
6076
+ const adminBaseAta = cpmmMigration.adminBaseAta ?? await getAssociatedTokenAddress({
6077
+ owner: admin,
6078
+ mint: baseMint,
6079
+ tokenProgram: tokenPrograms.baseTokenProgram
6080
+ });
6081
+ const adminQuoteAta = cpmmMigration.adminQuoteAta ?? await getAssociatedTokenAddress({
6082
+ owner: admin,
6083
+ mint: input.launchAccounts.quoteMint,
6084
+ tokenProgram: tokenPrograms.quoteTokenProgram
6085
+ });
6086
+ const recipients = [...cpmmMigration.recipients ?? []];
6087
+ const recipientAtas = cpmmMigration.recipientAtas ?? await Promise.all(
6088
+ recipients.map(
6089
+ ({ wallet }) => getAssociatedTokenAddress({
6090
+ owner: wallet,
6091
+ mint: baseMint,
6092
+ tokenProgram: tokenPrograms.baseTokenProgram
6093
+ })
6094
+ )
6095
+ );
6096
+ const migrationAccounts = await buildCpmmMigrationRemainingAccounts({
6097
+ launch: addresses.launch,
6098
+ baseMint,
6099
+ quoteMint: input.launchAccounts.quoteMint,
6100
+ launchAuthority: addresses.launchAuthority,
6101
+ adminBaseAta,
6102
+ adminQuoteAta,
6103
+ recipientAtas: [...recipientAtas],
6104
+ cpmmProgram: cpmmMigration.cpmmProgram ?? input.deployment?.cpmmProgram,
6105
+ cpmmMigratorProgram: cpmmMigration.program ?? cpmmMigratorProgram
6106
+ });
6107
+ const initPayload = encodeRegisterLaunchPayload({
6108
+ cpmmConfig: migrationAccounts.cpmmConfig,
6109
+ initialSwapFeeBps: cpmmMigration.initialSwapFeeBps ?? input.curve.swapFeeBps,
6110
+ initialFeeSplitBps: cpmmMigration.initialFeeSplitBps ?? DEFAULT_CPMM_MIGRATION_FEE_SPLIT_BPS,
6111
+ recipients,
6112
+ minRaiseQuote: cpmmMigration.minRaiseQuote ?? 0n,
6113
+ minMigrationPriceQ64Opt: cpmmMigration.minMigrationPriceQ64Opt ?? null,
6114
+ migratedPoolHookConfig: cpmmMigration.migratedPoolHookConfig ?? null
6115
+ });
6116
+ const migratePayload = encodeMigratePayload({
6117
+ baseForDistribution: cpmmMigration.baseForDistribution ?? input.supply.baseForDistribution,
6118
+ baseForLiquidity: cpmmMigration.baseForLiquidity ?? input.supply.baseForLiquidity
6119
+ });
6120
+ return {
6121
+ program: cpmmMigration.program ?? cpmmMigratorProgram,
6122
+ initPayload,
6123
+ migratePayload,
6124
+ cpmmConfig: migrationAccounts.cpmmConfig,
6125
+ remainingAccounts: migrationAccounts.addresses,
6126
+ remainingAccountsHash: migrationAccounts.hash,
6127
+ cpmmMigration: migrationAccounts
6128
+ };
6129
+ }
6130
+ async function deriveCreateLaunchAddresses(input) {
6131
+ const programId = input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID;
6132
+ const config = input.config ?? input.deployment?.initializerConfig ?? (await getConfigAddress2(programId))[0];
6133
+ const [launch] = await getLaunchAddress(
6134
+ input.namespace,
6135
+ input.launchId,
6136
+ programId
6137
+ );
6138
+ const [launchAuthority] = await getLaunchAuthorityAddress(launch, programId);
6139
+ const [launchFeeState] = await getLaunchFeeStateAddress(launch, programId);
6140
+ const metadataAccount = hasMetadata(input.metadata) ? input.metadataAccount ?? await getTokenMetadataAddress(getSignerAddress(input.baseMint)) : input.metadataAccount;
6141
+ return {
6142
+ config,
6143
+ launch,
6144
+ launchAuthority,
6145
+ launchFeeState,
6146
+ metadataAccount
6147
+ };
6148
+ }
6149
+ async function getMigrationInitRemainingAccountsHash({
6150
+ launch,
6151
+ migration
6152
+ }) {
6153
+ if (!migration) {
6154
+ return EMPTY_REMAINING_ACCOUNTS_HASH;
6155
+ }
6156
+ if (migration.initRemainingAccountsHash) {
6157
+ return migration.initRemainingAccountsHash;
6158
+ }
6159
+ const initHash = hashRemainingAccounts(migration.initRemainingAccounts);
6160
+ if (initHash) {
6161
+ return initHash;
6162
+ }
6163
+ if (migration.cpmmConfig) {
6164
+ const migratorProgram = migration.program ?? CPMM_MIGRATOR_PROGRAM_ID;
6165
+ const [cpmmMigrationState] = await getCpmmMigratorStateAddress(
6166
+ launch,
6167
+ migratorProgram
6168
+ );
6169
+ return computeRemainingAccountsHash([
6170
+ cpmmMigrationState,
6171
+ migration.cpmmConfig
6172
+ ]);
6173
+ }
6174
+ return EMPTY_REMAINING_ACCOUNTS_HASH;
6175
+ }
6176
+ async function createLaunch(input) {
6177
+ const programId = getInitializerProgramId(input);
6178
+ const launchId = input.launchId ?? createLaunchId();
6179
+ const hookContext = await getCreateLaunchHookContext(input);
6180
+ const namespace = input.namespace ?? hookContext.cosignerConfig ?? getSignerAddress(input.payer);
6181
+ const tokenPrograms = {
6182
+ ...launchTokenPrograms.splToken(),
6183
+ ...input.tokenPrograms
6184
+ };
6185
+ const addresses = input.addresses ?? await deriveCreateLaunchAddresses({
6186
+ deployment: input.deployment,
6187
+ programId,
6188
+ config: getInitializerConfig(input),
6189
+ namespace,
6190
+ launchId,
6191
+ baseMint: input.launchAccounts.baseMint,
6192
+ metadata: input.metadata
6193
+ });
6194
+ const migration = await resolveCreateLaunchMigration({
6195
+ addresses,
6196
+ input,
6197
+ tokenPrograms
6198
+ });
6199
+ const hook = resolveCreateLaunchHook({
6200
+ input,
6201
+ namespace,
6202
+ hookContext
6203
+ });
6204
+ const migratorInitRemainingAccountsHash = await getMigrationInitRemainingAccountsHash({
6205
+ launch: addresses.launch,
6206
+ migration
6207
+ });
6208
+ const migratorRemainingAccountsHash = migration?.remainingAccountsHash ?? hashRemainingAccounts(migration?.remainingAccounts) ?? EMPTY_REMAINING_ACCOUNTS_HASH;
6209
+ const instruction = await createInitializeLaunchInstruction(
6210
+ {
6211
+ config: addresses.config,
6212
+ launch: addresses.launch,
6213
+ launchAuthority: addresses.launchAuthority,
6214
+ baseMint: input.launchAccounts.baseMint,
6215
+ quoteMint: input.launchAccounts.quoteMint,
6216
+ baseVault: input.launchAccounts.baseVault,
6217
+ quoteVault: input.launchAccounts.quoteVault,
6218
+ launchFeeState: addresses.launchFeeState,
6219
+ payer: input.payer,
6220
+ authority: input.authority,
6221
+ hookProgram: hook.program,
6222
+ migratorProgram: migration?.program,
6223
+ cpmmConfig: migration?.cpmmConfig,
6224
+ baseTokenProgram: tokenPrograms.baseTokenProgram,
6225
+ quoteTokenProgram: tokenPrograms.quoteTokenProgram,
6226
+ systemProgram: input.systemProgram ?? SYSTEM_PROGRAM_ADDRESS,
6227
+ rent: input.rent ?? SYSVAR_RENT_ADDRESS,
6228
+ metadataAccount: addresses.metadataAccount,
6229
+ metadataProgram: input.metadataProgram ?? TOKEN_METADATA_PROGRAM_ID
6230
+ },
6231
+ {
6232
+ namespace,
6233
+ launchId,
6234
+ baseDecimals: input.supply.baseDecimals,
6235
+ baseTotalSupply: input.supply.baseTotalSupply,
6236
+ baseForDistribution: input.supply.baseForDistribution,
6237
+ baseForLiquidity: input.supply.baseForLiquidity,
6238
+ curveVirtualBase: input.curve.curveVirtualBase,
6239
+ curveVirtualQuote: input.curve.curveVirtualQuote,
6240
+ swapFeeBps: input.curve.swapFeeBps,
6241
+ curveKind: CURVE_KIND_XYK,
6242
+ curveParams: new Uint8Array([CURVE_PARAMS_FORMAT_XYK_V0]),
6243
+ allowBuy: input.allowBuy ?? true,
6244
+ allowSell: input.allowSell ?? true,
6245
+ hookFlags: hook.flags,
6246
+ hookPayload: hook.payload ?? new Uint8Array(),
6247
+ migratorInitPayload: migration?.initPayload ?? new Uint8Array(),
6248
+ migratorMigratePayload: migration?.migratePayload ?? new Uint8Array(),
6249
+ hookRemainingAccountsHash: hook.remainingAccountsHash,
6250
+ migratorInitRemainingAccountsHash,
6251
+ migratorRemainingAccountsHash,
6252
+ feeBeneficiaries: input.feeBeneficiaries ?? [],
6253
+ metadataName: input.metadata?.metadataName ?? "",
6254
+ metadataSymbol: input.metadata?.metadataSymbol ?? "",
6255
+ metadataUri: input.metadata?.metadataUri ?? ""
6256
+ },
6257
+ programId
6258
+ );
6259
+ const preparedInstruction = migration?.initRemainingAccounts ? {
6260
+ ...instruction,
6261
+ accounts: [
6262
+ ...instruction.accounts ?? [],
6263
+ ...(migration?.initRemainingAccounts ?? []).map(
6264
+ getRemainingAccountMeta
6265
+ )
6266
+ ]
6267
+ } : instruction;
6268
+ return {
6269
+ namespace,
6270
+ launchId,
6271
+ addresses,
6272
+ instruction: preparedInstruction,
6273
+ cpmmMigration: migration?.cpmmMigration
6274
+ };
6275
+ }
6276
+ var DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND = 20;
6277
+ function getInstructionLookupTableAddresses(instructions) {
6278
+ const seen = /* @__PURE__ */ new Set();
6279
+ const addresses = [];
6280
+ for (const instruction of Array.isArray(instructions) ? instructions : [instructions]) {
6281
+ for (const account of instruction.accounts ?? []) {
6282
+ if ("signer" in account || account.role === AccountRole.READONLY_SIGNER || account.role === AccountRole.WRITABLE_SIGNER) {
6283
+ continue;
6284
+ }
6285
+ if (!seen.has(account.address)) {
6286
+ seen.add(account.address);
6287
+ addresses.push(account.address);
6288
+ }
6289
+ }
6290
+ }
6291
+ return addresses;
6292
+ }
6293
+ async function buildAddressLookupTableSetupInstructions({
6294
+ authority,
6295
+ payer,
6296
+ recentSlot,
6297
+ addresses,
6298
+ addressesPerExtendInstruction = DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND
6299
+ }) {
6300
+ if (addressesPerExtendInstruction <= 0) {
6301
+ throw new Error("addressesPerExtendInstruction must be greater than zero");
6302
+ }
6303
+ const dedupedAddresses = [...new Set(addresses)];
6304
+ const lookupTablePda = await findAddressLookupTablePda({
6305
+ authority: authority.address,
6306
+ recentSlot
6307
+ });
6308
+ const [lookupTableAddress] = lookupTablePda;
6309
+ const createInstruction = getCreateLookupTableInstruction({
6310
+ address: lookupTablePda,
6311
+ authority: authority.address,
6312
+ payer,
6313
+ recentSlot
6314
+ });
6315
+ const extendInstructions = [];
6316
+ for (let start = 0; start < dedupedAddresses.length; start += addressesPerExtendInstruction) {
6317
+ extendInstructions.push(
6318
+ getExtendLookupTableInstruction({
6319
+ address: lookupTableAddress,
6320
+ authority,
6321
+ payer,
6322
+ addresses: dedupedAddresses.slice(
6323
+ start,
6324
+ start + addressesPerExtendInstruction
6325
+ )
6326
+ })
6327
+ );
6328
+ }
6329
+ return {
6330
+ lookupTableAddress,
6331
+ createInstruction,
6332
+ extendInstructions,
6333
+ addresses: dedupedAddresses
6334
+ };
6335
+ }
6336
+ function compressTransactionMessageWithLookupTable(transactionMessage, {
6337
+ lookupTableAddress,
6338
+ addresses
6339
+ }) {
6340
+ return compressTransactionMessageUsingAddressLookupTables(
6341
+ transactionMessage,
6342
+ {
6343
+ [lookupTableAddress]: [...addresses]
6344
+ }
6345
+ );
6346
+ }
6347
+ var SOLANA_TRANSACTION_SIZE_LIMIT = 1232;
6348
+ function measureTransactionMessageSize(transactionMessage) {
6349
+ const size = getTransactionMessageSize(transactionMessage);
6350
+ const overBy = Math.max(0, size - SOLANA_TRANSACTION_SIZE_LIMIT);
6351
+ return {
6352
+ size,
6353
+ limit: SOLANA_TRANSACTION_SIZE_LIMIT,
6354
+ overBy,
6355
+ fits: overBy === 0
6356
+ };
6357
+ }
6358
+ function measureTransactionMessageSizeWithLookupTable(transactionMessage, lookupTable) {
6359
+ return measureTransactionMessageSize(
6360
+ compressTransactionMessageWithLookupTable(transactionMessage, lookupTable)
6361
+ );
6362
+ }
6363
+ function assertTransactionMessageFits(transactionMessage, { label = "Transaction", metadataBytes } = {}) {
6364
+ const report = measureTransactionMessageSize(transactionMessage);
6365
+ if (report.fits) {
6366
+ return report;
6367
+ }
6368
+ const metadataHint = metadataBytes && metadataBytes > 0 ? ` Metadata contributes ${metadataBytes} instruction-data bytes; address lookup tables do not compress metadata strings.` : "";
6369
+ throw new Error(
6370
+ `${label} is ${report.size} bytes, exceeding Solana's ${report.limit}-byte transaction limit by ${report.overBy} bytes.${metadataHint}`
6371
+ );
6372
+ }
6373
+ function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupTable, options = {}) {
6374
+ const compressedMessage = compressTransactionMessageWithLookupTable(
6375
+ transactionMessage,
6376
+ lookupTable
6377
+ );
6378
+ return assertTransactionMessageFits(compressedMessage, options);
6379
+ }
6380
+ var addressCodec5 = getAddressCodec();
6381
+ function bytesToBase64(bytes) {
6382
+ let binary = "";
6383
+ for (let i = 0; i < bytes.length; i++) {
6384
+ binary += String.fromCharCode(bytes[i]);
6385
+ }
6386
+ return btoa(binary);
6387
+ }
6388
+ function base64ToBytes3(base64) {
6389
+ const binary = atob(base64);
6390
+ const bytes = new Uint8Array(binary.length);
6391
+ for (let i = 0; i < binary.length; i++) {
6392
+ bytes[i] = binary.charCodeAt(i);
6393
+ }
6394
+ return bytes;
6395
+ }
6396
+ async function fetchLaunch2(rpc, address4, config) {
6397
+ const response = await rpc.getAccountInfo(address4, {
6398
+ encoding: "base64",
6399
+ commitment: config?.commitment
6400
+ }).send();
6401
+ if (!response.value) {
6402
+ return null;
6403
+ }
6404
+ return getLaunchDecoder().decode(base64ToBytes3(response.value.data[0]));
6405
+ }
6406
+ async function fetchAllLaunches(rpc, config) {
6407
+ const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
6408
+ const discriminatorFilter = {
6409
+ memcmp: {
6410
+ offset: 0n,
6411
+ bytes: bytesToBase64(
6412
+ INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
6413
+ ),
6414
+ encoding: "base64"
6415
+ }
6416
+ };
6417
+ const response = await rpc.getProgramAccounts(programId, {
6418
+ encoding: "base64",
6419
+ commitment: config?.commitment,
6420
+ filters: [discriminatorFilter]
6421
+ }).send();
6422
+ const accounts = Array.isArray(response) ? response : response.value;
6423
+ const launches = [];
6424
+ const decoder = getLaunchDecoder();
6425
+ for (const account of accounts) {
6426
+ try {
6427
+ const launch = decoder.decode(base64ToBytes3(account.account.data[0]));
6428
+ launches.push({ address: account.pubkey, account: launch });
6429
+ } catch {
6430
+ console.warn(`Failed to decode launch account: ${account.pubkey}`);
6431
+ }
6432
+ }
6433
+ return launches;
6434
+ }
6435
+ async function fetchLaunchesByAuthority(rpc, authority, config) {
6436
+ const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
6437
+ const discriminatorFilter = {
6438
+ memcmp: {
6439
+ offset: 0n,
6440
+ bytes: bytesToBase64(
6441
+ INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
6442
+ ),
6443
+ encoding: "base64"
6444
+ }
6445
+ };
6446
+ const authorityFilter = {
6447
+ memcmp: {
6448
+ offset: 8n,
6449
+ bytes: bytesToBase64(
6450
+ addressCodec5.encode(authority)
6451
+ ),
6452
+ encoding: "base64"
6453
+ }
6454
+ };
6455
+ const response = await rpc.getProgramAccounts(programId, {
6456
+ encoding: "base64",
6457
+ commitment: config?.commitment,
6458
+ filters: [discriminatorFilter, authorityFilter]
6459
+ }).send();
6460
+ const accounts = Array.isArray(response) ? response : response.value;
6461
+ const launches = [];
6462
+ const decoder = getLaunchDecoder();
6463
+ for (const account of accounts) {
6464
+ try {
6465
+ const launch = decoder.decode(base64ToBytes3(account.account.data[0]));
6466
+ launches.push({ address: account.pubkey, account: launch });
6467
+ } catch {
6468
+ console.warn(`Failed to decode launch account: ${account.pubkey}`);
6469
+ }
6470
+ }
6471
+ return launches;
6472
+ }
6473
+ async function launchExists(rpc, namespace, launchId, config) {
6474
+ const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
6475
+ const [launchAddress] = await getLaunchAddress(
6476
+ namespace,
6477
+ launchId,
6478
+ programId
6479
+ );
6480
+ const launch = await fetchLaunch2(rpc, launchAddress, config);
6481
+ return launch !== null;
6482
+ }
6483
+
6060
6484
  // src/solana/migrators/predictionMigrator/index.ts
6061
6485
  var predictionMigrator_exports = {};
6062
6486
  __export(predictionMigrator_exports, {
@@ -6377,13 +6801,13 @@ function decodeOracleState3(encodedAccount) {
6377
6801
  getOracleStateDecoder2()
6378
6802
  );
6379
6803
  }
6380
- async function fetchOracleState2(rpc, address3, config) {
6381
- const maybeAccount = await fetchMaybeOracleState2(rpc, address3, config);
6804
+ async function fetchOracleState2(rpc, address4, config) {
6805
+ const maybeAccount = await fetchMaybeOracleState2(rpc, address4, config);
6382
6806
  assertAccountExists(maybeAccount);
6383
6807
  return maybeAccount;
6384
6808
  }
6385
- async function fetchMaybeOracleState2(rpc, address3, config) {
6386
- const maybeAccount = await fetchEncodedAccount(rpc, address3, config);
6809
+ async function fetchMaybeOracleState2(rpc, address4, config) {
6810
+ const maybeAccount = await fetchEncodedAccount(rpc, address4, config);
6387
6811
  return decodeOracleState3(maybeAccount);
6388
6812
  }
6389
6813
  async function fetchAllOracleState2(rpc, addresses, config) {
@@ -6732,7 +7156,7 @@ var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
6732
7156
  initializerProgram: INITIALIZER_PROGRAM_ID,
6733
7157
  cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
6734
7158
  cpmmHookProgram: CPMM_HOOK_PROGRAM_ID,
6735
- cosignerHookProgram: COSIGNER_HOOK_PROGRAM_ID
7159
+ cosignerHookProgram: DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
6736
7160
  };
6737
7161
  async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
6738
7162
  const [cpmmConfig] = await getConfigAddress(programs.cpmmProgram);
@@ -6746,6 +7170,6 @@ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGR
6746
7170
  };
6747
7171
  }
6748
7172
 
6749
- export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, cosignerHook_exports as cosignerHook, cpmm_exports as cpmm, cpmmMigrator_exports as cpmmMigrator, deriveSolanaCpmmDeployment, initializer_exports as initializer, predictionMigrator_exports as predictionMigrator, trustedOracle_exports as trustedOracle };
7173
+ export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, cosignerHook_exports as cosignerHook, cpmm_exports as cpmm, cpmmMigrator_exports as cpmmMigrator, createLaunch, deriveSolanaCpmmDeployment, initializer_exports as initializer, predictionMigrator_exports as predictionMigrator, trustedOracle_exports as trustedOracle };
6750
7174
  //# sourceMappingURL=index.js.map
6751
7175
  //# sourceMappingURL=index.js.map