@raydium-io/raydium-sdk-v2 0.1.39-alpha → 0.1.40-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/{api-25cae0da.d.ts → api-f02449a3.d.ts} +13 -13
  5. package/lib/common/accountInfo.d.ts +1 -1
  6. package/lib/common/bignumber.d.ts +1 -1
  7. package/lib/common/fractionUtil.d.ts +1 -1
  8. package/lib/common/index.d.ts +1 -1
  9. package/lib/common/transfer.d.ts +1 -1
  10. package/lib/common/txTool/txTool.d.ts +1 -1
  11. package/lib/common/txTool/txUtils.d.ts +1 -1
  12. package/lib/common/utility.d.ts +1 -1
  13. package/lib/index.d.ts +3 -3
  14. package/lib/index.js +1 -1
  15. package/lib/index.js.map +1 -1
  16. package/lib/index.mjs +1 -1
  17. package/lib/index.mjs.map +1 -1
  18. package/lib/module/amount.d.ts +1 -1
  19. package/lib/module/fraction.d.ts +1 -1
  20. package/lib/module/index.d.ts +1 -1
  21. package/lib/module/percent.d.ts +1 -1
  22. package/lib/module/price.d.ts +1 -1
  23. package/lib/raydium/account/account.d.ts +3 -3
  24. package/lib/raydium/account/index.d.ts +1 -1
  25. package/lib/raydium/account/instruction.d.ts +1 -1
  26. package/lib/raydium/account/layout.d.ts +2 -2
  27. package/lib/raydium/account/types.d.ts +1 -1
  28. package/lib/raydium/account/util.d.ts +1 -1
  29. package/lib/raydium/clmm/clmm.d.ts +3 -3
  30. package/lib/raydium/clmm/index.d.ts +3 -3
  31. package/lib/raydium/clmm/instrument.d.ts +2 -2
  32. package/lib/raydium/clmm/layout.d.ts +9 -9
  33. package/lib/raydium/clmm/type.d.ts +2 -2
  34. package/lib/raydium/clmm/utils/math.d.ts +2 -2
  35. package/lib/raydium/clmm/utils/pool.d.ts +2 -2
  36. package/lib/raydium/clmm/utils/position.d.ts +2 -2
  37. package/lib/raydium/clmm/utils/tick.d.ts +2 -2
  38. package/lib/raydium/clmm/utils/tickQuery.d.ts +2 -2
  39. package/lib/raydium/clmm/utils/tickarrayBitmap.d.ts +2 -2
  40. package/lib/raydium/cpmm/cpmm.d.ts +3 -3
  41. package/lib/raydium/cpmm/index.d.ts +1 -1
  42. package/lib/raydium/cpmm/layout.d.ts +3 -3
  43. package/lib/raydium/cpmm/type.d.ts +1 -1
  44. package/lib/raydium/farm/config.d.ts +1 -1
  45. package/lib/raydium/farm/farm.d.ts +3 -3
  46. package/lib/raydium/farm/index.d.ts +1 -1
  47. package/lib/raydium/farm/instruction.d.ts +1 -1
  48. package/lib/raydium/farm/layout.d.ts +1 -1
  49. package/lib/raydium/farm/type.d.ts +1 -1
  50. package/lib/raydium/farm/util.d.ts +1 -1
  51. package/lib/raydium/ido/ido.d.ts +3 -3
  52. package/lib/raydium/ido/index.d.ts +3 -3
  53. package/lib/raydium/ido/instruction.d.ts +1 -1
  54. package/lib/raydium/ido/type.d.ts +1 -1
  55. package/lib/raydium/index.d.ts +3 -3
  56. package/lib/raydium/index.js +1 -1
  57. package/lib/raydium/index.js.map +1 -1
  58. package/lib/raydium/index.mjs +1 -1
  59. package/lib/raydium/index.mjs.map +1 -1
  60. package/lib/raydium/liquidity/index.d.ts +1 -1
  61. package/lib/raydium/liquidity/instruction.d.ts +1 -1
  62. package/lib/raydium/liquidity/layout.d.ts +2 -2
  63. package/lib/raydium/liquidity/liquidity.d.ts +3 -3
  64. package/lib/raydium/liquidity/type.d.ts +1 -1
  65. package/lib/raydium/liquidity/utils.d.ts +1 -1
  66. package/lib/raydium/marketV2/createMarket.d.ts +3 -3
  67. package/lib/raydium/marketV2/index.d.ts +3 -3
  68. package/lib/raydium/moduleBase.d.ts +3 -3
  69. package/lib/raydium/raydium.d.ts +3 -3
  70. package/lib/raydium/raydium.js +1 -1
  71. package/lib/raydium/raydium.js.map +1 -1
  72. package/lib/raydium/raydium.mjs +1 -1
  73. package/lib/raydium/raydium.mjs.map +1 -1
  74. package/lib/raydium/serum/layout.d.ts +2 -2
  75. package/lib/raydium/token/constant.d.ts +1 -1
  76. package/lib/raydium/token/index.d.ts +1 -1
  77. package/lib/raydium/token/layout.d.ts +2 -2
  78. package/lib/raydium/token/token.d.ts +3 -3
  79. package/lib/raydium/token/type.d.ts +1 -1
  80. package/lib/raydium/token/utils.d.ts +1 -1
  81. package/lib/raydium/tradeV2/index.d.ts +2 -2
  82. package/lib/raydium/tradeV2/index.js.map +1 -1
  83. package/lib/raydium/tradeV2/index.mjs.map +1 -1
  84. package/lib/raydium/tradeV2/instrument.d.ts +2 -2
  85. package/lib/raydium/tradeV2/trade.d.ts +3 -3
  86. package/lib/raydium/tradeV2/trade.js +1 -1
  87. package/lib/raydium/tradeV2/trade.js.map +1 -1
  88. package/lib/raydium/tradeV2/trade.mjs +1 -1
  89. package/lib/raydium/tradeV2/trade.mjs.map +1 -1
  90. package/lib/raydium/tradeV2/type.d.ts +2 -2
  91. package/lib/raydium/type.d.ts +1 -1
  92. package/lib/raydium/utils1216/index.d.ts +3 -3
  93. package/lib/raydium/utils1216/utils1216.d.ts +3 -3
  94. package/lib/{raydium-810e369f.d.ts → raydium-6e4c8f65.d.ts} +4 -4
  95. package/lib/{type-bce9b6ba.d.ts → type-7700ca43.d.ts} +1 -1
  96. package/package.json +1 -1
  97. package/src/raydium/tradeV2/trade.ts +27 -4
