@raydium-io/raydium-sdk-v2 0.1.29-alpha → 0.1.30-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 (94) 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 +3 -3
  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 +1 -1
  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 +3 -3
  39. package/lib/raydium/cpmm/index.d.ts +1 -1
  40. package/lib/raydium/cpmm/layout.d.ts +1 -1
  41. package/lib/raydium/cpmm/type.d.ts +1 -1
  42. package/lib/raydium/farm/config.d.ts +1 -1
  43. package/lib/raydium/farm/farm.d.ts +3 -3
  44. package/lib/raydium/farm/index.d.ts +1 -1
  45. package/lib/raydium/farm/instruction.d.ts +1 -1
  46. package/lib/raydium/farm/layout.d.ts +1 -1
  47. package/lib/raydium/farm/type.d.ts +1 -1
  48. package/lib/raydium/farm/util.d.ts +1 -1
  49. package/lib/raydium/ido/ido.d.ts +3 -3
  50. package/lib/raydium/ido/index.d.ts +3 -3
  51. package/lib/raydium/ido/instruction.d.ts +1 -1
  52. package/lib/raydium/ido/type.d.ts +1 -1
  53. package/lib/raydium/index.d.ts +3 -3
  54. package/lib/raydium/index.js +1 -1
  55. package/lib/raydium/index.js.map +1 -1
  56. package/lib/raydium/index.mjs +1 -1
  57. package/lib/raydium/index.mjs.map +1 -1
  58. package/lib/raydium/liquidity/index.d.ts +1 -1
  59. package/lib/raydium/liquidity/instruction.d.ts +1 -1
  60. package/lib/raydium/liquidity/layout.d.ts +6 -6
  61. package/lib/raydium/liquidity/liquidity.d.ts +3 -3
  62. package/lib/raydium/liquidity/liquidity.js +1 -1
  63. package/lib/raydium/liquidity/liquidity.js.map +1 -1
  64. package/lib/raydium/liquidity/liquidity.mjs +1 -1
  65. package/lib/raydium/liquidity/liquidity.mjs.map +1 -1
  66. package/lib/raydium/liquidity/type.d.ts +6 -2
  67. package/lib/raydium/liquidity/type.js.map +1 -1
  68. package/lib/raydium/liquidity/utils.d.ts +1 -1
  69. package/lib/raydium/marketV2/createMarket.d.ts +3 -3
  70. package/lib/raydium/marketV2/index.d.ts +3 -3
  71. package/lib/raydium/moduleBase.d.ts +3 -3
  72. package/lib/raydium/raydium.d.ts +3 -3
  73. package/lib/raydium/raydium.js +1 -1
  74. package/lib/raydium/raydium.js.map +1 -1
  75. package/lib/raydium/raydium.mjs +1 -1
  76. package/lib/raydium/raydium.mjs.map +1 -1
  77. package/lib/raydium/token/constant.d.ts +1 -1
  78. package/lib/raydium/token/index.d.ts +1 -1
  79. package/lib/raydium/token/token.d.ts +3 -3
  80. package/lib/raydium/token/type.d.ts +1 -1
  81. package/lib/raydium/token/utils.d.ts +1 -1
  82. package/lib/raydium/tradeV2/index.d.ts +2 -2
  83. package/lib/raydium/tradeV2/instrument.d.ts +2 -2
  84. package/lib/raydium/tradeV2/trade.d.ts +3 -3
  85. package/lib/raydium/tradeV2/type.d.ts +2 -2
  86. package/lib/raydium/type.d.ts +1 -1
  87. package/lib/raydium/utils1216/index.d.ts +3 -3
  88. package/lib/raydium/utils1216/utils1216.d.ts +3 -3
  89. package/lib/{raydium-1e9cad89.d.ts → raydium-8871c9e8.d.ts} +4 -4
  90. package/lib/{type-b95eb35d.d.ts → type-0de39dab.d.ts} +1 -1
  91. package/package.json +1 -1
  92. package/src/raydium/liquidity/liquidity.ts +76 -30
  93. package/src/raydium/liquidity/type.ts +5 -1
  94. package/lib/{type-60acc172.d.ts → type-2596119f.d.ts} +5 -5
