@raydium-io/raydium-sdk-v2 0.0.28-alpha → 0.0.29-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/account.js +1 -1
- package/lib/raydium/account/account.js.map +1 -1
- package/lib/raydium/account/account.mjs +1 -1
- package/lib/raydium/account/account.mjs.map +1 -1
- 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 +3 -3
- package/lib/raydium/cpmm/index.d.ts +1 -1
- package/lib/raydium/cpmm/type.d.ts +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-a8b6c65a.d.ts → raydium-4ac54b85.d.ts} +3 -3
- package/lib/raydium-d75706f4.d.ts +530 -0
- package/lib/{type-502bbda1.d.ts → type-5c2ec3f0.d.ts} +1 -1
- package/lib/type-6fd96950.d.ts +608 -0
- package/lib/type-83523f5f.d.ts +1415 -0
- package/package.json +1 -1
- package/src/raydium/account/account.ts +1 -2
- package/lib/{type-3b373344.d.ts → type-322fdce2.d.ts} +5 -5
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { PublicKey, Commitment, Connection, Transaction, Signer, TransactionInstruction, Keypair, EpochInfo } from '@solana/web3.js';
|
|
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-83523f5f.js';
|
|
4
|
+
import { API_URL_CONFIG } from './api/url.js';
|
|
5
|
+
import { Owner } from './common/owner.js';
|
|
6
|
+
import { Cluster } from './solana/type.js';
|
|
7
|
+
import { TokenAccount, TokenAccountRaw, GetOrCreateTokenAccountParams, HandleTokenAccountParams } from './raydium/account/types.js';
|
|
8
|
+
import { Logger } from './common/logger.js';
|
|
9
|
+
import { TxVersion } from './common/txTool/txType.js';
|
|
10
|
+
import BN__default from 'bn.js';
|
|
11
|
+
import Decimal from 'decimal.js';
|
|
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-6fd96950.js';
|
|
14
|
+
import { ClmmPositionLayout } from './raydium/clmm/layout.js';
|
|
15
|
+
import { CpmmConfigInfoInterface, CreateCpmmPoolParam, CreateCpmmPoolAddress, AddCpmmLiquidityParams, WithdrawCpmmLiquidityParams, CpmmSwapParams, ComputePairAmountParams } from './raydium/cpmm/type.js';
|
|
16
|
+
import { CpmmPoolInfoLayout } from './raydium/cpmm/layout.js';
|
|
17
|
+
import { PoolAccountInfoV4, ReturnTypeGetAddLiquidityDefaultPool } from './raydium/tradeV2/type.js';
|
|
18
|
+
import { Structure } from './marshmallow/index.js';
|
|
19
|
+
|
|
20
|
+
interface ModuleBaseProps {
|
|
21
|
+
scope: Raydium;
|
|
22
|
+
moduleName: string;
|
|
23
|
+
}
|
|
24
|
+
declare class ModuleBase {
|
|
25
|
+
scope: Raydium;
|
|
26
|
+
private disabled;
|
|
27
|
+
protected logger: Logger;
|
|
28
|
+
constructor({ scope, moduleName }: ModuleBaseProps);
|
|
29
|
+
protected createTxBuilder(feePayer?: PublicKey): TxBuilder;
|
|
30
|
+
logDebug(...args: (string | number | Record<string, any>)[]): void;
|
|
31
|
+
logInfo(...args: (string | number | Record<string, any>)[]): void;
|
|
32
|
+
logAndCreateError(...args: (string | number | Record<string, any>)[]): void;
|
|
33
|
+
checkDisabled(): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface TokenAccountDataProp {
|
|
37
|
+
tokenAccounts?: TokenAccount[];
|
|
38
|
+
tokenAccountRawInfos?: TokenAccountRaw[];
|
|
39
|
+
}
|
|
40
|
+
declare class Account extends ModuleBase {
|
|
41
|
+
private _tokenAccounts;
|
|
42
|
+
private _tokenAccountRawInfos;
|
|
43
|
+
private _accountChangeListenerId?;
|
|
44
|
+
private _accountListener;
|
|
45
|
+
private _clientOwnedToken;
|
|
46
|
+
constructor(params: TokenAccountDataProp & ModuleBaseProps);
|
|
47
|
+
get tokenAccounts(): TokenAccount[];
|
|
48
|
+
get tokenAccountRawInfos(): TokenAccountRaw[];
|
|
49
|
+
updateTokenAccount({ tokenAccounts, tokenAccountRawInfos }: TokenAccountDataProp): Account;
|
|
50
|
+
addAccountChangeListener(cbk: (data: TokenAccountDataProp) => void): Account;
|
|
51
|
+
removeAccountChangeListener(cbk: (data: TokenAccountDataProp) => void): Account;
|
|
52
|
+
getAssociatedTokenAccount(mint: PublicKey, programId?: PublicKey): PublicKey;
|
|
53
|
+
fetchWalletTokenAccounts(config?: {
|
|
54
|
+
forceUpdate?: boolean;
|
|
55
|
+
commitment?: Commitment;
|
|
56
|
+
}): Promise<{
|
|
57
|
+
tokenAccounts: TokenAccount[];
|
|
58
|
+
tokenAccountRawInfos: TokenAccountRaw[];
|
|
59
|
+
}>;
|
|
60
|
+
getCreatedTokenAccount({ mint, programId, associatedOnly, }: {
|
|
61
|
+
mint: PublicKey;
|
|
62
|
+
programId?: PublicKey;
|
|
63
|
+
associatedOnly?: boolean;
|
|
64
|
+
}): Promise<PublicKey | undefined>;
|
|
65
|
+
getOrCreateTokenAccount(params: GetOrCreateTokenAccountParams): Promise<{
|
|
66
|
+
account?: PublicKey;
|
|
67
|
+
instructionParams?: AddInstructionParam;
|
|
68
|
+
}>;
|
|
69
|
+
checkOrCreateAta({ mint, programId, autoUnwrapWSOLToSOL, }: {
|
|
70
|
+
mint: PublicKey;
|
|
71
|
+
programId?: PublicKey;
|
|
72
|
+
autoUnwrapWSOLToSOL?: boolean;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
pubKey: PublicKey;
|
|
75
|
+
newInstructions: AddInstructionParam;
|
|
76
|
+
}>;
|
|
77
|
+
handleTokenAccount(params: HandleTokenAccountParams): Promise<AddInstructionParam & {
|
|
78
|
+
tokenAccount: PublicKey;
|
|
79
|
+
}>;
|
|
80
|
+
processTokenAccount(props: {
|
|
81
|
+
mint: PublicKey;
|
|
82
|
+
programId?: PublicKey;
|
|
83
|
+
amount?: BigNumberish;
|
|
84
|
+
useSOLBalance?: boolean;
|
|
85
|
+
handleTokenAccount?: boolean;
|
|
86
|
+
}): Promise<Promise<AddInstructionParam & {
|
|
87
|
+
tokenAccount?: PublicKey;
|
|
88
|
+
}>>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class Farm extends ModuleBase {
|
|
92
|
+
private _getUserRewardInfo;
|
|
93
|
+
create<T extends TxVersion>({ poolInfo: propPoolInfo, rewardInfos, payer, programId, txVersion, }: CreateFarm<T>): Promise<MakeTxData<T, CreateFarmExtInfo>>;
|
|
94
|
+
restartReward<T extends TxVersion>({ farmInfo, payer, newRewardInfo, txVersion, }: UpdateFarmReward): Promise<MakeTxData<T>>;
|
|
95
|
+
restartRewards<T extends TxVersion>({ farmInfo, payer, newRewardInfos, txVersion, }: UpdateFarmRewards<T>): Promise<MakeTxData<T>>;
|
|
96
|
+
addNewRewardToken<T extends TxVersion>(params: UpdateFarmReward): Promise<MakeTxData<T>>;
|
|
97
|
+
addNewRewardsToken<T extends TxVersion>(params: UpdateFarmRewards<T>): Promise<MakeTxData<T>>;
|
|
98
|
+
deposit<T extends TxVersion>(params: FarmDWParam<T>): Promise<MakeTxData<T>>;
|
|
99
|
+
withdraw<T extends TxVersion>(params: FarmDWParam<T>): Promise<MakeTxData<T>>;
|
|
100
|
+
withdrawFarmReward<T extends TxVersion>({ farmInfo, withdrawMint, txVersion, }: {
|
|
101
|
+
farmInfo: FormatFarmInfoOut;
|
|
102
|
+
withdrawMint: PublicKey;
|
|
103
|
+
payer?: PublicKey;
|
|
104
|
+
txVersion?: T;
|
|
105
|
+
}): Promise<MakeTxData<T>>;
|
|
106
|
+
harvestAllRewards<T extends TxVersion = TxVersion.LEGACY>(params: {
|
|
107
|
+
farmInfoList: Record<string, FormatFarmInfoOut>;
|
|
108
|
+
feePayer?: PublicKey;
|
|
109
|
+
useSOLBalance?: boolean;
|
|
110
|
+
associatedOnly?: boolean;
|
|
111
|
+
checkCreateATAOwner?: boolean;
|
|
112
|
+
userAuxiliaryLedgers?: string[];
|
|
113
|
+
txVersion?: T;
|
|
114
|
+
computeBudgetConfig?: ComputeBudgetConfig;
|
|
115
|
+
}): Promise<MakeMultiTxData<T>>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare class LiquidityModule extends ModuleBase {
|
|
119
|
+
private stableLayout;
|
|
120
|
+
constructor(params: ModuleBaseProps);
|
|
121
|
+
initLayout(): Promise<void>;
|
|
122
|
+
load(): Promise<void>;
|
|
123
|
+
computePairAmount({ poolInfo, amount, slippage, baseIn, }: {
|
|
124
|
+
poolInfo: ApiV3PoolInfoStandardItem;
|
|
125
|
+
amount: string | Decimal;
|
|
126
|
+
slippage: Percent;
|
|
127
|
+
baseIn?: boolean;
|
|
128
|
+
}): {
|
|
129
|
+
anotherAmount: TokenAmount;
|
|
130
|
+
maxAnotherAmount: TokenAmount;
|
|
131
|
+
liquidity: BN__default;
|
|
132
|
+
};
|
|
133
|
+
getAmmPoolKeys(poolId: string): Promise<AmmV4Keys | AmmV5Keys>;
|
|
134
|
+
addLiquidity<T extends TxVersion>(params: AddLiquidityParams<T>): Promise<MakeTxData<T>>;
|
|
135
|
+
removeLiquidity<T extends TxVersion>(params: RemoveParams<T>): Promise<Promise<MakeTxData<T>>>;
|
|
136
|
+
removeAllLpAndCreateClmmPosition<T extends TxVersion>({ poolInfo, clmmPoolInfo, removeLpAmount, createPositionInfo, farmInfo, userFarmLpAmount, base, computeBudgetConfig, payer, tokenProgram, checkCreateATAOwner, getEphemeralSigners, txVersion, }: {
|
|
137
|
+
poolInfo: ApiV3PoolInfoStandardItem;
|
|
138
|
+
clmmPoolInfo: ApiV3PoolInfoConcentratedItem;
|
|
139
|
+
removeLpAmount: BN__default;
|
|
140
|
+
createPositionInfo: {
|
|
141
|
+
tickLower: number;
|
|
142
|
+
tickUpper: number;
|
|
143
|
+
baseAmount: BN__default;
|
|
144
|
+
otherAmountMax: BN__default;
|
|
145
|
+
};
|
|
146
|
+
farmInfo?: FormatFarmInfoOutV6;
|
|
147
|
+
userFarmLpAmount?: BN__default;
|
|
148
|
+
base: "MintA" | "MintB";
|
|
149
|
+
payer?: PublicKey;
|
|
150
|
+
computeBudgetConfig?: ComputeBudgetConfig;
|
|
151
|
+
tokenProgram?: PublicKey;
|
|
152
|
+
checkCreateATAOwner?: boolean;
|
|
153
|
+
txVersion?: T;
|
|
154
|
+
getEphemeralSigners?: (k: number) => any;
|
|
155
|
+
}): Promise<MakeMultiTxData<T>>;
|
|
156
|
+
createPoolV4<T extends TxVersion>({ programId, marketInfo, baseMintInfo, quoteMintInfo, baseAmount, quoteAmount, startTime, ownerInfo, associatedOnly, checkCreateATAOwner, tokenProgram, txVersion, feeDestinationId, computeBudgetConfig, }: CreatePoolParam<T>): Promise<MakeTxData<T, {
|
|
157
|
+
address: CreatePoolAddress;
|
|
158
|
+
}>>;
|
|
159
|
+
getCreatePoolFee({ programId }: {
|
|
160
|
+
programId: PublicKey;
|
|
161
|
+
}): Promise<BN__default>;
|
|
162
|
+
computeAmountOut({ poolInfo, amountIn, mintIn, mintOut, slippage }: ComputeAmountOutParam): {
|
|
163
|
+
amountOut: BN__default;
|
|
164
|
+
minAmountOut: BN__default;
|
|
165
|
+
currentPrice: Decimal;
|
|
166
|
+
executionPrice: Decimal;
|
|
167
|
+
priceImpact: Decimal;
|
|
168
|
+
fee: BN__default;
|
|
169
|
+
};
|
|
170
|
+
swap<T extends TxVersion>({ poolInfo, amountIn, amountOut, inputMint, fixedSide, txVersion, computeBudgetConfig, }: SwapParam<T>): Promise<MakeTxData<T>>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
declare class Clmm extends ModuleBase {
|
|
174
|
+
constructor(params: ModuleBaseProps);
|
|
175
|
+
getClmmPoolKeys(poolId: string): Promise<ClmmKeys>;
|
|
176
|
+
createPool<T extends TxVersion>(props: CreateConcentratedPool<T>): Promise<MakeTxData<T, {
|
|
177
|
+
mockPoolInfo: ApiV3PoolInfoConcentratedItem;
|
|
178
|
+
address: ClmmKeys;
|
|
179
|
+
}>>;
|
|
180
|
+
openPositionFromBase<T extends TxVersion>({ poolInfo, poolKeys: propPoolKeys, ownerInfo, tickLower, tickUpper, base, baseAmount, otherAmountMax, associatedOnly, checkCreateATAOwner, withMetadata, getEphemeralSigners, computeBudgetConfig, txVersion, }: OpenPositionFromBase<T>): Promise<MakeTxData<T, OpenPositionFromBaseExtInfo>>;
|
|
181
|
+
openPositionFromLiquidity<T extends TxVersion>({ poolInfo, poolKeys: propPoolKeys, ownerInfo, amountMaxA, amountMaxB, tickLower, tickUpper, liquidity, associatedOnly, checkCreateATAOwner, withMetadata, txVersion, getEphemeralSigners, }: OpenPositionFromLiquidity<T>): Promise<MakeTxData<T, OpenPositionFromLiquidityExtInfo>>;
|
|
182
|
+
increasePositionFromLiquidity<T extends TxVersion>(props: IncreasePositionFromLiquidity<T>): Promise<MakeTxData<T, ManipulateLiquidityExtInfo>>;
|
|
183
|
+
increasePositionFromBase<T extends TxVersion>(props: IncreasePositionFromBase<T>): Promise<MakeTxData<T, ManipulateLiquidityExtInfo>>;
|
|
184
|
+
decreaseLiquidity<T extends TxVersion>(props: DecreaseLiquidity<T>): Promise<MakeTxData<T, ManipulateLiquidityExtInfo & Partial<ClosePositionExtInfo>>>;
|
|
185
|
+
closePosition<T extends TxVersion>({ poolInfo, ownerPosition, txVersion, }: {
|
|
186
|
+
poolInfo: ApiV3PoolInfoConcentratedItem;
|
|
187
|
+
ownerPosition: ClmmPositionLayout;
|
|
188
|
+
txVersion: T;
|
|
189
|
+
}): Promise<MakeTxData<T, ClosePositionExtInfo>>;
|
|
190
|
+
initReward<T extends TxVersion>({ poolInfo, ownerInfo, rewardInfo, associatedOnly, checkCreateATAOwner, computeBudgetConfig, txVersion, }: InitRewardParams<T>): Promise<MakeTxData<T, InitRewardExtInfo>>;
|
|
191
|
+
initRewards<T extends TxVersion>({ poolInfo, ownerInfo, rewardInfos, associatedOnly, checkCreateATAOwner, computeBudgetConfig, txVersion, }: InitRewardsParams<T>): Promise<MakeTxData<T, {
|
|
192
|
+
address: Record<string, PublicKey>;
|
|
193
|
+
}>>;
|
|
194
|
+
setReward<T extends TxVersion>({ poolInfo, ownerInfo, rewardInfo, associatedOnly, checkCreateATAOwner, computeBudgetConfig, txVersion, }: SetRewardParams<T>): Promise<MakeTxData<T, {
|
|
195
|
+
address: Record<string, PublicKey>;
|
|
196
|
+
}>>;
|
|
197
|
+
setRewards<T extends TxVersion>({ poolInfo, ownerInfo, rewardInfos, associatedOnly, checkCreateATAOwner, computeBudgetConfig, txVersion, }: SetRewardsParams<T>): Promise<MakeTxData<T, {
|
|
198
|
+
address: Record<string, PublicKey>;
|
|
199
|
+
}>>;
|
|
200
|
+
collectReward({ poolInfo, ownerInfo, rewardMint, associatedOnly, checkCreateATAOwner, }: CollectRewardParams): Promise<MakeTransaction>;
|
|
201
|
+
collectRewards({ poolInfo, ownerInfo, rewardMints, associatedOnly, checkCreateATAOwner, }: CollectRewardsParams): Promise<MakeTransaction>;
|
|
202
|
+
swap<T extends TxVersion>({ poolInfo, inputMint, amountIn, amountOutMin, priceLimit, ownerInfo, remainingAccounts, associatedOnly, checkCreateATAOwner, txVersion, }: {
|
|
203
|
+
poolInfo: ApiV3PoolInfoConcentratedItem;
|
|
204
|
+
inputMint: string | PublicKey;
|
|
205
|
+
amountIn: BN__default;
|
|
206
|
+
amountOutMin: BN__default;
|
|
207
|
+
priceLimit?: Decimal;
|
|
208
|
+
ownerInfo: {
|
|
209
|
+
useSOLBalance?: boolean;
|
|
210
|
+
feePayer?: PublicKey;
|
|
211
|
+
};
|
|
212
|
+
remainingAccounts: PublicKey[];
|
|
213
|
+
associatedOnly?: boolean;
|
|
214
|
+
checkCreateATAOwner?: boolean;
|
|
215
|
+
txVersion?: T;
|
|
216
|
+
}): Promise<MakeTxData<T>>;
|
|
217
|
+
harvestAllRewards<T extends TxVersion = TxVersion.LEGACY>({ allPoolInfo, allPositions, ownerInfo, associatedOnly, checkCreateATAOwner, programId, txVersion, computeBudgetConfig, }: HarvestAllRewardsParams<T>): Promise<MakeMultiTxData<T>>;
|
|
218
|
+
getWhiteListMint({ programId }: {
|
|
219
|
+
programId: PublicKey;
|
|
220
|
+
}): Promise<PublicKey[]>;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
declare class CpmmModule extends ModuleBase {
|
|
224
|
+
constructor(params: ModuleBaseProps);
|
|
225
|
+
load(): Promise<void>;
|
|
226
|
+
getCpmmPoolKeys(poolId: string): Promise<CpmmKeys>;
|
|
227
|
+
getRpcPoolInfo(poolId: string, fetchConfigInfo?: boolean): Promise<ReturnType<typeof CpmmPoolInfoLayout.decode> & {
|
|
228
|
+
baseReserve: BN__default;
|
|
229
|
+
quoteReserve: BN__default;
|
|
230
|
+
configInfo?: CpmmConfigInfoInterface;
|
|
231
|
+
}>;
|
|
232
|
+
createPool<T extends TxVersion>({ programId, poolFeeAccount, startTime, ownerInfo, associatedOnly, checkCreateATAOwner, txVersion, computeBudgetConfig, ...params }: CreateCpmmPoolParam<T>): Promise<MakeTxData<T, {
|
|
233
|
+
address: CreateCpmmPoolAddress;
|
|
234
|
+
}>>;
|
|
235
|
+
addLiquidity<T extends TxVersion>(params: AddCpmmLiquidityParams<T>): Promise<MakeTxData<T>>;
|
|
236
|
+
withdrawLiquidity<T extends TxVersion>(params: WithdrawCpmmLiquidityParams<T>): Promise<MakeTxData<T>>;
|
|
237
|
+
swap<T extends TxVersion>(params: CpmmSwapParams): Promise<MakeTxData<T>>;
|
|
238
|
+
computePairAmount({ poolInfo, amount, slippage, baseIn, }: ComputePairAmountParams): {
|
|
239
|
+
anotherAmount: TokenAmount;
|
|
240
|
+
maxAnotherAmount: TokenAmount;
|
|
241
|
+
liquidity: BN__default;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
declare type LiquidityPoolJsonInfo = any;
|
|
246
|
+
declare class TradeV2 extends ModuleBase {
|
|
247
|
+
constructor(params: ModuleBaseProps);
|
|
248
|
+
static getAddLiquidityDefaultPool({ addLiquidityPools, poolInfosCache, }: {
|
|
249
|
+
addLiquidityPools: LiquidityPoolJsonInfo[];
|
|
250
|
+
poolInfosCache: {
|
|
251
|
+
[ammId: string]: PoolAccountInfoV4;
|
|
252
|
+
};
|
|
253
|
+
}): ReturnTypeGetAddLiquidityDefaultPool;
|
|
254
|
+
private static comparePoolSize;
|
|
255
|
+
private getWSolAccounts;
|
|
256
|
+
unWrapWSol(props: {
|
|
257
|
+
amount: BigNumberish;
|
|
258
|
+
computeBudgetConfig?: ComputeBudgetConfig;
|
|
259
|
+
tokenProgram?: PublicKey;
|
|
260
|
+
}): Promise<MakeTransaction>;
|
|
261
|
+
wrapWSol(amount: BigNumberish, tokenProgram?: PublicKey): Promise<MakeTransaction>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
interface SHOW_INFO {
|
|
265
|
+
programId: PublicKey;
|
|
266
|
+
poolId: PublicKey;
|
|
267
|
+
ammId: PublicKey;
|
|
268
|
+
ownerAccountId: PublicKey;
|
|
269
|
+
snapshotLpAmount: BN__default;
|
|
270
|
+
openTime: number;
|
|
271
|
+
endTime: number;
|
|
272
|
+
project: typeof Utils1216.VERSION_PROJECT[number];
|
|
273
|
+
canClaim: boolean;
|
|
274
|
+
canClaimErrorType: canClaimErrorType;
|
|
275
|
+
tokenInfo: {
|
|
276
|
+
mintAddress: PublicKey;
|
|
277
|
+
mintVault: PublicKey;
|
|
278
|
+
mintDecimals: number;
|
|
279
|
+
perLpLoss: BN__default;
|
|
280
|
+
debtAmount: BN__default;
|
|
281
|
+
}[];
|
|
282
|
+
}
|
|
283
|
+
declare type canClaimErrorType = "outOfOperationalTime" | "alreadyClaimIt" | undefined;
|
|
284
|
+
declare class Utils1216 extends ModuleBase {
|
|
285
|
+
static CLAIMED_NUM: number;
|
|
286
|
+
static POOL_LAYOUT: Structure<number | PublicKey | Buffer | BN__default | BN__default[] | {
|
|
287
|
+
mintDecimals: number;
|
|
288
|
+
mintAddress: PublicKey;
|
|
289
|
+
mintVault: PublicKey;
|
|
290
|
+
perLpLoss: BN__default;
|
|
291
|
+
totalClaimedAmount: BN__default;
|
|
292
|
+
}[], "", {
|
|
293
|
+
padding: BN__default[];
|
|
294
|
+
bump: number;
|
|
295
|
+
endTime: BN__default;
|
|
296
|
+
openTime: BN__default;
|
|
297
|
+
status: number;
|
|
298
|
+
ammId: PublicKey;
|
|
299
|
+
tokenInfo: {
|
|
300
|
+
mintDecimals: number;
|
|
301
|
+
mintAddress: PublicKey;
|
|
302
|
+
mintVault: PublicKey;
|
|
303
|
+
perLpLoss: BN__default;
|
|
304
|
+
totalClaimedAmount: BN__default;
|
|
305
|
+
}[];
|
|
306
|
+
}>;
|
|
307
|
+
static OWNER_LAYOUT: Structure<number | PublicKey | Buffer | BN__default | BN__default[] | {
|
|
308
|
+
mintAddress: PublicKey;
|
|
309
|
+
debtAmount: BN__default;
|
|
310
|
+
claimedAmount: BN__default;
|
|
311
|
+
}[], "", {
|
|
312
|
+
padding: BN__default[];
|
|
313
|
+
owner: PublicKey;
|
|
314
|
+
version: number;
|
|
315
|
+
bump: number;
|
|
316
|
+
poolId: PublicKey;
|
|
317
|
+
lpAmount: BN__default;
|
|
318
|
+
tokenInfo: {
|
|
319
|
+
mintAddress: PublicKey;
|
|
320
|
+
debtAmount: BN__default;
|
|
321
|
+
claimedAmount: BN__default;
|
|
322
|
+
}[];
|
|
323
|
+
}>;
|
|
324
|
+
static DEFAULT_POOL_ID: PublicKey[];
|
|
325
|
+
static SEED_CONFIG: {
|
|
326
|
+
pool: {
|
|
327
|
+
id: Buffer;
|
|
328
|
+
};
|
|
329
|
+
owner: {
|
|
330
|
+
id: Buffer;
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
static VERSION_PROJECT: readonly [undefined, "Francium", "Tulip", "Larix"];
|
|
334
|
+
static getPdaPoolId(programId: PublicKey, ammId: PublicKey): {
|
|
335
|
+
publicKey: PublicKey;
|
|
336
|
+
nonce: number;
|
|
337
|
+
};
|
|
338
|
+
static getPdaOwnerId(programId: PublicKey, poolId: PublicKey, owner: PublicKey, version: number): {
|
|
339
|
+
publicKey: PublicKey;
|
|
340
|
+
nonce: number;
|
|
341
|
+
};
|
|
342
|
+
static getAllInfo({ connection, programId, poolIds, wallet, chainTime, }: {
|
|
343
|
+
connection: Connection;
|
|
344
|
+
programId: PublicKey;
|
|
345
|
+
poolIds: PublicKey[];
|
|
346
|
+
wallet: PublicKey;
|
|
347
|
+
chainTime: number;
|
|
348
|
+
}): Promise<SHOW_INFO[]>;
|
|
349
|
+
makeClaimTransaction({ poolInfo, ownerInfo, }: {
|
|
350
|
+
connection: Connection;
|
|
351
|
+
poolInfo: SHOW_INFO;
|
|
352
|
+
ownerInfo: {
|
|
353
|
+
wallet?: PublicKey;
|
|
354
|
+
associatedOnly: boolean;
|
|
355
|
+
};
|
|
356
|
+
}): Promise<{
|
|
357
|
+
transaction: Transaction;
|
|
358
|
+
signer: Signer[];
|
|
359
|
+
}[]>;
|
|
360
|
+
makeClaimAllTransaction({ poolInfos, ownerInfo, }: {
|
|
361
|
+
poolInfos: SHOW_INFO[];
|
|
362
|
+
ownerInfo: {
|
|
363
|
+
wallet?: PublicKey;
|
|
364
|
+
associatedOnly: boolean;
|
|
365
|
+
};
|
|
366
|
+
}): Promise<{
|
|
367
|
+
transaction: Transaction;
|
|
368
|
+
signer: Signer[];
|
|
369
|
+
}[]>;
|
|
370
|
+
static makeClaimInstruction({ programId, poolInfo, ownerInfo, }: {
|
|
371
|
+
programId: PublicKey;
|
|
372
|
+
poolInfo: SHOW_INFO;
|
|
373
|
+
ownerInfo: {
|
|
374
|
+
wallet: PublicKey;
|
|
375
|
+
ownerPda: PublicKey;
|
|
376
|
+
claimAddress: PublicKey[];
|
|
377
|
+
};
|
|
378
|
+
}): TransactionInstruction;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
interface ExtInfo {
|
|
382
|
+
address: {
|
|
383
|
+
marketId: PublicKey;
|
|
384
|
+
requestQueue: PublicKey;
|
|
385
|
+
eventQueue: PublicKey;
|
|
386
|
+
bids: PublicKey;
|
|
387
|
+
asks: PublicKey;
|
|
388
|
+
baseVault: PublicKey;
|
|
389
|
+
quoteVault: PublicKey;
|
|
390
|
+
baseMint: PublicKey;
|
|
391
|
+
quoteMin: PublicKey;
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
declare class MarketV2$1 extends ModuleBase {
|
|
395
|
+
create<T extends TxVersion>({ baseInfo, quoteInfo, lotSize, // 1
|
|
396
|
+
tickSize, // 0.01
|
|
397
|
+
dexProgramId, txVersion, computeBudgetConfig, }: {
|
|
398
|
+
baseInfo: {
|
|
399
|
+
mint: PublicKey;
|
|
400
|
+
decimals: number;
|
|
401
|
+
};
|
|
402
|
+
quoteInfo: {
|
|
403
|
+
mint: PublicKey;
|
|
404
|
+
decimals: number;
|
|
405
|
+
};
|
|
406
|
+
lotSize: number;
|
|
407
|
+
tickSize: number;
|
|
408
|
+
dexProgramId: PublicKey;
|
|
409
|
+
eventQueue?: PublicKey;
|
|
410
|
+
requestQueue?: PublicKey;
|
|
411
|
+
txVersion?: T;
|
|
412
|
+
computeBudgetConfig?: ComputeBudgetConfig;
|
|
413
|
+
}): Promise<MakeMultiTxData<T, ExtInfo>>;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
declare class MarketV2 extends ModuleBase {
|
|
417
|
+
claim<T extends TxVersion>({ ownerInfo, idoKeys, associatedOnly, checkCreateATAOwner, txVersion, }: {
|
|
418
|
+
ownerInfo: OwnerIdoInfo[keyof OwnerIdoInfo] & {
|
|
419
|
+
userIdoInfo: string;
|
|
420
|
+
};
|
|
421
|
+
idoKeys: IdoKeysData;
|
|
422
|
+
associatedOnly?: boolean;
|
|
423
|
+
checkCreateATAOwner?: boolean;
|
|
424
|
+
txVersion?: T;
|
|
425
|
+
}): Promise<MakeTxData>;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
declare class TokenModule extends ModuleBase {
|
|
429
|
+
private _tokenList;
|
|
430
|
+
private _tokenMap;
|
|
431
|
+
private _blackTokenMap;
|
|
432
|
+
private _mintGroup;
|
|
433
|
+
private _extraTokenList;
|
|
434
|
+
constructor(params: ModuleBaseProps);
|
|
435
|
+
load(params?: LoadParams & {
|
|
436
|
+
type?: JupTokenType;
|
|
437
|
+
}): Promise<void>;
|
|
438
|
+
get tokenList(): TokenInfo[];
|
|
439
|
+
get tokenMap(): Map<string, TokenInfo>;
|
|
440
|
+
get blackTokenMap(): Map<string, TokenInfo>;
|
|
441
|
+
get mintGroup(): {
|
|
442
|
+
official: Set<string>;
|
|
443
|
+
jup: Set<string>;
|
|
444
|
+
};
|
|
445
|
+
/** === util functions === */
|
|
446
|
+
getTokenInfo(mint: string | PublicKey): Promise<ApiV3Token>;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
interface RaydiumLoadParams extends TokenAccountDataProp, Omit<RaydiumApiBatchRequestParams, "api"> {
|
|
450
|
+
connection: Connection;
|
|
451
|
+
cluster?: Cluster;
|
|
452
|
+
owner?: PublicKey | Keypair;
|
|
453
|
+
apiRequestInterval?: number;
|
|
454
|
+
apiRequestTimeout?: number;
|
|
455
|
+
apiCacheTime?: number;
|
|
456
|
+
signAllTransactions?: SignAllTransactions;
|
|
457
|
+
urlConfigs?: API_URL_CONFIG;
|
|
458
|
+
logRequests?: boolean;
|
|
459
|
+
logCount?: number;
|
|
460
|
+
jupTokenType?: JupTokenType;
|
|
461
|
+
disableFeatureCheck?: boolean;
|
|
462
|
+
disableLoadToken?: boolean;
|
|
463
|
+
}
|
|
464
|
+
interface RaydiumApiBatchRequestParams {
|
|
465
|
+
api: Api;
|
|
466
|
+
defaultChainTimeOffset?: number;
|
|
467
|
+
defaultChainTime?: number;
|
|
468
|
+
}
|
|
469
|
+
declare type RaydiumConstructorParams = Required<RaydiumLoadParams> & RaydiumApiBatchRequestParams;
|
|
470
|
+
interface DataBase<T> {
|
|
471
|
+
fetched: number;
|
|
472
|
+
data: T;
|
|
473
|
+
extInfo?: Record<string, any>;
|
|
474
|
+
}
|
|
475
|
+
interface ApiData {
|
|
476
|
+
tokens?: DataBase<ApiV3Token[]>;
|
|
477
|
+
tokenList?: DataBase<ApiV3TokenRes>;
|
|
478
|
+
jupTokenList?: {
|
|
479
|
+
[JupTokenType.ALL]?: DataBase<ApiV3Token[]>;
|
|
480
|
+
[JupTokenType.Strict]?: DataBase<ApiV3Token[]>;
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
declare class Raydium {
|
|
484
|
+
cluster: Cluster;
|
|
485
|
+
farm: Farm;
|
|
486
|
+
account: Account;
|
|
487
|
+
liquidity: LiquidityModule;
|
|
488
|
+
clmm: Clmm;
|
|
489
|
+
cpmm: CpmmModule;
|
|
490
|
+
tradeV2: TradeV2;
|
|
491
|
+
utils1216: Utils1216;
|
|
492
|
+
marketV2: MarketV2$1;
|
|
493
|
+
ido: MarketV2;
|
|
494
|
+
token: TokenModule;
|
|
495
|
+
rawBalances: Map<string, string>;
|
|
496
|
+
apiData: ApiData;
|
|
497
|
+
availability: Partial<AvailabilityCheckAPI3>;
|
|
498
|
+
private _connection;
|
|
499
|
+
private _owner;
|
|
500
|
+
api: Api;
|
|
501
|
+
private _apiCacheTime;
|
|
502
|
+
private _signAllTransactions?;
|
|
503
|
+
private logger;
|
|
504
|
+
private _chainTime?;
|
|
505
|
+
private _epochInfo?;
|
|
506
|
+
constructor(config: RaydiumConstructorParams);
|
|
507
|
+
static load(config: RaydiumLoadParams): Promise<Raydium>;
|
|
508
|
+
get owner(): Owner | undefined;
|
|
509
|
+
get ownerPubKey(): PublicKey;
|
|
510
|
+
setOwner(owner?: PublicKey | Keypair): Raydium;
|
|
511
|
+
get connection(): Connection;
|
|
512
|
+
setConnection(connection: Connection): Raydium;
|
|
513
|
+
get signAllTransactions(): SignAllTransactions | undefined;
|
|
514
|
+
setSignAllTransactions(signAllTransactions?: SignAllTransactions): Raydium;
|
|
515
|
+
checkOwner(): void;
|
|
516
|
+
private isCacheInvalidate;
|
|
517
|
+
fetchChainTime(): Promise<void>;
|
|
518
|
+
fetchV3TokenList(forceUpdate?: boolean): Promise<ApiV3TokenRes>;
|
|
519
|
+
fetchJupTokenList(type: JupTokenType, forceUpdate?: boolean): Promise<ApiV3Token[]>;
|
|
520
|
+
get chainTimeData(): {
|
|
521
|
+
offset: number;
|
|
522
|
+
chainTime: number;
|
|
523
|
+
} | undefined;
|
|
524
|
+
chainTimeOffset(): Promise<number>;
|
|
525
|
+
currentBlockChainTime(): Promise<number>;
|
|
526
|
+
fetchEpochInfo(): Promise<EpochInfo>;
|
|
527
|
+
fetchAvailabilityStatus(skipCheck?: boolean): Promise<Partial<AvailabilityCheckAPI3>>;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export { Account as A, Clmm as C, Farm as F, LiquidityModule as L, MarketV2 as M, RaydiumLoadParams as R, SHOW_INFO as S, TokenAccountDataProp as T, Utils1216 as U, RaydiumApiBatchRequestParams as a, RaydiumConstructorParams as b, Raydium as c, canClaimErrorType as d, MarketV2$1 as e, ModuleBase as f, ModuleBaseProps as g, CpmmModule as h, TradeV2 as i, TokenModule as j };
|
|
@@ -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-322fdce2.js';
|
|
5
5
|
import { TxVersion } from './common/txTool/txType.js';
|
|
6
6
|
import { ClmmPositionLayout } from './raydium/clmm/layout.js';
|
|
7
7
|
|