@@ -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 { bN as TransferAmountFee, c4 as TokenAmount, z as PoolKeys, q as ApiV3PoolInfoItem } from '../../api-25cae0da.js';
3
+ import { bN as TransferAmountFee, c4 as TokenAmount, z as PoolKeys, q as ApiV3PoolInfoItem } from '../../api-f02449a3.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-bce9b6ba.js';
7
+ import { d as ComputeClmmPoolInfo } from '../../type-7700ca43.js';
8
8
  import { CpmmComputeData } from '../cpmm/type.js';
9
9
  import 'axios';
10
10
  import '../../solana/type.js';
@@ -1,6 +1,6 @@
1
1
  import '@solana/web3.js';
2
2
  import '@solana/spl-token';
3
- export { bV as ArrayItem, bL as ComputeBudgetConfig, c0 as Cover, bW as ExactPartial, bX as ExactRequired, b$ as Fallback, bO as GetTransferAmountFee, bZ as GetValue, bK as InstructionReturn, bM as LoadParams, bJ as MakeMultiTransaction, bH as MakeTransaction, bI as MakeV0Transaction, bS as MayArray, bT as MayDeepArray, bU as MayFunction, bR as ReplaceType, bP as ReturnTypeFetchMultipleMintInfo, bQ as ReturnTypeFetchMultipleMintInfos, bY as SKeyof, b_ as SOR, bG as SignAllTransactions, bN as TransferAmountFee, c1 as UnionCover, c2 as unionArr } from '../api-25cae0da.js';
3
+ export { bV as ArrayItem, bL as ComputeBudgetConfig, c0 as Cover, bW as ExactPartial, bX as ExactRequired, b$ as Fallback, bO as GetTransferAmountFee, bZ as GetValue, bK as InstructionReturn, bM as LoadParams, bJ as MakeMultiTransaction, bH as MakeTransaction, bI as MakeV0Transaction, bS as MayArray, bT as MayDeepArray, bU as MayFunction, bR as ReplaceType, bP as ReturnTypeFetchMultipleMintInfo, bQ as ReturnTypeFetchMultipleMintInfos, bY as SKeyof, b_ as SOR, bG as SignAllTransactions, bN as TransferAmountFee, c1 as UnionCover, c2 as unionArr } from '../api-f02449a3.js';
4
4
  import 'bn.js';
5
5
  import 'axios';
6
6
  import '../solana/type.js';
@@ -1,6 +1,6 @@
1
- export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-810e369f.js';
1
+ export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-6e4c8f65.js';
2
2
  import '@solana/web3.js';
3
- import '../../api-25cae0da.js';
3
+ import '../../api-f02449a3.js';
4
4
  import 'axios';
5
5
  import '../../solana/type.js';
