@raydium-io/raydium-sdk-v2 0.1.43-alpha → 0.1.45-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 (117) hide show
  1. package/README.md +40 -0
  2. package/lib/api/api.d.ts +1 -1
  3. package/lib/api/index.d.ts +1 -1
  4. package/lib/api/type.d.ts +1 -1
  5. package/lib/{api-7c7b1543.d.ts → api-00b0713a.d.ts} +8 -8
  6. package/lib/common/accountInfo.d.ts +1 -1
  7. package/lib/common/bignumber.d.ts +1 -1
  8. package/lib/common/fractionUtil.d.ts +1 -1
  9. package/lib/common/index.d.ts +1 -1
  10. package/lib/common/transfer.d.ts +1 -1
  11. package/lib/common/txTool/txTool.d.ts +1 -1
  12. package/lib/common/txTool/txUtils.d.ts +1 -1
  13. package/lib/common/utility.d.ts +1 -1
  14. package/lib/index.d.ts +3 -3
  15. package/lib/index.js +1 -1
  16. package/lib/index.js.map +1 -1
  17. package/lib/index.mjs +1 -1
  18. package/lib/index.mjs.map +1 -1
  19. package/lib/module/amount.d.ts +1 -1
  20. package/lib/module/fraction.d.ts +1 -1
  21. package/lib/module/index.d.ts +1 -1
  22. package/lib/module/percent.d.ts +1 -1
  23. package/lib/module/price.d.ts +1 -1
  24. package/lib/raydium/account/account.d.ts +3 -3
  25. package/lib/raydium/account/index.d.ts +1 -1
  26. package/lib/raydium/account/instruction.d.ts +1 -1
  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 +6 -6
  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/cpmm.js +1 -1
  42. package/lib/raydium/cpmm/cpmm.js.map +1 -1
  43. package/lib/raydium/cpmm/cpmm.mjs +1 -1
  44. package/lib/raydium/cpmm/cpmm.mjs.map +1 -1
  45. package/lib/raydium/cpmm/index.d.ts +1 -1
  46. package/lib/raydium/cpmm/layout.d.ts +1 -1
  47. package/lib/raydium/cpmm/type.d.ts +2 -1
  48. package/lib/raydium/cpmm/type.js.map +1 -1
  49. package/lib/raydium/farm/config.d.ts +1 -1
  50. package/lib/raydium/farm/farm.d.ts +3 -3
  51. package/lib/raydium/farm/index.d.ts +1 -1
  52. package/lib/raydium/farm/instruction.d.ts +1 -1
  53. package/lib/raydium/farm/layout.d.ts +1 -1
  54. package/lib/raydium/farm/type.d.ts +1 -1
  55. package/lib/raydium/farm/util.d.ts +1 -1
  56. package/lib/raydium/ido/ido.d.ts +3 -3
  57. package/lib/raydium/ido/index.d.ts +3 -3
  58. package/lib/raydium/ido/instruction.d.ts +1 -1
  59. package/lib/raydium/ido/type.d.ts +1 -1
  60. package/lib/raydium/index.d.ts +3 -3
  61. package/lib/raydium/index.js +1 -1
  62. package/lib/raydium/index.js.map +1 -1
  63. package/lib/raydium/index.mjs +1 -1
  64. package/lib/raydium/index.mjs.map +1 -1
  65. package/lib/raydium/liquidity/index.d.ts +1 -1
  66. package/lib/raydium/liquidity/instruction.d.ts +1 -1
  67. package/lib/raydium/liquidity/layout.d.ts +6 -6
  68. package/lib/raydium/liquidity/liquidity.d.ts +3 -3
  69. package/lib/raydium/liquidity/type.d.ts +1 -1
  70. package/lib/raydium/liquidity/utils.d.ts +1 -1
  71. package/lib/raydium/marketV2/createMarket.d.ts +3 -3
  72. package/lib/raydium/marketV2/createMarket.js +1 -1
  73. package/lib/raydium/marketV2/createMarket.js.map +1 -1
  74. package/lib/raydium/marketV2/createMarket.mjs +1 -1
  75. package/lib/raydium/marketV2/createMarket.mjs.map +1 -1
  76. package/lib/raydium/marketV2/index.d.ts +3 -3
  77. package/lib/raydium/marketV2/index.js +1 -1
  78. package/lib/raydium/marketV2/index.js.map +1 -1
  79. package/lib/raydium/marketV2/index.mjs +1 -1
  80. package/lib/raydium/marketV2/index.mjs.map +1 -1
  81. package/lib/raydium/marketV2/instrument.d.ts +3 -0
  82. package/lib/raydium/marketV2/instrument.js +1 -1
  83. package/lib/raydium/marketV2/instrument.js.map +1 -1
  84. package/lib/raydium/marketV2/instrument.mjs +1 -1
  85. package/lib/raydium/marketV2/instrument.mjs.map +1 -1
  86. package/lib/raydium/moduleBase.d.ts +3 -3
  87. package/lib/raydium/raydium.d.ts +3 -3
  88. package/lib/raydium/raydium.js +1 -1
  89. package/lib/raydium/raydium.js.map +1 -1
  90. package/lib/raydium/raydium.mjs +1 -1
  91. package/lib/raydium/raydium.mjs.map +1 -1
  92. package/lib/raydium/token/constant.d.ts +1 -1
  93. package/lib/raydium/token/index.d.ts +1 -1
  94. package/lib/raydium/token/token.d.ts +3 -3
  95. package/lib/raydium/token/type.d.ts +1 -1
  96. package/lib/raydium/token/utils.d.ts +1 -1
  97. package/lib/raydium/tradeV2/index.d.ts +2 -2
  98. package/lib/raydium/tradeV2/index.js.map +1 -1
  99. package/lib/raydium/tradeV2/index.mjs.map +1 -1
  100. package/lib/raydium/tradeV2/instrument.d.ts +2 -2
  101. package/lib/raydium/tradeV2/trade.d.ts +3 -3
  102. package/lib/raydium/tradeV2/trade.js +1 -1
  103. package/lib/raydium/tradeV2/trade.js.map +1 -1
  104. package/lib/raydium/tradeV2/trade.mjs +1 -1
  105. package/lib/raydium/tradeV2/trade.mjs.map +1 -1
  106. package/lib/raydium/tradeV2/type.d.ts +2 -2
  107. package/lib/raydium/type.d.ts +1 -1
  108. package/lib/raydium/utils1216/index.d.ts +3 -3
  109. package/lib/raydium/utils1216/utils1216.d.ts +3 -3
  110. package/lib/{raydium-8a28fbc6.d.ts → raydium-15ed5dcf.d.ts} +7 -4
  111. package/lib/{type-32d4c4bc.d.ts → type-b868e5e7.d.ts} +1 -1
  112. package/package.json +1 -1
  113. package/src/raydium/cpmm/cpmm.ts +2 -1
  114. package/src/raydium/cpmm/type.ts +1 -0
  115. package/src/raydium/marketV2/createMarket.ts +12 -2
  116. package/src/raydium/marketV2/instrument.ts +12 -8
  117. package/src/raydium/tradeV2/trade.ts +8 -12