@@ -1,4 +1,4 @@
1
- import { bz as TokenInfo } from '../../type-60acc172.js';
1
+ import { bz as TokenInfo } from '../../type-2596119f.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-60acc172.js';
3
+ export { bC as LpToken, bB as SplToken, bz as TokenInfo, bA as TokenJson } from '../../type-2596119f.js';
4
4
  export { parseTokenInfo, solToWSolToken, toApiV3Token, toFeeConfig, 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-60acc172.js';
3
- export { j as default } from '../../raydium-1e9cad89.js';
2
+ import '../../type-2596119f.js';
3
+ export { j as default } from '../../raydium-8871c9e8.js';
4
4
  import 'bn.js';
5
5
  import '@solana/spl-token';
6
6
  import '../../solana/type.js';
@@ -22,7 +22,7 @@ import '../account/layout.js';
22
22
  import '../liquidity/type.js';
23
23
  import '../liquidity/layout.js';
24
24
  import '../liquidity/stable.js';
25
- import '../../type-b95eb35d.js';
25
+ import '../../type-0de39dab.js';
26
26
  import '../clmm/layout.js';
27
27
  import '../cpmm/type.js';
28
28
  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-60acc172.js';
1
+ export { bC as LpToken, bB as SplToken, bz as TokenInfo, bA as TokenJson } from '../../type-2596119f.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, TransferFeeConfig } from '@solana/spl-token';
3
- import { bz as TokenInfo, a9 as BigNumberish, c1 as TokenAmount, e as ApiV3Token } from '../../type-60acc172.js';
3
+ import { bz as TokenInfo, a9 as BigNumberish, c1 as TokenAmount, e as ApiV3Token } from '../../type-2596119f.js';
4
4
  import { Token } from '../../module/token.js';
5
5
  import 'bn.js';
6
6
  import '../../solana/type.js';
@@ -2,7 +2,7 @@ export { makeSwapInstruction, route1Instruction, route2Instruction, routeInstruc
2
2
  export { BasicPoolInfo, ComputeAmountOutAmmLayout, ComputeAmountOutLayout, ComputeAmountOutRouteLayout, ComputePoolType, ComputeRoutePathType, 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-60acc172.js';
5
+ import '../../type-2596119f.js';
6
6
  import '@solana/spl-token';
7
7
  import '../../solana/type.js';
8
8
  import '../../common/txTool/txType.js';
@@ -17,7 +17,7 @@ import '../../common/logger.js';
17
17
  import '../../module/currency.js';
18
18
  import '../liquidity/type.js';
19
19
  import '../liquidity/layout.js';
20
- import '../../type-b95eb35d.js';
20
+ import '../../type-0de39dab.js';
21
21
  import '../clmm/layout.js';
22
22
  import '../cpmm/type.js';
23
23
  import '../cpmm/curve/calculator.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-60acc172.js';
3
+ import { n as ApiV3PoolInfoItem, w as PoolKeys } from '../../type-2596119f.js';
4
4
  import { ComputePoolType, MakeSwapInstructionParam, ReturnTypeMakeSwapInstruction } from './type.js';
5
5
  import '@solana/spl-token';
6
6
  import '../../solana/type.js';
@@ -16,7 +16,7 @@ import '../../common/logger.js';
16
16
  import '../../module/currency.js';
17
17
  import '../liquidity/type.js';
18
18
  import '../liquidity/layout.js';
19
- import '../../type-b95eb35d.js';
19
+ import '../../type-0de39dab.js';
20
20
  import '../clmm/layout.js';
21
21
  import '../cpmm/type.js';
22
22
  import '../cpmm/curve/calculator.js';
@@ -1,10 +1,10 @@
1
1
  import '@solana/web3.js';
2
2
  import '../../common/txTool/txType.js';
3
- import '../../type-60acc172.js';
4
- export { i as default } from '../../raydium-1e9cad89.js';
3
+ import '../../type-2596119f.js';
4
+ export { i as default } from '../../raydium-8871c9e8.js';
5
5
  import 'bn.js';
6
6
  import '../liquidity/type.js';
7
- import '../../type-b95eb35d.js';
7
+ import '../../type-0de39dab.js';
8
8
  import './type.js';
9
9
  import '../cpmm/type.js';
10
10
  import '@solana/spl-token';
@@ -1,10 +1,10 @@
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, c1 as TokenAmount, w as PoolKeys, n as ApiV3PoolInfoItem } from '../../type-60acc172.js';
3
+ import { bK as TransferAmountFee, c1 as TokenAmount, w as PoolKeys, n as ApiV3PoolInfoItem } from '../../type-2596119f.js';
4
4
  import Decimal from 'decimal.js';
5
5
  import { Token } from '../../module/token.js';
6
6
  import { ComputeAmountOutParam } from '../liquidity/type.js';
7
- import { d as ComputeClmmPoolInfo } from '../../type-b95eb35d.js';
7
+ import { d as ComputeClmmPoolInfo } from '../../type-0de39dab.js';
8
8
  import { CpmmComputeData } from '../cpmm/type.js';
9
9
  import '@solana/spl-token';
10
10
  import '../../solana/type.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-60acc172.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-2596119f.js';
4
4
  import 'bn.js';
5
5
  import '../solana/type.js';
6
6
  import '../common/txTool/txType.js';
@@ -1,9 +1,9 @@
1
- export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-1e9cad89.js';
1
+ export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-8871c9e8.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-60acc172.js';
6
+ import '../../type-2596119f.js';
7
7
  import 'bn.js';
8
8
  import '@solana/spl-token';
9
9
  import '../../common/txTool/txType.js';
@@ -22,7 +22,7 @@ import '../account/layout.js';
22
22
  import '../liquidity/type.js';
23
23
  import '../liquidity/layout.js';
24
24
  import '../liquidity/stable.js';
25
- import '../../type-b95eb35d.js';
25
+ import '../../type-0de39dab.js';
26
26
  import '../clmm/layout.js';
27
27
  import '../cpmm/type.js';
28
28
  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-1e9cad89.js';
4
+ export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-8871c9e8.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-60acc172.js';
9
+ import '../../type-2596119f.js';
10
10
  import '@solana/spl-token';
11
11
  import '../../common/txTool/txType.js';
12
12
  import '../../common/owner.js';
@@ -22,7 +22,7 @@ import '../account/layout.js';
22
22
  import '../liquidity/type.js';
23
23
  import '../liquidity/layout.js';
24
24
  import '../liquidity/stable.js';
25
- import '../../type-b95eb35d.js';
25
+ import '../../type-0de39dab.js';
26
26
  import '../clmm/layout.js';
27
27
  import '../cpmm/type.js';
28
28
  import '../cpmm/curve/calculator.js';
@@ -1,6 +1,6 @@
1
1
  import { PublicKey, Commitment, EpochInfo, Connection, Transaction, Signer, TransactionInstruction, Keypair } 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, bN as ReturnTypeFetchMultipleMintInfos, C as CpmmKeys, m as ApiV3PoolInfoStandardItemCpmm, bL as GetTransferAmountFee, w as PoolKeys, e as ApiV3Token, X as OwnerIdoInfo, Y as IdoKeysData, bJ as LoadParams, J as JupTokenType, bz as TokenInfo, bD as SignAllTransactions, V as AvailabilityCheckAPI3, f as ApiV3TokenRes } from './type-60acc172.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, bN as ReturnTypeFetchMultipleMintInfos, C as CpmmKeys, m as ApiV3PoolInfoStandardItemCpmm, bL as GetTransferAmountFee, w as PoolKeys, e as ApiV3Token, X as OwnerIdoInfo, Y as IdoKeysData, bJ as LoadParams, J as JupTokenType, bz as TokenInfo, bD as SignAllTransactions, V as AvailabilityCheckAPI3, f as ApiV3TokenRes } from './type-2596119f.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';
@@ -11,7 +11,7 @@ import BN__default from 'bn.js';
11
11
  import Decimal from 'decimal.js';
12
12
  import { AddLiquidityParams, RemoveParams, CreatePoolParam, CreatePoolAddress, ComputeAmountOutParam, SwapParam, AmmRpcData } from './raydium/liquidity/type.js';
13
13
  import { StableLayout } from './raydium/liquidity/stable.js';
14
- 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, F as ClmmRpcData, d as ComputeClmmPoolInfo, l as ReturnTypeFetchMultiplePoolTickArrays } from './type-b95eb35d.js';
14
+ 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, F as ClmmRpcData, d as ComputeClmmPoolInfo, l as ReturnTypeFetchMultiplePoolTickArrays } from './type-0de39dab.js';
15
15
  import { ClmmPositionLayout, PositionInfoLayout, PoolInfoLayout } from './raydium/clmm/layout.js';
