@whetstone-research/doppler-sdk 1.0.28 → 1.0.30

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.
@@ -26,6 +26,7 @@ var MAX_HOOK_ALLOWLIST = 32;
26
26
  var MAX_ORACLE_OBSERVATIONS = 64;
27
27
  var SEED_CONFIG = "config";
28
28
  var SEED_POOL = "pool";
29
+ var SEED_SPOT_POOL = "spot_pool";
29
30
  var SEED_AUTHORITY = "authority";
30
31
  var SEED_VAULT0 = "vault0";
31
32
  var SEED_VAULT1 = "vault1";
@@ -201,6 +202,14 @@ var ACCOUNT_DISCRIMINATORS = {
201
202
  // src/solana/core/pda.ts
202
203
  var addressCodec = kit.getAddressCodec();
203
204
  var textEncoder = new TextEncoder();
205
+ function u16Seed(value) {
206
+ if (!Number.isInteger(value) || value < 0 || value > 65535) {
207
+ throw new RangeError("u16 value must be between 0 and 65535");
208
+ }
209
+ const bytes = new Uint8Array(2);
210
+ new DataView(bytes.buffer).setUint16(0, value, true);
211
+ return bytes;
212
+ }
204
213
  function sortMints(mint0, mint1) {
205
214
  const bytesA = addressCodec.encode(mint0);
206
215
  const bytesB = addressCodec.encode(mint1);
@@ -240,6 +249,18 @@ async function getPoolAddress(mint0, mint1, programId = CPMM_PROGRAM_ID) {
240
249
  ]
241
250
  });
242
251
  }
