@raydium-io/raydium-sdk-v2 0.0.30-alpha → 0.0.31-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.
- package/lib/api/api.d.ts +1 -1
- package/lib/api/index.d.ts +1 -1
- package/lib/api/type.d.ts +1 -1
- package/lib/common/accountInfo.d.ts +1 -1
- package/lib/common/bignumber.d.ts +1 -1
- package/lib/common/fractionUtil.d.ts +1 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/transfer.d.ts +1 -1
- package/lib/common/txTool/txTool.d.ts +1 -1
- package/lib/common/txTool/txUtils.d.ts +1 -1
- package/lib/common/utility.d.ts +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/module/amount.d.ts +1 -1
- package/lib/module/fraction.d.ts +1 -1
- package/lib/module/index.d.ts +1 -1
- package/lib/module/percent.d.ts +1 -1
- package/lib/module/price.d.ts +1 -1
- package/lib/raydium/account/account.d.ts +3 -3
- package/lib/raydium/account/index.d.ts +1 -1
- package/lib/raydium/account/instruction.d.ts +1 -1
- package/lib/raydium/account/types.d.ts +1 -1
- package/lib/raydium/account/util.d.ts +1 -1
- package/lib/raydium/clmm/clmm.d.ts +3 -3
- package/lib/raydium/clmm/index.d.ts +3 -3
- package/lib/raydium/clmm/instrument.d.ts +2 -2
- package/lib/raydium/clmm/layout.d.ts +5 -5
- package/lib/raydium/clmm/type.d.ts +2 -2
- package/lib/raydium/clmm/utils/math.d.ts +2 -2
- package/lib/raydium/clmm/utils/pool.d.ts +2 -2
- package/lib/raydium/clmm/utils/position.d.ts +2 -2
- package/lib/raydium/clmm/utils/tick.d.ts +2 -2
- package/lib/raydium/clmm/utils/tickQuery.d.ts +2 -2
- package/lib/raydium/clmm/utils/tickarrayBitmap.d.ts +2 -2
- package/lib/raydium/cpmm/cpmm.d.ts +4 -4
- package/lib/raydium/cpmm/cpmm.js +1 -1
- package/lib/raydium/cpmm/cpmm.js.map +1 -1
- package/lib/raydium/cpmm/cpmm.mjs +1 -1
- package/lib/raydium/cpmm/cpmm.mjs.map +1 -1
- package/lib/raydium/cpmm/index.d.ts +1 -1
- package/lib/raydium/cpmm/index.js +1 -1
- package/lib/raydium/cpmm/index.js.map +1 -1
- package/lib/raydium/cpmm/index.mjs +1 -1
- package/lib/raydium/cpmm/index.mjs.map +1 -1
- package/lib/raydium/cpmm/instruction.js +1 -1
- package/lib/raydium/cpmm/instruction.js.map +1 -1
- package/lib/raydium/cpmm/instruction.mjs +1 -1
- package/lib/raydium/cpmm/instruction.mjs.map +1 -1
- package/lib/raydium/cpmm/type.d.ts +9 -2
- package/lib/raydium/cpmm/type.js +1 -1
- package/lib/raydium/cpmm/type.js.map +1 -1
- package/lib/raydium/farm/config.d.ts +1 -1
- package/lib/raydium/farm/farm.d.ts +3 -3
- package/lib/raydium/farm/index.d.ts +1 -1
- package/lib/raydium/farm/instruction.d.ts +1 -1
- package/lib/raydium/farm/layout.d.ts +1 -1
- package/lib/raydium/farm/type.d.ts +1 -1
- package/lib/raydium/farm/util.d.ts +1 -1
- package/lib/raydium/ido/ido.d.ts +3 -3
- package/lib/raydium/ido/index.d.ts +3 -3
- package/lib/raydium/ido/instruction.d.ts +1 -1
- package/lib/raydium/ido/type.d.ts +1 -1
- package/lib/raydium/index.d.ts +3 -3
- package/lib/raydium/index.js +1 -1
- package/lib/raydium/index.js.map +1 -1
- package/lib/raydium/index.mjs +1 -1
- package/lib/raydium/index.mjs.map +1 -1
- package/lib/raydium/liquidity/index.d.ts +1 -1
- package/lib/raydium/liquidity/instruction.d.ts +1 -1
- package/lib/raydium/liquidity/liquidity.d.ts +3 -3
- package/lib/raydium/liquidity/type.d.ts +1 -1
- package/lib/raydium/liquidity/utils.d.ts +1 -1
- package/lib/raydium/marketV2/createMarket.d.ts +3 -3
- package/lib/raydium/marketV2/index.d.ts +3 -3
- package/lib/raydium/moduleBase.d.ts +3 -3
- package/lib/raydium/raydium.d.ts +3 -3
- package/lib/raydium/raydium.js +1 -1
- package/lib/raydium/raydium.js.map +1 -1
- package/lib/raydium/raydium.mjs +1 -1
- package/lib/raydium/raydium.mjs.map +1 -1
- package/lib/raydium/token/constant.d.ts +1 -1
- package/lib/raydium/token/index.d.ts +1 -1
- package/lib/raydium/token/token.d.ts +3 -3
- package/lib/raydium/token/type.d.ts +1 -1
- package/lib/raydium/token/utils.d.ts +1 -1
- package/lib/raydium/tradeV2/index.d.ts +2 -2
- package/lib/raydium/tradeV2/instrument.d.ts +2 -2
- package/lib/raydium/tradeV2/trade.d.ts +3 -3
- package/lib/raydium/tradeV2/type.d.ts +2 -2
- package/lib/raydium/type.d.ts +1 -1
- package/lib/raydium/utils1216/index.d.ts +3 -3
- package/lib/raydium/utils1216/utils1216.d.ts +3 -3
- package/lib/{raydium-d75706f4.d.ts → raydium-af1993ca.d.ts} +6 -5
- package/lib/{type-83523f5f.d.ts → type-3b373344.d.ts} +3 -3
- package/lib/{type-6fd96950.d.ts → type-502bbda1.d.ts} +1 -1
- package/package.json +1 -1
- package/src/raydium/cpmm/cpmm.ts +70 -19
- package/src/raydium/cpmm/instruction.ts +1 -1
- package/src/raydium/cpmm/type.ts +9 -2
|
@@ -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-
|
|
3
|
+
export { bC as LpToken, bB as SplToken, bz as TokenInfo, bA as TokenJson } from '../../type-3b373344.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-
|
|
3
|
-
export { j as default } from '../../raydium-
|
|
2
|
+
import '../../type-3b373344.js';
|
|
3
|
+
export { j as default } from '../../raydium-af1993ca.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-
|
|
23
|
+
import '../../type-502bbda1.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-
|
|
1
|
+
export { bC as LpToken, bB as SplToken, bz as TokenInfo, bA as TokenJson } from '../../type-3b373344.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-
|
|
3
|
+
import { bz as TokenInfo, a9 as BigNumberish, c1 as TokenAmount, e as ApiV3Token } from '../../type-3b373344.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-
|
|
5
|
+
import '../../type-3b373344.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-
|
|
17
|
+
import '../../type-502bbda1.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-
|
|
3
|
+
import { n as ApiV3PoolInfoItem, w as PoolKeys } from '../../type-3b373344.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-
|
|
16
|
+
import '../../type-502bbda1.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-
|
|
2
|
+
export { i as default } from '../../raydium-af1993ca.js';
|
|
3
3
|
import './type.js';
|
|
4
|
-
import '../../type-
|
|
4
|
+
import '../../type-3b373344.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-
|
|
24
|
+
import '../../type-502bbda1.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-
|
|
3
|
+
import { bK as TransferAmountFee, c6 as Price, c5 as Percent, c1 as TokenAmount, n as ApiV3PoolInfoItem, w as PoolKeys } from '../../type-3b373344.js';
|
|
4
4
|
import { Token } from '../../module/token.js';
|
|
5
|
-
import { c as ClmmPoolInfo } from '../../type-
|
|
5
|
+
import { c as ClmmPoolInfo } from '../../type-502bbda1.js';
|
|
6
6
|
import '@solana/spl-token';
|
|
7
7
|
import '../../common/txTool/txType.js';
|
|
8
8
|
import '../../common/owner.js';
|
package/lib/raydium/type.d.ts
CHANGED
|
@@ -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-
|
|
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-3b373344.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-
|
|
1
|
+
export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-af1993ca.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-
|
|
6
|
+
import '../../type-3b373344.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-
|
|
23
|
+
import '../../type-502bbda1.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-
|
|
4
|
+
export { S as SHOW_INFO, d as canClaimErrorType, U as default } from '../../raydium-af1993ca.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-
|
|
9
|
+
import '../../type-3b373344.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-
|
|
23
|
+
import '../../type-502bbda1.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-
|
|
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, bL as GetTransferAmountFee, 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-3b373344.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,7 +10,7 @@ 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-
|
|
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-502bbda1.js';
|
|
14
14
|
import { ClmmPositionLayout } from './raydium/clmm/layout.js';
|
|
15
15
|
import { CpmmConfigInfoInterface, CreateCpmmPoolParam, CreateCpmmPoolAddress, AddCpmmLiquidityParams, WithdrawCpmmLiquidityParams, CpmmSwapParams, ComputePairAmountParams } from './raydium/cpmm/type.js';
|
|
16
16
|
import { CpmmPoolInfoLayout } from './raydium/cpmm/layout.js';
|
|
@@ -235,9 +235,10 @@ declare class CpmmModule extends ModuleBase {
|
|
|
235
235
|
addLiquidity<T extends TxVersion>(params: AddCpmmLiquidityParams<T>): Promise<MakeTxData<T>>;
|
|
236
236
|
withdrawLiquidity<T extends TxVersion>(params: WithdrawCpmmLiquidityParams<T>): Promise<MakeTxData<T>>;
|
|
237
237
|
swap<T extends TxVersion>(params: CpmmSwapParams): Promise<MakeTxData<T>>;
|
|
238
|
-
computePairAmount({ poolInfo, amount, slippage, baseIn, }: ComputePairAmountParams): {
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
computePairAmount({ poolInfo, amount, slippage, epochInfo, baseIn, }: ComputePairAmountParams): {
|
|
239
|
+
inputAmountFee: GetTransferAmountFee;
|
|
240
|
+
anotherAmount: GetTransferAmountFee;
|
|
241
|
+
maxAnotherAmount: GetTransferAmountFee;
|
|
241
242
|
liquidity: BN__default;
|
|
242
243
|
};
|
|
243
244
|
}
|
|
@@ -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<
|
|
897
|
+
declare const VoterVotingMintConfig: Structure<number[] | PublicKey | 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<PublicKey | number[] | BN__defaul
|
|
|
904
904
|
reserved1: number[];
|
|
905
905
|
reserved2: BN__default[];
|
|
906
906
|
}>;
|
|
907
|
-
declare const VoterRegistrar: Structure<number |
|
|
907
|
+
declare const VoterRegistrar: Structure<number | number[] | PublicKey | 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 |
|
|
962
|
+
declare const Voter: Structure<number | number[] | PublicKey | Buffer | {
|
|
963
963
|
reserved: number[];
|
|
964
964
|
lockup: {
|
|
965
965
|
startTime: 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 { 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-
|
|
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-3b373344.js';
|
|
5
5
|
import { TxVersion } from './common/txTool/txType.js';
|
|
6
6
|
import { ClmmPositionLayout } from './raydium/clmm/layout.js';
|
|
7
7
|
|
package/package.json
CHANGED
package/src/raydium/cpmm/cpmm.ts
CHANGED
|
@@ -30,6 +30,8 @@ import {
|
|
|
30
30
|
import BN from "bn.js";
|
|
31
31
|
import { CpmmPoolInfoLayout, CpmmConfigInfoLayout } from "./layout";
|
|
32
32
|
import Decimal from "decimal.js";
|
|
33
|
+
import { getTransferAmountFeeV2 } from "@/common";
|
|
34
|
+
import { GetTransferAmountFee } from "@/raydium/type";
|
|
33
35
|
|
|
34
36
|
export default class CpmmModule extends ModuleBase {
|
|
35
37
|
constructor(params: ModuleBaseProps) {
|
|
@@ -192,7 +194,7 @@ export default class CpmmModule extends ModuleBase {
|
|
|
192
194
|
}
|
|
193
195
|
|
|
194
196
|
public async addLiquidity<T extends TxVersion>(params: AddCpmmLiquidityParams<T>): Promise<MakeTxData<T>> {
|
|
195
|
-
const { poolInfo, inputAmount, baseIn, slippage, computeBudgetConfig, config, txVersion } = params;
|
|
197
|
+
const { poolInfo, inputAmount, baseIn, slippage, computeResult, computeBudgetConfig, config, txVersion } = params;
|
|
196
198
|
|
|
197
199
|
if (this.scope.availability.addStandardPosition === false)
|
|
198
200
|
this.logAndCreateError("add liquidity feature disabled in your region");
|
|
@@ -209,7 +211,12 @@ export default class CpmmModule extends ModuleBase {
|
|
|
209
211
|
...config,
|
|
210
212
|
};
|
|
211
213
|
const rpcPoolData = await this.getRpcPoolInfo(poolInfo.id);
|
|
212
|
-
const {
|
|
214
|
+
const {
|
|
215
|
+
liquidity,
|
|
216
|
+
inputAmountFee,
|
|
217
|
+
anotherAmount: _anotherAmount,
|
|
218
|
+
} = computeResult ||
|
|
219
|
+
this.computePairAmount({
|
|
213
220
|
poolInfo: {
|
|
214
221
|
...poolInfo,
|
|
215
222
|
mintAmountA: new Decimal(rpcPoolData.baseReserve.toString()).div(10 ** poolInfo.mintA.decimals).toNumber(),
|
|
@@ -218,11 +225,13 @@ export default class CpmmModule extends ModuleBase {
|
|
|
218
225
|
},
|
|
219
226
|
slippage,
|
|
220
227
|
baseIn,
|
|
228
|
+
epochInfo: await this.scope.fetchEpochInfo(),
|
|
221
229
|
amount: new Decimal(inputAmount.toString()).div(
|
|
222
230
|
10 ** (baseIn ? poolInfo.mintA.decimals : poolInfo.mintB.decimals),
|
|
223
231
|
),
|
|
224
232
|
});
|
|
225
|
-
|
|
233
|
+
|
|
234
|
+
const anotherAmount = _anotherAmount.amount;
|
|
226
235
|
const mintAUseSOLBalance = poolInfo.mintA.address === NATIVE_MINT.toString();
|
|
227
236
|
const mintBUseSOLBalance = poolInfo.mintB.address === NATIVE_MINT.toString();
|
|
228
237
|
|
|
@@ -304,8 +313,8 @@ export default class CpmmModule extends ModuleBase {
|
|
|
304
313
|
new PublicKey(poolInfo.lpMint.address),
|
|
305
314
|
|
|
306
315
|
liquidity,
|
|
307
|
-
baseIn ?
|
|
308
|
-
baseIn ? anotherAmount :
|
|
316
|
+
baseIn ? inputAmountFee.amount : anotherAmount,
|
|
317
|
+
baseIn ? anotherAmount : inputAmountFee.amount,
|
|
309
318
|
),
|
|
310
319
|
],
|
|
311
320
|
instructionTypes: [InstructionType.CpmmAddLiquidity],
|
|
@@ -520,15 +529,34 @@ export default class CpmmModule extends ModuleBase {
|
|
|
520
529
|
amount,
|
|
521
530
|
// anotherToken,
|
|
522
531
|
slippage,
|
|
532
|
+
epochInfo,
|
|
523
533
|
baseIn,
|
|
524
|
-
}: ComputePairAmountParams): {
|
|
525
|
-
|
|
526
|
-
|
|
534
|
+
}: ComputePairAmountParams): {
|
|
535
|
+
inputAmountFee: GetTransferAmountFee;
|
|
536
|
+
anotherAmount: GetTransferAmountFee;
|
|
537
|
+
maxAnotherAmount: GetTransferAmountFee;
|
|
538
|
+
liquidity: BN;
|
|
539
|
+
} {
|
|
540
|
+
const coefficient = 1 - Number(slippage.toSignificant()) / 100;
|
|
541
|
+
const inputAmount = new BN(
|
|
542
|
+
new Decimal(amount)
|
|
543
|
+
.mul(10 ** poolInfo[baseIn ? "mintA" : "mintB"].decimals)
|
|
544
|
+
.mul(coefficient)
|
|
545
|
+
.toFixed(0),
|
|
546
|
+
);
|
|
547
|
+
const inputAmountFee = getTransferAmountFeeV2(
|
|
548
|
+
inputAmount,
|
|
549
|
+
poolInfo[baseIn ? "mintA" : "mintB"].extensions.feeConfig,
|
|
550
|
+
epochInfo,
|
|
551
|
+
false,
|
|
552
|
+
);
|
|
553
|
+
const _inputAmountWithoutFee = inputAmount.sub(inputAmountFee.fee ?? new BN(0));
|
|
527
554
|
|
|
528
555
|
const [baseReserve, quoteReserve] = [
|
|
529
556
|
new BN(new Decimal(poolInfo.mintAmountA).mul(10 ** poolInfo.mintA.decimals).toString()),
|
|
530
557
|
new BN(new Decimal(poolInfo.mintAmountB).mul(10 ** poolInfo.mintB.decimals).toString()),
|
|
531
558
|
];
|
|
559
|
+
|
|
532
560
|
const lpAmount = new BN(
|
|
533
561
|
new Decimal(poolInfo.lpAmount).mul(10 ** poolInfo.lpMint.decimals).toFixed(0, Decimal.ROUND_DOWN),
|
|
534
562
|
);
|
|
@@ -539,6 +567,8 @@ export default class CpmmModule extends ModuleBase {
|
|
|
539
567
|
baseIn ? poolInfo.mintA.symbol : poolInfo.mintB.symbol,
|
|
540
568
|
"amountIn:",
|
|
541
569
|
inputAmount.toString(),
|
|
570
|
+
"amountInFee:",
|
|
571
|
+
inputAmountFee.fee?.toString() ?? 0,
|
|
542
572
|
"anotherToken:",
|
|
543
573
|
baseIn ? poolInfo.mintB.symbol : poolInfo.mintA.symbol,
|
|
544
574
|
"slippage:",
|
|
@@ -549,23 +579,44 @@ export default class CpmmModule extends ModuleBase {
|
|
|
549
579
|
const input = baseIn ? "base" : "quote";
|
|
550
580
|
this.logDebug("input side:", input);
|
|
551
581
|
|
|
552
|
-
const liquidity =
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
582
|
+
const liquidity = _inputAmountWithoutFee.mul(lpAmount).div(input === "base" ? baseReserve : quoteReserve);
|
|
583
|
+
let anotherAmountFee: GetTransferAmountFee = {
|
|
584
|
+
amount: BN_ZERO,
|
|
585
|
+
fee: undefined,
|
|
586
|
+
expirationTime: undefined,
|
|
587
|
+
};
|
|
588
|
+
if (!_inputAmountWithoutFee.isZero()) {
|
|
589
|
+
anotherAmountFee = getTransferAmountFeeV2(
|
|
590
|
+
lpToAmount(liquidity, baseReserve, quoteReserve, lpAmount)[baseIn ? "amountB" : "amountA"],
|
|
591
|
+
poolInfo[baseIn ? "mintB" : "mintA"].extensions.feeConfig,
|
|
592
|
+
epochInfo,
|
|
593
|
+
true,
|
|
594
|
+
);
|
|
557
595
|
}
|
|
558
596
|
|
|
559
597
|
const _slippage = new Percent(new BN(1)).add(slippage);
|
|
560
|
-
const slippageAdjustedAmount =
|
|
598
|
+
const slippageAdjustedAmount = getTransferAmountFeeV2(
|
|
599
|
+
_slippage.mul(anotherAmountFee.amount.sub(anotherAmountFee.amount ?? new BN(0))).quotient,
|
|
600
|
+
poolInfo[baseIn ? "mintB" : "mintA"].extensions.feeConfig,
|
|
601
|
+
epochInfo,
|
|
602
|
+
true,
|
|
603
|
+
);
|
|
561
604
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
605
|
+
this.logDebug(
|
|
606
|
+
"anotherAmount:",
|
|
607
|
+
anotherAmountFee.amount.toString(),
|
|
608
|
+
"anotherAmountFee:",
|
|
609
|
+
anotherAmountFee.fee?.toString() ?? 0,
|
|
610
|
+
"maxAnotherAmount:",
|
|
611
|
+
slippageAdjustedAmount.amount.toString(),
|
|
612
|
+
"maxAnotherAmountFee:",
|
|
613
|
+
slippageAdjustedAmount.fee?.toString() ?? 0,
|
|
614
|
+
);
|
|
565
615
|
|
|
566
616
|
return {
|
|
567
|
-
|
|
568
|
-
|
|
617
|
+
inputAmountFee,
|
|
618
|
+
anotherAmount: anotherAmountFee,
|
|
619
|
+
maxAnotherAmount: slippageAdjustedAmount,
|
|
569
620
|
liquidity,
|
|
570
621
|
};
|
|
571
622
|
}
|
|
@@ -5,7 +5,7 @@ import { TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID }
|
|
|
5
5
|
import { SYSTEM_PROGRAM_ID, RENT_PROGRAM_ID, MEMO_PROGRAM_ID2, createLogger } from "@/common";
|
|
6
6
|
|
|
7
7
|
import { struct, u64 } from "@/marshmallow";
|
|
8
|
-
const logger = createLogger("
|
|
8
|
+
const logger = createLogger("Raydium_cpmm");
|
|
9
9
|
const anchorDataBuf = {
|
|
10
10
|
initialize: [175, 175, 109, 31, 13, 152, 155, 237],
|
|
11
11
|
deposit: [242, 35, 198, 137, 82, 225, 242, 182],
|
package/src/raydium/cpmm/type.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PublicKey } from "@solana/web3.js";
|
|
1
|
+
import { EpochInfo, PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { ApiV3PoolInfoStandardItemCpmm, ApiV3Token } from "@/api/type";
|
|
3
3
|
import { TxVersion } from "@/common/txTool/txType";
|
|
4
4
|
import BN from "bn.js";
|
|
5
|
-
import { ComputeBudgetConfig } from "@/raydium/type";
|
|
5
|
+
import { ComputeBudgetConfig, GetTransferAmountFee } from "@/raydium/type";
|
|
6
6
|
import { SwapResult } from "./curve/calculator";
|
|
7
7
|
import { Percent } from "@/module";
|
|
8
8
|
import Decimal from "decimal.js";
|
|
@@ -96,6 +96,12 @@ export interface AddCpmmLiquidityParams<T = TxVersion.LEGACY> {
|
|
|
96
96
|
};
|
|
97
97
|
computeBudgetConfig?: ComputeBudgetConfig;
|
|
98
98
|
txVersion?: T;
|
|
99
|
+
computeResult?: {
|
|
100
|
+
inputAmountFee: GetTransferAmountFee;
|
|
101
|
+
anotherAmount: GetTransferAmountFee;
|
|
102
|
+
maxAnotherAmount: GetTransferAmountFee;
|
|
103
|
+
liquidity: BN;
|
|
104
|
+
};
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
export interface WithdrawCpmmLiquidityParams<T = TxVersion.LEGACY> {
|
|
@@ -125,5 +131,6 @@ export interface ComputePairAmountParams {
|
|
|
125
131
|
poolInfo: ApiV3PoolInfoStandardItemCpmm;
|
|
126
132
|
amount: string | Decimal;
|
|
127
133
|
slippage: Percent;
|
|
134
|
+
epochInfo: EpochInfo;
|
|
128
135
|
baseIn?: boolean;
|
|
129
136
|
}
|