@whetstone-research/doppler-sdk 1.0.16 → 1.0.18

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.
Files changed (35) hide show
  1. package/dist/{chunk-TVBSIQIX.js → chunk-6TOPYGOG.js} +4 -3
  2. package/dist/chunk-6TOPYGOG.js.map +1 -0
  3. package/dist/{chunk-3BW6IVP3.cjs → chunk-AKLS6T3R.cjs} +4 -3
  4. package/dist/chunk-AKLS6T3R.cjs.map +1 -0
  5. package/dist/{chunk-NMTYI3TB.js → chunk-C2D7CIXP.js} +6 -4
  6. package/dist/{chunk-NMTYI3TB.js.map → chunk-C2D7CIXP.js.map} +1 -1
  7. package/dist/{chunk-W5TMS4RD.cjs → chunk-GUGN3EYX.cjs} +39 -37
  8. package/dist/{chunk-W5TMS4RD.cjs.map → chunk-GUGN3EYX.cjs.map} +1 -1
  9. package/dist/evm/index.cjs +10 -0
  10. package/dist/evm/index.cjs.map +1 -1
  11. package/dist/evm/index.d.cts +14 -1
  12. package/dist/evm/index.d.ts +14 -1
  13. package/dist/evm/index.js +10 -1
  14. package/dist/evm/index.js.map +1 -1
  15. package/dist/{oracle-DN8BrGPh.d.ts → oracle-7PmpwwPx.d.cts} +2 -0
  16. package/dist/{oracle-DN8BrGPh.d.cts → oracle-7PmpwwPx.d.ts} +2 -0
  17. package/dist/{pda-5D3GD5S6.js → pda-N6ULJYLG.js} +3 -3
  18. package/dist/pda-N6ULJYLG.js.map +1 -0
  19. package/dist/{pda-GNZYNRUH.cjs → pda-PZRHQJMK.cjs} +16 -16
  20. package/dist/pda-PZRHQJMK.cjs.map +1 -0
  21. package/dist/solana/index.cjs +866 -185
  22. package/dist/solana/index.cjs.map +1 -1
  23. package/dist/solana/index.d.cts +383 -24
  24. package/dist/solana/index.d.ts +383 -24
  25. package/dist/solana/index.js +707 -26
  26. package/dist/solana/index.js.map +1 -1
  27. package/dist/solana/react/index.cjs +47 -47
  28. package/dist/solana/react/index.d.cts +1 -1
  29. package/dist/solana/react/index.d.ts +1 -1
  30. package/dist/solana/react/index.js +3 -3
  31. package/package.json +1 -1
  32. package/dist/chunk-3BW6IVP3.cjs.map +0 -1
  33. package/dist/chunk-TVBSIQIX.js.map +0 -1
  34. package/dist/pda-5D3GD5S6.js.map +0 -1
  35. package/dist/pda-GNZYNRUH.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk3BW6IVP3_cjs = require('./chunk-3BW6IVP3.cjs');
3
+ var chunkAKLS6T3R_cjs = require('./chunk-AKLS6T3R.cjs');
4
4
  var kit = require('@solana/kit');
5
5
 
6
6
  var addressCodec = kit.getAddressCodec();