16
16
  import { CpmmRpcData, CpmmComputeData, CreateCpmmPoolParam, CreateCpmmPoolAddress, AddCpmmLiquidityParams, WithdrawCpmmLiquidityParams, CpmmSwapParams, ComputePairAmountParams } from './raydium/cpmm/type.js';
17
17
  import { ComputeAmountOutLayout, BasicPoolInfo, ReturnTypeGetAllRoute, ComputeRoutePathType, ComputePoolType, ReturnTypeFetchMultipleInfo } from './raydium/tradeV2/type.js';
@@ -168,7 +168,7 @@ declare class LiquidityModule extends ModuleBase {
168
168
  priceImpact: Decimal;
169
169
  fee: BN__default;
170
170
  };
171
- swap<T extends TxVersion>({ poolInfo, poolKeys: propPoolKeys, amountIn, amountOut, inputMint, fixedSide, txVersion, computeBudgetConfig, }: SwapParam<T>): Promise<MakeTxData<T>>;
171
+ swap<T extends TxVersion>({ poolInfo, poolKeys: propPoolKeys, amountIn, amountOut, inputMint, fixedSide, txVersion, config, computeBudgetConfig, }: SwapParam<T>): Promise<MakeTxData<T>>;
172
172
  getRpcPoolInfo(poolId: string): Promise<AmmRpcData>;