6
6
  import 'bn.js';
@@ -21,7 +21,7 @@ import '../account/layout.js';
21
21
  import '../liquidity/type.js';
22
22
  import '../liquidity/layout.js';
23
23
  import '../liquidity/stable.js';
24
- import '../../type-bce9b6ba.js';
24
+ import '../../type-7700ca43.js';
25
25
  import '../clmm/layout.js';
26
26
  import '../cpmm/type.js';
27
27
  import '../cpmm/curve/calculator.js';
@@ -1,9 +1,9 @@
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-810e369f.js';
4
+ export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-6e4c8f65.js';
5
5
  import '../../marshmallow/buffer-layout.js';
6
- import '../../api-25cae0da.js';
6
+ import '../../api-f02449a3.js';
7
7
  import 'axios';
8
8
  import '../../solana/type.js';
9
9
  import '@solana/spl-token';
@@ -21,7 +21,7 @@ import '../account/layout.js';
21
21
  import '../liquidity/type.js';
22
22
  import '../liquidity/layout.js';
23
23
  import '../liquidity/stable.js';
24
- import '../../type-bce9b6ba.js';
24
+ import '../../type-7700ca43.js';
25
25
  import '../clmm/layout.js';
26
26
  import '../cpmm/type.js';
27
27
  import '../cpmm/curve/calculator.js';
@@ -1,5 +1,5 @@
1
1
  import { PublicKey, Commitment, EpochInfo, Connection, Transaction, Signer, TransactionInstruction, Keypair } from '@solana/web3.js';
2
- import { aA as TxBuilder, as as AddInstructionParam, ac as BigNumberish, bn as CreateFarm, az as MakeTxData, bo as CreateFarmExtInfo, bp as UpdateFarmReward, bq as UpdateFarmRewards, br as FarmDWParam, X as FormatFarmInfoOut, bL as ComputeBudgetConfig, ay as MakeMultiTxData, o as ApiV3PoolInfoStandardItem, c8 as Percent, c4 as TokenAmount, v as AmmV4Keys, w as AmmV5Keys, n as ApiV3PoolInfoConcentratedItem, W as FormatFarmInfoOutV6, y as ClmmKeys, bH as MakeTransaction, bQ as ReturnTypeFetchMultipleMintInfos, C as CpmmKeys, p as ApiV3PoolInfoStandardItemCpmm, bO as GetTransferAmountFee, z as PoolKeys, h as ApiV3Token, _ as OwnerIdoInfo, $ as IdoKeysData, bM as LoadParams, J as JupTokenType, bC as TokenInfo, bG as SignAllTransactions, a as Api, Y as AvailabilityCheckAPI3, i as ApiV3TokenRes } from './api-25cae0da.js';
2
+ import { aA as TxBuilder, as as AddInstructionParam, ac as BigNumberish, bn as CreateFarm, az as MakeTxData, bo as CreateFarmExtInfo, bp as UpdateFarmReward, bq as UpdateFarmRewards, br as FarmDWParam, X as FormatFarmInfoOut, bL as ComputeBudgetConfig, ay as MakeMultiTxData, o as ApiV3PoolInfoStandardItem, c8 as Percent, c4 as TokenAmount, v as AmmV4Keys, w as AmmV5Keys, n as ApiV3PoolInfoConcentratedItem, W as FormatFarmInfoOutV6, y as ClmmKeys, bH as MakeTransaction, bQ as ReturnTypeFetchMultipleMintInfos, C as CpmmKeys, p as ApiV3PoolInfoStandardItemCpmm, bO as GetTransferAmountFee, z as PoolKeys, h as ApiV3Token, _ as OwnerIdoInfo, $ as IdoKeysData, bM as LoadParams, J as JupTokenType, bC as TokenInfo, bG as SignAllTransactions, a as Api, Y as AvailabilityCheckAPI3, i as ApiV3TokenRes } from './api-f02449a3.js';
3
3
  import { API_URL_CONFIG } from './api/url.js';
4
4
  import { Owner } from './common/owner.js';
5
5
  import { Cluster } from './solana/type.js';
@@ -10,7 +10,7 @@ import BN__default from 'bn.js';
10
10
  import Decimal from 'decimal.js';
11
11
  import { AddLiquidityParams, RemoveParams, CreatePoolParam, CreatePoolAddress, ComputeAmountOutParam, SwapParam, AmmRpcData } from './raydium/liquidity/type.js';
12
12
  import { StableLayout } from './raydium/liquidity/stable.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, F as ClmmRpcData, d as ComputeClmmPoolInfo, l as ReturnTypeFetchMultiplePoolTickArrays } from './type-bce9b6ba.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, F as ClmmRpcData, d as ComputeClmmPoolInfo, l as ReturnTypeFetchMultiplePoolTickArrays } from './type-7700ca43.js';