252
+ async function getSpotPoolAddress(mint0, mint1, swapFeeBps, programId = CPMM_PROGRAM_ID) {
253
+ const [token0, token1] = sortMints(mint0, mint1);
254
+ return kit.getProgramDerivedAddress({
255
+ programAddress: programId,
256
+ seeds: [
257
+ textEncoder.encode(SEED_SPOT_POOL),
258
+ addressCodec.encode(token0),
259
+ addressCodec.encode(token1),
260
+ u16Seed(swapFeeBps)
261
+ ]
262
+ });
263
+ }
243
264
  async function getPoolAuthorityAddress(pool, programId = CPMM_PROGRAM_ID) {
244
265
  return kit.getProgramDerivedAddress({
245
266
  programAddress: programId,
@@ -388,6 +409,9 @@ exports.SEED_ORACLE = SEED_ORACLE;
388
409
  exports.SEED_POOL = SEED_POOL;
389
410
  exports.SEED_POSITION = SEED_POSITION;
390
411
  exports.SEED_PROTOCOL_FEE_OWNER = SEED_PROTOCOL_FEE_OWNER;
412
+ exports.SEED_SPOT_POOL = SEED_SPOT_POOL;
413
+ exports.SEED_VAULT0 = SEED_VAULT0;
414
+ exports.SEED_VAULT1 = SEED_VAULT1;
391
415
  exports.SYSVAR_INSTRUCTIONS_ADDRESS = SYSVAR_INSTRUCTIONS_ADDRESS;
392
416
  exports.TOKEN_2022_PROGRAM_ADDRESS = TOKEN_2022_PROGRAM_ADDRESS;
393
417
  exports.TOKEN_METADATA_PROGRAM_ID = TOKEN_METADATA_PROGRAM_ID;
@@ -403,7 +427,8 @@ exports.getPoolVault1Address = getPoolVault1Address;
403
427
  exports.getPositionAddress = getPositionAddress;
404
428
  exports.getProtocolFeeOwnerAddress = getProtocolFeeOwnerAddress;
405
429
  exports.getProtocolFeePositionAddress = getProtocolFeePositionAddress;
430
+ exports.getSpotPoolAddress = getSpotPoolAddress;
406
431
  exports.getSwapAddresses = getSwapAddresses;
407
432
  exports.sortMints = sortMints;
408
- //# sourceMappingURL=chunk-U6B52TBT.cjs.map
409
- //# sourceMappingURL=chunk-U6B52TBT.cjs.map
433
+ //# sourceMappingURL=chunk-4CI2M2F6.cjs.map
434
+ //# sourceMappingURL=chunk-4CI2M2F6.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/solana/core/constants.ts","../src/solana/core/pda.ts"],"names":["address","getAddressCodec","getProgramDerivedAddress"],"mappings":";;;;;;;;AAQO,IAAM,0BAAA,GAAsCA,WAAA;AAAA,EACjD;AACF;AACO,IAAM,2BAAA,GAAuCA,WAAA;AAAA,EAClD;AACF;AAKO,IAAM,sBAAA,GAAkCA,WAAA;AAAA,EAC7C;AACF,CAAA;AAKO,IAAM,eAAA,GAAkB;AAKxB,IAAM,yBAAA,GAAqCA,WAAA;AAAA,EAChD;AACF;AAOO,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AmB,IAAA,EAAM,KAAA,EAAO,UAAA,EAAY,SAAS,CAAA;AAAA,IACrD,0BAAA,CAA2B,MAAM,SAAS,CAAA;AAAA,IAC1C,gBAAA,CAAiB,MAAM,SAAS;AAAA,GACjC,CAAA;AACH,EAAA,MAAM,sBAAsB,MAAM,kBAAA;AAAA,IAChC,IAAA;AAAA,IACA,iBAAiB,CAAC,CAAA;AAAA,IAClB,EAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-4CI2M2F6.cjs","sourcesContent":["import { address, type Address } from '@solana/kit';\nexport {\n TOKEN_PROGRAM_ADDRESS,\n ASSOCIATED_TOKEN_PROGRAM_ADDRESS,\n} from '@solana-program/token';\nexport { SYSTEM_PROGRAM_ADDRESS } from '@solana-program/system';\nexport { SYSVAR_RENT_ADDRESS } from '@solana/sysvars';\n\nexport const TOKEN_2022_PROGRAM_ADDRESS: Address = address(\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n);\nexport const SYSVAR_INSTRUCTIONS_ADDRESS: Address = address(\n 'Sysvar1nstructions1111111111111111111111111',\n);\n\n/**\n * CPMM AMM program ID for the default devnet deployment.\n */\nexport const DEVNET_CPMM_PROGRAM_ID: Address = address(\n '9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ',\n);\n\n/**\n * @deprecated Use DEVNET_CPMM_PROGRAM_ID or pass an explicit deployment.\n */\nexport const CPMM_PROGRAM_ID = DEVNET_CPMM_PROGRAM_ID;\n\n/**\n * Metaplex Token Metadata Program ID\n */\nexport const TOKEN_METADATA_PROGRAM_ID: Address = address(\n 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s',\n);\n\n// ============================================================================\n// Math Constants\n// ============================================================================\n\n/** Basis points denominator (10,000 = 100%) */\nexport const BPS_DENOM = 10_000n;\n\n/** Q64.64 fixed-point representation of 1.0 (2^64) */\nexport const Q64_ONE = 1n << 64n;\n\n/** Current account version */\nexport const ACCOUNT_VERSION = 1;\n\n// ============================================================================\n// Array Size Constants\n// ============================================================================\n\n/** Maximum number of programs in hook allowlist */\nexport const MAX_HOOK_ALLOWLIST = 32;\n\n/** Maximum number of oracle observations (TWAP buffer size) */\nexport const MAX_ORACLE_OBSERVATIONS = 64;\n\n// ============================================================================\n// PDA Seeds\n// ============================================================================\n\n/** Seed for AmmConfig PDA: ['config'] */\nexport const SEED_CONFIG = 'config';\n\n/** Seed prefix for launch-migrated Pool PDA: ['pool', token0_mint, token1_mint] */\nexport const SEED_POOL = 'pool';\n\n/** Seed prefix for spot Pool PDA: ['spot_pool', token0_mint, token1_mint, swap_fee_bps] */\nexport const SEED_SPOT_POOL = 'spot_pool';\n\n/** Seed prefix for pool authority PDA: ['authority', pool] */\nexport const SEED_AUTHORITY = 'authority';\n\n/** Seed prefix for token0 vault PDA: ['vault0', pool] */\nexport const SEED_VAULT0 = 'vault0';\n\n/** Seed prefix for token1 vault PDA: ['vault1', pool] */\nexport const SEED_VAULT1 = 'vault1';\n\n/** Seed prefix for Position PDA: ['position', pool, owner, position_id] */\nexport const SEED_POSITION = 'position';\n\n/** Seed prefix for OracleState PDA: ['oracle', pool] */\nexport const SEED_ORACLE = 'oracle';\n\n/** Seed prefix for protocol fee owner PDA: ['protocol_fee_owner', pool] */\nexport const SEED_PROTOCOL_FEE_OWNER = 'protocol_fee_owner';\n\n// ============================================================================\n// Hook Flags\n// ============================================================================\n\n/** Hook: called before swap */\nexport const HF_BEFORE_SWAP = 1 << 0;\n\n/** Hook: called after swap */\nexport const HF_AFTER_SWAP = 1 << 1;\n\n/** Hook: called before add liquidity */\nexport const HF_BEFORE_ADD_LIQ = 1 << 2;\n\n/** Hook: called after add liquidity */\nexport const HF_AFTER_ADD_LIQ = 1 << 3;\n\n/** Hook: called before remove liquidity */\nexport const HF_BEFORE_REMOVE_LIQ = 1 << 4;\n\n/** Hook: called after remove liquidity */\nexport const HF_AFTER_REMOVE_LIQ = 1 << 5;\n\n/** Require an oracle account when invoking hooks */\nexport const HF_REQUIRE_ORACLE = 1 << 6;\n\n/** Preserve readonly signer metas when forwarding remaining accounts to hooks */\nexport const HF_FORWARD_READONLY_SIGNERS = 1 << 7;\n\n/** Hook return value indicating \"no change\" to fee parameter */\nexport const HOOK_NO_CHANGE = 0xffff;\n\n// ============================================================================\n// Instruction Discriminators (Anchor 8-byte hashes)\n// ============================================================================\n\n/**\n * Anchor instruction discriminator (first 8 bytes of SHA256(\"global:<instruction_name>\"))\n * These are computed at build time from the instruction names.\n */\nexport const INSTRUCTION_DISCRIMINATORS = {\n // SHA256(\"global:initialize_config\")[0:8]\n initializeConfig: new Uint8Array([\n 0xd0, 0x7f, 0x15, 0x01, 0xc2, 0xbe, 0xc4, 0x46,\n ]),\n // SHA256(\"global:initialize_pool\")[0:8]\n initializePool: new Uint8Array([\n 0x5f, 0xb4, 0x0a, 0xac, 0x54, 0xae, 0xe8, 0x28,\n ]),\n // SHA256(\"global:initialize_oracle\")[0:8]\n initializeOracle: new Uint8Array([\n 0x90, 0xdf, 0x83, 0x78, 0xc4, 0xfd, 0xb5, 0x63,\n ]),\n // SHA256(\"global:create_position\")[0:8]\n createPosition: new Uint8Array([\n 0x30, 0xd7, 0xc5, 0x99, 0x60, 0xcb, 0xb4, 0x85,\n ]),\n // SHA256(\"global:add_liquidity\")[0:8]\n addLiquidity: new Uint8Array([\n 0xb5, 0x9d, 0x59, 0x43, 0x8f, 0xb6, 0x34, 0x48,\n ]),\n // SHA256(\"global:remove_liquidity\")[0:8]\n removeLiquidity: new Uint8Array([\n 0x50, 0x55, 0xd1, 0x48, 0x18, 0xce, 0xb1, 0x6c,\n ]),\n // SHA256(\"global:swap_exact_in\")[0:8]\n swapExactIn: new Uint8Array([0x68, 0x68, 0x83, 0x56, 0xa1, 0xbd, 0xb4, 0xd8]),\n // SHA256(\"global:collect_fees\")[0:8]\n collectFees: new Uint8Array([0xa4, 0x98, 0xcf, 0x63, 0x1e, 0xba, 0x13, 0xb6]),\n // SHA256(\"global:collect_protocol_fees\")[0:8]\n collectProtocolFees: new Uint8Array([\n 0x16, 0x43, 0x17, 0x62, 0x96, 0xb2, 0x46, 0xdc,\n ]),\n // SHA256(\"global:close_position\")[0:8]\n closePosition: new Uint8Array([\n 0x7b, 0x86, 0x51, 0x00, 0x31, 0x44, 0x62, 0x62,\n ]),\n // SHA256(\"global:oracle_update\")[0:8]\n oracleUpdate: new Uint8Array([\n 0x55, 0xd1, 0xf8, 0x8e, 0xba, 0xf9, 0x78, 0xef,\n ]),\n // SHA256(\"global:oracle_consult\")[0:8]\n oracleConsult: new Uint8Array([\n 0xef, 0xed, 0xff, 0xb1, 0x8e, 0x48, 0x60, 0xaf,\n ]),\n // SHA256(\"global:set_hook\")[0:8]\n setHook: new Uint8Array([0xaf, 0x10, 0xbb, 0xfc, 0x13, 0x36, 0x6f, 0xdd]),\n // SHA256(\"global:set_fees\")[0:8]\n setFees: new Uint8Array([0x89, 0xb2, 0x31, 0x3a, 0x00, 0xf5, 0xf2, 0xbe]),\n // SHA256(\"global:transfer_admin\")[0:8]\n transferAdmin: new Uint8Array([\n 0x2a, 0xf2, 0x42, 0x6a, 0xe4, 0x0a, 0x6f, 0x9c,\n ]),\n // SHA256(\"global:pause\")[0:8]\n pause: new Uint8Array([0xd3, 0x16, 0xdd, 0xfb, 0x4a, 0x79, 0xc1, 0x2f]),\n // SHA256(\"global:unpause\")[0:8]\n unpause: new Uint8Array([0xa9, 0x90, 0x04, 0x26, 0x0a, 0x8d, 0xbc, 0xff]),\n // SHA256(\"global:withdraw_vault_excess\")[0:8]\n withdrawVaultExcess: new Uint8Array([\n 0xeb, 0xc5, 0xf7, 0xb1, 0x89, 0x48, 0x87, 0x71,\n ]),\n} as const;\n\n// ============================================================================\n// Account Discriminators (Anchor 8-byte hashes)\n// ============================================================================\n\n/**\n * Anchor account discriminator (first 8 bytes of SHA256(\"account:<AccountName>\"))\n */\nexport const ACCOUNT_DISCRIMINATORS = {\n // SHA256(\"account:AmmConfig\")[0:8]\n AmmConfig: new Uint8Array([0xda, 0xf4, 0x21, 0x68, 0xcb, 0xcb, 0x2b, 0x6f]),\n // SHA256(\"account:Pool\")[0:8]\n Pool: new Uint8Array([0xf1, 0x9a, 0x6d, 0x04, 0x11, 0xb1, 0x6d, 0xbc]),\n // SHA256(\"account:Position\")[0:8]\n Position: new Uint8Array([0xaa, 0xbc, 0x8f, 0xe4, 0x7a, 0x40, 0xf7, 0xd0]),\n // SHA256(\"account:OracleState\")[0:8]\n OracleState: new Uint8Array([0x61, 0x9c, 0x9d, 0xbd, 0xc2, 0x49, 0x08, 0x0f]),\n} as const;\n","import {\n type Address,\n type ProgramDerivedAddress,\n getAddressCodec,\n getProgramDerivedAddress,\n} from '@solana/kit';\nimport {\n CPMM_PROGRAM_ID,\n SEED_CONFIG,\n SEED_POOL,\n SEED_SPOT_POOL,\n SEED_AUTHORITY,\n SEED_VAULT0,\n SEED_VAULT1,\n SEED_POSITION,\n SEED_ORACLE,\n SEED_PROTOCOL_FEE_OWNER,\n} from './constants.js';\n\nconst addressCodec = getAddressCodec();\nconst textEncoder = new TextEncoder();\n\nfunction u16Seed(value: number): Uint8Array {\n if (!Number.isInteger(value) || value < 0 || value > 0xffff) {\n throw new RangeError('u16 value must be between 0 and 65535');\n }\n\n const bytes = new Uint8Array(2);\n new DataView(bytes.buffer).setUint16(0, value, true);\n return bytes;\n}\n\n// ============================================================================\n// Token Sorting\n// ============================================================================\n\n/**\n * Sort two mints into canonical order (token0 < token1 by bytes)\n * This is required for Pool PDA derivation and instruction ordering.\n *\n * @param mint0 - First mint address\n * @param mint1 - Second mint address\n * @returns Tuple of [token0, token1] in canonical order\n * @throws Error if mints are equal\n */\nexport function sortMints(mint0: Address, mint1: Address): [Address, Address] {\n const bytesA = addressCodec.encode(mint0);\n const bytesB = addressCodec.encode(mint1);\n\n for (let i = 0; i < 32; i++) {\n if (bytesA[i] < bytesB[i]) {\n return [mint0, mint1];\n }\n if (bytesA[i] > bytesB[i]) {\n return [mint1, mint0];\n }\n }\n\n throw new Error('Mints are equal - cannot create pool with identical tokens');\n}\n\n/**\n * Check if mints are in canonical order\n */\nexport function areMintsOrdered(mint0: Address, mint1: Address): boolean {\n const bytes0 = addressCodec.encode(mint0);\n const bytes1 = addressCodec.encode(mint1);\n\n for (let i = 0; i < 32; i++) {\n if (bytes0[i] < bytes1[i]) return true;\n if (bytes0[i] > bytes1[i]) return false;\n }\n return false; // equal\n}\n\n// ============================================================================\n// PDA Derivation Functions\n// ============================================================================\n\n/**\n * Derive the AmmConfig PDA address\n * Seeds: ['config']\n */\nexport async function getConfigAddress(\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [textEncoder.encode(SEED_CONFIG)],\n });\n}\n\n/**\n * Derive the Pool PDA address for a token pair\n * Seeds: ['pool', token0_mint, token1_mint]\n *\n * Note: Mints will be automatically sorted if not in canonical order.\n */\nexport async function getPoolAddress(\n mint0: Address,\n mint1: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n const [token0, token1] = sortMints(mint0, mint1);\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [\n textEncoder.encode(SEED_POOL),\n addressCodec.encode(token0),\n addressCodec.encode(token1),\n ],\n });\n}\n\n/**\n * Derive the spot Pool PDA address for a token pair and immutable fee tier.\n * Seeds: ['spot_pool', token0_mint, token1_mint, swap_fee_bps_le]\n *\n * Note: Mints will be automatically sorted if not in canonical order.\n */\nexport async function getSpotPoolAddress(\n mint0: Address,\n mint1: Address,\n swapFeeBps: number,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n const [token0, token1] = sortMints(mint0, mint1);\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [\n textEncoder.encode(SEED_SPOT_POOL),\n addressCodec.encode(token0),\n addressCodec.encode(token1),\n u16Seed(swapFeeBps),\n ],\n });\n}\n\n/**\n * Derive the Pool authority PDA (vault owner)\n * Seeds: ['authority', pool]\n */\nexport async function getPoolAuthorityAddress(\n pool: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [textEncoder.encode(SEED_AUTHORITY), addressCodec.encode(pool)],\n });\n}\n\n/**\n * Derive the token0 vault PDA.\n * Seeds: ['vault0', pool]\n */\nexport async function getPoolVault0Address(\n pool: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [textEncoder.encode(SEED_VAULT0), addressCodec.encode(pool)],\n });\n}\n\n/**\n * Derive the token1 vault PDA.\n * Seeds: ['vault1', pool]\n */\nexport async function getPoolVault1Address(\n pool: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [textEncoder.encode(SEED_VAULT1), addressCodec.encode(pool)],\n });\n}\n\n/**\n * Derive the Position PDA address\n * Seeds: ['position', pool, owner, position_id_le_bytes]\n */\nexport async function getPositionAddress(\n pool: Address,\n owner: Address,\n positionId: bigint,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n const positionIdBytes = new Uint8Array(8);\n const view = new DataView(positionIdBytes.buffer);\n view.setBigUint64(0, positionId, true); // little-endian\n\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [\n textEncoder.encode(SEED_POSITION),\n addressCodec.encode(pool),\n addressCodec.encode(owner),\n positionIdBytes,\n ],\n });\n}\n\n/**\n * Derive the OracleState PDA address\n * Seeds: ['oracle', pool]\n */\nexport async function getOracleAddress(\n pool: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [textEncoder.encode(SEED_ORACLE), addressCodec.encode(pool)],\n });\n}\n\n/**\n * Derive the protocol fee owner PDA address\n * Seeds: ['protocol_fee_owner', pool]\n */\nexport async function getProtocolFeeOwnerAddress(\n pool: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n return getProgramDerivedAddress({\n programAddress: programId,\n seeds: [\n textEncoder.encode(SEED_PROTOCOL_FEE_OWNER),\n addressCodec.encode(pool),\n ],\n });\n}\n\n/**\n * Derive the protocol fee position PDA address.\n * Seeds: ['position', pool, protocol_fee_owner, 0]\n */\nexport async function getProtocolFeePositionAddress(\n pool: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<ProgramDerivedAddress> {\n const [protocolFeeOwner] = await getProtocolFeeOwnerAddress(pool, programId);\n return getPositionAddress(pool, protocolFeeOwner, 0n, programId);\n}\n\n// ============================================================================\n// Batch PDA Derivation\n// ============================================================================\n\n/**\n * Derive all PDAs needed for pool initialization\n */\nexport async function getPoolInitAddresses(\n mint0: Address,\n mint1: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<{\n token0: Address;\n token1: Address;\n pool: ProgramDerivedAddress;\n authority: ProgramDerivedAddress;\n vault0: ProgramDerivedAddress;\n vault1: ProgramDerivedAddress;\n config: ProgramDerivedAddress;\n protocolFeeOwner: ProgramDerivedAddress;\n protocolFeePosition: ProgramDerivedAddress;\n}> {\n const [token0, token1] = sortMints(mint0, mint1);\n const [config, pool] = await Promise.all([\n getConfigAddress(programId),\n getPoolAddress(token0, token1, programId),\n ]);\n const [authority, vault0, vault1, protocolFeeOwner] = await Promise.all([\n getPoolAuthorityAddress(pool[0], programId),\n getPoolVault0Address(pool[0], programId),\n getPoolVault1Address(pool[0], programId),\n getProtocolFeeOwnerAddress(pool[0], programId),\n ]);\n const protocolFeePosition = await getPositionAddress(\n pool[0],\n protocolFeeOwner[0],\n 0n,\n programId,\n );\n\n return {\n token0,\n token1,\n pool,\n authority,\n vault0,\n vault1,\n config,\n protocolFeeOwner,\n protocolFeePosition,\n };\n}\n\n/**\n * Derive all PDAs needed for swap operation\n */\nexport async function getSwapAddresses(\n pool: Address,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<{\n config: ProgramDerivedAddress;\n authority: ProgramDerivedAddress;\n oracle: ProgramDerivedAddress;\n}> {\n const [config, authority, oracle] = await Promise.all([\n getConfigAddress(programId),\n getPoolAuthorityAddress(pool, programId),\n getOracleAddress(pool, programId),\n ]);\n\n return { config, authority, oracle };\n}\n\n/**\n * Derive all PDAs needed for liquidity operations\n */\nexport async function getLiquidityAddresses(\n pool: Address,\n owner: Address,\n positionId: bigint,\n programId: Address = CPMM_PROGRAM_ID,\n): Promise<{\n config: ProgramDerivedAddress;\n authority: ProgramDerivedAddress;\n position: ProgramDerivedAddress;\n protocolFeeOwner: ProgramDerivedAddress;\n protocolFeePosition: ProgramDerivedAddress;\n oracle: ProgramDerivedAddress;\n}> {\n const [config, authority, position, protocolFeeOwner, oracle] =\n await Promise.all([\n getConfigAddress(programId),\n getPoolAuthorityAddress(pool, programId),\n getPositionAddress(pool, owner, positionId, programId),\n getProtocolFeeOwnerAddress(pool, programId),\n getOracleAddress(pool, programId),\n ]);\n const protocolFeePosition = await getPositionAddress(\n pool,\n protocolFeeOwner[0],\n 0n,\n programId,\n );\n\n return {\n config,\n authority,\n position,\n protocolFeeOwner,\n protocolFeePosition,\n oracle,\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkU6B52TBT_cjs = require('./chunk-U6B52TBT.cjs');
3
+ var chunk4CI2M2F6_cjs = require('./chunk-4CI2M2F6.cjs');
4
4
  var kit = require('@solana/kit');
5
5
  var programClientCore = require('@solana/program-client-core');
6
6
 
@@ -50,7 +50,7 @@ var ammConfigDataCodec = kit.getStructCodec([
50
50
  ["admin", addressCodec],
51
51
  ["paused", boolCodec],
52
52
  ["hookAllowlistLen", u8Codec],
53
- ["hookAllowlist", kit.getArrayCodec(addressCodec, { size: chunkU6B52TBT_cjs.MAX_HOOK_ALLOWLIST })],
53
+ ["hookAllowlist", kit.getArrayCodec(addressCodec, { size: chunk4CI2M2F6_cjs.MAX_HOOK_ALLOWLIST })],
54
54
  ["maxSwapFeeBps", u16Codec],
55
55
  ["maxFeeSplitBps", u16Codec],
56
56
  ["protocolFeeEnabled", boolCodec],
@@ -113,22 +113,22 @@ var oracleStateDataCodec = kit.getStructCodec([
113
113
  ["observationIndex", u16Codec],
114
114
  [
115
115
  "observations",
116
- kit.getArrayCodec(observationCodec, { size: chunkU6B52TBT_cjs.MAX_ORACLE_OBSERVATIONS })
116
+ kit.getArrayCodec(observationCodec, { size: chunk4CI2M2F6_cjs.MAX_ORACLE_OBSERVATIONS })
117
117
  ],
118
118
  ["version", u8Codec],
119
119
  ["reserved", reservedBytesCodec]
120
120
  ]);
121
121
  var ammConfigDecoder = kit.getHiddenPrefixDecoder(ammConfigDataCodec, [
122
- kit.getConstantDecoder(chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS.AmmConfig)
122
+ kit.getConstantDecoder(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.AmmConfig)
123
123
  ]);
124
124
  var poolDecoder = kit.getHiddenPrefixDecoder(poolDataCodec, [
125
- kit.getConstantDecoder(chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS.Pool)
125
+ kit.getConstantDecoder(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Pool)
126
126
  ]);
127
127
  var positionDecoder = kit.getHiddenPrefixDecoder(positionDataCodec, [
128
- kit.getConstantDecoder(chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS.Position)
128
+ kit.getConstantDecoder(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Position)
129
129
  ]);
130
130
  var oracleStateDecoder = kit.getHiddenPrefixDecoder(oracleStateDataCodec, [
131
- kit.getConstantDecoder(chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS.OracleState)
131
+ kit.getConstantDecoder(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.OracleState)
132
132
  ]);
133
133
  function decodeAmmConfig(data) {
134
134
  return ammConfigDecoder.decode(data);
@@ -348,12 +348,12 @@ function warnAccountDecodeFailure(accountType, accountAddress) {
348
348
  function q64ToNumber(q64) {
349
349
  const intPart = q64 >> 64n;
350
350
  const fracPart = q64 & (1n << 64n) - 1n;
351
- return Number(intPart) + Number(fracPart) / Number(chunkU6B52TBT_cjs.Q64_ONE);
351
+ return Number(intPart) + Number(fracPart) / Number(chunk4CI2M2F6_cjs.Q64_ONE);
352
352
  }
353
353
  function numberToQ64(n) {
354
354
  const intPart = Math.floor(n);
355
355
  const fracPart = n - intPart;
356
- return (BigInt(intPart) << 64n) + BigInt(Math.round(fracPart * Number(chunkU6B52TBT_cjs.Q64_ONE)));
356
+ return (BigInt(intPart) << 64n) + BigInt(Math.round(fracPart * Number(chunk4CI2M2F6_cjs.Q64_ONE)));
357
357
  }
358
358
  function q64Mul(a, b) {
359
359
  return a * b >> 64n;
@@ -409,8 +409,8 @@ function getSwapQuote(pool, amountIn, tradeDirection) {
409
409
  if (reserveIn === 0n || reserveOut === 0n) {
410
410
  throw new Error("Pool has zero liquidity");
411
411
  }
412
- const feeTotal = amountIn * BigInt(pool.swapFeeBps) / chunkU6B52TBT_cjs.BPS_DENOM;
413
- const feeDist = feeTotal * BigInt(pool.feeSplitBps) / chunkU6B52TBT_cjs.BPS_DENOM;
412
+ const feeTotal = amountIn * BigInt(pool.swapFeeBps) / chunk4CI2M2F6_cjs.BPS_DENOM;
413
+ const feeDist = feeTotal * BigInt(pool.feeSplitBps) / chunk4CI2M2F6_cjs.BPS_DENOM;
414
414
  const feeComp = feeTotal - feeDist;
415
415
  const amountInEff = amountIn - feeTotal;
416
416
  const amountOut = amountInEff * reserveOut / (reserveIn + amountInEff);
@@ -436,8 +436,8 @@ function getSwapQuoteExactOut(pool, amountOut, tradeDirection) {
436
436
  }
437
437
  const amountInEff = ceilDiv(amountOut * reserveIn, reserveOut - amountOut);
438
438
  const amountIn = ceilDiv(
439
- amountInEff * chunkU6B52TBT_cjs.BPS_DENOM,
440
- chunkU6B52TBT_cjs.BPS_DENOM - BigInt(pool.swapFeeBps)
439
+ amountInEff * chunk4CI2M2F6_cjs.BPS_DENOM,
440
+ chunk4CI2M2F6_cjs.BPS_DENOM - BigInt(pool.swapFeeBps)
441
441
  );
442
442
  const feeTotal = amountIn - amountInEff;
443
443
  return { amountIn, feeTotal };
@@ -1699,6 +1699,298 @@ function parseInitializePoolInstruction(instruction) {
1699
1699
  data: getInitializePoolInstructionDataDecoder().decode(instruction.data)
1700
1700
  };
1701
1701
  }
1702
+ var INITIALIZE_SPOT_POOL_DISCRIMINATOR = new Uint8Array([
1703
+ 254,
1704
+ 243,
1705
+ 84,
1706
+ 29,
1707
+ 237,
1708
+ 165,
1709
+ 241,
1710
+ 217
1711
+ ]);
1712
+ function getInitializeSpotPoolDiscriminatorBytes() {
1713
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
1714
+ INITIALIZE_SPOT_POOL_DISCRIMINATOR
1715
+ );
1716
+ }
1717
+ function getInitializeSpotPoolInstructionDataEncoder() {
1718
+ return kit.transformEncoder(
1719
+ kit.getStructEncoder([
1720
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
1721
+ ["mintA", kit.getAddressEncoder()],
1722
+ ["mintB", kit.getAddressEncoder()],
1723
+ ["swapFeeBps", kit.getU16Encoder()]
1724
+ ]),
1725
+ (value) => ({
1726
+ ...value,
1727
+ discriminator: INITIALIZE_SPOT_POOL_DISCRIMINATOR
1728
+ })
1729
+ );
1730
+ }
1731
+ function getInitializeSpotPoolInstructionDataDecoder() {
1732
+ return kit.getStructDecoder([
1733
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
1734
+ ["mintA", kit.getAddressDecoder()],
1735
+ ["mintB", kit.getAddressDecoder()],
1736
+ ["swapFeeBps", kit.getU16Decoder()]
1737
+ ]);
1738
+ }
1739
+ function getInitializeSpotPoolInstructionDataCodec() {
1740
+ return kit.combineCodec(
1741
+ getInitializeSpotPoolInstructionDataEncoder(),
1742
+ getInitializeSpotPoolInstructionDataDecoder()
1743
+ );
1744
+ }
1745
+ async function getInitializeSpotPoolInstructionAsync(input, config) {
1746
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1747
+ const originalAccounts = {
1748
+ config: { value: input.config ?? null, isWritable: false },
1749
+ pool: { value: input.pool ?? null, isWritable: true },
1750
+ protocolFeePosition: {
1751
+ value: input.protocolFeePosition ?? null,
1752
+ isWritable: true
1753
+ },
1754
+ protocolFeeOwner: {
1755
+ value: input.protocolFeeOwner ?? null,
1756
+ isWritable: false
1757
+ },
1758
+ authority: { value: input.authority ?? null, isWritable: false },
1759
+ vault0: { value: input.vault0 ?? null, isWritable: true },
1760
+ vault1: { value: input.vault1 ?? null, isWritable: true },
1761
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1762
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1763
+ payer: { value: input.payer ?? null, isWritable: true },
1764
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
1765
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
1766
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1767
+ rent: { value: input.rent ?? null, isWritable: false },
1768
+ migrationAuthority: {
1769
+ value: input.migrationAuthority ?? null,
1770
+ isWritable: false
1771
+ }
1772
+ };
1773
+ const accounts = originalAccounts;
1774
+ const args = { ...input };
1775
+ if (!accounts.protocolFeeOwner.value) {
1776
+ accounts.protocolFeeOwner.value = await kit.getProgramDerivedAddress({
1777
+ programAddress,
1778
+ seeds: [
1779
+ kit.getBytesEncoder().encode(
1780
+ new Uint8Array([
1781
+ 112,
1782
+ 114,
1783
+ 111,
1784
+ 116,
1785
+ 111,
1786
+ 99,
1787
+ 111,
1788
+ 108,
1789
+ 95,
1790
+ 102,
1791
+ 101,
1792
+ 101,
1793
+ 95,
1794
+ 111,
1795
+ 119,
1796
+ 110,
1797
+ 101,
1798
+ 114
1799
+ ])
1800
+ ),
1801
+ kit.getAddressEncoder().encode(
1802
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1803
+ )
1804
+ ]
1805
+ });
1806
+ }
1807
+ if (!accounts.protocolFeePosition.value) {
1808
+ accounts.protocolFeePosition.value = await kit.getProgramDerivedAddress({
1809
+ programAddress,
1810
+ seeds: [
1811
+ kit.getBytesEncoder().encode(
1812
+ new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
1813
+ ),
1814
+ kit.getAddressEncoder().encode(
1815
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1816
+ ),
1817
+ kit.getAddressEncoder().encode(
1818
+ programClientCore.getAddressFromResolvedInstructionAccount(
1819
+ "protocolFeeOwner",
1820
+ accounts.protocolFeeOwner.value
1821
+ )
1822
+ ),
1823
+ kit.getBytesEncoder().encode(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]))
1824
+ ]
1825
+ });
1826
+ }
1827
+ if (!accounts.authority.value) {
1828
+ accounts.authority.value = await kit.getProgramDerivedAddress({
1829
+ programAddress,
1830
+ seeds: [
1831
+ kit.getBytesEncoder().encode(
1832
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
1833
+ ),
1834
+ kit.getAddressEncoder().encode(
1835
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1836
+ )
1837
+ ]
1838
+ });
1839
+ }
1840
+ if (!accounts.vault0.value) {
1841
+ accounts.vault0.value = await kit.getProgramDerivedAddress({
1842
+ programAddress,
1843
+ seeds: [
1844
+ kit.getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 48])),
1845
+ kit.getAddressEncoder().encode(
1846
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1847
+ )
1848
+ ]
1849
+ });
1850
+ }
1851
+ if (!accounts.vault1.value) {
1852
+ accounts.vault1.value = await kit.getProgramDerivedAddress({
1853
+ programAddress,
1854
+ seeds: [
1855
+ kit.getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 49])),
1856
+ kit.getAddressEncoder().encode(
1857
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1858
+ )
1859
+ ]
1860
+ });
1861
+ }
1862
+ if (!accounts.systemProgram.value) {
1863
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1864
+ }
1865
+ if (!accounts.rent.value) {
1866
+ accounts.rent.value = "SysvarRent111111111111111111111111111111111";
1867
+ }
1868
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1869
+ return Object.freeze({
1870
+ accounts: [
1871
+ getAccountMeta("config", accounts.config),
1872
+ getAccountMeta("pool", accounts.pool),
1873
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1874
+ getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
1875
+ getAccountMeta("authority", accounts.authority),
1876
+ getAccountMeta("vault0", accounts.vault0),
1877
+ getAccountMeta("vault1", accounts.vault1),
1878
+ getAccountMeta("token0Mint", accounts.token0Mint),
1879
+ getAccountMeta("token1Mint", accounts.token1Mint),
1880
+ getAccountMeta("payer", accounts.payer),
1881
+ getAccountMeta("token0Program", accounts.token0Program),
1882
+ getAccountMeta("token1Program", accounts.token1Program),
1883
+ getAccountMeta("systemProgram", accounts.systemProgram),
1884
+ getAccountMeta("rent", accounts.rent),
1885
+ getAccountMeta("migrationAuthority", accounts.migrationAuthority)
1886
+ ],
1887
+ data: getInitializeSpotPoolInstructionDataEncoder().encode(
1888
+ args
1889
+ ),
1890
+ programAddress
1891
+ });
1892
+ }
1893
+ function getInitializeSpotPoolInstruction(input, config) {
1894
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1895
+ const originalAccounts = {
1896
+ config: { value: input.config ?? null, isWritable: false },
1897
+ pool: { value: input.pool ?? null, isWritable: true },
1898
+ protocolFeePosition: {
1899
+ value: input.protocolFeePosition ?? null,
1900
+ isWritable: true
1901
+ },
1902
+ protocolFeeOwner: {
1903
+ value: input.protocolFeeOwner ?? null,
1904
+ isWritable: false
1905
+ },
1906
+ authority: { value: input.authority ?? null, isWritable: false },
1907
+ vault0: { value: input.vault0 ?? null, isWritable: true },
1908
+ vault1: { value: input.vault1 ?? null, isWritable: true },
1909
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1910
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1911
+ payer: { value: input.payer ?? null, isWritable: true },
1912
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
1913
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
1914
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1915
+ rent: { value: input.rent ?? null, isWritable: false },
1916
+ migrationAuthority: {
1917
+ value: input.migrationAuthority ?? null,
1918
+ isWritable: false
1919
+ }
1920
+ };
1921
+ const accounts = originalAccounts;
1922
+ const args = { ...input };
1923
+ if (!accounts.systemProgram.value) {
1924
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1925
+ }
1926
+ if (!accounts.rent.value) {
1927
+ accounts.rent.value = "SysvarRent111111111111111111111111111111111";
1928
+ }
1929
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1930
+ return Object.freeze({
1931
+ accounts: [
1932
+ getAccountMeta("config", accounts.config),
1933
+ getAccountMeta("pool", accounts.pool),
1934
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1935
+ getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
1936
+ getAccountMeta("authority", accounts.authority),
1937
+ getAccountMeta("vault0", accounts.vault0),
1938
+ getAccountMeta("vault1", accounts.vault1),
1939
+ getAccountMeta("token0Mint", accounts.token0Mint),
1940
+ getAccountMeta("token1Mint", accounts.token1Mint),
1941
+ getAccountMeta("payer", accounts.payer),
1942
+ getAccountMeta("token0Program", accounts.token0Program),
1943
+ getAccountMeta("token1Program", accounts.token1Program),
1944
+ getAccountMeta("systemProgram", accounts.systemProgram),
1945
+ getAccountMeta("rent", accounts.rent),
1946
+ getAccountMeta("migrationAuthority", accounts.migrationAuthority)
1947
+ ],
1948
+ data: getInitializeSpotPoolInstructionDataEncoder().encode(
1949
+ args
1950
+ ),
1951
+ programAddress
1952
+ });
1953
+ }
1954
+ function parseInitializeSpotPoolInstruction(instruction) {
1955
+ if (instruction.accounts.length < 15) {
1956
+ throw new kit.SolanaError(
1957
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1958
+ {
1959
+ actualAccountMetas: instruction.accounts.length,
1960
+ expectedAccountMetas: 15
1961
+ }
1962
+ );
1963
+ }
1964
+ let accountIndex = 0;
1965
+ const getNextAccount = () => {
1966
+ const accountMeta = instruction.accounts[accountIndex];
1967
+ accountIndex += 1;
1968
+ return accountMeta;
1969
+ };
1970
+ return {
1971
+ programAddress: instruction.programAddress,
1972
+ accounts: {
1973
+ config: getNextAccount(),
1974
+ pool: getNextAccount(),
1975
+ protocolFeePosition: getNextAccount(),
1976
+ protocolFeeOwner: getNextAccount(),
1977
+ authority: getNextAccount(),
1978
+ vault0: getNextAccount(),
1979
+ vault1: getNextAccount(),
1980
+ token0Mint: getNextAccount(),
1981
+ token1Mint: getNextAccount(),
1982
+ payer: getNextAccount(),
1983
+ token0Program: getNextAccount(),
1984
+ token1Program: getNextAccount(),
1985
+ systemProgram: getNextAccount(),
1986
+ rent: getNextAccount(),
1987
+ migrationAuthority: getNextAccount()
1988
+ },
1989
+ data: getInitializeSpotPoolInstructionDataDecoder().decode(
1990
+ instruction.data
1991
+ )
1992
+ };
1993
+ }
1702
1994
  var ORACLE_CONSULT_DISCRIMINATOR = new Uint8Array([
1703
1995
  239,
1704
1996
  237,
@@ -3442,11 +3734,11 @@ async function fetchPool(rpc, address, config) {
3442
3734
  return decodePool(base64ToBytes(response.value.data[0]));
3443
3735
  }
3444
3736
  async function fetchAllPools(rpc, config) {
3445
- const programId = config?.programId ?? chunkU6B52TBT_cjs.CPMM_PROGRAM_ID;
3737
+ const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
3446
3738
  const discriminatorFilter = {
3447
3739
  memcmp: {
3448
3740
  offset: 0n,
3449
- bytes: bytesToBase64EncodedBytes(chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS.Pool),
3741
+ bytes: bytesToBase64EncodedBytes(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Pool),
3450
3742
  encoding: "base64"
3451
3743
  }
3452
3744
  };
@@ -3471,8 +3763,8 @@ async function fetchAllPools(rpc, config) {
3471
3763
  return pools;
3472
3764
  }
3473
3765
  async function getPoolByMints(rpc, mint0, mint1, config) {
3474
- const programId = config?.programId ?? chunkU6B52TBT_cjs.CPMM_PROGRAM_ID;
3475
- const [poolAddress] = await chunkU6B52TBT_cjs.getPoolAddress(mint0, mint1, programId);
3766
+ const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
3767
+ const [poolAddress] = await chunk4CI2M2F6_cjs.getPoolAddress(mint0, mint1, programId);
3476
3768
  const pool = await fetchPool(rpc, poolAddress, config);
3477
3769
  if (!pool) {
3478
3770
  return null;
@@ -3499,9 +3791,9 @@ async function poolExists(rpc, mint0, mint1, config) {
3499
3791
  const result = await getPoolByMints(rpc, mint0, mint1, config);
3500
3792
  return result !== null;
3501
3793
  }
3502
- async function getPoolAddressFromMints(mint0, mint1, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID) {
3503
- const [token0, token1] = chunkU6B52TBT_cjs.sortMints(mint0, mint1);
3504
- const [poolAddress] = await chunkU6B52TBT_cjs.getPoolAddress(mint0, mint1, programId);
3794
+ async function getPoolAddressFromMints(mint0, mint1, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID) {
3795
+ const [token0, token1] = chunk4CI2M2F6_cjs.sortMints(mint0, mint1);
3796
+ const [poolAddress] = await chunk4CI2M2F6_cjs.getPoolAddress(mint0, mint1, programId);
3505
3797
  return {
3506
3798
  poolAddress,
3507
3799
  token0,
@@ -3534,13 +3826,13 @@ async function fetchPosition(rpc, address, config) {
3534
3826
  return decodePosition(base64ToBytes(response.value.data[0]));
3535
3827
  }
3536
3828
  async function fetchUserPositions(rpc, owner, pool, config) {
3537
- const programId = config?.programId ?? chunkU6B52TBT_cjs.CPMM_PROGRAM_ID;
3829
+ const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
3538
3830
  const filters = [
3539
3831
  // Discriminator filter (first 8 bytes)
3540
3832
  {
3541
3833
  memcmp: {
3542
3834
  offset: 0n,
3543
- bytes: bytesToBase64EncodedBytes(chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS.Position),
3835
+ bytes: bytesToBase64EncodedBytes(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Position),
3544
3836
  encoding: "base64"
3545
3837
  }
3546
3838
  },
@@ -3583,13 +3875,13 @@ async function fetchUserPositions(rpc, owner, pool, config) {
3583
3875
  return positions;
3584
3876
  }
3585
3877
  async function fetchPoolPositions(rpc, pool, config) {
3586
- const programId = config?.programId ?? chunkU6B52TBT_cjs.CPMM_PROGRAM_ID;
3878
+ const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
3587
3879
  const filters = [
3588
3880
  // Discriminator filter
3589
3881
  {
3590
3882
  memcmp: {
3591
3883
  offset: 0n,
3592
- bytes: bytesToBase64EncodedBytes(chunkU6B52TBT_cjs.ACCOUNT_DISCRIMINATORS.Position),
3884
+ bytes: bytesToBase64EncodedBytes(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Position),
3593
3885
  encoding: "base64"
3594
3886
  }
3595
3887
  },
@@ -3649,8 +3941,8 @@ function getPositionValue(pool, position) {
3649
3941
  };
3650
3942
  }
3651
3943
  async function fetchPositionByParams(rpc, pool, owner, positionId, config) {
3652
- const programId = config?.programId ?? chunkU6B52TBT_cjs.CPMM_PROGRAM_ID;
3653
- const [address] = await chunkU6B52TBT_cjs.getPositionAddress(
3944
+ const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
3945
+ const [address] = await chunk4CI2M2F6_cjs.getPositionAddress(
3654
3946
  pool,
3655
3947
  owner,
3656
3948
  positionId,
@@ -3665,8 +3957,8 @@ async function fetchPositionByParams(rpc, pool, owner, positionId, config) {
3665
3957
  account: position
3666
3958
  };
3667
3959
  }
3668
- async function getPositionAddressFromParams(pool, owner, positionId, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID) {
3669
- const [address] = await chunkU6B52TBT_cjs.getPositionAddress(
3960
+ async function getPositionAddressFromParams(pool, owner, positionId, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID) {
3961
+ const [address] = await chunk4CI2M2F6_cjs.getPositionAddress(
3670
3962
  pool,
3671
3963
  owner,
3672
3964
  positionId,
@@ -3709,8 +4001,8 @@ async function fetchOracle(rpc, address, config) {
3709
4001
  return decodeOracleState(base64ToBytes(response.value.data[0]));
3710
4002
  }
3711
4003
  async function getOracleForPool(rpc, pool, config) {
3712
- const programId = config?.programId ?? chunkU6B52TBT_cjs.CPMM_PROGRAM_ID;
3713
- const [oracleAddress] = await chunkU6B52TBT_cjs.getOracleAddress(pool, programId);
4004
+ const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
4005
+ const [oracleAddress] = await chunk4CI2M2F6_cjs.getOracleAddress(pool, programId);
3714
4006
  const oracle = await fetchOracle(rpc, oracleAddress, config);
3715
4007
  if (!oracle) {
3716
4008
  return null;
@@ -3720,8 +4012,8 @@ async function getOracleForPool(rpc, pool, config) {
3720
4012
  account: oracle
3721
4013
  };
3722
4014
  }
3723
- async function getOracleAddressFromPool(pool, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID) {
3724
- const [address] = await chunkU6B52TBT_cjs.getOracleAddress(pool, programId);
4015
+ async function getOracleAddressFromPool(pool, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID) {
4016
+ const [address] = await chunk4CI2M2F6_cjs.getOracleAddress(pool, programId);
3725
4017
  return address;
3726
4018
  }
3727
4019
  function consultTwap(oracle, windowSeconds, currentTimestamp) {
@@ -3844,10 +4136,10 @@ function getOracleBufferStats(oracle) {
3844
4136
  };
3845
4137
  }
3846
4138
  async function fetchOraclesBatch(rpc, pools, config) {
3847
- const programId = config?.programId ?? chunkU6B52TBT_cjs.CPMM_PROGRAM_ID;
4139
+ const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
3848
4140
  const oracles = /* @__PURE__ */ new Map();
3849
4141
  const oracleAddresses = await Promise.all(
3850
- pools.map((pool) => chunkU6B52TBT_cjs.getOracleAddress(pool, programId))
4142
+ pools.map((pool) => chunk4CI2M2F6_cjs.getOracleAddress(pool, programId))
3851
4143
  );
3852
4144
  const results = await Promise.all(
3853
4145
  oracleAddresses.map(([addr]) => fetchOracle(rpc, addr, config))
@@ -3883,6 +4175,7 @@ exports.CREATE_POSITION_DISCRIMINATOR = CREATE_POSITION_DISCRIMINATOR;
3883
4175
  exports.INITIALIZE_CONFIG_DISCRIMINATOR = INITIALIZE_CONFIG_DISCRIMINATOR;
3884
4176
  exports.INITIALIZE_ORACLE_DISCRIMINATOR = INITIALIZE_ORACLE_DISCRIMINATOR;
3885
4177
  exports.INITIALIZE_POOL_DISCRIMINATOR = INITIALIZE_POOL_DISCRIMINATOR;
4178
+ exports.INITIALIZE_SPOT_POOL_DISCRIMINATOR = INITIALIZE_SPOT_POOL_DISCRIMINATOR;
3886
4179
  exports.ORACLE_CONSULT_DISCRIMINATOR = ORACLE_CONSULT_DISCRIMINATOR;
3887
4180
  exports.ORACLE_UPDATE_DISCRIMINATOR = ORACLE_UPDATE_DISCRIMINATOR;
3888
4181
  exports.PAUSE_DISCRIMINATOR = PAUSE_DISCRIMINATOR;
@@ -3995,6 +4288,12 @@ exports.getInitializePoolInstructionAsync = getInitializePoolInstructionAsync;
3995
4288
  exports.getInitializePoolInstructionDataCodec = getInitializePoolInstructionDataCodec;
3996
4289
  exports.getInitializePoolInstructionDataDecoder = getInitializePoolInstructionDataDecoder;
3997
4290
  exports.getInitializePoolInstructionDataEncoder = getInitializePoolInstructionDataEncoder;
4291
+ exports.getInitializeSpotPoolDiscriminatorBytes = getInitializeSpotPoolDiscriminatorBytes;
4292
+ exports.getInitializeSpotPoolInstruction = getInitializeSpotPoolInstruction;
4293
+ exports.getInitializeSpotPoolInstructionAsync = getInitializeSpotPoolInstructionAsync;
4294
+ exports.getInitializeSpotPoolInstructionDataCodec = getInitializeSpotPoolInstructionDataCodec;
4295
+ exports.getInitializeSpotPoolInstructionDataDecoder = getInitializeSpotPoolInstructionDataDecoder;
4296
+ exports.getInitializeSpotPoolInstructionDataEncoder = getInitializeSpotPoolInstructionDataEncoder;
3998
4297
  exports.getK = getK;
3999
4298
  exports.getOracleAddressFromPool = getOracleAddressFromPool;
4000
4299
  exports.getOracleAge = getOracleAge;
@@ -4105,6 +4404,7 @@ exports.parseCreatePositionInstruction = parseCreatePositionInstruction;
4105
4404
  exports.parseInitializeConfigInstruction = parseInitializeConfigInstruction;
4106
4405
  exports.parseInitializeOracleInstruction = parseInitializeOracleInstruction;
4107
4406
  exports.parseInitializePoolInstruction = parseInitializePoolInstruction;
4407
+ exports.parseInitializeSpotPoolInstruction = parseInitializeSpotPoolInstruction;
4108
4408
  exports.parseOracleConsultInstruction = parseOracleConsultInstruction;
4109
4409
  exports.parseOracleUpdateInstruction = parseOracleUpdateInstruction;
4110
4410
  exports.parsePauseInstruction = parsePauseInstruction;
@@ -4133,5 +4433,5 @@ exports.sortPositionsByShares = sortPositionsByShares;
4133
4433
  exports.swapExactInArgsCodec = swapExactInArgsCodec;
4134
4434
  exports.transferAdminArgsCodec = transferAdminArgsCodec;
4135
4435
  exports.warnAccountDecodeFailure = warnAccountDecodeFailure;
4136
- //# sourceMappingURL=chunk-4WY5GNZD.cjs.map
4137
- //# sourceMappingURL=chunk-4WY5GNZD.cjs.map
4436
+ //# sourceMappingURL=chunk-7PXLEMBJ.cjs.map
4437
+ //# sourceMappingURL=chunk-7PXLEMBJ.cjs.map