173
173
  getRpcPoolInfos(poolIds: (string | PublicKey)[], config?: {
174
174
  batchRequest?: boolean;
@@ -419,11 +419,11 @@ declare class Utils1216 extends ModuleBase {
419
419
  perLpLoss: BN__default;
420
420
  totalClaimedAmount: BN__default;
421
421
  }[], "", {
422
- status: number;
423
422
  padding: BN__default[];
424
423
  bump: number;
425
424
  endTime: BN__default;
426
425
  openTime: BN__default;
426
+ status: number;
427
427
  ammId: PublicKey;
428
428
  tokenInfo: {
429
429
  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-60acc172.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-2596119f.js';
5
5
  import { TxVersion } from './common/txTool/txType.js';
6
6
  import { ClmmPositionLayout, PoolInfoLayout } from './raydium/clmm/layout.js';
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydium-io/raydium-sdk-v2",
3
- "version": "0.1.29-alpha",
3
+ "version": "0.1.30-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",
@@ -51,6 +51,7 @@ import { LIQUIDITY_FEES_NUMERATOR, LIQUIDITY_FEES_DENOMINATOR } from "./constant
51
51
 
52
52
  import BN from "bn.js";
53
53
  import Decimal from "decimal.js";
54
+ import { WSOLMint } from "@/common";
54
55
 
55
56
  export default class LiquidityModule extends ModuleBase {
56
57
  public stableLayout: StableLayout;
@@ -836,42 +837,87 @@ export default class LiquidityModule extends ModuleBase {
836
837
  inputMint,
837
838
  fixedSide,
838
839
  txVersion,
840
+ config,
839
841
  computeBudgetConfig,
840
842
  }: SwapParam<T>): Promise<MakeTxData<T>> {
841
843
  const txBuilder = this.createTxBuilder();
844
+ const { associatedOnly = false, inputUseSolBalance = true, outputUseSolBalance = true } = config || {};
845
+
842
846
  const [tokenIn, tokenOut] =
843
847
  inputMint === poolInfo.mintA.address ? [poolInfo.mintA, poolInfo.mintB] : [poolInfo.mintB, poolInfo.mintA];
844
- const tokenAccountIn = await this.scope.account.getCreatedTokenAccount({
845
- mint: new PublicKey(tokenIn.address),
846
- programId: new PublicKey(tokenIn.programId),
847
- associatedOnly: false,
848
- });
849
848
 
850
- const tokenAccountOut = await this.scope.account.getCreatedTokenAccount({
851
- mint: new PublicKey(tokenOut.address),
852
- programId: new PublicKey(tokenOut.programId),
853
- associatedOnly: false,
854
- });
849
+ const inputTokenUseSolBalance = inputUseSolBalance && tokenIn.address === WSOLMint.toBase58();
850
+ const outputTokenUseSolBalance = outputUseSolBalance && tokenOut.address === WSOLMint.toBase58();
855
851
 
856
- const { tokenAccount: _tokenAccountIn, ...accountInIns } = await this.scope.account.handleTokenAccount({
857
- side: "in",
858
- amount: amountIn,
859
- mint: new PublicKey(tokenIn.address),
860
- tokenAccount: tokenAccountIn,
861
- bypassAssociatedCheck: false,
862
- checkCreateATAOwner: false,
863
- });
864
- txBuilder.addInstruction(accountInIns);
852
+ const { account: _tokenAccountIn, instructionParams: ownerTokenAccountBaseInstruction } =
853
+ await this.scope.account.getOrCreateTokenAccount({
854
+ tokenProgram: TOKEN_PROGRAM_ID,
855
+ mint: new PublicKey(tokenIn.address),
856
+ owner: this.scope.ownerPubKey,
865
857
 
866
- const { tokenAccount: _tokenAccountOut, ...accountOutIns } = await this.scope.account.handleTokenAccount({
867
- side: "out",
868
- amount: 0,
869
- mint: new PublicKey(tokenOut.address),
870
- tokenAccount: tokenAccountOut,
871
- bypassAssociatedCheck: false,
872
- checkCreateATAOwner: false,
873
- });
874
- txBuilder.addInstruction(accountOutIns);
858
+ createInfo: inputTokenUseSolBalance
859
+ ? {
860
+ payer: this.scope.ownerPubKey,
861
+ amount: amountIn,
862
+ }
863
+ : undefined,
864
+ skipCloseAccount: !inputTokenUseSolBalance,
865
+ notUseTokenAccount: inputTokenUseSolBalance,
866
+ associatedOnly,
867
+ });
868
+ txBuilder.addInstruction(ownerTokenAccountBaseInstruction || {});
869
+
870
+ if (!_tokenAccountIn) this.logAndCreateError("input token account not found", tokenIn.address);
871
+
872
+ const { account: _tokenAccountOut, instructionParams: ownerTokenAccountQuoteInstruction } =
873
+ await this.scope.account.getOrCreateTokenAccount({
874
+ tokenProgram: TOKEN_PROGRAM_ID,
875
+ mint: new PublicKey(tokenOut.address),
876
+ owner: this.scope.ownerPubKey,
877
+ createInfo: outputTokenUseSolBalance
878
+ ? {
879
+ payer: this.scope.ownerPubKey!,
880
+ amount: 0,
881
+ }
882
+ : undefined,
883
+ skipCloseAccount: !outputTokenUseSolBalance,
884
+ notUseTokenAccount: outputTokenUseSolBalance,
885
+ associatedOnly,
886
+ });
887
+ txBuilder.addInstruction(ownerTokenAccountQuoteInstruction || {});
888
+ if (_tokenAccountOut === undefined) throw new Error("output token account not found");
889
+
890
+ // const tokenAccountIn = await this.scope.account.getCreatedTokenAccount({
891
+ // mint: new PublicKey(tokenIn.address),
892
+ // programId: new PublicKey(tokenIn.programId),
893
+ // associatedOnly: false,
894
+ // });
895
+
896
+ // const tokenAccountOut = await this.scope.account.getCreatedTokenAccount({
897
+ // mint: new PublicKey(tokenOut.address),
898
+ // programId: new PublicKey(tokenOut.programId),
899
+ // associatedOnly: false,
900
+ // });
901
+
902
+ // const { tokenAccount: _tokenAccountIn, ...accountInIns } = await this.scope.account.handleTokenAccount({
903
+ // side: "in",
904
+ // amount: amountIn,
905
+ // mint: new PublicKey(tokenIn.address),
906
+ // tokenAccount: tokenAccountIn,
907
+ // bypassAssociatedCheck: false,
908
+ // checkCreateATAOwner: false,
909
+ // });
910
+ // txBuilder.addInstruction(accountInIns);
911
+
912
+ // const { tokenAccount: _tokenAccountOut, ...accountOutIns } = await this.scope.account.handleTokenAccount({
913
+ // side: "out",
914
+ // amount: 0,
915
+ // mint: new PublicKey(tokenOut.address),
916
+ // tokenAccount: tokenAccountOut,
917
+ // bypassAssociatedCheck: false,
918
+ // checkCreateATAOwner: false,
919
+ // });
920
+ // txBuilder.addInstruction(accountOutIns);
875
921
 
876
922
  const poolKeys = propPoolKeys || (await this.getAmmPoolKeys(poolInfo.id));
877
923
  let version = 4;
@@ -883,8 +929,8 @@ export default class LiquidityModule extends ModuleBase {
883
929
  version,
884
930
  poolKeys,
885
931
  userKeys: {
886
- tokenAccountIn: _tokenAccountIn,
887
- tokenAccountOut: _tokenAccountOut,
932
+ tokenAccountIn: _tokenAccountIn!,
933
+ tokenAccountOut: _tokenAccountOut!,
888
934
  owner: this.scope.ownerPubKey,
889
935
  },
890
936
  amountIn,
@@ -205,11 +205,15 @@ export interface ComputeAmountOutParam {
205
205
  export interface SwapParam<T = TxVersion.LEGACY> {
206
206
  poolInfo: ApiV3PoolInfoStandardItem;
207
207
  poolKeys?: AmmV4Keys | AmmV5Keys;
208
- associatedOnly: boolean;
209
208
  amountIn: BN;
210
209
  amountOut: BN;
211
210
  inputMint: string;
212
211
  fixedSide: SwapSide;
212
+ config?: {
213
+ associatedOnly?: boolean;
214
+ inputUseSolBalance?: boolean;
215
+ outputUseSolBalance?: boolean;
216
+ };
213
217
  computeBudgetConfig?: ComputeBudgetConfig;
214
218
  txVersion?: T;
215
219
  }
@@ -855,37 +855,37 @@ declare type FarmStateV6 = GetStructureSchema<FarmStateLayoutV6>;
855
855
  declare type FarmState = FarmStateV3 | FarmStateV5 | FarmStateV6;
856
856
  declare type FarmStateLayout = FarmStateLayoutV3 | FarmStateLayoutV5 | FarmStateLayoutV6;
857
857
  declare const farmLedgerLayoutV3_1: Structure<PublicKey | BN__default | BN__default[], "", {
858
- id: PublicKey;
859
858
  state: BN__default;
859
+ id: PublicKey;
860
860
  owner: PublicKey;
861
861
  deposited: BN__default;
862
862
  rewardDebts: BN__default[];
863
863
  }>;
864
864
  declare const farmLedgerLayoutV3_2: Structure<PublicKey | BN__default | BN__default[], "", {
865
- id: PublicKey;
866
865
  state: BN__default;
866
+ id: PublicKey;
867
867
  owner: PublicKey;
868
868
  deposited: BN__default;
869
869
  rewardDebts: BN__default[];
870
870
  voteLockedBalance: BN__default;
871
871
  }>;
872
872
  declare const farmLedgerLayoutV5_1: Structure<PublicKey | BN__default | BN__default[], "", {
873
- id: PublicKey;
874
873
  state: BN__default;
874
+ id: PublicKey;
875
875
  owner: PublicKey;
876
876
  deposited: BN__default;
877
877
  rewardDebts: BN__default[];
878
878
  }>;
879
879
  declare const farmLedgerLayoutV5_2: Structure<PublicKey | BN__default | BN__default[], "", {
880
- id: PublicKey;
881
880
  state: BN__default;
881
+ id: PublicKey;
882
882
  owner: PublicKey;
883
883
  deposited: BN__default;
884
884
  rewardDebts: BN__default[];
885
885
  }>;
886
886
  declare const farmLedgerLayoutV6_1: Structure<PublicKey | BN__default | BN__default[], "", {
887
- id: PublicKey;
888
887
  state: BN__default;
888
+ id: PublicKey;
889
889
  owner: PublicKey;
890
890
  deposited: BN__default;
891
891
  rewardDebts: BN__default[];