14
14
  import { ClmmPositionLayout, PositionInfoLayout, PoolInfoLayout } from './raydium/clmm/layout.js';
15
15
  import { CpmmRpcData, CpmmComputeData, CreateCpmmPoolParam, CreateCpmmPoolAddress, AddCpmmLiquidityParams, WithdrawCpmmLiquidityParams, CpmmSwapParams, ComputePairAmountParams } from './raydium/cpmm/type.js';
16
16
  import { ComputeAmountOutLayout, BasicPoolInfo, ReturnTypeGetAllRoute, ComputeRoutePathType, ComputePoolType, ReturnTypeFetchMultipleInfo } from './raydium/tradeV2/type.js';
@@ -411,7 +411,7 @@ interface SHOW_INFO {
411
411
  declare type canClaimErrorType = "outOfOperationalTime" | "alreadyClaimIt" | undefined;
412
412
  declare class Utils1216 extends ModuleBase {
413
413
  static CLAIMED_NUM: number;
414
- static POOL_LAYOUT: Structure<number | BN__default | Buffer | PublicKey | BN__default[] | {
414
+ static POOL_LAYOUT: Structure<number | PublicKey | Buffer | BN__default | BN__default[] | {
415
415
  mintDecimals: number;
416
416
  mintAddress: PublicKey;
417
417
  mintVault: PublicKey;
@@ -432,7 +432,7 @@ declare class Utils1216 extends ModuleBase {
432
432
  totalClaimedAmount: BN__default;
433
433
  }[];
434
434
  }>;
435
- static OWNER_LAYOUT: Structure<number | BN__default | Buffer | PublicKey | BN__default[] | {
435
+ static OWNER_LAYOUT: Structure<number | PublicKey | Buffer | BN__default | BN__default[] | {
436
436
  mintAddress: PublicKey;
437
437
  debtAmount: BN__default;
438
438
  claimedAmount: BN__default;
@@ -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 { n as ApiV3PoolInfoConcentratedItem, d as ApiClmmConfigInfo, h as ApiV3Token, bO as GetTransferAmountFee, bN as TransferAmountFee, c9 as Price, c8 as Percent, c4 as TokenAmount, bL as ComputeBudgetConfig, c6 as Fraction, bC as TokenInfo, y as ClmmKeys } from './api-25cae0da.js';
4
+ import { n as ApiV3PoolInfoConcentratedItem, d as ApiClmmConfigInfo, h as ApiV3Token, bO as GetTransferAmountFee, bN as TransferAmountFee, c9 as Price, c8 as Percent, c4 as TokenAmount, bL as ComputeBudgetConfig, c6 as Fraction, bC as TokenInfo, y as ClmmKeys } from './api-f02449a3.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.39-alpha",
3
+ "version": "0.1.40-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",
@@ -218,10 +218,33 @@ export default class TradeV2 extends ModuleBase {
218
218
  throw Error("input account check error");
219
219
  }
220
220
 
221
- const destinationAcc = this.scope.account.getAssociatedTokenAccount(
222
- outputMint,
223
- amountOut.amount.token.isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID,
224
- );
221
+ let destinationAcc: PublicKey;
222
+ if (swapInfo.routeType === "route") {
223
+ destinationAcc = this.scope.account.getAssociatedTokenAccount(
224
+ outputMint,
225
+ amountOut.amount.token.isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID,
226
+ );
227
+ } else {
228
+ const baseIn = swapInfo.poolInfoList[0].mintA.address === inputMint.toBase58();
229
+ const { account, instructionParams } = await this.scope.account.getOrCreateTokenAccount({
230
+ tokenProgram: amountOut.amount.token.isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID,
231
+ mint: outputMint,
232
+ notUseTokenAccount: isOutputSol,
233
+ owner: this.scope.ownerPubKey,
234
+ skipCloseAccount: true,
235
+ createInfo:
236
+ isOutputSol || baseIn
237
+ ? {
238
+ payer: this.scope.ownerPubKey,
239
+ amount: baseIn ? 0 : amountIn.amount.raw,
240
+ }
241
+ : undefined,
242
+ associatedOnly: isOutputSol ? false : ownerInfo.associatedOnly,
243
+ checkCreateATAOwner: ownerInfo.checkCreateATAOwner,
244
+ });
245
+ destinationAcc = account!;
246
+ instructionParams && txBuilder.addInstruction(instructionParams);
247
+ }
225
248
 
226
249
  if (isOutputSol) {
227
250
  txBuilder.addInstruction({