@@ -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-7c7b1543.js';
3
+ import { bN as TransferAmountFee, c4 as TokenAmount, z as PoolKeys, q as ApiV3PoolInfoItem } from '../../api-00b0713a.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-32d4c4bc.js';
7
+ import { d as ComputeClmmPoolInfo } from '../../type-b868e5e7.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-7c7b1543.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-00b0713a.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-8a28fbc6.js';
1
+ export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-15ed5dcf.js';
2
2
  import '@solana/web3.js';
3
- import '../../api-7c7b1543.js';
3
+ import '../../api-00b0713a.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-32d4c4bc.js';
24
+ import '../../type-b868e5e7.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-8a28fbc6.js';
4
+ export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-15ed5dcf.js';
5
5
  import '../../marshmallow/buffer-layout.js';
6
- import '../../api-7c7b1543.js';
6
+ import '../../api-00b0713a.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-32d4c4bc.js';
24
+ import '../../type-b868e5e7.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-7c7b1543.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-00b0713a.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-32d4c4bc.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-b868e5e7.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';
@@ -418,11 +418,11 @@ declare class Utils1216 extends ModuleBase {
418
418
  perLpLoss: BN__default;
419
419
  totalClaimedAmount: BN__default;
420
420
  }[], "", {
421
+ status: number;
421
422
  padding: BN__default[];
422
423
  bump: number;
423
424
  endTime: BN__default;
424
425
  openTime: BN__default;
425
- status: number;
426
426
  ammId: PublicKey;
427
427
  tokenInfo: {
428
428
  mintDecimals: number;
@@ -522,7 +522,7 @@ interface ExtInfo {
522
522
  declare class MarketV2$1 extends ModuleBase {
523
523
  create<T extends TxVersion>({ baseInfo, quoteInfo, lotSize, // 1
524
524
  tickSize, // 0.01
525
- dexProgramId, txVersion, computeBudgetConfig, }: {
525
+ dexProgramId, requestQueueSpace, eventQueueSpace, orderbookQueueSpace, txVersion, computeBudgetConfig, }: {
526
526
  baseInfo: {
527
527
  mint: PublicKey;
528
528
  decimals: number;
@@ -536,6 +536,9 @@ declare class MarketV2$1 extends ModuleBase {
536
536
  dexProgramId: PublicKey;
537
537
  eventQueue?: PublicKey;
538
538
  requestQueue?: PublicKey;
539
+ requestQueueSpace?: number;
540
+ eventQueueSpace?: number;
541
+ orderbookQueueSpace?: number;
539
542
  txVersion?: T;
540
543
  computeBudgetConfig?: ComputeBudgetConfig;
541
544
  }): Promise<MakeMultiTxData<T, ExtInfo>>;
@@ -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-7c7b1543.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-00b0713a.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.43-alpha",
3
+ "version": "0.1.45-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",
@@ -631,6 +631,7 @@ export default class CpmmModule extends ModuleBase {
631
631
  poolInfo,
632
632
  poolKeys: propPoolKeys,
633
633
  baseIn,
634
+ inputAmount,
634
635
  swapResult,
635
636
  slippage = 0,
636
637
  config,
@@ -723,7 +724,7 @@ export default class CpmmModule extends ModuleBase {
723
724
  baseIn ? mintB : mintA,
724
725
  getPdaObservationId(new PublicKey(poolInfo.programId), new PublicKey(poolInfo.id)).publicKey,
725
726
 
726
- swapResult.sourceAmountSwapped,
727
+ inputAmount,
727
728
  swapResult.destinationAmountSwapped,
728
729
  ),
729
730
  // baseIn
@@ -123,6 +123,7 @@ export interface CpmmSwapParams<T = TxVersion.LEGACY> {
123
123
  baseIn: boolean;
124
124
  slippage?: number;
125
125
  swapResult: SwapResult;
126
+ inputAmount: BN;
126
127
 
127
128
  config?: {
128
129
  bypassAssociatedCheck?: boolean;
@@ -3,11 +3,11 @@ import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
3
3
  import BN from "bn.js";
4
4
  import ModuleBase from "../moduleBase";
5
5
  import { TxVersion } from "@/common/txTool/txType";
6
- import { MakeMultiTxData, TxBuildData, TxV0BuildData } from "@/common/txTool/txTool";
6
+ import { MakeMultiTxData } from "@/common/txTool/txTool";
7
7
  import { generatePubKey } from "../account/util";
8
8
  import { BN_ZERO } from "@/common/bignumber";
9
9
  import { makeCreateMarketInstruction } from "./instrument";
10
- import { ComputeBudgetConfig, MakeMultiTransaction } from "@/raydium/type";
10
+ import { ComputeBudgetConfig } from "@/raydium/type";
11
11
 
12
12
  interface ExtInfo {
13
13
  address: {
@@ -30,6 +30,9 @@ export default class MarketV2 extends ModuleBase {
30
30
  lotSize, // 1
31
31
  tickSize, // 0.01
32
32
  dexProgramId,
33
+ requestQueueSpace,
34
+ eventQueueSpace,
35
+ orderbookQueueSpace,
33
36
  txVersion,
34
37
  computeBudgetConfig,
35
38
  }: {
@@ -46,6 +49,9 @@ export default class MarketV2 extends ModuleBase {
46
49
  dexProgramId: PublicKey;
47
50
  eventQueue?: PublicKey;
48
51
  requestQueue?: PublicKey;
52
+ requestQueueSpace?: number;
53
+ eventQueueSpace?: number;
54
+ orderbookQueueSpace?: number;
49
55
  txVersion?: T;
50
56
  computeBudgetConfig?: ComputeBudgetConfig;
51
57
  }): Promise<MakeMultiTxData<T, ExtInfo>> {
@@ -102,6 +108,10 @@ export default class MarketV2 extends ModuleBase {
102
108
  vaultSignerNonce,
103
109
  baseLotSize,
104
110
  quoteLotSize,
111
+
112
+ requestQueueSpace,
113
+ eventQueueSpace,
114
+ orderbookQueueSpace,
105
115
  },
106
116
  });
107
117
  const txBuilder = this.createTxBuilder();
@@ -120,6 +120,10 @@ export async function makeCreateMarketInstruction({
120
120
 
121
121
  baseLotSize: BN;
122
122
  quoteLotSize: BN;
123
+
124
+ requestQueueSpace?: number;
125
+ eventQueueSpace?: number;
126
+ orderbookQueueSpace?: number;
123
127
  };
124
128
  }): Promise<Transactions> {
125
129
  const tx1 = new Transaction();
@@ -163,8 +167,8 @@ export async function makeCreateMarketInstruction({
163
167
  basePubkey: wallet,
164
168
  seed: marketInfo.requestQueue.seed,
165
169
  newAccountPubkey: marketInfo.requestQueue.publicKey,
166
- lamports: await connection.getMinimumBalanceForRentExemption(5120 + 12),
167
- space: 5120 + 12,
170
+ lamports: await connection.getMinimumBalanceForRentExemption(marketInfo.requestQueueSpace ?? 5120 + 12),
171
+ space: marketInfo.requestQueueSpace ?? 5120 + 12,
168
172
  programId: marketInfo.programId,
169
173
  }),
170
174
  SystemProgram.createAccountWithSeed({
@@ -172,8 +176,8 @@ export async function makeCreateMarketInstruction({
172
176
  basePubkey: wallet,
173
177
  seed: marketInfo.eventQueue.seed,
174
178
  newAccountPubkey: marketInfo.eventQueue.publicKey,
175
- lamports: await connection.getMinimumBalanceForRentExemption(262144 + 12),
176
- space: 262144 + 12,
179
+ lamports: await connection.getMinimumBalanceForRentExemption(marketInfo.eventQueueSpace ?? 262144 + 12),
180
+ space: marketInfo.eventQueueSpace ?? 262144 + 12,
177
181
  programId: marketInfo.programId,
178
182
  }),
179
183
  SystemProgram.createAccountWithSeed({
@@ -181,8 +185,8 @@ export async function makeCreateMarketInstruction({
181
185
  basePubkey: wallet,
182
186
  seed: marketInfo.bids.seed,
183
187
  newAccountPubkey: marketInfo.bids.publicKey,
184
- lamports: await connection.getMinimumBalanceForRentExemption(65536 + 12),
185
- space: 65536 + 12,
188
+ lamports: await connection.getMinimumBalanceForRentExemption(marketInfo.orderbookQueueSpace ?? 65536 + 12),
189
+ space: marketInfo.orderbookQueueSpace ?? 65536 + 12,
186
190
  programId: marketInfo.programId,
187
191
  }),
188
192
  SystemProgram.createAccountWithSeed({
@@ -190,8 +194,8 @@ export async function makeCreateMarketInstruction({
190
194
  basePubkey: wallet,
191
195
  seed: marketInfo.asks.seed,
192
196
  newAccountPubkey: marketInfo.asks.publicKey,
193
- lamports: await connection.getMinimumBalanceForRentExemption(65536 + 12),
194
- space: 65536 + 12,
197
+ lamports: await connection.getMinimumBalanceForRentExemption(marketInfo.orderbookQueueSpace ?? 65536 + 12),
198
+ space: marketInfo.orderbookQueueSpace ?? 65536 + 12,
195
199
  programId: marketInfo.programId,
196
200
  }),
197
201
  initializeMarket({
@@ -225,20 +225,16 @@ export default class TradeV2 extends ModuleBase {
225
225
  amountOut.amount.token.isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID,
226
226
  );
227
227
  } else {
228
- const baseIn = swapInfo.poolInfoList[0].mintA.address === inputMint.toBase58();
229
228
  const { account, instructionParams } = await this.scope.account.getOrCreateTokenAccount({
230
229
  tokenProgram: amountOut.amount.token.isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID,
231
230
  mint: outputMint,
232
231
  notUseTokenAccount: isOutputSol,
233
232
  owner: this.scope.ownerPubKey,
234
233
  skipCloseAccount: true,
235
- createInfo:
236
- isOutputSol || baseIn
237
- ? {
238
- payer: this.scope.ownerPubKey,
239
- amount: baseIn ? 0 : amountIn.amount.raw,
240
- }
241
- : undefined,
234
+ createInfo: {
235
+ payer: this.scope.ownerPubKey,
236
+ amount: 0,
237
+ },
242
238
  associatedOnly: isOutputSol ? false : ownerInfo.associatedOnly,
243
239
  checkCreateATAOwner: ownerInfo.checkCreateATAOwner,
244
240
  });
@@ -586,7 +582,7 @@ export default class TradeV2 extends ModuleBase {
586
582
  for (const infoOut of info.out) {
587
583
  if (infoIn.version === 6 && needTickArray[infoIn.id.toString()] === undefined) {
588
584
  needTickArray[infoIn.id.toString()] = infoIn;
589
- } else if (infoIn.version === 7 && cpmmPools[infoIn.id.toString()] === undefined) {
585
+ } else if (infoIn.version === 7 && cpmmPoolList[infoIn.id.toString()] === undefined) {
590
586
  cpmmPoolList[infoIn.id.toString()] = infoIn;
591
587
  } else if (
592
588
  (infoIn.version === 4 || infoIn.version === 5) &&
@@ -596,7 +592,7 @@ export default class TradeV2 extends ModuleBase {
596
592
  }
597
593
  if (infoOut.version === 6 && needTickArray[infoOut.id.toString()] === undefined) {
598
594
  needTickArray[infoOut.id.toString()] = infoOut;
599
- } else if (infoOut.version === 7 && cpmmPools[infoOut.id.toString()] === undefined) {
595
+ } else if (infoOut.version === 7 && cpmmPoolList[infoOut.id.toString()] === undefined) {
600
596
  cpmmPoolList[infoOut.id.toString()] = infoOut;
601
597
  } else if (
602
598
  (infoOut.version === 4 || infoOut.version === 5) &&
@@ -1115,7 +1111,7 @@ export default class TradeV2 extends ModuleBase {
1115
1111
  pools.filter((p) => p.version === 6 && !clmmRpcData[p.id.toString()]).map((p) => p.id.toString()),
1116
1112
  );
1117
1113
  if (clmmFetchKeys.size > 0) {
1118
- const clmmData = this.scope.clmm.getRpcClmmPoolInfos({ poolIds: Array.from(clmmFetchKeys) });
1114
+ const clmmData = await this.scope.clmm.getRpcClmmPoolInfos({ poolIds: Array.from(clmmFetchKeys) });
1119
1115
  Object.keys(clmmData).forEach((poolId) => {
1120
1116
  clmmRpcData[poolId] = clmmData[poolId];
1121
1117
  });
@@ -1125,7 +1121,7 @@ export default class TradeV2 extends ModuleBase {
1125
1121
  pools.filter((p) => p.version === 4 && !ammRpcData[p.id.toString()]).map((p) => p.id.toString()),
1126
1122
  );
1127
1123
  if (ammFetchKeys.size > 0) {
1128
- const ammData = this.scope.liquidity.getRpcPoolInfos(Array.from(clmmFetchKeys));
1124
+ const ammData = await this.scope.liquidity.getRpcPoolInfos(Array.from(clmmFetchKeys));
1129
1125
  Object.keys(ammData).forEach((poolId) => {
1130
1126
  ammRpcData[poolId] = ammData[poolId];
1131
1127
  });