aftermath-ts-sdk 1.2.64 → 1.2.65
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/dist/general/dynamicGas/dynamicGas.d.ts +34 -0
- package/dist/general/dynamicGas/dynamicGas.d.ts.map +1 -1
- package/dist/general/dynamicGas/dynamicGas.js +34 -0
- package/dist/general/dynamicGas/dynamicGasTypes.d.ts +25 -0
- package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +1 -1
- package/dist/general/prices/prices.d.ts +73 -0
- package/dist/general/prices/prices.d.ts.map +1 -1
- package/dist/general/prices/prices.js +73 -0
- package/dist/general/providers/aftermath.d.ts +106 -25
- package/dist/general/providers/aftermath.d.ts.map +1 -1
- package/dist/general/providers/aftermath.js +108 -27
- package/dist/general/providers/aftermathApi.d.ts +127 -8
- package/dist/general/providers/aftermathApi.d.ts.map +1 -1
- package/dist/general/providers/aftermathApi.js +132 -12
- package/dist/general/types/castingTypes.d.ts +0 -7
- package/dist/general/types/castingTypes.d.ts.map +1 -1
- package/dist/general/types/castingTypes.js +6 -0
- package/dist/general/types/generalTypes.d.ts +228 -7
- package/dist/general/types/generalTypes.d.ts.map +1 -1
- package/dist/general/types/suiTypes.d.ts +0 -16
- package/dist/general/types/suiTypes.d.ts.map +1 -1
- package/dist/general/types/suiTypes.js +3 -25
- package/dist/general/utils/casting.d.ts +159 -3
- package/dist/general/utils/casting.d.ts.map +1 -1
- package/dist/general/utils/casting.js +162 -16
- package/dist/general/utils/fixedUtils.d.ts +89 -2
- package/dist/general/utils/fixedUtils.d.ts.map +1 -1
- package/dist/general/utils/fixedUtils.js +81 -4
- package/dist/general/utils/helpers.d.ts +320 -9
- package/dist/general/utils/helpers.d.ts.map +1 -1
- package/dist/general/utils/helpers.js +350 -89
- package/dist/general/utils/iFixedUtils.d.ts +64 -0
- package/dist/general/utils/iFixedUtils.d.ts.map +1 -1
- package/dist/general/utils/iFixedUtils.js +64 -0
- package/dist/general/wallet/wallet.d.ts +75 -0
- package/dist/general/wallet/wallet.d.ts.map +1 -1
- package/dist/general/wallet/wallet.js +75 -5
- package/dist/packages/auth/auth.d.ts +113 -0
- package/dist/packages/auth/auth.d.ts.map +1 -1
- package/dist/packages/auth/auth.js +129 -15
- package/dist/packages/auth/authTypes.d.ts +66 -0
- package/dist/packages/auth/authTypes.d.ts.map +1 -1
- package/dist/packages/coin/coin.d.ts +250 -0
- package/dist/packages/coin/coin.d.ts.map +1 -1
- package/dist/packages/coin/coin.js +238 -14
- package/dist/packages/coin/coinTypes.d.ts +93 -0
- package/dist/packages/coin/coinTypes.d.ts.map +1 -1
- package/dist/packages/dca/dca.d.ts +124 -35
- package/dist/packages/dca/dca.d.ts.map +1 -1
- package/dist/packages/dca/dca.js +127 -37
- package/dist/packages/dca/dcaTypes.d.ts +213 -28
- package/dist/packages/dca/dcaTypes.d.ts.map +1 -1
- package/dist/packages/farms/farms.d.ts +184 -1
- package/dist/packages/farms/farms.d.ts.map +1 -1
- package/dist/packages/farms/farms.js +185 -11
- package/dist/packages/farms/farmsStakedPosition.d.ts +140 -6
- package/dist/packages/farms/farmsStakedPosition.d.ts.map +1 -1
- package/dist/packages/farms/farmsStakedPosition.js +189 -144
- package/dist/packages/farms/farmsStakingPool.d.ts +161 -1
- package/dist/packages/farms/farmsStakingPool.d.ts.map +1 -1
- package/dist/packages/farms/farmsStakingPool.js +176 -70
- package/dist/packages/farms/farmsTypes.d.ts +283 -2
- package/dist/packages/farms/farmsTypes.d.ts.map +1 -1
- package/dist/packages/farms/farmsTypes.js +18 -0
- package/dist/packages/limitOrders/limitOrders.d.ts +108 -21
- package/dist/packages/limitOrders/limitOrders.d.ts.map +1 -1
- package/dist/packages/limitOrders/limitOrders.js +110 -22
- package/dist/packages/limitOrders/limitOrdersTypes.d.ts +142 -0
- package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +1 -1
- package/dist/packages/multisig/multisig.d.ts +33 -4
- package/dist/packages/multisig/multisig.d.ts.map +1 -1
- package/dist/packages/multisig/multisig.js +33 -4
- package/dist/packages/multisig/multisigTypes.d.ts +17 -0
- package/dist/packages/multisig/multisigTypes.d.ts.map +1 -1
- package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -1
- package/dist/packages/pools/pool.d.ts +327 -85
- package/dist/packages/pools/pool.d.ts.map +1 -1
- package/dist/packages/pools/pool.js +333 -91
- package/dist/packages/pools/pools.d.ts +299 -37
- package/dist/packages/pools/pools.d.ts.map +1 -1
- package/dist/packages/pools/pools.js +306 -52
- package/dist/packages/pools/poolsTypes.d.ts +267 -2
- package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
- package/dist/packages/referralVault/referralVault.d.ts +37 -0
- package/dist/packages/referralVault/referralVault.d.ts.map +1 -1
- package/dist/packages/referralVault/referralVault.js +37 -0
- package/dist/packages/router/router.d.ts +213 -17
- package/dist/packages/router/router.d.ts.map +1 -1
- package/dist/packages/router/router.js +214 -18
- package/dist/packages/router/routerTypes.d.ts +198 -14
- package/dist/packages/router/routerTypes.d.ts.map +1 -1
- package/dist/packages/staking/staking.d.ts +301 -43
- package/dist/packages/staking/staking.d.ts.map +1 -1
- package/dist/packages/staking/staking.js +308 -51
- package/dist/packages/staking/stakingTypes.d.ts +426 -6
- package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
- package/dist/packages/staking/stakingTypes.js +19 -0
- package/dist/packages/sui/sui.d.ts +39 -0
- package/dist/packages/sui/sui.d.ts.map +1 -1
- package/dist/packages/sui/sui.js +39 -0
- package/dist/packages/userData/userData.d.ts +66 -12
- package/dist/packages/userData/userData.d.ts.map +1 -1
- package/dist/packages/userData/userData.js +66 -12
- package/dist/packages/userData/userDataTypes.d.ts +19 -0
- package/dist/packages/userData/userDataTypes.d.ts.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/package.json +1 -1
- package/dist/general/historicalData/historicalData.d.ts +0 -15
- package/dist/general/historicalData/historicalData.d.ts.map +0 -1
- package/dist/general/historicalData/historicalData.js +0 -45
- package/dist/general/historicalData/historicalDataTypes.d.ts +0 -10
- package/dist/general/historicalData/historicalDataTypes.d.ts.map +0 -1
- package/dist/general/historicalData/historicalDataTypes.js +0 -2
|
@@ -3,141 +3,403 @@ import { Pool } from "./pool";
|
|
|
3
3
|
import { Caller } from "../../general/utils/caller";
|
|
4
4
|
import { AftermathApi } from "../../general/providers";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* The `Pools` class provides a high-level interface for interacting with
|
|
7
|
+
* Aftermath Finance liquidity pools. It allows fetching individual or multiple
|
|
8
|
+
* pools, managing liquidity pool tokens (LP tokens), and creating new pools
|
|
9
|
+
* if you have the required privileges.
|
|
7
10
|
*
|
|
8
11
|
* @example
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* const
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
14
|
+
* await afSdk.init(); // initialize provider
|
|
15
|
+
*
|
|
16
|
+
* const pools = afSdk.Pools();
|
|
17
|
+
*
|
|
18
|
+
* // Fetch a single pool
|
|
19
|
+
* const pool = await pools.getPool({ objectId: "0x<poolId>" });
|
|
20
|
+
*
|
|
21
|
+
* // Fetch multiple pools
|
|
22
|
+
* const poolArray = await pools.getPools({ objectIds: ["0x<id1>", "0x<id2>"] });
|
|
14
23
|
* ```
|
|
15
24
|
*/
|
|
16
25
|
export declare class Pools extends Caller {
|
|
17
26
|
private readonly Provider?;
|
|
18
27
|
/**
|
|
19
|
-
*
|
|
28
|
+
* Static constants relevant to the pool logic, such as protocol fees,
|
|
29
|
+
* referral percentages, and bounds for trading/withdrawal percentages.
|
|
20
30
|
*/
|
|
21
31
|
static readonly constants: {
|
|
32
|
+
/**
|
|
33
|
+
* Protocol fee structure: `totalProtocol` is the fraction of trades
|
|
34
|
+
* that is taken as a fee, which is split among `treasury`, `insuranceFund`,
|
|
35
|
+
* and `devWallet` in the given proportions.
|
|
36
|
+
*/
|
|
22
37
|
feePercentages: {
|
|
38
|
+
/**
|
|
39
|
+
* The total fraction (as a decimal) of trades charged by the protocol.
|
|
40
|
+
* e.g., 0.00005 => 0.005%.
|
|
41
|
+
*/
|
|
23
42
|
totalProtocol: number;
|
|
43
|
+
/**
|
|
44
|
+
* The fraction of `totalProtocol` allocated to the treasury.
|
|
45
|
+
*/
|
|
24
46
|
treasury: number;
|
|
47
|
+
/**
|
|
48
|
+
* The fraction of `totalProtocol` allocated to the insurance fund.
|
|
49
|
+
*/
|
|
25
50
|
insuranceFund: number;
|
|
51
|
+
/**
|
|
52
|
+
* The fraction of `totalProtocol` allocated to the dev wallet.
|
|
53
|
+
*/
|
|
26
54
|
devWallet: number;
|
|
27
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Referral fee structures, applying a discount/rebate to the user and
|
|
58
|
+
* referrer, taken from the treasury portion of protocol fees.
|
|
59
|
+
*/
|
|
28
60
|
referralPercentages: {
|
|
61
|
+
/**
|
|
62
|
+
* The fraction of the treasury portion that discounts the user's fee.
|
|
63
|
+
*/
|
|
29
64
|
discount: number;
|
|
65
|
+
/**
|
|
66
|
+
* The fraction of the treasury portion that acts as a rebate to the referrer.
|
|
67
|
+
*/
|
|
30
68
|
rebate: number;
|
|
31
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Various bounds used to prevent extreme trades or invalid pool configurations.
|
|
72
|
+
*/
|
|
32
73
|
bounds: {
|
|
74
|
+
/**
|
|
75
|
+
* Maximum number of distinct coins allowed in a single pool.
|
|
76
|
+
*/
|
|
33
77
|
maxCoinsInPool: number;
|
|
78
|
+
/**
|
|
79
|
+
* Maximum fraction (decimal) of a pool's balance that can be traded at once.
|
|
80
|
+
*/
|
|
34
81
|
maxTradePercentageOfPoolBalance: number;
|
|
82
|
+
/**
|
|
83
|
+
* Maximum fraction (decimal) of a pool's balance that can be withdrawn at once.
|
|
84
|
+
*/
|
|
35
85
|
maxWithdrawPercentageOfPoolBalance: number;
|
|
86
|
+
/**
|
|
87
|
+
* Minimum and maximum swap fees (0.01% to 10%).
|
|
88
|
+
*/
|
|
36
89
|
minSwapFee: number;
|
|
37
90
|
maxSwapFee: number;
|
|
91
|
+
/**
|
|
92
|
+
* Minimum and maximum coin weight for weighted pools (1% to 99%).
|
|
93
|
+
*/
|
|
38
94
|
minWeight: number;
|
|
39
95
|
maxWeight: number;
|
|
96
|
+
/**
|
|
97
|
+
* Minimum and maximum DAO fee (0% to 100%).
|
|
98
|
+
*/
|
|
40
99
|
minDaoFee: number;
|
|
41
100
|
maxDaoFee: number;
|
|
42
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* Default parameter(s) used in the absence of explicit user or code settings.
|
|
104
|
+
*/
|
|
43
105
|
defaults: {
|
|
106
|
+
/**
|
|
107
|
+
* Default decimals for LP coins if none are specified.
|
|
108
|
+
*/
|
|
44
109
|
lpCoinDecimals: number;
|
|
45
110
|
};
|
|
46
111
|
};
|
|
47
112
|
/**
|
|
48
|
-
* Creates `Pools`
|
|
113
|
+
* Creates a new `Pools` instance for querying and managing AMM pools on Aftermath.
|
|
49
114
|
*
|
|
50
|
-
* @param
|
|
51
|
-
* @
|
|
115
|
+
* @param config - Optional configuration object specifying network or access token.
|
|
116
|
+
* @param Provider - An optional `AftermathApi` instance providing advanced transaction building.
|
|
52
117
|
*/
|
|
53
118
|
constructor(config?: CallerConfig, Provider?: AftermathApi | undefined);
|
|
54
119
|
/**
|
|
55
|
-
*
|
|
120
|
+
* Fetches a single pool by its on-chain `objectId` and returns a new `Pool` instance.
|
|
56
121
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @returns
|
|
122
|
+
* @param inputs - An object containing `objectId`.
|
|
123
|
+
* @returns A promise that resolves to a `Pool` instance.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const pool = await pools.getPool({ objectId: "0x<poolId>" });
|
|
128
|
+
* console.log(pool.pool.lpCoinType, pool.pool.name);
|
|
129
|
+
* ```
|
|
59
130
|
*/
|
|
60
131
|
getPool(inputs: {
|
|
61
132
|
objectId: ObjectId;
|
|
62
133
|
}): Promise<Pool>;
|
|
63
134
|
/**
|
|
64
|
-
*
|
|
135
|
+
* Fetches multiple pools by their on-chain `objectIds` and returns an array of `Pool` instances.
|
|
136
|
+
*
|
|
137
|
+
* @param inputs - An object containing an array of `objectIds`.
|
|
138
|
+
* @returns A promise that resolves to an array of `Pool` instances.
|
|
65
139
|
*
|
|
66
|
-
* @
|
|
67
|
-
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const poolArray = await pools.getPools({ objectIds: ["0x<id1>", "0x<id2>"] });
|
|
143
|
+
* console.log(poolArray.length);
|
|
144
|
+
* ```
|
|
68
145
|
*/
|
|
69
146
|
getPools(inputs: {
|
|
70
147
|
objectIds: ObjectId[];
|
|
71
148
|
}): Promise<Pool[]>;
|
|
72
149
|
/**
|
|
73
|
-
* Retrieves all pools
|
|
74
|
-
*
|
|
150
|
+
* Retrieves all pools recognized by the Aftermath API, returning an array of `Pool` objects.
|
|
151
|
+
*
|
|
152
|
+
* @returns An array of `Pool` instances.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const allPools = await pools.getAllPools();
|
|
157
|
+
* console.log(allPools.map(p => p.pool.name));
|
|
158
|
+
* ```
|
|
75
159
|
*/
|
|
76
160
|
getAllPools(): Promise<Pool[]>;
|
|
161
|
+
/**
|
|
162
|
+
* Fetches information about all owned LP coins for a given wallet address.
|
|
163
|
+
* This indicates the user's liquidity positions across multiple pools.
|
|
164
|
+
*
|
|
165
|
+
* @param inputs - An object containing the `walletAddress`.
|
|
166
|
+
* @returns A `PoolLpInfo` object summarizing the user's LP balances.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* const lpCoins = await pools.getOwnedLpCoins({ walletAddress: "0x<address>" });
|
|
171
|
+
* console.log(lpCoins);
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
77
174
|
getOwnedLpCoins(inputs: {
|
|
78
175
|
walletAddress: SuiAddress;
|
|
79
176
|
}): Promise<PoolLpInfo>;
|
|
80
177
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
178
|
+
* Constructs or fetches a transaction to publish a new LP coin package,
|
|
179
|
+
* typically used by advanced users or devs establishing new liquidity pools.
|
|
180
|
+
*
|
|
181
|
+
* @param inputs - Includes the user `walletAddress` and the `lpCoinDecimals`.
|
|
182
|
+
* @returns A transaction object (or data) that can be signed and published to Sui.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* const publishTx = await pools.getPublishLpCoinTransaction({
|
|
187
|
+
* walletAddress: "0x<address>",
|
|
188
|
+
* lpCoinDecimals: 9
|
|
189
|
+
* });
|
|
190
|
+
* ```
|
|
84
191
|
*/
|
|
85
192
|
getPublishLpCoinTransaction(inputs: ApiPublishLpCoinBody): Promise<import("@mysten/sui/transactions").Transaction>;
|
|
86
193
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
194
|
+
* Constructs a transaction to create a brand new pool on-chain, given coin types,
|
|
195
|
+
* initial weights, fees, and possible DAO fee info.
|
|
196
|
+
*
|
|
197
|
+
* @param inputs - The body describing how to form the new pool.
|
|
198
|
+
* @returns A transaction object that can be signed and executed.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* const createPoolTx = await pools.getCreatePoolTransaction({
|
|
203
|
+
* walletAddress: "0x<address>",
|
|
204
|
+
* lpCoinType: "0x<lpCoin>",
|
|
205
|
+
* lpCoinMetadata: {
|
|
206
|
+
* name: "MyPool LP",
|
|
207
|
+
* symbol: "MYPLP"
|
|
208
|
+
* },
|
|
209
|
+
* coinsInfo: [
|
|
210
|
+
* {
|
|
211
|
+
* coinType: "0x<coinA>",
|
|
212
|
+
* weight: 0.5,
|
|
213
|
+
* decimals: 9,
|
|
214
|
+
* tradeFeeIn: 0.003,
|
|
215
|
+
* initialDeposit: 1_000_000_000n
|
|
216
|
+
* },
|
|
217
|
+
* // ...
|
|
218
|
+
* ],
|
|
219
|
+
* poolName: "My Weighted Pool",
|
|
220
|
+
* createPoolCapId: "0x<capId>",
|
|
221
|
+
* respectDecimals: true,
|
|
222
|
+
* });
|
|
223
|
+
* ```
|
|
90
224
|
*/
|
|
91
225
|
getCreatePoolTransaction(inputs: ApiCreatePoolBody): Promise<import("@mysten/sui/transactions").Transaction>;
|
|
92
226
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* @
|
|
96
|
-
* @
|
|
227
|
+
* Retrieves the on-chain pool object ID corresponding to a specific LP coin type.
|
|
228
|
+
*
|
|
229
|
+
* @param inputs - Contains the `lpCoinType` string.
|
|
230
|
+
* @returns The pool object ID if it exists.
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* const poolId = await pools.getPoolObjectIdForLpCoinType({
|
|
235
|
+
* lpCoinType: "0x<lpCoinType>"
|
|
236
|
+
* });
|
|
237
|
+
* console.log(poolId);
|
|
238
|
+
* ```
|
|
97
239
|
*/
|
|
98
240
|
getPoolObjectIdForLpCoinType: (inputs: {
|
|
99
241
|
lpCoinType: CoinType;
|
|
100
242
|
}) => Promise<(string | undefined)[]>;
|
|
101
|
-
getPoolObjectIdsForLpCoinTypes: (inputs: ApiPoolObjectIdForLpCoinTypeBody) => Promise<(ObjectId | undefined)[]>;
|
|
102
243
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
244
|
+
* Retrieves multiple pool object IDs given an array of LP coin types.
|
|
245
|
+
* If a given LP coin type has no associated pool, it might return `undefined`.
|
|
246
|
+
*
|
|
247
|
+
* @param inputs - Contains an array of `lpCoinTypes`.
|
|
248
|
+
* @returns An array of `ObjectId | undefined` of matching length.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* const poolIds = await pools.getPoolObjectIdsForLpCoinTypes({
|
|
253
|
+
* lpCoinTypes: ["0x<lpCoinA>", "0x<lpCoinB>"]
|
|
254
|
+
* });
|
|
255
|
+
* console.log(poolIds);
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
getPoolObjectIdsForLpCoinTypes(inputs: ApiPoolObjectIdForLpCoinTypeBody): Promise<(ObjectId | undefined)[]>;
|
|
259
|
+
/**
|
|
260
|
+
* Checks if a given coin type is recognized as an LP coin.
|
|
261
|
+
* Internally calls `getPoolObjectIdForLpCoinType`.
|
|
262
|
+
*
|
|
263
|
+
* @param inputs - Contains the `lpCoinType` to check.
|
|
264
|
+
* @returns `true` if the coin is an LP token, `false` otherwise.
|
|
106
265
|
*/
|
|
107
266
|
isLpCoinType: (inputs: {
|
|
108
267
|
lpCoinType: CoinType;
|
|
109
268
|
}) => Promise<boolean>;
|
|
110
269
|
/**
|
|
111
|
-
* Retrieves the total volume in the last 24 hours.
|
|
112
|
-
*
|
|
270
|
+
* Retrieves the total volume across all pools in the last 24 hours.
|
|
271
|
+
*
|
|
272
|
+
* @returns A promise resolving to a numeric volume (e.g., in USD).
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```typescript
|
|
276
|
+
* const totalVol24 = await pools.getTotalVolume24hrs();
|
|
277
|
+
* console.log("Protocol-wide 24h volume:", totalVol24);
|
|
278
|
+
* ```
|
|
113
279
|
*/
|
|
114
280
|
getTotalVolume24hrs: () => Promise<number>;
|
|
281
|
+
/**
|
|
282
|
+
* Retrieves the total value locked (TVL) across all or specific pool IDs.
|
|
283
|
+
*
|
|
284
|
+
* @param inputs - Optionally provide an array of specific `poolIds`. If omitted, returns global TVL.
|
|
285
|
+
* @returns A promise resolving to a numeric TVL (e.g., in USD).
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* const allTvl = await pools.getTVL();
|
|
290
|
+
* const subsetTvl = await pools.getTVL({ poolIds: ["0x<id1>", "0x<id2>"] });
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
115
293
|
getTVL(inputs?: {
|
|
116
294
|
poolIds?: ObjectId[];
|
|
117
295
|
}): Promise<number>;
|
|
118
296
|
/**
|
|
119
|
-
* Fetches
|
|
120
|
-
*
|
|
121
|
-
*
|
|
297
|
+
* Fetches an array of `PoolStats` objects for a given set of pools,
|
|
298
|
+
* including volume, fees, TVL, and other metrics.
|
|
299
|
+
*
|
|
300
|
+
* @param inputs - Must include an array of `poolIds`.
|
|
301
|
+
* @returns An array of `PoolStats` in matching order.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```typescript
|
|
305
|
+
* const stats = await pools.getPoolsStats({ poolIds: ["0x<id1>", "0x<id2>"] });
|
|
306
|
+
* console.log(stats[0].volume, stats[1].tvl);
|
|
307
|
+
* ```
|
|
122
308
|
*/
|
|
123
309
|
getPoolsStats(inputs: ApiPoolsStatsBody): Promise<PoolStats[]>;
|
|
310
|
+
/**
|
|
311
|
+
* Returns all DAO fee pool owner capabilities owned by a particular user.
|
|
312
|
+
* This is used to see which pools' DAO fees the user can update.
|
|
313
|
+
*
|
|
314
|
+
* @param inputs - An object with user `walletAddress`.
|
|
315
|
+
* @returns Data about each `DaoFeePoolOwnerCapObject` the user owns.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* const daoCaps = await pools.getOwnedDaoFeePoolOwnerCaps({
|
|
320
|
+
* walletAddress: "0x<address>"
|
|
321
|
+
* });
|
|
322
|
+
* console.log(daoCaps);
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
124
325
|
getOwnedDaoFeePoolOwnerCaps(inputs: ApiPoolsOwnedDaoFeePoolOwnerCapsBody): Promise<import("./poolsTypes").DaoFeePoolOwnerCapObject[]>;
|
|
326
|
+
/**
|
|
327
|
+
* Fetches user-specific interaction events (deposits, withdrawals) across pools,
|
|
328
|
+
* optionally with pagination.
|
|
329
|
+
*
|
|
330
|
+
* @param inputs - An object containing `walletAddress`, plus optional pagination (`cursor`, `limit`).
|
|
331
|
+
* @returns An event set with a cursor for further queries if available.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const userEvents = await pools.getInteractionEvents({
|
|
336
|
+
* walletAddress: "0x...",
|
|
337
|
+
* limit: 10,
|
|
338
|
+
* });
|
|
339
|
+
* console.log(userEvents.events, userEvents.nextCursor);
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
125
342
|
getInteractionEvents(inputs: ApiIndexerEventsBody & {
|
|
126
343
|
walletAddress: SuiAddress;
|
|
127
344
|
}): Promise<import("../../types").IndexerEventsWithCursor<PoolDepositEvent | PoolWithdrawEvent>>;
|
|
345
|
+
/**
|
|
346
|
+
* Returns how much coin remains **after** applying the protocol fees
|
|
347
|
+
* (and referral discount if `withReferral` is `true`).
|
|
348
|
+
*
|
|
349
|
+
* @param inputs - The original `amount` and an optional referral flag.
|
|
350
|
+
* @returns The post-fee (net) amount as a bigint.
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```typescript
|
|
354
|
+
* const netAmount = Pools.getAmountWithProtocolFees({ amount: 1_000_000n });
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
128
357
|
static getAmountWithProtocolFees: (inputs: {
|
|
129
358
|
amount: Balance;
|
|
130
359
|
withReferral?: boolean;
|
|
131
360
|
}) => bigint;
|
|
361
|
+
/**
|
|
362
|
+
* The inverse calculation: given a net amount (post-fees), figure out
|
|
363
|
+
* the original gross amount. Used when we already have fees subtracted
|
|
364
|
+
* but need to restore an original quantity.
|
|
365
|
+
*
|
|
366
|
+
* @param inputs - The net `amount` after fees, plus an optional referral flag.
|
|
367
|
+
* @returns The original gross amount as a bigint.
|
|
368
|
+
*/
|
|
132
369
|
static getAmountWithoutProtocolFees: (inputs: {
|
|
133
370
|
amount: Balance;
|
|
134
371
|
withReferral?: boolean;
|
|
135
372
|
}) => bigint;
|
|
373
|
+
/**
|
|
374
|
+
* A helper to transform a user-provided slippage fraction, e.g. 0.01,
|
|
375
|
+
* into a 1 - slippage format, if needed for certain math operations.
|
|
376
|
+
*
|
|
377
|
+
* @param slippage - The decimal fraction of slippage tolerance, e.g. 0.01 => 1%.
|
|
378
|
+
* @returns A big integer representing `1 - slippage` in a fixed context.
|
|
379
|
+
*/
|
|
136
380
|
static normalizeInvertSlippage: (slippage: Slippage) => bigint;
|
|
381
|
+
/**
|
|
382
|
+
* Produces a user-friendly string for an LP coin type, e.g. "Sui Coin LP"
|
|
383
|
+
* by analyzing the coin type symbol. Typically used in UIs or logs.
|
|
384
|
+
*
|
|
385
|
+
* @param lpCoinType - The coin type for the LP token.
|
|
386
|
+
* @returns A string representation for display, e.g. "Af_lp_abc" => "Abc LP".
|
|
387
|
+
*/
|
|
137
388
|
static displayLpCoinType: (lpCoinType: CoinType) => string;
|
|
389
|
+
/**
|
|
390
|
+
* A quick heuristic check to see if the given `lpCoinType` string
|
|
391
|
+
* might represent an Aftermath LP token. This is not a full on-chain validation.
|
|
392
|
+
*
|
|
393
|
+
* @param inputs - An object containing `lpCoinType`.
|
|
394
|
+
* @returns `true` if it matches a known pattern; otherwise `false`.
|
|
395
|
+
*/
|
|
138
396
|
static isPossibleLpCoinType: (inputs: {
|
|
139
397
|
lpCoinType: CoinType;
|
|
140
398
|
}) => boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Provides a typed reference to the `Pools` part of the `AftermathApi`,
|
|
401
|
+
* throwing an error if not defined.
|
|
402
|
+
*/
|
|
141
403
|
private useProvider;
|
|
142
404
|
}
|
|
143
405
|
//# sourceMappingURL=pools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pools.d.ts","sourceRoot":"","sources":["../../../src/packages/pools/pools.ts"],"names":[],"mappings":"AA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