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
|
@@ -2,104 +2,319 @@ import { Balance, Event, Object, ObjectId, Percentage, Slippage, SuiAddress, Tim
|
|
|
2
2
|
import { ManipulateType } from "dayjs";
|
|
3
3
|
import { CoinDecimal, CoinsToBalance, CoinType } from "../coin/coinTypes";
|
|
4
4
|
import { UniqueId } from "../router/routerTypes";
|
|
5
|
+
/**
|
|
6
|
+
* Name or label used to identify a pool. e.g., "My Stable Pool" or "SUI-COIN LP".
|
|
7
|
+
*/
|
|
5
8
|
export type PoolName = string;
|
|
9
|
+
/**
|
|
10
|
+
* Represents a coin's weight in a weighted pool, stored as a bigint for
|
|
11
|
+
* 1e9 or 1e18 style scaling.
|
|
12
|
+
*/
|
|
6
13
|
export type PoolWeight = bigint;
|
|
14
|
+
/**
|
|
15
|
+
* Represents the trade fee for a coin in the pool, stored as a bigint
|
|
16
|
+
* in a scaled format (e.g. 1 = 1e9).
|
|
17
|
+
*/
|
|
7
18
|
export type PoolTradeFee = bigint;
|
|
19
|
+
/**
|
|
20
|
+
* Represents the deposit fee for a coin in the pool, stored as a bigint
|
|
21
|
+
* in a scaled format.
|
|
22
|
+
*/
|
|
8
23
|
export type PoolDepositFee = bigint;
|
|
24
|
+
/**
|
|
25
|
+
* Represents the withdrawal fee for a coin in the pool, stored as a bigint
|
|
26
|
+
* in a scaled format.
|
|
27
|
+
*/
|
|
9
28
|
export type PoolWithdrawFee = bigint;
|
|
29
|
+
/**
|
|
30
|
+
* Represents "flatness" in a pool, used for certain advanced pool calculations
|
|
31
|
+
* or invariants. Often 0 or 1, depending on stable vs. uncorrelated logic.
|
|
32
|
+
*/
|
|
10
33
|
export type PoolFlatness = bigint;
|
|
34
|
+
/**
|
|
35
|
+
* Represents a normalized balance in the pool, often used for
|
|
36
|
+
* internal calculations to standardize coin decimals.
|
|
37
|
+
*/
|
|
11
38
|
export type NormalizedBalance = bigint;
|
|
39
|
+
/**
|
|
40
|
+
* A big integer scalar used for decimals conversion (1e9 or 1e18, etc.).
|
|
41
|
+
*/
|
|
12
42
|
export type DecimalsScalar = bigint;
|
|
43
|
+
/**
|
|
44
|
+
* A record mapping `CoinType` => a `PoolCoin` structure, describing
|
|
45
|
+
* each coin's weight, balance, fees, and decimal scaling within a pool.
|
|
46
|
+
*/
|
|
13
47
|
export type PoolCoins = Record<CoinType, PoolCoin>;
|
|
48
|
+
/**
|
|
49
|
+
* Details about a coin in the pool, including the on-chain balance,
|
|
50
|
+
* trade fees (in/out), deposit/withdraw fees, and decimal scaling factors.
|
|
51
|
+
*/
|
|
14
52
|
export interface PoolCoin {
|
|
53
|
+
/**
|
|
54
|
+
* The coin's weight in the pool (e.g., for a weight-based AMM).
|
|
55
|
+
*/
|
|
15
56
|
weight: PoolWeight;
|
|
57
|
+
/**
|
|
58
|
+
* The on-chain balance of this coin in the pool.
|
|
59
|
+
*/
|
|
16
60
|
balance: Balance;
|
|
61
|
+
/**
|
|
62
|
+
* The inbound trade fee (scaled) for this coin.
|
|
63
|
+
*/
|
|
17
64
|
tradeFeeIn: PoolTradeFee;
|
|
65
|
+
/**
|
|
66
|
+
* The outbound trade fee (scaled) for this coin.
|
|
67
|
+
*/
|
|
18
68
|
tradeFeeOut: PoolTradeFee;
|
|
69
|
+
/**
|
|
70
|
+
* The deposit fee (scaled) for adding this coin into the pool.
|
|
71
|
+
*/
|
|
19
72
|
depositFee: PoolDepositFee;
|
|
73
|
+
/**
|
|
74
|
+
* The withdrawal fee (scaled) for removing this coin from the pool.
|
|
75
|
+
*/
|
|
20
76
|
withdrawFee: PoolWithdrawFee;
|
|
77
|
+
/**
|
|
78
|
+
* A scaling factor (like 1e9 or 1e18) used to unify coin decimals
|
|
79
|
+
* for internal math.
|
|
80
|
+
*/
|
|
21
81
|
decimalsScalar: DecimalsScalar;
|
|
82
|
+
/**
|
|
83
|
+
* The "normalized" balance, factoring in `decimalsScalar`.
|
|
84
|
+
*/
|
|
22
85
|
normalizedBalance: NormalizedBalance;
|
|
86
|
+
/**
|
|
87
|
+
* The displayed decimals for user-facing reference (e.g., 6, 9, 18).
|
|
88
|
+
*/
|
|
23
89
|
decimals?: CoinDecimal;
|
|
24
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* The primary pool object structure stored on-chain.
|
|
93
|
+
* `lpCoinType` is the minted LP token, `coins` is a record of coin data.
|
|
94
|
+
*/
|
|
25
95
|
export interface PoolObject extends Object {
|
|
96
|
+
/**
|
|
97
|
+
* The human-readable name of the pool (e.g., "My Weighted Pool").
|
|
98
|
+
*/
|
|
26
99
|
name: PoolName;
|
|
100
|
+
/**
|
|
101
|
+
* The address of the pool's creator.
|
|
102
|
+
*/
|
|
27
103
|
creator: SuiAddress;
|
|
104
|
+
/**
|
|
105
|
+
* The LP coin type for this pool, e.g., "0x<...>::af_lp::AF_LP_xyz".
|
|
106
|
+
*/
|
|
28
107
|
lpCoinType: CoinType;
|
|
108
|
+
/**
|
|
109
|
+
* The total supply of LP tokens currently minted.
|
|
110
|
+
*/
|
|
29
111
|
lpCoinSupply: Balance;
|
|
112
|
+
/**
|
|
113
|
+
* The amount of LP tokens that are illiquid (locked for some reason).
|
|
114
|
+
*/
|
|
30
115
|
illiquidLpCoinSupply: Balance;
|
|
116
|
+
/**
|
|
117
|
+
* A "flatness" parameter used for stable vs. uncorrelated logic. 0 or 1 typically.
|
|
118
|
+
*/
|
|
31
119
|
flatness: PoolFlatness;
|
|
120
|
+
/**
|
|
121
|
+
* A record of coin data for each coin type in the pool.
|
|
122
|
+
*/
|
|
32
123
|
coins: PoolCoins;
|
|
124
|
+
/**
|
|
125
|
+
* The decimals used by the LP coin.
|
|
126
|
+
*/
|
|
33
127
|
lpCoinDecimals: CoinDecimal;
|
|
128
|
+
/**
|
|
129
|
+
* An optional DAO fee object, if the pool is configured to support a fee for a DAO or treasury.
|
|
130
|
+
*/
|
|
34
131
|
daoFeePoolObject?: DaoFeePoolObject;
|
|
35
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Minimal information about a user's LP coin in a specific pool,
|
|
135
|
+
* including the pool ID and balance of that LP coin type.
|
|
136
|
+
*/
|
|
36
137
|
export interface PoolLpInfo {
|
|
37
138
|
lpCoinType: CoinType;
|
|
38
139
|
poolId: ObjectId;
|
|
39
140
|
balance: Balance;
|
|
40
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* An on-chain object representing DAO fee configuration for a pool:
|
|
144
|
+
* it stores the fee basis points and the fee recipient address.
|
|
145
|
+
*/
|
|
41
146
|
export interface DaoFeePoolObject extends Object {
|
|
147
|
+
/**
|
|
148
|
+
* The fee in basis points, e.g., 100 => 1%.
|
|
149
|
+
*/
|
|
42
150
|
feeBps: bigint;
|
|
151
|
+
/**
|
|
152
|
+
* The Sui address receiving the fee portion from trades or other actions.
|
|
153
|
+
*/
|
|
43
154
|
feeRecipient: SuiAddress;
|
|
44
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* A capability object indicating ownership of a `DaoFeePoolObject`.
|
|
158
|
+
* Whomever holds this can update the fee parameters or recipient.
|
|
159
|
+
*/
|
|
45
160
|
export interface DaoFeePoolOwnerCapObject extends Object {
|
|
161
|
+
/**
|
|
162
|
+
* The `DaoFeePoolObject` ID this cap is associated with.
|
|
163
|
+
*/
|
|
46
164
|
daoFeePoolId: ObjectId;
|
|
47
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Represents a trade event within a pool, indicating coins in/out,
|
|
168
|
+
* final amounts, etc.
|
|
169
|
+
*/
|
|
48
170
|
export interface PoolTradeEvent extends Event {
|
|
49
171
|
poolId: ObjectId;
|
|
50
172
|
trader: SuiAddress;
|
|
173
|
+
/**
|
|
174
|
+
* The array of coin types that were spent in the trade.
|
|
175
|
+
*/
|
|
51
176
|
typesIn: CoinType[];
|
|
177
|
+
/**
|
|
178
|
+
* The amounts of each coin type that were spent.
|
|
179
|
+
*/
|
|
52
180
|
amountsIn: Balance[];
|
|
181
|
+
/**
|
|
182
|
+
* The coin types that were received.
|
|
183
|
+
*/
|
|
53
184
|
typesOut: CoinType[];
|
|
185
|
+
/**
|
|
186
|
+
* The amounts of each output coin.
|
|
187
|
+
*/
|
|
54
188
|
amountsOut: Balance[];
|
|
55
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Represents a deposit event where a user adds liquidity to a pool,
|
|
192
|
+
* receiving minted LP tokens in return.
|
|
193
|
+
*/
|
|
56
194
|
export interface PoolDepositEvent extends Event {
|
|
57
195
|
poolId: ObjectId;
|
|
196
|
+
/**
|
|
197
|
+
* The address that deposited into the pool.
|
|
198
|
+
*/
|
|
58
199
|
depositor: SuiAddress;
|
|
200
|
+
/**
|
|
201
|
+
* The coin types that were deposited.
|
|
202
|
+
*/
|
|
59
203
|
types: CoinType[];
|
|
204
|
+
/**
|
|
205
|
+
* The amounts for each deposited coin type.
|
|
206
|
+
*/
|
|
60
207
|
deposits: Balance[];
|
|
208
|
+
/**
|
|
209
|
+
* The amount of LP minted for the depositor.
|
|
210
|
+
*/
|
|
61
211
|
lpMinted: Balance;
|
|
62
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Represents a withdrawal event where a user removes liquidity from a pool,
|
|
215
|
+
* burning LP tokens and receiving coin amounts in return.
|
|
216
|
+
*/
|
|
63
217
|
export interface PoolWithdrawEvent extends Event {
|
|
64
218
|
poolId: ObjectId;
|
|
219
|
+
/**
|
|
220
|
+
* The user who withdrew from the pool.
|
|
221
|
+
*/
|
|
65
222
|
withdrawer: SuiAddress;
|
|
223
|
+
/**
|
|
224
|
+
* The coin types that were returned upon withdrawal.
|
|
225
|
+
*/
|
|
66
226
|
types: CoinType[];
|
|
227
|
+
/**
|
|
228
|
+
* The amounts for each returned coin type.
|
|
229
|
+
*/
|
|
67
230
|
withdrawn: Balance[];
|
|
231
|
+
/**
|
|
232
|
+
* The amount of LP burned in exchange for these outputs.
|
|
233
|
+
*/
|
|
68
234
|
lpBurned: Balance;
|
|
69
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Fired when a new DAO fee pool is created for a specific internal pool.
|
|
238
|
+
*/
|
|
70
239
|
export interface CreatedDaoFeePoolEvent extends Event {
|
|
71
240
|
daoFeePoolId: ObjectId;
|
|
72
241
|
innerPoolId: ObjectId;
|
|
73
242
|
feeBps: bigint;
|
|
74
243
|
feeRecipient: SuiAddress;
|
|
75
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Fired when the fee basis points in a `DaoFeePoolObject` are updated.
|
|
247
|
+
*/
|
|
76
248
|
export interface UpdatedFeeBpsEvent extends Event {
|
|
77
249
|
daoFeePoolId: ObjectId;
|
|
78
250
|
oldFeeBps: bigint;
|
|
79
251
|
newFeeBps: bigint;
|
|
80
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Fired when the fee recipient address in a `DaoFeePoolObject` changes.
|
|
255
|
+
*/
|
|
81
256
|
export interface UpdatedFeeRecipientEvent extends Event {
|
|
82
257
|
daoFeePoolId: ObjectId;
|
|
83
258
|
oldFeeAddress: SuiAddress;
|
|
84
259
|
newFeeAddress: SuiAddress;
|
|
85
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Basic statistical data about a pool, including volume, TVL, supply per LPS,
|
|
263
|
+
* fees, and APR.
|
|
264
|
+
*/
|
|
86
265
|
export interface PoolStats {
|
|
266
|
+
/**
|
|
267
|
+
* The 24-hour volume or some aggregated volume metric for the pool.
|
|
268
|
+
*/
|
|
87
269
|
volume: number;
|
|
270
|
+
/**
|
|
271
|
+
* The total value locked in the pool, often in USD or stablecoin value.
|
|
272
|
+
*/
|
|
88
273
|
tvl: number;
|
|
274
|
+
/**
|
|
275
|
+
* A representation of the distribution of supply among liquidity providers,
|
|
276
|
+
* e.g., how many tokens each user holds. May be used for advanced UI.
|
|
277
|
+
*/
|
|
89
278
|
supplyPerLps: number[];
|
|
279
|
+
/**
|
|
280
|
+
* The price of 1 LP token in reference to a stable baseline (USD).
|
|
281
|
+
*/
|
|
90
282
|
lpPrice: number;
|
|
283
|
+
/**
|
|
284
|
+
* The total fees generated by the pool in a given period (often 24h or 7d).
|
|
285
|
+
*/
|
|
91
286
|
fees: number;
|
|
287
|
+
/**
|
|
288
|
+
* The approximate annual percentage rate (yield) derived from fees, volume, or
|
|
289
|
+
* other data. This can be used to estimate LP profits or compare pools.
|
|
290
|
+
*/
|
|
92
291
|
apr: number;
|
|
93
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Represents a data point for pool analytics, including a Unix timestamp (in ms)
|
|
295
|
+
* and a numeric value (e.g., volume or fee data).
|
|
296
|
+
*/
|
|
94
297
|
export interface PoolDataPoint {
|
|
95
298
|
time: Timestamp;
|
|
96
299
|
value: number;
|
|
97
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Supported timeframes for graphing or fetching historical data:
|
|
303
|
+
* 1 day, 1 week, 1 month, 3 months, 6 months, or 1 year.
|
|
304
|
+
*/
|
|
98
305
|
export type PoolGraphDataTimeframeKey = "1D" | "1W" | "1M" | "3M" | "6M" | "1Y";
|
|
306
|
+
/**
|
|
307
|
+
* An optional object or approach to define timeframe windows, using
|
|
308
|
+
* dayjs manipulation. Not always used directly.
|
|
309
|
+
*/
|
|
99
310
|
export interface PoolGraphDataTimeframe {
|
|
100
311
|
time: Timestamp;
|
|
101
312
|
timeUnit: ManipulateType;
|
|
102
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* An object describing how each coin in a newly created pool is configured,
|
|
316
|
+
* including initial deposit, weight, and fees.
|
|
317
|
+
*/
|
|
103
318
|
export interface PoolCreationCoinInfo {
|
|
104
319
|
coinType: CoinType;
|
|
105
320
|
weight: PoolWeight;
|
|
@@ -110,11 +325,18 @@ export interface PoolCreationCoinInfo {
|
|
|
110
325
|
withdrawFee: PoolWithdrawFee;
|
|
111
326
|
initialDeposit: Balance;
|
|
112
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Metadata for the newly published LP coin, specifying name, symbol, and optional icon URL.
|
|
330
|
+
*/
|
|
113
331
|
export interface PoolCreationLpCoinMetadata {
|
|
114
332
|
name: string;
|
|
115
333
|
symbol: string;
|
|
116
334
|
iconUrl?: Url;
|
|
117
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* A data structure used for integration with CoinGecko, representing
|
|
338
|
+
* an aggregated ticker ID, base/target coins, price, volumes, and liquidity.
|
|
339
|
+
*/
|
|
118
340
|
export interface CoinGeckoTickerData {
|
|
119
341
|
ticker_id: UniqueId;
|
|
120
342
|
base_currency: CoinType;
|
|
@@ -125,6 +347,10 @@ export interface CoinGeckoTickerData {
|
|
|
125
347
|
target_volume: number;
|
|
126
348
|
liquidity_in_usd: number;
|
|
127
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* Represents a historical trade record for integration with CoinGecko,
|
|
352
|
+
* storing a trade ID, price, volumes, timestamp, and buy/sell type.
|
|
353
|
+
*/
|
|
128
354
|
export interface CoinGeckoHistoricalTradeData {
|
|
129
355
|
trade_id: UniqueId;
|
|
130
356
|
price: number;
|
|
@@ -133,6 +359,10 @@ export interface CoinGeckoHistoricalTradeData {
|
|
|
133
359
|
trade_timestamp: Timestamp;
|
|
134
360
|
type: "buy" | "sell";
|
|
135
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Request body for a user trade, specifying which coin to send in and how much,
|
|
364
|
+
* which coin to receive, plus slippage and optional referral info.
|
|
365
|
+
*/
|
|
136
366
|
export interface ApiPoolTradeBody {
|
|
137
367
|
walletAddress: SuiAddress;
|
|
138
368
|
coinInType: CoinType;
|
|
@@ -142,6 +372,10 @@ export interface ApiPoolTradeBody {
|
|
|
142
372
|
referrer?: SuiAddress;
|
|
143
373
|
isSponsoredTx?: boolean;
|
|
144
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Request body for depositing liquidity into a pool, specifying the amounts in,
|
|
377
|
+
* slippage, and optional referral or sponsorship data.
|
|
378
|
+
*/
|
|
145
379
|
export interface ApiPoolDepositBody {
|
|
146
380
|
walletAddress: SuiAddress;
|
|
147
381
|
amountsIn: CoinsToBalance;
|
|
@@ -149,6 +383,10 @@ export interface ApiPoolDepositBody {
|
|
|
149
383
|
referrer?: SuiAddress;
|
|
150
384
|
isSponsoredTx?: boolean;
|
|
151
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Request body for withdrawing specific amounts from the pool, specifying
|
|
388
|
+
* which coins to remove, how much LP is burned, slippage, etc.
|
|
389
|
+
*/
|
|
152
390
|
export interface ApiPoolWithdrawBody {
|
|
153
391
|
walletAddress: SuiAddress;
|
|
154
392
|
amountsOutDirection: CoinsToBalance;
|
|
@@ -156,15 +394,27 @@ export interface ApiPoolWithdrawBody {
|
|
|
156
394
|
slippage: Slippage;
|
|
157
395
|
referrer?: SuiAddress;
|
|
158
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Request body for withdrawing all coin types from a pool using a single
|
|
399
|
+
* ratio or entire LP amount, simplifying the multi-coin approach.
|
|
400
|
+
*/
|
|
159
401
|
export interface ApiPoolAllCoinWithdrawBody {
|
|
160
402
|
walletAddress: SuiAddress;
|
|
161
403
|
lpCoinAmount: Balance;
|
|
162
404
|
referrer?: SuiAddress;
|
|
163
405
|
}
|
|
406
|
+
/**
|
|
407
|
+
* Request body for publishing a new LP coin on-chain,
|
|
408
|
+
* typically specifying the coin's decimals.
|
|
409
|
+
*/
|
|
164
410
|
export interface ApiPublishLpCoinBody {
|
|
165
411
|
walletAddress: SuiAddress;
|
|
166
|
-
lpCoinDecimals:
|
|
412
|
+
lpCoinDecimals: number;
|
|
167
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Request body for creating a new pool, specifying coin information,
|
|
416
|
+
* the LP coin metadata, and optional DAO fee info.
|
|
417
|
+
*/
|
|
168
418
|
export interface ApiCreatePoolBody {
|
|
169
419
|
walletAddress: SuiAddress;
|
|
170
420
|
lpCoinType: CoinType;
|
|
@@ -172,7 +422,7 @@ export interface ApiCreatePoolBody {
|
|
|
172
422
|
coinsInfo: {
|
|
173
423
|
coinType: CoinType;
|
|
174
424
|
weight: Percentage;
|
|
175
|
-
decimals?:
|
|
425
|
+
decimals?: number;
|
|
176
426
|
tradeFeeIn: Percentage;
|
|
177
427
|
initialDeposit: Balance;
|
|
178
428
|
}[];
|
|
@@ -188,16 +438,31 @@ export interface ApiCreatePoolBody {
|
|
|
188
438
|
feeRecipient: SuiAddress;
|
|
189
439
|
};
|
|
190
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* For retrieving the spot price of a pool, specifying coin in/out.
|
|
443
|
+
* Not always used directly, but present in certain route building contexts.
|
|
444
|
+
*/
|
|
191
445
|
export interface ApiPoolSpotPriceBody {
|
|
192
446
|
coinInType: CoinType;
|
|
193
447
|
coinOutType: CoinType;
|
|
194
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* Request body for obtaining a pool object ID from an LP coin type.
|
|
451
|
+
* Useful to confirm if a coin is indeed an LP token and which pool it references.
|
|
452
|
+
*/
|
|
195
453
|
export interface ApiPoolObjectIdForLpCoinTypeBody {
|
|
196
454
|
lpCoinTypes: CoinType[];
|
|
197
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* Request body for fetching statistics about one or more pools.
|
|
458
|
+
*/
|
|
198
459
|
export interface ApiPoolsStatsBody {
|
|
199
460
|
poolIds: ObjectId[];
|
|
200
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* Request body for listing the owned DAO fee pool owner caps,
|
|
464
|
+
* letting a user see if they can update fees/recipients in certain pools.
|
|
465
|
+
*/
|
|
201
466
|
export interface ApiPoolsOwnedDaoFeePoolOwnerCapsBody {
|
|
202
467
|
walletAddress: SuiAddress;
|
|
203
468
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poolsTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/pools/poolsTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV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,13 +1,50 @@
|
|
|
1
1
|
import { AftermathApi } from "../../general/providers";
|
|
2
2
|
import { Caller } from "../../general/utils/caller";
|
|
3
3
|
import { CallerConfig, SuiAddress } from "../../types";
|
|
4
|
+
/**
|
|
5
|
+
* The `ReferralVault` class provides functionality for querying and managing
|
|
6
|
+
* referral information within the Aftermath protocol. It allows you to look
|
|
7
|
+
* up the referrer for a given address.
|
|
8
|
+
*/
|
|
4
9
|
export declare class ReferralVault extends Caller {
|
|
5
10
|
private readonly Provider?;
|
|
11
|
+
/**
|
|
12
|
+
* Contains static configuration relevant to the referral system, if any.
|
|
13
|
+
* Currently empty but can be extended for future needs.
|
|
14
|
+
*/
|
|
6
15
|
static readonly constants: {};
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new instance of `ReferralVault` to interact with referral-related
|
|
18
|
+
* features in the Aftermath protocol.
|
|
19
|
+
*
|
|
20
|
+
* @param config - Optional caller configuration, including Sui network and access token.
|
|
21
|
+
* @param Provider - An optional `AftermathApi` provider instance for referral-specific methods.
|
|
22
|
+
*/
|
|
7
23
|
constructor(config?: CallerConfig, Provider?: AftermathApi | undefined);
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves the referrer address for a specified referee (user).
|
|
26
|
+
*
|
|
27
|
+
* @param inputs - An object containing the `referee` Sui address.
|
|
28
|
+
* @returns A promise that resolves to either the referrer's `SuiAddress` or the string `"None"` if no referrer exists.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
33
|
+
* await afSdk.init(); // initialize provider
|
|
34
|
+
*
|
|
35
|
+
* const referralVault = afSdk.ReferralVault();
|
|
36
|
+
*
|
|
37
|
+
* const referrer = await referralVault.getReferrer({ referee: "0x<user_address>" });
|
|
38
|
+
* console.log("Referrer address:", referrer);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
8
41
|
getReferrer(inputs: {
|
|
9
42
|
referee: SuiAddress;
|
|
10
43
|
}): Promise<SuiAddress | "None">;
|
|
44
|
+
/**
|
|
45
|
+
* Internal helper to retrieve the configured `ReferralVault` provider from
|
|
46
|
+
* `AftermathApi`, throwing an error if not defined.
|
|
47
|
+
*/
|
|
11
48
|
private useProvider;
|
|
12
49
|
}
|
|
13
50
|
//# sourceMappingURL=referralVault.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referralVault.d.ts","sourceRoot":"","sources":["../../../src/packages/referralVault/referralVault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAmB,MAAM,aAAa,CAAC;AAExE,qBAAa,aAAc,SAAQ,MAAM;
|
|
1
|
+
{"version":3,"file":"referralVault.d.ts","sourceRoot":"","sources":["../../../src/packages/referralVault/referralVault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAmB,MAAM,aAAa,CAAC;AAExE;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,MAAM;IAwBvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAnB3B;;;OAGG;IACH,gBAAuB,SAAS,KAAM;IAMtC;;;;;;OAMG;gBAEF,MAAM,CAAC,EAAE,YAAY,EACJ,QAAQ,CAAC,0BAAc;IASzC;;;;;;;;;;;;;;;;OAgBG;IACU,WAAW,CAAC,MAAM,EAAE;QAChC,OAAO,EAAE,UAAU,CAAC;KACpB,GAAG,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC;IAQhC;;;OAGG;IACH,OAAO,CAAC,WAAW,CAIjB;CACF"}
|
|
@@ -11,16 +11,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ReferralVault = void 0;
|
|
13
13
|
const caller_1 = require("../../general/utils/caller");
|
|
14
|
+
/**
|
|
15
|
+
* The `ReferralVault` class provides functionality for querying and managing
|
|
16
|
+
* referral information within the Aftermath protocol. It allows you to look
|
|
17
|
+
* up the referrer for a given address.
|
|
18
|
+
*/
|
|
14
19
|
class ReferralVault extends caller_1.Caller {
|
|
15
20
|
// =========================================================================
|
|
16
21
|
// Constructor
|
|
17
22
|
// =========================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new instance of `ReferralVault` to interact with referral-related
|
|
25
|
+
* features in the Aftermath protocol.
|
|
26
|
+
*
|
|
27
|
+
* @param config - Optional caller configuration, including Sui network and access token.
|
|
28
|
+
* @param Provider - An optional `AftermathApi` provider instance for referral-specific methods.
|
|
29
|
+
*/
|
|
18
30
|
constructor(config, Provider) {
|
|
19
31
|
super(config, "referral-vault");
|
|
20
32
|
this.Provider = Provider;
|
|
21
33
|
// =========================================================================
|
|
22
34
|
// Private Helpers
|
|
23
35
|
// =========================================================================
|
|
36
|
+
/**
|
|
37
|
+
* Internal helper to retrieve the configured `ReferralVault` provider from
|
|
38
|
+
* `AftermathApi`, throwing an error if not defined.
|
|
39
|
+
*/
|
|
24
40
|
this.useProvider = () => {
|
|
25
41
|
var _a;
|
|
26
42
|
const provider = (_a = this.Provider) === null || _a === void 0 ? void 0 : _a.ReferralVault();
|
|
@@ -32,6 +48,23 @@ class ReferralVault extends caller_1.Caller {
|
|
|
32
48
|
// =========================================================================
|
|
33
49
|
// Inspections
|
|
34
50
|
// =========================================================================
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves the referrer address for a specified referee (user).
|
|
53
|
+
*
|
|
54
|
+
* @param inputs - An object containing the `referee` Sui address.
|
|
55
|
+
* @returns A promise that resolves to either the referrer's `SuiAddress` or the string `"None"` if no referrer exists.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
60
|
+
* await afSdk.init(); // initialize provider
|
|
61
|
+
*
|
|
62
|
+
* const referralVault = afSdk.ReferralVault();
|
|
63
|
+
*
|
|
64
|
+
* const referrer = await referralVault.getReferrer({ referee: "0x<user_address>" });
|
|
65
|
+
* console.log("Referrer address:", referrer);
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
35
68
|
getReferrer(inputs) {
|
|
36
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
70
|
return this.fetchApi(`${inputs.referee}/referrer`);
|
|
@@ -42,4 +75,8 @@ exports.ReferralVault = ReferralVault;
|
|
|
42
75
|
// =========================================================================
|
|
43
76
|
// Constants
|
|
44
77
|
// =========================================================================
|
|
78
|
+
/**
|
|
79
|
+
* Contains static configuration relevant to the referral system, if any.
|
|
80
|
+
* Currently empty but can be extended for future needs.
|
|
81
|
+
*/
|
|
45
82
|
ReferralVault.constants = {};
|