@whetstone-research/doppler-sdk 1.0.34 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk4CI2M2F6_cjs = require('./chunk-4CI2M2F6.cjs');
3
+ var chunkO2Z5ORGF_cjs = require('./chunk-O2Z5ORGF.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: chunk4CI2M2F6_cjs.MAX_HOOK_ALLOWLIST })],
53
+ ["hookAllowlist", kit.getArrayCodec(addressCodec, { size: chunkO2Z5ORGF_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: chunk4CI2M2F6_cjs.MAX_ORACLE_OBSERVATIONS })
116
+ kit.getArrayCodec(observationCodec, { size: chunkO2Z5ORGF_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(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.AmmConfig)
122
+ kit.getConstantDecoder(chunkO2Z5ORGF_cjs.ACCOUNT_DISCRIMINATORS.AmmConfig)
123
123
  ]);
124
124
  var poolDecoder = kit.getHiddenPrefixDecoder(poolDataCodec, [
125
- kit.getConstantDecoder(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Pool)
125
+ kit.getConstantDecoder(chunkO2Z5ORGF_cjs.ACCOUNT_DISCRIMINATORS.Pool)
126
126
  ]);
127
127
  var positionDecoder = kit.getHiddenPrefixDecoder(positionDataCodec, [
128
- kit.getConstantDecoder(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Position)
128
+ kit.getConstantDecoder(chunkO2Z5ORGF_cjs.ACCOUNT_DISCRIMINATORS.Position)
129
129
  ]);
130
130
  var oracleStateDecoder = kit.getHiddenPrefixDecoder(oracleStateDataCodec, [
131
- kit.getConstantDecoder(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.OracleState)
131
+ kit.getConstantDecoder(chunkO2Z5ORGF_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(chunk4CI2M2F6_cjs.Q64_ONE);
351
+ return Number(intPart) + Number(fracPart) / Number(chunkO2Z5ORGF_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(chunk4CI2M2F6_cjs.Q64_ONE)));
356
+ return (BigInt(intPart) << 64n) + BigInt(Math.round(fracPart * Number(chunkO2Z5ORGF_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) / chunk4CI2M2F6_cjs.BPS_DENOM;
413
- const feeDist = feeTotal * BigInt(pool.feeSplitBps) / chunk4CI2M2F6_cjs.BPS_DENOM;
412
+ const feeTotal = amountIn * BigInt(pool.swapFeeBps) / chunkO2Z5ORGF_cjs.BPS_DENOM;
413
+ const feeDist = feeTotal * BigInt(pool.feeSplitBps) / chunkO2Z5ORGF_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 * chunk4CI2M2F6_cjs.BPS_DENOM,
440
- chunk4CI2M2F6_cjs.BPS_DENOM - BigInt(pool.swapFeeBps)
439
+ amountInEff * chunkO2Z5ORGF_cjs.BPS_DENOM,
440
+ chunkO2Z5ORGF_cjs.BPS_DENOM - BigInt(pool.swapFeeBps)
441
441
  );
442
442
  const feeTotal = amountIn - amountInEff;
443
443
  return { amountIn, feeTotal };
@@ -1991,6 +1991,307 @@ function parseInitializeSpotPoolInstruction(instruction) {
1991
1991
  )
1992
1992
  };
1993
1993
  }
1994
+ var INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR = new Uint8Array([
1995
+ 98,
1996
+ 227,
1997
+ 206,
1998
+ 159,
1999
+ 252,
2000
+ 134,
2001
+ 77,
2002
+ 21
2003
+ ]);
2004
+ function getInitializeSpotPoolWithHookDiscriminatorBytes() {
2005
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2006
+ INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR
2007
+ );
2008
+ }
2009
+ function getInitializeSpotPoolWithHookInstructionDataEncoder() {
2010
+ return kit.transformEncoder(
2011
+ kit.getStructEncoder([
2012
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2013
+ ["mintA", kit.getAddressEncoder()],
2014
+ ["mintB", kit.getAddressEncoder()],
2015
+ ["swapFeeBps", kit.getU16Encoder()],
2016
+ ["hookProgram", kit.getAddressEncoder()],
2017
+ ["hookFlags", kit.getU32Encoder()]
2018
+ ]),
2019
+ (value) => ({
2020
+ ...value,
2021
+ discriminator: INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR
2022
+ })
2023
+ );
2024
+ }
2025
+ function getInitializeSpotPoolWithHookInstructionDataDecoder() {
2026
+ return kit.getStructDecoder([
2027
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2028
+ ["mintA", kit.getAddressDecoder()],
2029
+ ["mintB", kit.getAddressDecoder()],
2030
+ ["swapFeeBps", kit.getU16Decoder()],
2031
+ ["hookProgram", kit.getAddressDecoder()],
2032
+ ["hookFlags", kit.getU32Decoder()]
2033
+ ]);
2034
+ }
2035
+ function getInitializeSpotPoolWithHookInstructionDataCodec() {
2036
+ return kit.combineCodec(
2037
+ getInitializeSpotPoolWithHookInstructionDataEncoder(),
2038
+ getInitializeSpotPoolWithHookInstructionDataDecoder()
2039
+ );
2040
+ }
2041
+ async function getInitializeSpotPoolWithHookInstructionAsync(input, config) {
2042
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2043
+ const originalAccounts = {
2044
+ config: { value: input.config ?? null, isWritable: false },
2045
+ pool: { value: input.pool ?? null, isWritable: true },
2046
+ protocolFeePosition: {
2047
+ value: input.protocolFeePosition ?? null,
2048
+ isWritable: true
2049
+ },
2050
+ protocolFeeOwner: {
2051
+ value: input.protocolFeeOwner ?? null,
2052
+ isWritable: false
2053
+ },
2054
+ authority: { value: input.authority ?? null, isWritable: false },
2055
+ vault0: { value: input.vault0 ?? null, isWritable: true },
2056
+ vault1: { value: input.vault1 ?? null, isWritable: true },
2057
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2058
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2059
+ payer: { value: input.payer ?? null, isWritable: true },
2060
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
2061
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
2062
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
2063
+ rent: { value: input.rent ?? null, isWritable: false },
2064
+ migrationAuthority: {
2065
+ value: input.migrationAuthority ?? null,
2066
+ isWritable: false
2067
+ },
2068
+ hookProgram: { value: input.hookProgram ?? null, isWritable: false }
2069
+ };
2070
+ const accounts = originalAccounts;
2071
+ const args = { ...input, hookProgram: input.hookProgramArg };
2072
+ if (!accounts.protocolFeeOwner.value) {
2073
+ accounts.protocolFeeOwner.value = await kit.getProgramDerivedAddress({
2074
+ programAddress,
2075
+ seeds: [
2076
+ kit.getBytesEncoder().encode(
2077
+ new Uint8Array([
2078
+ 112,
2079
+ 114,
2080
+ 111,
2081
+ 116,
2082
+ 111,
2083
+ 99,
2084
+ 111,
2085
+ 108,
2086
+ 95,
2087
+ 102,
2088
+ 101,
2089
+ 101,
2090
+ 95,
2091
+ 111,
2092
+ 119,
2093
+ 110,
2094
+ 101,
2095
+ 114
2096
+ ])
2097
+ ),
2098
+ kit.getAddressEncoder().encode(
2099
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2100
+ )
2101
+ ]
2102
+ });
2103
+ }
2104
+ if (!accounts.protocolFeePosition.value) {
2105
+ accounts.protocolFeePosition.value = await kit.getProgramDerivedAddress({
2106
+ programAddress,
2107
+ seeds: [
2108
+ kit.getBytesEncoder().encode(
2109
+ new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
2110
+ ),
2111
+ kit.getAddressEncoder().encode(
2112
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2113
+ ),
2114
+ kit.getAddressEncoder().encode(
2115
+ programClientCore.getAddressFromResolvedInstructionAccount(
2116
+ "protocolFeeOwner",
2117
+ accounts.protocolFeeOwner.value
2118
+ )
2119
+ ),
2120
+ kit.getBytesEncoder().encode(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]))
2121
+ ]
2122
+ });
2123
+ }
2124
+ if (!accounts.authority.value) {
2125
+ accounts.authority.value = await kit.getProgramDerivedAddress({
2126
+ programAddress,
2127
+ seeds: [
2128
+ kit.getBytesEncoder().encode(
2129
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
2130
+ ),
2131
+ kit.getAddressEncoder().encode(
2132
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2133
+ )
2134
+ ]
2135
+ });
2136
+ }
2137
+ if (!accounts.vault0.value) {
2138
+ accounts.vault0.value = await kit.getProgramDerivedAddress({
2139
+ programAddress,
2140
+ seeds: [
2141
+ kit.getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 48])),
2142
+ kit.getAddressEncoder().encode(
2143
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2144
+ )
2145
+ ]
2146
+ });
2147
+ }
2148
+ if (!accounts.vault1.value) {
2149
+ accounts.vault1.value = await kit.getProgramDerivedAddress({
2150
+ programAddress,
2151
+ seeds: [
2152
+ kit.getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 49])),
2153
+ kit.getAddressEncoder().encode(
2154
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2155
+ )
2156
+ ]
2157
+ });
2158
+ }
2159
+ if (!accounts.systemProgram.value) {
2160
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2161
+ }
2162
+ if (!accounts.rent.value) {
2163
+ accounts.rent.value = "SysvarRent111111111111111111111111111111111";
2164
+ }
2165
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2166
+ return Object.freeze({
2167
+ accounts: [
2168
+ getAccountMeta("config", accounts.config),
2169
+ getAccountMeta("pool", accounts.pool),
2170
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
2171
+ getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
2172
+ getAccountMeta("authority", accounts.authority),
2173
+ getAccountMeta("vault0", accounts.vault0),
2174
+ getAccountMeta("vault1", accounts.vault1),
2175
+ getAccountMeta("token0Mint", accounts.token0Mint),
2176
+ getAccountMeta("token1Mint", accounts.token1Mint),
2177
+ getAccountMeta("payer", accounts.payer),
2178
+ getAccountMeta("token0Program", accounts.token0Program),
2179
+ getAccountMeta("token1Program", accounts.token1Program),
2180
+ getAccountMeta("systemProgram", accounts.systemProgram),
2181
+ getAccountMeta("rent", accounts.rent),
2182
+ getAccountMeta("migrationAuthority", accounts.migrationAuthority),
2183
+ getAccountMeta("hookProgram", accounts.hookProgram)
2184
+ ],
2185
+ data: getInitializeSpotPoolWithHookInstructionDataEncoder().encode(
2186
+ args
2187
+ ),
2188
+ programAddress
2189
+ });
2190
+ }
2191
+ function getInitializeSpotPoolWithHookInstruction(input, config) {
2192
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2193
+ const originalAccounts = {
2194
+ config: { value: input.config ?? null, isWritable: false },
2195
+ pool: { value: input.pool ?? null, isWritable: true },
2196
+ protocolFeePosition: {
2197
+ value: input.protocolFeePosition ?? null,
2198
+ isWritable: true
2199
+ },
2200
+ protocolFeeOwner: {
2201
+ value: input.protocolFeeOwner ?? null,
2202
+ isWritable: false
2203
+ },
2204
+ authority: { value: input.authority ?? null, isWritable: false },
2205
+ vault0: { value: input.vault0 ?? null, isWritable: true },
2206
+ vault1: { value: input.vault1 ?? null, isWritable: true },
2207
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2208
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2209
+ payer: { value: input.payer ?? null, isWritable: true },
2210
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
2211
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
2212
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
2213
+ rent: { value: input.rent ?? null, isWritable: false },
2214
+ migrationAuthority: {
2215
+ value: input.migrationAuthority ?? null,
2216
+ isWritable: false
2217
+ },
2218
+ hookProgram: { value: input.hookProgram ?? null, isWritable: false }
2219
+ };
2220
+ const accounts = originalAccounts;
2221
+ const args = { ...input, hookProgram: input.hookProgramArg };
2222
+ if (!accounts.systemProgram.value) {
2223
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2224
+ }
2225
+ if (!accounts.rent.value) {
2226
+ accounts.rent.value = "SysvarRent111111111111111111111111111111111";
2227
+ }
2228
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2229
+ return Object.freeze({
2230
+ accounts: [
2231
+ getAccountMeta("config", accounts.config),
2232
+ getAccountMeta("pool", accounts.pool),
2233
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
2234
+ getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
2235
+ getAccountMeta("authority", accounts.authority),
2236
+ getAccountMeta("vault0", accounts.vault0),
2237
+ getAccountMeta("vault1", accounts.vault1),
2238
+ getAccountMeta("token0Mint", accounts.token0Mint),
2239
+ getAccountMeta("token1Mint", accounts.token1Mint),
2240
+ getAccountMeta("payer", accounts.payer),
2241
+ getAccountMeta("token0Program", accounts.token0Program),
2242
+ getAccountMeta("token1Program", accounts.token1Program),
2243
+ getAccountMeta("systemProgram", accounts.systemProgram),
2244
+ getAccountMeta("rent", accounts.rent),
2245
+ getAccountMeta("migrationAuthority", accounts.migrationAuthority),
2246
+ getAccountMeta("hookProgram", accounts.hookProgram)
2247
+ ],
2248
+ data: getInitializeSpotPoolWithHookInstructionDataEncoder().encode(
2249
+ args
2250
+ ),
2251
+ programAddress
2252
+ });
2253
+ }
2254
+ function parseInitializeSpotPoolWithHookInstruction(instruction) {
2255
+ if (instruction.accounts.length < 16) {
2256
+ throw new kit.SolanaError(
2257
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2258
+ {
2259
+ actualAccountMetas: instruction.accounts.length,
2260
+ expectedAccountMetas: 16
2261
+ }
2262
+ );
2263
+ }
2264
+ let accountIndex = 0;
2265
+ const getNextAccount = () => {
2266
+ const accountMeta = instruction.accounts[accountIndex];
2267
+ accountIndex += 1;
2268
+ return accountMeta;
2269
+ };
2270
+ return {
2271
+ programAddress: instruction.programAddress,
2272
+ accounts: {
2273
+ config: getNextAccount(),
2274
+ pool: getNextAccount(),
2275
+ protocolFeePosition: getNextAccount(),
2276
+ protocolFeeOwner: getNextAccount(),
2277
+ authority: getNextAccount(),
2278
+ vault0: getNextAccount(),
2279
+ vault1: getNextAccount(),
2280
+ token0Mint: getNextAccount(),
2281
+ token1Mint: getNextAccount(),
2282
+ payer: getNextAccount(),
2283
+ token0Program: getNextAccount(),
2284
+ token1Program: getNextAccount(),
2285
+ systemProgram: getNextAccount(),
2286
+ rent: getNextAccount(),
2287
+ migrationAuthority: getNextAccount(),
2288
+ hookProgram: getNextAccount()
2289
+ },
2290
+ data: getInitializeSpotPoolWithHookInstructionDataDecoder().decode(
2291
+ instruction.data
2292
+ )
2293
+ };
2294
+ }
1994
2295
  var ORACLE_CONSULT_DISCRIMINATOR = new Uint8Array([
1995
2296
  239,
1996
2297
  237,
@@ -3734,11 +4035,11 @@ async function fetchPool(rpc, address, config) {
3734
4035
  return decodePool(base64ToBytes(response.value.data[0]));
3735
4036
  }
3736
4037
  async function fetchAllPools(rpc, config) {
3737
- const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
4038
+ const programId = config?.programId ?? chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID;
3738
4039
  const discriminatorFilter = {
3739
4040
  memcmp: {
3740
4041
  offset: 0n,
3741
- bytes: bytesToBase64EncodedBytes(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Pool),
4042
+ bytes: bytesToBase64EncodedBytes(chunkO2Z5ORGF_cjs.ACCOUNT_DISCRIMINATORS.Pool),
3742
4043
  encoding: "base64"
3743
4044
  }
3744
4045
  };
@@ -3763,8 +4064,8 @@ async function fetchAllPools(rpc, config) {
3763
4064
  return pools;
3764
4065
  }
3765
4066
  async function getPoolByMints(rpc, mint0, mint1, config) {
3766
- const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
3767
- const [poolAddress] = await chunk4CI2M2F6_cjs.getPoolAddress(mint0, mint1, programId);
4067
+ const programId = config?.programId ?? chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID;
4068
+ const [poolAddress] = await chunkO2Z5ORGF_cjs.getPoolAddress(mint0, mint1, programId);
3768
4069
  const pool = await fetchPool(rpc, poolAddress, config);
3769
4070
  if (!pool) {
3770
4071
  return null;
@@ -3791,9 +4092,9 @@ async function poolExists(rpc, mint0, mint1, config) {
3791
4092
  const result = await getPoolByMints(rpc, mint0, mint1, config);
3792
4093
  return result !== null;
3793
4094
  }
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);
4095
+ async function getPoolAddressFromMints(mint0, mint1, programId = chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID) {
4096
+ const [token0, token1] = chunkO2Z5ORGF_cjs.sortMints(mint0, mint1);
4097
+ const [poolAddress] = await chunkO2Z5ORGF_cjs.getPoolAddress(mint0, mint1, programId);
3797
4098
  return {
3798
4099
  poolAddress,
3799
4100
  token0,
@@ -3826,13 +4127,13 @@ async function fetchPosition(rpc, address, config) {
3826
4127
  return decodePosition(base64ToBytes(response.value.data[0]));
3827
4128
  }
3828
4129
  async function fetchUserPositions(rpc, owner, pool, config) {
3829
- const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
4130
+ const programId = config?.programId ?? chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID;
3830
4131
  const filters = [
3831
4132
  // Discriminator filter (first 8 bytes)
3832
4133
  {
3833
4134
  memcmp: {
3834
4135
  offset: 0n,
3835
- bytes: bytesToBase64EncodedBytes(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Position),
4136
+ bytes: bytesToBase64EncodedBytes(chunkO2Z5ORGF_cjs.ACCOUNT_DISCRIMINATORS.Position),
3836
4137
  encoding: "base64"
3837
4138
  }
3838
4139
  },
@@ -3875,13 +4176,13 @@ async function fetchUserPositions(rpc, owner, pool, config) {
3875
4176
  return positions;
3876
4177
  }
3877
4178
  async function fetchPoolPositions(rpc, pool, config) {
3878
- const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
4179
+ const programId = config?.programId ?? chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID;
3879
4180
  const filters = [
3880
4181
  // Discriminator filter
3881
4182
  {
3882
4183
  memcmp: {
3883
4184
  offset: 0n,
3884
- bytes: bytesToBase64EncodedBytes(chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS.Position),
4185
+ bytes: bytesToBase64EncodedBytes(chunkO2Z5ORGF_cjs.ACCOUNT_DISCRIMINATORS.Position),
3885
4186
  encoding: "base64"
3886
4187
  }
3887
4188
  },
@@ -3941,8 +4242,8 @@ function getPositionValue(pool, position) {
3941
4242
  };
3942
4243
  }
3943
4244
  async function fetchPositionByParams(rpc, pool, owner, positionId, config) {
3944
- const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
3945
- const [address] = await chunk4CI2M2F6_cjs.getPositionAddress(
4245
+ const programId = config?.programId ?? chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID;
4246
+ const [address] = await chunkO2Z5ORGF_cjs.getPositionAddress(
3946
4247
  pool,
3947
4248
  owner,
3948
4249
  positionId,
@@ -3957,8 +4258,8 @@ async function fetchPositionByParams(rpc, pool, owner, positionId, config) {
3957
4258
  account: position
3958
4259
  };
3959
4260
  }
3960
- async function getPositionAddressFromParams(pool, owner, positionId, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID) {
3961
- const [address] = await chunk4CI2M2F6_cjs.getPositionAddress(
4261
+ async function getPositionAddressFromParams(pool, owner, positionId, programId = chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID) {
4262
+ const [address] = await chunkO2Z5ORGF_cjs.getPositionAddress(
3962
4263
  pool,
3963
4264
  owner,
3964
4265
  positionId,
@@ -4001,8 +4302,8 @@ async function fetchOracle(rpc, address, config) {
4001
4302
  return decodeOracleState(base64ToBytes(response.value.data[0]));
4002
4303
  }
4003
4304
  async function getOracleForPool(rpc, pool, config) {
4004
- const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
4005
- const [oracleAddress] = await chunk4CI2M2F6_cjs.getOracleAddress(pool, programId);
4305
+ const programId = config?.programId ?? chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID;
4306
+ const [oracleAddress] = await chunkO2Z5ORGF_cjs.getOracleAddress(pool, programId);
4006
4307
  const oracle = await fetchOracle(rpc, oracleAddress, config);
4007
4308
  if (!oracle) {
4008
4309
  return null;
@@ -4012,8 +4313,8 @@ async function getOracleForPool(rpc, pool, config) {
4012
4313
  account: oracle
4013
4314
  };
4014
4315
  }
4015
- async function getOracleAddressFromPool(pool, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID) {
4016
- const [address] = await chunk4CI2M2F6_cjs.getOracleAddress(pool, programId);
4316
+ async function getOracleAddressFromPool(pool, programId = chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID) {
4317
+ const [address] = await chunkO2Z5ORGF_cjs.getOracleAddress(pool, programId);
4017
4318
  return address;
4018
4319
  }
4019
4320
  function consultTwap(oracle, windowSeconds, currentTimestamp) {
@@ -4136,10 +4437,10 @@ function getOracleBufferStats(oracle) {
4136
4437
  };
4137
4438
  }
4138
4439
  async function fetchOraclesBatch(rpc, pools, config) {
4139
- const programId = config?.programId ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
4440
+ const programId = config?.programId ?? chunkO2Z5ORGF_cjs.CPMM_PROGRAM_ID;
4140
4441
  const oracles = /* @__PURE__ */ new Map();
4141
4442
  const oracleAddresses = await Promise.all(
4142
- pools.map((pool) => chunk4CI2M2F6_cjs.getOracleAddress(pool, programId))
4443
+ pools.map((pool) => chunkO2Z5ORGF_cjs.getOracleAddress(pool, programId))
4143
4444
  );
4144
4445
  const results = await Promise.all(
4145
4446
  oracleAddresses.map(([addr]) => fetchOracle(rpc, addr, config))
@@ -4176,6 +4477,7 @@ exports.INITIALIZE_CONFIG_DISCRIMINATOR = INITIALIZE_CONFIG_DISCRIMINATOR;
4176
4477
  exports.INITIALIZE_ORACLE_DISCRIMINATOR = INITIALIZE_ORACLE_DISCRIMINATOR;
4177
4478
  exports.INITIALIZE_POOL_DISCRIMINATOR = INITIALIZE_POOL_DISCRIMINATOR;
4178
4479
  exports.INITIALIZE_SPOT_POOL_DISCRIMINATOR = INITIALIZE_SPOT_POOL_DISCRIMINATOR;
4480
+ exports.INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR = INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR;
4179
4481
  exports.ORACLE_CONSULT_DISCRIMINATOR = ORACLE_CONSULT_DISCRIMINATOR;
4180
4482
  exports.ORACLE_UPDATE_DISCRIMINATOR = ORACLE_UPDATE_DISCRIMINATOR;
4181
4483
  exports.PAUSE_DISCRIMINATOR = PAUSE_DISCRIMINATOR;
@@ -4294,6 +4596,12 @@ exports.getInitializeSpotPoolInstructionAsync = getInitializeSpotPoolInstruction
4294
4596
  exports.getInitializeSpotPoolInstructionDataCodec = getInitializeSpotPoolInstructionDataCodec;
4295
4597
  exports.getInitializeSpotPoolInstructionDataDecoder = getInitializeSpotPoolInstructionDataDecoder;
4296
4598
  exports.getInitializeSpotPoolInstructionDataEncoder = getInitializeSpotPoolInstructionDataEncoder;
4599
+ exports.getInitializeSpotPoolWithHookDiscriminatorBytes = getInitializeSpotPoolWithHookDiscriminatorBytes;
4600
+ exports.getInitializeSpotPoolWithHookInstruction = getInitializeSpotPoolWithHookInstruction;
4601
+ exports.getInitializeSpotPoolWithHookInstructionAsync = getInitializeSpotPoolWithHookInstructionAsync;
4602
+ exports.getInitializeSpotPoolWithHookInstructionDataCodec = getInitializeSpotPoolWithHookInstructionDataCodec;
4603
+ exports.getInitializeSpotPoolWithHookInstructionDataDecoder = getInitializeSpotPoolWithHookInstructionDataDecoder;
4604
+ exports.getInitializeSpotPoolWithHookInstructionDataEncoder = getInitializeSpotPoolWithHookInstructionDataEncoder;
4297
4605
  exports.getK = getK;
4298
4606
  exports.getOracleAddressFromPool = getOracleAddressFromPool;
4299
4607
  exports.getOracleAge = getOracleAge;
@@ -4405,6 +4713,7 @@ exports.parseInitializeConfigInstruction = parseInitializeConfigInstruction;
4405
4713
  exports.parseInitializeOracleInstruction = parseInitializeOracleInstruction;
4406
4714
  exports.parseInitializePoolInstruction = parseInitializePoolInstruction;
4407
4715
  exports.parseInitializeSpotPoolInstruction = parseInitializeSpotPoolInstruction;
4716
+ exports.parseInitializeSpotPoolWithHookInstruction = parseInitializeSpotPoolWithHookInstruction;
4408
4717
  exports.parseOracleConsultInstruction = parseOracleConsultInstruction;
4409
4718
  exports.parseOracleUpdateInstruction = parseOracleUpdateInstruction;
4410
4719
  exports.parsePauseInstruction = parsePauseInstruction;
@@ -4433,5 +4742,5 @@ exports.sortPositionsByShares = sortPositionsByShares;
4433
4742
  exports.swapExactInArgsCodec = swapExactInArgsCodec;
4434
4743
  exports.transferAdminArgsCodec = transferAdminArgsCodec;
4435
4744
  exports.warnAccountDecodeFailure = warnAccountDecodeFailure;
4436
- //# sourceMappingURL=chunk-7PXLEMBJ.cjs.map
4437
- //# sourceMappingURL=chunk-7PXLEMBJ.cjs.map
4745
+ //# sourceMappingURL=chunk-AANZBN5X.cjs.map
4746
+ //# sourceMappingURL=chunk-AANZBN5X.cjs.map