@raydium-io/raydium-sdk-v2 0.0.24-alpha → 0.0.26-alpha

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 (97) hide show
  1. package/lib/api/api.d.ts +1 -1
  2. package/lib/api/index.d.ts +1 -1
  3. package/lib/api/type.d.ts +1 -1
  4. package/lib/common/accountInfo.d.ts +1 -1
  5. package/lib/common/bignumber.d.ts +1 -1
  6. package/lib/common/fractionUtil.d.ts +1 -1
  7. package/lib/common/index.d.ts +1 -1
  8. package/lib/common/transfer.d.ts +1 -1
  9. package/lib/common/txTool/txTool.d.ts +1 -1
  10. package/lib/common/txTool/txUtils.d.ts +1 -1
  11. package/lib/common/utility.d.ts +1 -1
  12. package/lib/index.d.ts +4 -4
  13. package/lib/index.js +1 -1
  14. package/lib/index.js.map +1 -1
  15. package/lib/index.mjs +1 -1
  16. package/lib/index.mjs.map +1 -1
  17. package/lib/module/amount.d.ts +1 -1
  18. package/lib/module/fraction.d.ts +1 -1
  19. package/lib/module/index.d.ts +1 -1
  20. package/lib/module/percent.d.ts +1 -1
  21. package/lib/module/price.d.ts +1 -1
  22. package/lib/raydium/account/account.d.ts +3 -3
  23. package/lib/raydium/account/index.d.ts +1 -1
  24. package/lib/raydium/account/instruction.d.ts +1 -1
  25. package/lib/raydium/account/types.d.ts +1 -1
  26. package/lib/raydium/account/util.d.ts +1 -1
  27. package/lib/raydium/clmm/clmm.d.ts +3 -3
  28. package/lib/raydium/clmm/index.d.ts +3 -3
  29. package/lib/raydium/clmm/instrument.d.ts +2 -2
  30. package/lib/raydium/clmm/layout.d.ts +6 -6
  31. package/lib/raydium/clmm/type.d.ts +2 -2
  32. package/lib/raydium/clmm/utils/math.d.ts +2 -2
  33. package/lib/raydium/clmm/utils/pool.d.ts +2 -2
  34. package/lib/raydium/clmm/utils/position.d.ts +2 -2
  35. package/lib/raydium/clmm/utils/tick.d.ts +2 -2
  36. package/lib/raydium/clmm/utils/tickQuery.d.ts +2 -2
  37. package/lib/raydium/clmm/utils/tickarrayBitmap.d.ts +2 -2
  38. package/lib/raydium/cpmm/cpmm.d.ts +4 -4
  39. package/lib/raydium/cpmm/cpmm.js +1 -1
  40. package/lib/raydium/cpmm/cpmm.js.map +1 -1
  41. package/lib/raydium/cpmm/cpmm.mjs +1 -1
  42. package/lib/raydium/cpmm/cpmm.mjs.map +1 -1
  43. package/lib/raydium/cpmm/index.d.ts +2 -2
  44. package/lib/raydium/cpmm/index.js +1 -1
  45. package/lib/raydium/cpmm/index.mjs +1 -1
  46. package/lib/raydium/cpmm/layout.d.ts +1 -1
  47. package/lib/raydium/cpmm/type.d.ts +12 -6
  48. package/lib/raydium/cpmm/type.js +1 -1
  49. package/lib/raydium/cpmm/type.js.map +1 -1
  50. package/lib/raydium/farm/config.d.ts +1 -1
  51. package/lib/raydium/farm/farm.d.ts +3 -3
  52. package/lib/raydium/farm/index.d.ts +1 -1
  53. package/lib/raydium/farm/instruction.d.ts +1 -1
  54. package/lib/raydium/farm/layout.d.ts +1 -1
  55. package/lib/raydium/farm/type.d.ts +1 -1
  56. package/lib/raydium/farm/util.d.ts +1 -1
  57. package/lib/raydium/ido/ido.d.ts +3 -3
  58. package/lib/raydium/ido/index.d.ts +3 -3
  59. package/lib/raydium/ido/instruction.d.ts +1 -1
  60. package/lib/raydium/ido/type.d.ts +1 -1
  61. package/lib/raydium/index.d.ts +4 -4
  62. package/lib/raydium/index.js +1 -1
  63. package/lib/raydium/index.js.map +1 -1
  64. package/lib/raydium/index.mjs +1 -1
  65. package/lib/raydium/index.mjs.map +1 -1
  66. package/lib/raydium/liquidity/index.d.ts +1 -1
  67. package/lib/raydium/liquidity/instruction.d.ts +1 -1
  68. package/lib/raydium/liquidity/layout.d.ts +2 -2
  69. package/lib/raydium/liquidity/liquidity.d.ts +3 -3
  70. package/lib/raydium/liquidity/type.d.ts +1 -1
  71. package/lib/raydium/liquidity/utils.d.ts +1 -1
  72. package/lib/raydium/marketV2/createMarket.d.ts +3 -3
  73. package/lib/raydium/marketV2/index.d.ts +3 -3
  74. package/lib/raydium/moduleBase.d.ts +3 -3
  75. package/lib/raydium/raydium.d.ts +3 -3
  76. package/lib/raydium/raydium.js +1 -1
  77. package/lib/raydium/raydium.js.map +1 -1
  78. package/lib/raydium/raydium.mjs +1 -1
  79. package/lib/raydium/raydium.mjs.map +1 -1
  80. package/lib/raydium/token/constant.d.ts +1 -1
  81. package/lib/raydium/token/index.d.ts +1 -1
  82. package/lib/raydium/token/token.d.ts +3 -3
  83. package/lib/raydium/token/type.d.ts +1 -1
  84. package/lib/raydium/token/utils.d.ts +1 -1
  85. package/lib/raydium/tradeV2/index.d.ts +2 -2
  86. package/lib/raydium/tradeV2/instrument.d.ts +2 -2
  87. package/lib/raydium/tradeV2/trade.d.ts +3 -3
  88. package/lib/raydium/tradeV2/type.d.ts +2 -2
  89. package/lib/raydium/type.d.ts +1 -1
  90. package/lib/raydium/utils1216/index.d.ts +3 -3
  91. package/lib/raydium/utils1216/utils1216.d.ts +3 -3
  92. package/lib/{raydium-54450191.d.ts → raydium-d75706f4.d.ts} +7 -11
  93. package/lib/{type-5c2ec3f0.d.ts → type-6fd96950.d.ts} +1 -1
  94. package/lib/{type-322fdce2.d.ts → type-83523f5f.d.ts} +8 -8
  95. package/package.json +1 -1
  96. package/src/raydium/cpmm/cpmm.ts +17 -9
  97. package/src/raydium/cpmm/type.ts +12 -4