@@ -50,7 +50,7 @@ var ammConfigDataCodec = kit.getStructCodec([
50
50
  ["paused", boolCodec],
51
51
  ["numeraireMint", addressCodec],
52
52
  ["hookAllowlistLen", u8Codec],
53
- ["hookAllowlist", kit.getArrayCodec(addressCodec, { size: chunk3BW6IVP3_cjs.MAX_HOOK_ALLOWLIST })],
53
+ ["hookAllowlist", kit.getArrayCodec(addressCodec, { size: chunkAKLS6T3R_cjs.MAX_HOOK_ALLOWLIST })],
54
54
  ["maxSwapFeeBps", u16Codec],
55
55
  ["maxFeeSplitBps", u16Codec],
56
56
  ["maxRouteHops", u8Codec],
@@ -117,22 +117,22 @@ var oracleStateDataCodec = kit.getStructCodec([
117
117
  ["observationIndex", u16Codec],
118
118
  [
119
119
  "observations",
120
- kit.getArrayCodec(observationCodec, { size: chunk3BW6IVP3_cjs.MAX_ORACLE_OBSERVATIONS })
120
+ kit.getArrayCodec(observationCodec, { size: chunkAKLS6T3R_cjs.MAX_ORACLE_OBSERVATIONS })
121
121
  ],
122
122
  ["version", u8Codec],
123
123
  ["reserved", reservedBytesCodec]
124
124
  ]);
125
125
  var ammConfigDecoder = kit.getHiddenPrefixDecoder(ammConfigDataCodec, [
126
- kit.getConstantDecoder(chunk3BW6IVP3_cjs.ACCOUNT_DISCRIMINATORS.AmmConfig)
126
+ kit.getConstantDecoder(chunkAKLS6T3R_cjs.ACCOUNT_DISCRIMINATORS.AmmConfig)
127
127
  ]);
128
128
  var poolDecoder = kit.getHiddenPrefixDecoder(poolDataCodec, [
129
- kit.getConstantDecoder(chunk3BW6IVP3_cjs.ACCOUNT_DISCRIMINATORS.Pool)
129
+ kit.getConstantDecoder(chunkAKLS6T3R_cjs.ACCOUNT_DISCRIMINATORS.Pool)
130
130
  ]);
131
131
  var positionDecoder = kit.getHiddenPrefixDecoder(positionDataCodec, [
132
- kit.getConstantDecoder(chunk3BW6IVP3_cjs.ACCOUNT_DISCRIMINATORS.Position)
132
+ kit.getConstantDecoder(chunkAKLS6T3R_cjs.ACCOUNT_DISCRIMINATORS.Position)
133
133
  ]);
134
134
  var oracleStateDecoder = kit.getHiddenPrefixDecoder(oracleStateDataCodec, [
135
- kit.getConstantDecoder(chunk3BW6IVP3_cjs.ACCOUNT_DISCRIMINATORS.OracleState)
135
+ kit.getConstantDecoder(chunkAKLS6T3R_cjs.ACCOUNT_DISCRIMINATORS.OracleState)
136
136
  ]);
137
137
  function decodeAmmConfig(data) {
138
138
  return ammConfigDecoder.decode(data);
@@ -214,7 +214,9 @@ var initializePoolArgsCodec = kit.getStructCodec([
214
214
  ["initialSwapFeeBps", u16Codec],
215
215
  ["initialFeeSplitBps", u16Codec],
216
216
  ["liquidityMeasureTokenIndex", u8Codec],
217
- ["numeraireMintOverride", optionAddressCodec]
217
+ ["numeraireMintOverride", optionAddressCodec],
218
+ ["hookProgram", addressCodec],
219
+ ["hookFlags", u32Codec]
218
220
  ]);
219
221
  var initializeOracleArgsCodec = kit.getStructCodec([
220
222
  ["maxPriceChangeRatioQ64", u128Codec],
@@ -296,12 +298,12 @@ function encodeQuoteToNumeraireArgs(args) {
296
298
  function q64ToNumber(q64) {
297
299
  const intPart = q64 >> 64n;
298
300
  const fracPart = q64 & (1n << 64n) - 1n;
299
- return Number(intPart) + Number(fracPart) / Number(chunk3BW6IVP3_cjs.Q64_ONE);
301
+ return Number(intPart) + Number(fracPart) / Number(chunkAKLS6T3R_cjs.Q64_ONE);
300
302
  }
301
303
  function numberToQ64(n) {
302
304
  const intPart = Math.floor(n);
303
305
  const fracPart = n - intPart;
304
- return (BigInt(intPart) << 64n) + BigInt(Math.round(fracPart * Number(chunk3BW6IVP3_cjs.Q64_ONE)));
306
+ return (BigInt(intPart) << 64n) + BigInt(Math.round(fracPart * Number(chunkAKLS6T3R_cjs.Q64_ONE)));
305
307
  }
306
308
  function q64Mul(a, b) {
307
309
  return a * b >> 64n;
@@ -357,8 +359,8 @@ function getSwapQuote(pool, amountIn, tradeDirection) {
357
359
  if (reserveIn === 0n || reserveOut === 0n) {
358
360
  throw new Error("Pool has zero liquidity");
359
361
  }
360
- const feeTotal = amountIn * BigInt(pool.swapFeeBps) / chunk3BW6IVP3_cjs.BPS_DENOM;
361
- const feeDist = feeTotal * BigInt(pool.feeSplitBps) / chunk3BW6IVP3_cjs.BPS_DENOM;
362
+ const feeTotal = amountIn * BigInt(pool.swapFeeBps) / chunkAKLS6T3R_cjs.BPS_DENOM;
363
+ const feeDist = feeTotal * BigInt(pool.feeSplitBps) / chunkAKLS6T3R_cjs.BPS_DENOM;
362
364
  const feeComp = feeTotal - feeDist;
363
365
  const amountInEff = amountIn - feeTotal;
364
366
  const amountOut = amountInEff * reserveOut / (reserveIn + amountInEff);
@@ -384,8 +386,8 @@ function getSwapQuoteExactOut(pool, amountOut, tradeDirection) {
384
386
  }
385
387
  const amountInEff = ceilDiv(amountOut * reserveIn, reserveOut - amountOut);
386
388
  const amountIn = ceilDiv(
387
- amountInEff * chunk3BW6IVP3_cjs.BPS_DENOM,
388
- chunk3BW6IVP3_cjs.BPS_DENOM - BigInt(pool.swapFeeBps)
389
+ amountInEff * chunkAKLS6T3R_cjs.BPS_DENOM,
390
+ chunkAKLS6T3R_cjs.BPS_DENOM - BigInt(pool.swapFeeBps)
389
391
  );
390
392
  const feeTotal = amountIn - amountInEff;
391
393
  return { amountIn, feeTotal };
@@ -513,11 +515,11 @@ async function fetchPool(rpc, address, config) {
513
515
  return decodePool(base64ToBytes(response.value.data[0]));
514
516
  }
515
517
  async function fetchAllPools(rpc, config) {
516
- const programId = config?.programId ?? chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID;
518
+ const programId = config?.programId ?? chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID;
517
519
  const discriminatorFilter = {
518
520
  memcmp: {
519
521
  offset: 0n,
520
- bytes: bytesToBase64(chunk3BW6IVP3_cjs.ACCOUNT_DISCRIMINATORS.Pool),
522
+ bytes: bytesToBase64(chunkAKLS6T3R_cjs.ACCOUNT_DISCRIMINATORS.Pool),
521
523
  encoding: "base64"
522
524
  }
523
525
  };
@@ -542,8 +544,8 @@ async function fetchAllPools(rpc, config) {
542
544
  return pools;
543
545
  }
544
546
  async function getPoolByMints(rpc, mint0, mint1, config) {
545
- const programId = config?.programId ?? chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID;
546
- const [poolAddress] = await chunk3BW6IVP3_cjs.getPoolAddress(mint0, mint1, programId);
547
+ const programId = config?.programId ?? chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID;
548
+ const [poolAddress] = await chunkAKLS6T3R_cjs.getPoolAddress(mint0, mint1, programId);
547
549
  const pool = await fetchPool(rpc, poolAddress, config);
548
550
  if (!pool) {
549
551
  return null;
@@ -570,9 +572,9 @@ async function poolExists(rpc, mint0, mint1, config) {
570
572
  const result = await getPoolByMints(rpc, mint0, mint1, config);
571
573
  return result !== null;
572
574
  }
573
- async function getPoolAddressFromMints(mint0, mint1, programId = chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID) {
574
- const [token0, token1] = chunk3BW6IVP3_cjs.sortMints(mint0, mint1);
575
- const [poolAddress] = await chunk3BW6IVP3_cjs.getPoolAddress(mint0, mint1, programId);
575
+ async function getPoolAddressFromMints(mint0, mint1, programId = chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID) {
576
+ const [token0, token1] = chunkAKLS6T3R_cjs.sortMints(mint0, mint1);
577
+ const [poolAddress] = await chunkAKLS6T3R_cjs.getPoolAddress(mint0, mint1, programId);
576
578
  return {
577
579
  poolAddress,
578
580
  token0,
@@ -620,14 +622,14 @@ async function fetchPosition(rpc, address, config) {
620
622
  return decodePosition(base64ToBytes2(response.value.data[0]));
621
623
  }
622
624
  async function fetchUserPositions(rpc, owner, pool, config) {
623
- const programId = config?.programId ?? chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID;
625
+ const programId = config?.programId ?? chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID;
624
626
  const filters = [
625
627
  // Discriminator filter (first 8 bytes)
626
628
  {
627
629
  memcmp: {
628
630
  offset: 0n,
629
631
  bytes: bytesToBase642(
630
- chunk3BW6IVP3_cjs.ACCOUNT_DISCRIMINATORS.Position
632
+ chunkAKLS6T3R_cjs.ACCOUNT_DISCRIMINATORS.Position
631
633
  ),
632
634
  encoding: "base64"
633
635
  }
@@ -671,14 +673,14 @@ async function fetchUserPositions(rpc, owner, pool, config) {
671
673
  return positions;
672
674
  }
673
675
  async function fetchPoolPositions(rpc, pool, config) {
674
- const programId = config?.programId ?? chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID;
676
+ const programId = config?.programId ?? chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID;
675
677
  const filters = [
676
678
  // Discriminator filter
677
679
  {
678
680
  memcmp: {
679
681
  offset: 0n,
680
682
  bytes: bytesToBase642(
681
- chunk3BW6IVP3_cjs.ACCOUNT_DISCRIMINATORS.Position
683
+ chunkAKLS6T3R_cjs.ACCOUNT_DISCRIMINATORS.Position
682
684
  ),
683
685
  encoding: "base64"
684
686
  }
@@ -739,8 +741,8 @@ function getPositionValue(pool, position) {
739
741
  };
740
742
  }
741
743
  async function fetchPositionByParams(rpc, pool, owner, positionId, config) {
742
- const programId = config?.programId ?? chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID;
743
- const [address] = await chunk3BW6IVP3_cjs.getPositionAddress(
744
+ const programId = config?.programId ?? chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID;
745
+ const [address] = await chunkAKLS6T3R_cjs.getPositionAddress(
744
746
  pool,
745
747
  owner,
746
748
  positionId,
@@ -755,8 +757,8 @@ async function fetchPositionByParams(rpc, pool, owner, positionId, config) {
755
757
  account: position
756
758
  };
757
759
  }
758
- async function getPositionAddressFromParams(pool, owner, positionId, programId = chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID) {
759
- const [address] = await chunk3BW6IVP3_cjs.getPositionAddress(
760
+ async function getPositionAddressFromParams(pool, owner, positionId, programId = chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID) {
761
+ const [address] = await chunkAKLS6T3R_cjs.getPositionAddress(
760
762
  pool,
761
763
  owner,
762
764
  positionId,
@@ -807,8 +809,8 @@ async function fetchOracle(rpc, address, config) {
807
809
  return decodeOracleState(base64ToBytes3(response.value.data[0]));
808
810
  }
809
811
  async function getOracleForPool(rpc, pool, config) {
810
- const programId = config?.programId ?? chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID;
811
- const [oracleAddress] = await chunk3BW6IVP3_cjs.getOracleAddress(pool, programId);
812
+ const programId = config?.programId ?? chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID;
813
+ const [oracleAddress] = await chunkAKLS6T3R_cjs.getOracleAddress(pool, programId);
812
814
  const oracle = await fetchOracle(rpc, oracleAddress, config);
813
815
  if (!oracle) {
814
816
  return null;
@@ -818,8 +820,8 @@ async function getOracleForPool(rpc, pool, config) {
818
820
  account: oracle
819
821
  };
820
822
  }
821
- async function getOracleAddressFromPool(pool, programId = chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID) {
822
- const [address] = await chunk3BW6IVP3_cjs.getOracleAddress(pool, programId);
823
+ async function getOracleAddressFromPool(pool, programId = chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID) {
824
+ const [address] = await chunkAKLS6T3R_cjs.getOracleAddress(pool, programId);
823
825
  return address;
824
826
  }
825
827
  function consultTwap(oracle, windowSeconds, currentTimestamp) {
@@ -942,10 +944,10 @@ function getOracleBufferStats(oracle) {
942
944
  };
943
945
  }
944
946
  async function fetchOraclesBatch(rpc, pools, config) {
945
- const programId = config?.programId ?? chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID;
947
+ const programId = config?.programId ?? chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID;
946
948
  const oracles = /* @__PURE__ */ new Map();
947
949
  const oracleAddresses = await Promise.all(
948
- pools.map((pool) => chunk3BW6IVP3_cjs.getOracleAddress(pool, programId))
950
+ pools.map((pool) => chunkAKLS6T3R_cjs.getOracleAddress(pool, programId))
949
951
  );
950
952
  const results = await Promise.all(
951
953
  oracleAddresses.map(([addr]) => fetchOracle(rpc, addr, config))
@@ -1063,5 +1065,5 @@ exports.sortPoolsByReserves = sortPoolsByReserves;
1063
1065
  exports.sortPositionsByShares = sortPositionsByShares;
1064
1066
  exports.swapExactInArgsCodec = swapExactInArgsCodec;
1065
1067
  exports.transferAdminArgsCodec = transferAdminArgsCodec;
1066
- //# sourceMappingURL=chunk-W5TMS4RD.cjs.map
1067
- //# sourceMappingURL=chunk-W5TMS4RD.cjs.map
1068
+ //# sourceMappingURL=chunk-GUGN3EYX.cjs.map
1069
+ //# sourceMappingURL=chunk-GUGN3EYX.cjs.map