@@ -1,4 +1,4 @@
1
- import { bz as TokenInfo } from '../../type-322fdce2.js';
1
+ import { bz as TokenInfo } from '../../type-83523f5f.js';
2
2
  import '@solana/web3.js';
3
3
  import 'bn.js';
4
4
  import '@solana/spl-token';
@@ -1,6 +1,6 @@
1
1
  export { SOL_INFO, TOKEN_WSOL } from './constant.js';
2
2
  export { SPL_MINT_LAYOUT, SplMintLayout } from './layout.js';
3
- export { bC as LpToken, bB as SplToken, bz as TokenInfo, bA as TokenJson } from '../../type-322fdce2.js';
3
+ export { bC as LpToken, bB as SplToken, bz as TokenInfo, bA as TokenJson } from '../../type-83523f5f.js';
4
4
  export { parseTokenInfo, solToWSolToken, toToken, toTokenAmount, toTokenInfo, wSolToSolToken } from './utils.js';
5
5
  import '@solana/web3.js';
6
6
  import 'bn.js';
@@ -1,6 +1,6 @@
1
1
  import '@solana/web3.js';
2
- import '../../type-322fdce2.js';
3
- export { j as default } from '../../raydium-54450191.js';
2
+ import '../../type-83523f5f.js';
3
+ export { j as default } from '../../raydium-d75706f4.js';
4
4
  import 'bn.js';
5
5
  import '@solana/spl-token';
6
6
  import '../../common/txTool/txType.js';
@@ -20,7 +20,7 @@ import '../../api/url.js';
20
20
  import '../account/types.js';
21
21
  import '../account/layout.js';
22
22
  import '../liquidity/type.js';
23
- import '../../type-5c2ec3f0.js';
23
+ import '../../type-6fd96950.js';
24
24
  import '../clmm/layout.js';
25
25
  import '../cpmm/type.js';
26
26
  import '../cpmm/curve/calculator.js';
@@ -1,4 +1,4 @@
1
- export { bC as LpToken, bB as SplToken, bz as TokenInfo, bA as TokenJson } from '../../type-322fdce2.js';
1
+ export { bC as LpToken, bB as SplToken, bz as TokenInfo, bA as TokenJson } from '../../type-83523f5f.js';
2
2
  import '../../module/token.js';
3
3
  import '@solana/web3.js';
4
4
  import 'bn.js';
@@ -1,6 +1,6 @@
1
1
  import { Connection, PublicKey } from '@solana/web3.js';
2
2
  import { RawMint } from '@solana/spl-token';
3
- import { bz as TokenInfo, a9 as BigNumberish, c1 as TokenAmount, e as ApiV3Token } from '../../type-322fdce2.js';
3
+ import { bz as TokenInfo, a9 as BigNumberish, c1 as TokenAmount, e as ApiV3Token } from '../../type-83523f5f.js';
4
4
  import { Token } from '../../module/token.js';
5
5
  import 'bn.js';
6
6
  import '../../common/txTool/txType.js';
@@ -2,7 +2,7 @@ export { makeSwapInstruction, route1Instruction, route2Instruction, routeInstruc
2
2
  export { ComputeAmountOutAmmLayout, ComputeAmountOutLayout, ComputeAmountOutRouteLayout, MakeSwapInstructionParam, PoolAccountInfoV4, ReturnTypeFetchMultipleInfo, ReturnTypeGetAddLiquidityDefaultPool, ReturnTypeGetAllRoute, ReturnTypeMakeSwapInstruction, ReturnTypeMakeSwapTransaction, RoutePathType } from './type.js';
3
3
  import '@solana/web3.js';
4
4
  import 'bn.js';
5
- import '../../type-322fdce2.js';
5
+ import '../../type-83523f5f.js';
6
6
  import '@solana/spl-token';
7
7
  import '../../common/txTool/txType.js';
8
8
  import '../../common/owner.js';
@@ -14,5 +14,5 @@ import '../../marshmallow/index.js';
14
14
  import '../../marshmallow/buffer-layout.js';
15
15
  import '../../common/logger.js';
16
16
  import '../../module/currency.js';
17
- import '../../type-5c2ec3f0.js';
17
+ import '../../type-6fd96950.js';
18
18
  import '../clmm/layout.js';
@@ -1,6 +1,6 @@
1
1
  import { PublicKey, TransactionInstruction } from '@solana/web3.js';
2
2
  import BN__default from 'bn.js';
3
- import { n as ApiV3PoolInfoItem, w as PoolKeys } from '../../type-322fdce2.js';
3
+ import { n as ApiV3PoolInfoItem, w as PoolKeys } from '../../type-83523f5f.js';
4
4
  import { ReturnTypeMakeSwapInstruction, ComputeAmountOutLayout } from './type.js';
5
5
  import '@solana/spl-token';
6
6
  import '../../common/txTool/txType.js';
@@ -13,7 +13,7 @@ import '../../marshmallow/index.js';
13
13
  import '../../marshmallow/buffer-layout.js';
14
14
  import '../../common/logger.js';
15
15
  import '../../module/currency.js';
16
- import '../../type-5c2ec3f0.js';
16
+ import '../../type-6fd96950.js';
17
17
  import '../clmm/layout.js';
18
18
 
19
19
  declare function route1Instruction(programId: PublicKey, poolInfoA: ApiV3PoolInfoItem, poolKeyA: PoolKeys, poolKeyB: PoolKeys, userSourceToken: PublicKey, userRouteToken: PublicKey, userPdaAccount: PublicKey, ownerWallet: PublicKey, inputMint: PublicKey, amountIn: BN__default, amountOut: BN__default, tickArrayA?: PublicKey[]): TransactionInstruction;
@@ -1,7 +1,7 @@
1
1
  import '@solana/web3.js';
2
- export { i as default } from '../../raydium-54450191.js';
2
+ export { i as default } from '../../raydium-d75706f4.js';
3
3
  import './type.js';
4
- import '../../type-322fdce2.js';
4
+ import '../../type-83523f5f.js';
5
5
  import '../../api/api.js';
6
6
  import 'axios';
7
7
  import '../../solana/type.js';
@@ -21,7 +21,7 @@ import '../../module/currency.js';
21
21
  import '../account/types.js';
22
22
  import '../account/layout.js';
23
23
  import '../liquidity/type.js';
24
- import '../../type-5c2ec3f0.js';
24
+ import '../../type-6fd96950.js';
25
25
  import '../clmm/layout.js';
26
26
  import '../cpmm/type.js';
27
27
  import '../cpmm/curve/calculator.js';
@@ -1,8 +1,8 @@
1
1
  import { PublicKey, Keypair, Signer, TransactionInstruction, Transaction } from '@solana/web3.js';
2
2
  import BN__default from 'bn.js';
3
- import { bK as TransferAmountFee, c6 as Price, c5 as Percent, c1 as TokenAmount, n as ApiV3PoolInfoItem, w as PoolKeys } from '../../type-322fdce2.js';
3
+ import { bK as TransferAmountFee, c6 as Price, c5 as Percent, c1 as TokenAmount, n as ApiV3PoolInfoItem, w as PoolKeys } from '../../type-83523f5f.js';
4
4
  import { Token } from '../../module/token.js';
5
- import { c as ClmmPoolInfo } from '../../type-5c2ec3f0.js';
5
+ import { c as ClmmPoolInfo } from '../../type-6fd96950.js';
6
6
  import '@solana/spl-token';
7
7
  import '../../common/txTool/txType.js';
8
8
  import '../../common/owner.js';
@@ -1,6 +1,6 @@
1
1
  import '@solana/web3.js';
2
2
  import '@solana/spl-token';
3
- export { bS as ArrayItem, bI as ComputeBudgetConfig, bZ as Cover, bT as ExactPartial, bU as ExactRequired, bY as Fallback, bL as GetTransferAmountFee, bW as GetValue, bH as InstructionReturn, bJ as LoadParams, bG as MakeMultiTransaction, bE as MakeTransaction, bF as MakeV0Transaction, bP as MayArray, bQ as MayDeepArray, bR as MayFunction, bO as ReplaceType, bM as ReturnTypeFetchMultipleMintInfo, bN as ReturnTypeFetchMultipleMintInfos, bV as SKeyof, bX as SOR, bD as SignAllTransactions, bK as TransferAmountFee, b_ as UnionCover, b$ as unionArr } from '../type-322fdce2.js';
3
+ export { bS as ArrayItem, bI as ComputeBudgetConfig, bZ as Cover, bT as ExactPartial, bU as ExactRequired, bY as Fallback, bL as GetTransferAmountFee, bW as GetValue, bH as InstructionReturn, bJ as LoadParams, bG as MakeMultiTransaction, bE as MakeTransaction, bF as MakeV0Transaction, bP as MayArray, bQ as MayDeepArray, bR as MayFunction, bO as ReplaceType, bM as ReturnTypeFetchMultipleMintInfo, bN as ReturnTypeFetchMultipleMintInfos, bV as SKeyof, bX as SOR, bD as SignAllTransactions, bK as TransferAmountFee, b_ as UnionCover, b$ as unionArr } from '../type-83523f5f.js';
4
4
  import 'bn.js';
5
5
  import '../common/txTool/txType.js';
6
6
  import '../common/owner.js';
@@ -1,9 +1,9 @@
1
- export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-54450191.js';
1
+ export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-d75706f4.js';
2
2
  import '@solana/web3.js';
3
3
  import '../../api/api.js';
4
4
  import 'axios';
5
5
  import '../../solana/type.js';
6
- import '../../type-322fdce2.js';
6
+ import '../../type-83523f5f.js';
7
7
  import 'bn.js';
8
8
  import '@solana/spl-token';
9
9
  import '../../common/txTool/txType.js';
@@ -20,7 +20,7 @@ import '../../api/url.js';
20
20
  import '../account/types.js';
21
21
  import '../account/layout.js';
22
22
  import '../liquidity/type.js';
23
- import '../../type-5c2ec3f0.js';
23
+ import '../../type-6fd96950.js';
24
24
  import '../clmm/layout.js';
25
25
  import '../cpmm/type.js';
26
26
  import '../cpmm/curve/calculator.js';
@@ -1,12 +1,12 @@
1
1
  import '../../marshmallow/index.js';
2
2
  import '@solana/web3.js';
3
3
  import 'bn.js';
4
- export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-54450191.js';
4
+ export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-d75706f4.js';
5
5
  import '../../marshmallow/buffer-layout.js';
6
6
  import '../../api/api.js';
7
7
  import 'axios';
8
8
  import '../../solana/type.js';
9
- import '../../type-322fdce2.js';
9
+ import '../../type-83523f5f.js';
10
10
  import '@solana/spl-token';
11
11
  import '../../common/txTool/txType.js';
12
12
  import '../../common/owner.js';
@@ -20,7 +20,7 @@ import '../../api/url.js';
20
20
  import '../account/types.js';
21
21
  import '../account/layout.js';
22
22
  import '../liquidity/type.js';
23
- import '../../type-5c2ec3f0.js';
23
+ import '../../type-6fd96950.js';
24
24
  import '../clmm/layout.js';
25
25
  import '../cpmm/type.js';
26
26
  import '../cpmm/curve/calculator.js';
@@ -1,6 +1,6 @@
1
1
  import { PublicKey, Commitment, Connection, Transaction, Signer, TransactionInstruction, Keypair, EpochInfo } from '@solana/web3.js';
2
2
  import { Api } from './api/api.js';
3
- import { ax as TxBuilder, ap as AddInstructionParam, a9 as BigNumberish, bk as CreateFarm, aw as MakeTxData, bl as CreateFarmExtInfo, bm as UpdateFarmReward, bn as UpdateFarmRewards, bo as FarmDWParam, U as FormatFarmInfoOut, bI as ComputeBudgetConfig, av as MakeMultiTxData, l as ApiV3PoolInfoStandardItem, c5 as Percent, c1 as TokenAmount, s as AmmV4Keys, t as AmmV5Keys, k as ApiV3PoolInfoConcentratedItem, S as FormatFarmInfoOutV6, v as ClmmKeys, bE as MakeTransaction, C as CpmmKeys, X as OwnerIdoInfo, Y as IdoKeysData, bJ as LoadParams, J as JupTokenType, bz as TokenInfo, e as ApiV3Token, bD as SignAllTransactions, V as AvailabilityCheckAPI3, f as ApiV3TokenRes } from './type-322fdce2.js';
3
+ import { ax as TxBuilder, ap as AddInstructionParam, a9 as BigNumberish, bk as CreateFarm, aw as MakeTxData, bl as CreateFarmExtInfo, bm as UpdateFarmReward, bn as UpdateFarmRewards, bo as FarmDWParam, U as FormatFarmInfoOut, bI as ComputeBudgetConfig, av as MakeMultiTxData, l as ApiV3PoolInfoStandardItem, c5 as Percent, c1 as TokenAmount, s as AmmV4Keys, t as AmmV5Keys, k as ApiV3PoolInfoConcentratedItem, S as FormatFarmInfoOutV6, v as ClmmKeys, bE as MakeTransaction, C as CpmmKeys, X as OwnerIdoInfo, Y as IdoKeysData, bJ as LoadParams, J as JupTokenType, bz as TokenInfo, e as ApiV3Token, bD as SignAllTransactions, V as AvailabilityCheckAPI3, f as ApiV3TokenRes } from './type-83523f5f.js';
4
4
  import { API_URL_CONFIG } from './api/url.js';
5
5
  import { Owner } from './common/owner.js';
6
6
  import { Cluster } from './solana/type.js';
@@ -10,9 +10,9 @@ import { TxVersion } from './common/txTool/txType.js';
10
10
  import BN__default from 'bn.js';
11
11
  import Decimal from 'decimal.js';
12
12
  import { AddLiquidityParams, RemoveParams, CreatePoolParam, CreatePoolAddress, ComputeAmountOutParam, SwapParam } from './raydium/liquidity/type.js';
13
- import { m as CreateConcentratedPool, O as OpenPositionFromBase, p as OpenPositionFromBaseExtInfo, q as OpenPositionFromLiquidity, r as OpenPositionFromLiquidityExtInfo, I as IncreasePositionFromLiquidity, M as ManipulateLiquidityExtInfo, n as IncreasePositionFromBase, D as DecreaseLiquidity, B as ClosePositionExtInfo, s as InitRewardParams, E as InitRewardExtInfo, t as InitRewardsParams, u as SetRewardParams, v as SetRewardsParams, w as CollectRewardParams, x as CollectRewardsParams, H as HarvestAllRewardsParams } from './type-5c2ec3f0.js';
13
+ import { m as CreateConcentratedPool, O as OpenPositionFromBase, p as OpenPositionFromBaseExtInfo, q as OpenPositionFromLiquidity, r as OpenPositionFromLiquidityExtInfo, I as IncreasePositionFromLiquidity, M as ManipulateLiquidityExtInfo, n as IncreasePositionFromBase, D as DecreaseLiquidity, B as ClosePositionExtInfo, s as InitRewardParams, E as InitRewardExtInfo, t as InitRewardsParams, u as SetRewardParams, v as SetRewardsParams, w as CollectRewardParams, x as CollectRewardsParams, H as HarvestAllRewardsParams } from './type-6fd96950.js';
14
14
  import { ClmmPositionLayout } from './raydium/clmm/layout.js';
15
- import { CreateCpmmPoolParam, CreateCpmmPoolAddress, AddCpmmLiquidityParams, WithdrawCpmmLiquidityParams, CpmmSwapParams } from './raydium/cpmm/type.js';
15
+ import { CpmmConfigInfoInterface, CreateCpmmPoolParam, CreateCpmmPoolAddress, AddCpmmLiquidityParams, WithdrawCpmmLiquidityParams, CpmmSwapParams, ComputePairAmountParams } from './raydium/cpmm/type.js';
16
16
  import { CpmmPoolInfoLayout } from './raydium/cpmm/layout.js';
17
17
  import { PoolAccountInfoV4, ReturnTypeGetAddLiquidityDefaultPool } from './raydium/tradeV2/type.js';
18
18
  import { Structure } from './marshmallow/index.js';
@@ -224,9 +224,10 @@ declare class CpmmModule extends ModuleBase {
224
224
  constructor(params: ModuleBaseProps);
225
225
  load(): Promise<void>;
226
226
  getCpmmPoolKeys(poolId: string): Promise<CpmmKeys>;
227
- getRpcPoolInfo(poolId: string): Promise<ReturnType<typeof CpmmPoolInfoLayout.decode> & {
227
+ getRpcPoolInfo(poolId: string, fetchConfigInfo?: boolean): Promise<ReturnType<typeof CpmmPoolInfoLayout.decode> & {
228
228
  baseReserve: BN__default;
229
229
  quoteReserve: BN__default;
230
+ configInfo?: CpmmConfigInfoInterface;
230
231
  }>;
231
232
  createPool<T extends TxVersion>({ programId, poolFeeAccount, startTime, ownerInfo, associatedOnly, checkCreateATAOwner, txVersion, computeBudgetConfig, ...params }: CreateCpmmPoolParam<T>): Promise<MakeTxData<T, {
232
233
  address: CreateCpmmPoolAddress;
@@ -234,12 +235,7 @@ declare class CpmmModule extends ModuleBase {
234
235
  addLiquidity<T extends TxVersion>(params: AddCpmmLiquidityParams<T>): Promise<MakeTxData<T>>;
235
236
  withdrawLiquidity<T extends TxVersion>(params: WithdrawCpmmLiquidityParams<T>): Promise<MakeTxData<T>>;
236
237
  swap<T extends TxVersion>(params: CpmmSwapParams): Promise<MakeTxData<T>>;
237
- computePairAmount({ poolInfo, amount, slippage, baseIn, }: {
238
- poolInfo: ApiV3PoolInfoStandardItem;
239
- amount: string | Decimal;
240
- slippage: Percent;
241
- baseIn?: boolean;
242
- }): {
238
+ computePairAmount({ poolInfo, amount, slippage, baseIn, }: ComputePairAmountParams): {
243
239
  anotherAmount: TokenAmount;
244
240
  maxAnotherAmount: TokenAmount;
245
241
  liquidity: BN__default;
@@ -294,11 +290,11 @@ declare class Utils1216 extends ModuleBase {
294
290
  perLpLoss: BN__default;
295
291
  totalClaimedAmount: BN__default;
296
292
  }[], "", {
297
- status: number;
298
293
  padding: BN__default[];
299
294
  bump: number;
300
295
  endTime: BN__default;
301
296
  openTime: BN__default;
297
+ status: number;
302
298
  ammId: PublicKey;
303
299
  tokenInfo: {
304
300
  mintDecimals: number;
@@ -1,7 +1,7 @@
1
1
  import { PublicKey, Transaction, Signer, Keypair, TransactionInstruction, EpochInfo } from '@solana/web3.js';
2
2
  import BN__default from 'bn.js';
3
3
  import Decimal from 'decimal.js';
4
- import { k as ApiV3PoolInfoConcentratedItem, b as ApiClmmConfigInfo, e as ApiV3Token, bL as GetTransferAmountFee, bK as TransferAmountFee, c6 as Price, c5 as Percent, c1 as TokenAmount, bI as ComputeBudgetConfig, c3 as Fraction, bz as TokenInfo, v as ClmmKeys } from './type-322fdce2.js';
4
+ import { k as ApiV3PoolInfoConcentratedItem, b as ApiClmmConfigInfo, e as ApiV3Token, bL as GetTransferAmountFee, bK as TransferAmountFee, c6 as Price, c5 as Percent, c1 as TokenAmount, bI as ComputeBudgetConfig, c3 as Fraction, bz as TokenInfo, v as ClmmKeys } from './type-83523f5f.js';
5
5
  import { TxVersion } from './common/txTool/txType.js';
6
6
  import { ClmmPositionLayout } from './raydium/clmm/layout.js';
7
7
 
@@ -843,37 +843,37 @@ declare type FarmStateV6 = GetStructureSchema<FarmStateLayoutV6>;
843
843
  declare type FarmState = FarmStateV3 | FarmStateV5 | FarmStateV6;
844
844
  declare type FarmStateLayout = FarmStateLayoutV3 | FarmStateLayoutV5 | FarmStateLayoutV6;
845
845
  declare const farmLedgerLayoutV3_1: Structure<PublicKey | BN__default | BN__default[], "", {
846
- id: PublicKey;
847
846
  state: BN__default;
847
+ id: PublicKey;
848
848
  owner: PublicKey;
849
849
  deposited: BN__default;
850
850
  rewardDebts: BN__default[];
851
851
  }>;
852
852
  declare const farmLedgerLayoutV3_2: Structure<PublicKey | BN__default | BN__default[], "", {
853
- id: PublicKey;
854
853
  state: BN__default;
854
+ id: PublicKey;
855
855
  owner: PublicKey;
856
856
  deposited: BN__default;
857
857
  rewardDebts: BN__default[];
858
858
  voteLockedBalance: BN__default;
859
859
  }>;
860
860
  declare const farmLedgerLayoutV5_1: Structure<PublicKey | BN__default | BN__default[], "", {
861
- id: PublicKey;
862
861
  state: BN__default;
862
+ id: PublicKey;
863
863
  owner: PublicKey;
864
864
  deposited: BN__default;
865
865
  rewardDebts: BN__default[];
866
866
  }>;
867
867
  declare const farmLedgerLayoutV5_2: Structure<PublicKey | BN__default | BN__default[], "", {
868
- id: PublicKey;
869
868
  state: BN__default;
869
+ id: PublicKey;
870
870
  owner: PublicKey;
871
871
  deposited: BN__default;
872
872
  rewardDebts: BN__default[];
873
873
  }>;
874
874
  declare const farmLedgerLayoutV6_1: Structure<PublicKey | BN__default | BN__default[], "", {
875
- id: PublicKey;
876
875
  state: BN__default;
876
+ id: PublicKey;
877
877
  owner: PublicKey;
878
878
  deposited: BN__default;
879
879
  rewardDebts: BN__default[];
@@ -894,7 +894,7 @@ declare const dwLayout: Structure<number | BN__default, "", {
894
894
  instruction: number;
895
895
  amount: BN__default;
896
896
  }>;
897
- declare const VoterVotingMintConfig: Structure<number[] | PublicKey | BN__default | BN__default[], "", {
897
+ declare const VoterVotingMintConfig: Structure<PublicKey | number[] | BN__default | BN__default[], "", {
898
898
  mint: PublicKey;
899
899
  grantAuthority: PublicKey;
900
900
  baselineVoteWeightScaledFactor: BN__default;
@@ -904,7 +904,7 @@ declare const VoterVotingMintConfig: Structure<number[] | PublicKey | BN__defaul
904
904
  reserved1: number[];
905
905
  reserved2: BN__default[];
906
906
  }>;
907
- declare const VoterRegistrar: Structure<number | number[] | PublicKey | Buffer | BN__default | BN__default[] | {
907
+ declare const VoterRegistrar: Structure<number | PublicKey | number[] | Buffer | BN__default | BN__default[] | {
908
908
  mint: PublicKey;
909
909
  grantAuthority: PublicKey;
910
910
  baselineVoteWeightScaledFactor: BN__default;
@@ -959,7 +959,7 @@ declare const VoterDepositEntry: Structure<number | boolean | number[] | BN__def
959
959
  allowClawback: boolean;
960
960
  votingMintConfigIdx: number;
961
961
  }>;
962
- declare const Voter: Structure<number | number[] | PublicKey | Buffer | {
962
+ declare const Voter: Structure<number | PublicKey | number[] | Buffer | {
963
963
  reserved: number[];
964
964
  lockup: {
965
965
  startTime: BN__default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydium-io/raydium-sdk-v2",
3
- "version": "0.0.24-alpha",
3
+ "version": "0.0.26-alpha",
4
4
  "description": "An SDK for building applications on top of Raydium.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "./lib/index.js",
@@ -1,6 +1,6 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  import { NATIVE_MINT, TOKEN_PROGRAM_ID, AccountLayout } from "@solana/spl-token";
3
- import { ApiV3PoolInfoStandardItem, CpmmKeys } from "@/api/type";
3
+ import { CpmmKeys } from "@/api/type";
4
4
  import { TokenAmount, Percent } from "@/module";
5
5
  import { toToken } from "../token";
6
6
  import { BN_ZERO } from "@/common/bignumber";
@@ -16,6 +16,8 @@ import {
16
16
  AddCpmmLiquidityParams,
17
17
  WithdrawCpmmLiquidityParams,
18
18
  CpmmSwapParams,
19
+ ComputePairAmountParams,
20
+ CpmmConfigInfoInterface,
19
21
  } from "./type";
20
22
  import { getCreatePoolKeys, getPdaObservationId } from "./pda";
21
23
  import {
@@ -26,7 +28,7 @@ import {
26
28
  makeSwapCpmmBaseOutInInstruction,
27
29
  } from "./instruction";
28
30
  import BN from "bn.js";
29
- import { CpmmPoolInfoLayout } from "./layout";
31
+ import { CpmmPoolInfoLayout, CpmmConfigInfoLayout } from "./layout";
30
32
  import Decimal from "decimal.js";
31
33
 
32
34
  export default class CpmmModule extends ModuleBase {
@@ -42,10 +44,14 @@ export default class CpmmModule extends ModuleBase {
42
44
  return ((await this.scope.api.fetchPoolKeysById({ idList: [poolId] })) as CpmmKeys[])[0];
43
45
  }
44
46
 
45
- public async getRpcPoolInfo(poolId: string): Promise<
47
+ public async getRpcPoolInfo(
48
+ poolId: string,
49
+ fetchConfigInfo?: boolean,
50
+ ): Promise<
46
51
  ReturnType<typeof CpmmPoolInfoLayout.decode> & {
47
52
  baseReserve: BN;
48
53
  quoteReserve: BN;
54
+ configInfo?: CpmmConfigInfoInterface;
49
55
  }
50
56
  > {
51
57
  const accountData = await this.scope.connection.getAccountInfo(new PublicKey(poolId));
@@ -59,6 +65,12 @@ export default class CpmmModule extends ModuleBase {
59
65
  if (!poolVaultAState) throw new Error(`pool vaultA info not found: ${poolInfo.vaultA.toBase58()}`);
60
66
  if (!poolVaultBState) throw new Error(`pool vaultB info not found: ${poolInfo.vaultB.toBase58()}`);
61
67
 
68
+ let configInfo: CpmmConfigInfoInterface | undefined;
69
+ if (fetchConfigInfo) {
70
+ const configState = await this.scope.connection.getAccountInfo(poolInfo.configId);
71
+ if (configState) configInfo = CpmmConfigInfoLayout.decode(configState.data);
72
+ }
73
+
62
74
  return {
63
75
  ...poolInfo,
64
76
  baseReserve: new BN(AccountLayout.decode(poolVaultAState.data).amount.toString())
@@ -67,6 +79,7 @@ export default class CpmmModule extends ModuleBase {
67
79
  quoteReserve: new BN(AccountLayout.decode(poolVaultBState.data).amount.toString())
68
80
  .sub(poolInfo.protocolFeesMintB)
69
81
  .sub(poolInfo.fundFeesMintB),
82
+ configInfo,
70
83
  };
71
84
  }
72
85
 
@@ -508,12 +521,7 @@ export default class CpmmModule extends ModuleBase {
508
521
  // anotherToken,
509
522
  slippage,
510
523
  baseIn,
511
- }: {
512
- poolInfo: ApiV3PoolInfoStandardItem;
513
- amount: string | Decimal;
514
- slippage: Percent;
515
- baseIn?: boolean;
516
- }): { anotherAmount: TokenAmount; maxAnotherAmount: TokenAmount; liquidity: BN } {
524
+ }: ComputePairAmountParams): { anotherAmount: TokenAmount; maxAnotherAmount: TokenAmount; liquidity: BN } {
517
525
  const inputAmount = new BN(new Decimal(amount).mul(10 ** poolInfo[baseIn ? "mintA" : "mintB"].decimals).toFixed(0));
518
526
  const _anotherToken = toToken(poolInfo[baseIn ? "mintB" : "mintA"]);
519
527
 
@@ -1,10 +1,11 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
- import { ApiV3PoolInfoStandardItem, ApiV3Token } from "@/api/type";
2
+ import { ApiV3PoolInfoStandardItemCpmm, ApiV3Token } from "@/api/type";
3
3
  import { TxVersion } from "@/common/txTool/txType";
4
4
  import BN from "bn.js";
5
5
  import { ComputeBudgetConfig } from "@/raydium/type";
6
6
  import { SwapResult } from "./curve/calculator";
7
7
  import { Percent } from "@/module";
8
+ import Decimal from "decimal.js";
8
9
 
9
10
  export interface CpmmConfigInfoInterface {
10
11
  bump: number;
@@ -84,7 +85,7 @@ export interface CreateCpmmPoolAddress {
84
85
  }
85
86
 
86
87
  export interface AddCpmmLiquidityParams<T = TxVersion.LEGACY> {
87
- poolInfo: ApiV3PoolInfoStandardItem;
88
+ poolInfo: ApiV3PoolInfoStandardItemCpmm;
88
89
  payer?: PublicKey;
89
90
  inputAmount: BN;
90
91
  baseIn: boolean;
@@ -98,7 +99,7 @@ export interface AddCpmmLiquidityParams<T = TxVersion.LEGACY> {
98
99
  }
99
100
 
100
101
  export interface WithdrawCpmmLiquidityParams<T = TxVersion.LEGACY> {
101
- poolInfo: ApiV3PoolInfoStandardItem;
102
+ poolInfo: ApiV3PoolInfoStandardItemCpmm;
102
103
  payer?: PublicKey;
103
104
  lpAmount: BN;
104
105
  slippage: Percent;
@@ -107,7 +108,7 @@ export interface WithdrawCpmmLiquidityParams<T = TxVersion.LEGACY> {
107
108
  }
108
109
 
109
110
  export interface CpmmSwapParams<T = TxVersion.LEGACY> {
110
- poolInfo: ApiV3PoolInfoStandardItem;
111
+ poolInfo: ApiV3PoolInfoStandardItemCpmm;
111
112
  payer?: PublicKey;
112
113
  baseIn: boolean;
113
114
  swapResult: SwapResult;
@@ -119,3 +120,10 @@ export interface CpmmSwapParams<T = TxVersion.LEGACY> {
119
120
  computeBudgetConfig?: ComputeBudgetConfig;
120
121
  txVersion?: T;
121
122
  }
123
+
124
+ export interface ComputePairAmountParams {
125
+ poolInfo: ApiV3PoolInfoStandardItemCpmm;
126
+ amount: string | Decimal;
127
+ slippage: Percent;
128
+ baseIn?: boolean;
129
+ }