aftermath-ts-sdk 1.2.63 → 1.2.64-docs.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +61 -27
  2. package/dist/general/dynamicGas/dynamicGas.d.ts +34 -0
  3. package/dist/general/dynamicGas/dynamicGas.d.ts.map +1 -1
  4. package/dist/general/dynamicGas/dynamicGas.js +34 -0
  5. package/dist/general/dynamicGas/dynamicGasTypes.d.ts +25 -0
  6. package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +1 -1
  7. package/dist/general/prices/prices.d.ts +73 -0
  8. package/dist/general/prices/prices.d.ts.map +1 -1
  9. package/dist/general/prices/prices.js +73 -0
  10. package/dist/general/providers/aftermath.d.ts +106 -25
  11. package/dist/general/providers/aftermath.d.ts.map +1 -1
  12. package/dist/general/providers/aftermath.js +108 -27
  13. package/dist/general/providers/aftermathApi.d.ts +127 -8
  14. package/dist/general/providers/aftermathApi.d.ts.map +1 -1
  15. package/dist/general/providers/aftermathApi.js +132 -12
  16. package/dist/general/types/castingTypes.d.ts +0 -7
  17. package/dist/general/types/castingTypes.d.ts.map +1 -1
  18. package/dist/general/types/castingTypes.js +6 -0
  19. package/dist/general/types/generalTypes.d.ts +228 -7
  20. package/dist/general/types/generalTypes.d.ts.map +1 -1
  21. package/dist/general/types/suiTypes.d.ts +0 -16
  22. package/dist/general/types/suiTypes.d.ts.map +1 -1
  23. package/dist/general/types/suiTypes.js +3 -25
  24. package/dist/general/utils/casting.d.ts +159 -3
  25. package/dist/general/utils/casting.d.ts.map +1 -1
  26. package/dist/general/utils/casting.js +162 -16
  27. package/dist/general/utils/fixedUtils.d.ts +89 -2
  28. package/dist/general/utils/fixedUtils.d.ts.map +1 -1
  29. package/dist/general/utils/fixedUtils.js +81 -4
  30. package/dist/general/utils/helpers.d.ts +320 -9
  31. package/dist/general/utils/helpers.d.ts.map +1 -1
  32. package/dist/general/utils/helpers.js +350 -89
  33. package/dist/general/utils/iFixedUtils.d.ts +64 -0
  34. package/dist/general/utils/iFixedUtils.d.ts.map +1 -1
  35. package/dist/general/utils/iFixedUtils.js +64 -0
  36. package/dist/general/wallet/wallet.d.ts +75 -0
  37. package/dist/general/wallet/wallet.d.ts.map +1 -1
  38. package/dist/general/wallet/wallet.js +75 -5
  39. package/dist/packages/auth/auth.d.ts +113 -0
  40. package/dist/packages/auth/auth.d.ts.map +1 -1
  41. package/dist/packages/auth/auth.js +129 -15
  42. package/dist/packages/auth/authTypes.d.ts +66 -0
  43. package/dist/packages/auth/authTypes.d.ts.map +1 -1
  44. package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
  45. package/dist/packages/coin/api/coinApi.js +28 -20
  46. package/dist/packages/coin/coin.d.ts +250 -0
  47. package/dist/packages/coin/coin.d.ts.map +1 -1
  48. package/dist/packages/coin/coin.js +238 -14
  49. package/dist/packages/coin/coinTypes.d.ts +93 -0
  50. package/dist/packages/coin/coinTypes.d.ts.map +1 -1
  51. package/dist/packages/dca/dca.d.ts +124 -35
  52. package/dist/packages/dca/dca.d.ts.map +1 -1
  53. package/dist/packages/dca/dca.js +127 -37
  54. package/dist/packages/dca/dcaTypes.d.ts +213 -28
  55. package/dist/packages/dca/dcaTypes.d.ts.map +1 -1
  56. package/dist/packages/farms/farms.d.ts +184 -1
  57. package/dist/packages/farms/farms.d.ts.map +1 -1
  58. package/dist/packages/farms/farms.js +185 -11
  59. package/dist/packages/farms/farmsStakedPosition.d.ts +140 -6
  60. package/dist/packages/farms/farmsStakedPosition.d.ts.map +1 -1
  61. package/dist/packages/farms/farmsStakedPosition.js +189 -144
  62. package/dist/packages/farms/farmsStakingPool.d.ts +161 -1
  63. package/dist/packages/farms/farmsStakingPool.d.ts.map +1 -1
  64. package/dist/packages/farms/farmsStakingPool.js +176 -70
  65. package/dist/packages/farms/farmsTypes.d.ts +283 -2
  66. package/dist/packages/farms/farmsTypes.d.ts.map +1 -1
  67. package/dist/packages/farms/farmsTypes.js +18 -0
  68. package/dist/packages/limitOrders/limitOrders.d.ts +108 -21
  69. package/dist/packages/limitOrders/limitOrders.d.ts.map +1 -1
  70. package/dist/packages/limitOrders/limitOrders.js +110 -22
  71. package/dist/packages/limitOrders/limitOrdersTypes.d.ts +142 -0
  72. package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +1 -1
  73. package/dist/packages/multisig/multisig.d.ts +33 -4
  74. package/dist/packages/multisig/multisig.d.ts.map +1 -1
  75. package/dist/packages/multisig/multisig.js +33 -4
  76. package/dist/packages/multisig/multisigTypes.d.ts +17 -0
  77. package/dist/packages/multisig/multisigTypes.d.ts.map +1 -1
  78. package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -1
  79. package/dist/packages/pools/pool.d.ts +327 -85
  80. package/dist/packages/pools/pool.d.ts.map +1 -1
  81. package/dist/packages/pools/pool.js +333 -91
  82. package/dist/packages/pools/pools.d.ts +299 -37
  83. package/dist/packages/pools/pools.d.ts.map +1 -1
  84. package/dist/packages/pools/pools.js +306 -52
  85. package/dist/packages/pools/poolsTypes.d.ts +273 -8
  86. package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
  87. package/dist/packages/referralVault/referralVault.d.ts +37 -0
  88. package/dist/packages/referralVault/referralVault.d.ts.map +1 -1
  89. package/dist/packages/referralVault/referralVault.js +37 -0
  90. package/dist/packages/router/router.d.ts +213 -17
  91. package/dist/packages/router/router.d.ts.map +1 -1
  92. package/dist/packages/router/router.js +214 -18
  93. package/dist/packages/router/routerTypes.d.ts +198 -14
  94. package/dist/packages/router/routerTypes.d.ts.map +1 -1
  95. package/dist/packages/staking/staking.d.ts +301 -43
  96. package/dist/packages/staking/staking.d.ts.map +1 -1
  97. package/dist/packages/staking/staking.js +308 -51
  98. package/dist/packages/staking/stakingTypes.d.ts +426 -6
  99. package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
  100. package/dist/packages/staking/stakingTypes.js +19 -0
  101. package/dist/packages/sui/sui.d.ts +39 -0
  102. package/dist/packages/sui/sui.d.ts.map +1 -1
  103. package/dist/packages/sui/sui.js +39 -0
  104. package/dist/packages/userData/userData.d.ts +66 -12
  105. package/dist/packages/userData/userData.d.ts.map +1 -1
  106. package/dist/packages/userData/userData.js +66 -12
  107. package/dist/packages/userData/userDataTypes.d.ts +19 -0
  108. package/dist/packages/userData/userDataTypes.d.ts.map +1 -1
  109. package/dist/types.d.ts.map +1 -1
  110. package/dist/types.js +0 -1
  111. package/package.json +1 -1
  112. package/dist/general/historicalData/historicalData.d.ts +0 -15
  113. package/dist/general/historicalData/historicalData.d.ts.map +0 -1
  114. package/dist/general/historicalData/historicalData.js +0 -45
  115. package/dist/general/historicalData/historicalDataTypes.d.ts +0 -10
  116. package/dist/general/historicalData/historicalDataTypes.d.ts.map +0 -1
  117. package/dist/general/historicalData/historicalDataTypes.js +0 -2
@@ -3,125 +3,383 @@ import { Caller } from "../../general/utils/caller";
3
3
  import { SuiValidatorSummary, ValidatorsApy } from "@mysten/sui/client";
4
4
  import { AftermathApi } from "../../general/providers";
5
5
  /**
6
- * The Staking class provides an interface for interacting with the Staking contract.
6
+ * The `Staking` class provides methods for interacting with Aftermath's
7
+ * staking and unstaking systems for SUI. This includes fetching validator
8
+ * information, creating stake and unstake transactions, and retrieving
9
+ * relevant staking statistics such as TVL and APY.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Instantiate Staking
14
+ * const sdk = new Aftermath("MAINNET");
15
+ * await sdk.init();
16
+ * const staking = sdk.Staking();
17
+ *
18
+ * // Get active validators
19
+ * const validators = await staking.getActiveValidators();
20
+ *
21
+ * // Create a transaction for staking SUI
22
+ * const stakeTx = await staking.getStakeTransaction({
23
+ * walletAddress: "0x...",
24
+ * suiStakeAmount: BigInt("1000000000"),
25
+ * validatorAddress: "0x..."
26
+ * });
27
+ * ```
7
28
  */
8
29
  export declare class Staking extends Caller {
9
30
  private readonly Provider?;
10
31
  /**
11
- * Constants related to staking.
32
+ * Contains constants for staking, including protocol fees, default validator
33
+ * fee, and staking/unstaking bounds. Also defines the maximum external fee
34
+ * percentage allowed for third-party fees.
12
35
  */
13
36
  static readonly constants: {
37
+ /**
38
+ * Configuration for fees related to staking and unstaking operations.
39
+ */
14
40
  fees: {
41
+ /**
42
+ * Protocol unstake fee (5%).
43
+ */
15
44
  protocolUnstake: number;
45
+ /**
46
+ * Default validator fee (0%).
47
+ */
16
48
  defaultValidator: number;
49
+ /**
50
+ * Maximum validator fee (5%).
51
+ */
17
52
  maxValidator: number;
18
53
  };
54
+ /**
55
+ * Configuration for minimum stake/unstake amounts, and maximum external fee
56
+ * percentage allowed.
57
+ */
19
58
  bounds: {
59
+ /**
60
+ * Minimum SUI that can be staked. 1 SUI = 10^9 MIST.
61
+ */
20
62
  minStake: bigint;
63
+ /**
64
+ * Minimum afSUI that can be unstaked. 1 afSUI = 10^9 MIST (mirroring SUI decimals).
65
+ */
21
66
  minUnstake: bigint;
22
67
  /**
23
- * Max fee percentage that third parties can charge on staking/unstaking transactions
68
+ * Maximum external fee percentage that third parties can add on top
69
+ * of protocol fees for staking or unstaking transactions.
70
+ * @remarks 0.5 = 50%
24
71
  */
25
72
  maxExternalFeePercentage: number;
26
73
  };
74
+ /**
75
+ * The default validator fee (0%).
76
+ */
27
77
  defaultValidatorFee: number;
28
78
  };
29
79
  /**
30
- * Creates a new instance of the Staking class.
31
- * @param network - The network to use for interacting with the Staking contract.
80
+ * Creates a new instance of the `Staking` class for interacting with Aftermath
81
+ * staking contracts.
82
+ *
83
+ * @param config - Optional configuration containing the Sui network and/or access token.
84
+ * @param Provider - Optional instance of `AftermathApi` for building transactions.
32
85
  */
33
86
  constructor(config?: CallerConfig, Provider?: AftermathApi | undefined);
34
87
  /**
35
- * Fetches the list of active validators.
36
- * @returns A Promise that resolves to an array of `SuiValidatorSummary` objects.
88
+ * Fetches the list of currently active validators on the Sui network.
89
+ *
90
+ * @returns A promise that resolves to an array of `SuiValidatorSummary` objects,
91
+ * each describing a validator's on-chain metadata.
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * const validators = await staking.getActiveValidators();
96
+ * console.log(validators);
97
+ * ```
37
98
  */
38
99
  getActiveValidators(): Promise<SuiValidatorSummary[]>;
39
100
  /**
40
- * Fetches the APYs for all validators.
41
- * @returns A Promise that resolves to a `ValidatorsApy` object.
101
+ * Fetches the current APYs for all validators, aggregated by the indexer.
102
+ *
103
+ * @returns A promise that resolves to a `ValidatorsApy` object, containing
104
+ * APY data indexed by validator addresses.
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const validatorApys = await staking.getValidatorApys();
109
+ * console.log(validatorApys);
110
+ * ```
42
111
  */
43
112
  getValidatorApys(): Promise<ValidatorsApy>;
44
113
  /**
45
- * Fetches the configuration for all validators.
46
- * @returns A Promise that resolves to an array of `ValidatorConfigObject` objects.
114
+ * Fetches the configuration details for each validator, including fees and
115
+ * operation caps.
116
+ *
117
+ * @returns A promise that resolves to an array of `ValidatorConfigObject`s.
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * const configs = await staking.getValidatorConfigs();
122
+ * console.log(configs);
123
+ * ```
47
124
  */
48
125
  getValidatorConfigs(): Promise<ValidatorConfigObject[]>;
49
126
  /**
50
- * Fetches the staking positions for a given account.
51
- * @param inputs - An object containing the account address and optional pagination parameters.
52
- * @returns A Promise that resolves to an array of `StakingPosition` objects.
127
+ * Retrieves a list of staking positions for the specified account.
128
+ *
129
+ * @param inputs - Contains the `walletAddress` to query, plus optional cursor
130
+ * and limit for pagination.
131
+ * @returns A promise that resolves to an array of `StakingPosition` objects
132
+ * reflecting the user's active or pending stakes.
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const positions = await staking.getStakingPositions({
137
+ * walletAddress: "0x...",
138
+ * cursor: 0,
139
+ * limit: 10
140
+ * });
141
+ * console.log(positions);
142
+ * ```
53
143
  */
54
144
  getStakingPositions(inputs: ApiStakingPositionsBody): Promise<StakingPosition[]>;
55
145
  /**
56
- * Fetches the delegated stakes for a given validator.
57
- * @param inputs - An object containing the validator address and optional pagination parameters.
58
- * @returns A Promise that resolves to an array of `SuiDelegatedStake` objects.
146
+ * Fetches all delegated stakes for a specific wallet address. Delegated
147
+ * stakes typically represent user funds staked to one or more validators.
148
+ *
149
+ * @param inputs - Contains the `walletAddress` for which to fetch delegated stakes.
150
+ * @returns A promise resolving to an array of `SuiDelegatedStake` objects.
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * const delegatedStakes = await staking.getDelegatedStakes({
155
+ * walletAddress: "0x..."
156
+ * });
157
+ * console.log(delegatedStakes);
158
+ * ```
59
159
  */
60
160
  getDelegatedStakes(inputs: ApiDelegatedStakesBody): Promise<SuiDelegatedStake[]>;
61
161
  /**
62
- * Fetches the operation caps for a given validator.
63
- * @param inputs - An object containing the validator address and optional pagination parameters.
64
- * @returns A Promise that resolves to an array of `ValidatorOperationCapObject` objects.
162
+ * Retrieves validator operation caps for a specified address. Operation caps
163
+ * typically govern who is authorized to adjust validator fees and settings.
164
+ *
165
+ * @param inputs - Contains the `walletAddress` for which to fetch validator
166
+ * operation caps, plus optional pagination.
167
+ * @returns A promise resolving to an array of `ValidatorOperationCapObject`s.
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * const caps = await staking.getValidatorOperationCaps({
172
+ * walletAddress: "0x...",
173
+ * cursor: 0,
174
+ * limit: 5
175
+ * });
176
+ * console.log(caps);
177
+ * ```
65
178
  */
66
179
  getValidatorOperationCaps(inputs: ApiValidatorOperationCapsBody): Promise<ValidatorOperationCapObject[]>;
67
180
  /**
68
- * Fetches the transaction object for staking SUI.
69
- * @param inputs - An object containing the staker address and the amount of SUI to stake.
70
- * @returns A Promise that resolves to a transaction object.
181
+ * Builds or fetches a staking transaction object, which can then be signed
182
+ * and submitted to the network.
183
+ *
184
+ * @param inputs - Includes the `walletAddress`, the amount of SUI to stake, and
185
+ * the validator address to stake with. Optionally includes a `referrer`, `externalFee`,
186
+ * and a sponsored transaction flag.
187
+ * @returns A promise resolving to a transaction that can be signed and executed.
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * const stakeTx = await staking.getStakeTransaction({
192
+ * walletAddress: "0x...",
193
+ * suiStakeAmount: BigInt("1000000000"), // 1 SUI
194
+ * validatorAddress: "0x..."
195
+ * });
196
+ * // sign and execute this transaction using your preferred Sui wallet
197
+ * ```
71
198
  */
72
199
  getStakeTransaction(inputs: ApiStakeBody): Promise<import("@mysten/sui/transactions").Transaction>;
73
200
  /**
74
- * Fetches the transaction object for unstaking SUI.
75
- * @param inputs - An object containing the staker address and the amount of SUI to unstake.
76
- * @returns A Promise that resolves to a transaction object.
201
+ * Builds or fetches an unstaking transaction object, allowing a user to
202
+ * convert their afSUI back into SUI (either atomically or via partial
203
+ * liquidity).
204
+ *
205
+ * @param inputs - Contains the `walletAddress`, the afSUI amount to unstake,
206
+ * and whether it's an atomic operation. Optionally includes a `referrer`,
207
+ * `externalFee`, and a sponsored transaction flag.
208
+ * @returns A promise resolving to a transaction that can be signed and executed.
209
+ *
210
+ * @example
211
+ * ```typescript
212
+ * const unstakeTx = await staking.getUnstakeTransaction({
213
+ * walletAddress: "0x...",
214
+ * afSuiUnstakeAmount: BigInt("1000000000"), // 1 afSUI
215
+ * isAtomic: true
216
+ * });
217
+ * // sign and execute this transaction to receive SUI
218
+ * ```
77
219
  */
78
220
  getUnstakeTransaction(inputs: ApiUnstakeBody): Promise<import("@mysten/sui/transactions").Transaction>;
79
221
  /**
80
- * Fetches the transaction object for staking stakedSUI.
81
- * @param inputs - An object containing the staker address and the amount of stakedSUI to stake.
82
- * @returns A Promise that resolves to a transaction object.
222
+ * Builds or fetches a transaction to stake an existing stakedSUI object
223
+ * (e.g., re-staking funds that were already staked under a different
224
+ * validator).
225
+ *
226
+ * @param inputs - Contains the `walletAddress`, an array of `stakedSuiIds`
227
+ * to be re-staked, and the new `validatorAddress`. Optionally includes
228
+ * a `referrer` and a sponsored transaction flag.
229
+ * @returns A promise resolving to a transaction object that can be signed
230
+ * and executed.
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * const stakeStakedTx = await staking.getStakeStakedSuiTransaction({
235
+ * walletAddress: "0x...",
236
+ * stakedSuiIds: ["0x<stakedSuiId1>", "0x<stakedSuiId2>"],
237
+ * validatorAddress: "0x..."
238
+ * });
239
+ * // sign and execute this transaction
240
+ * ```
83
241
  */
84
242
  getStakeStakedSuiTransaction(inputs: ApiStakeStakedSuiBody): Promise<import("@mysten/sui/transactions").Transaction>;
85
243
  /**
86
- * Fetches the transaction object for updating a validator's fee.
87
- * @param inputs - An object containing the validator address and the new fee percentage.
88
- * @returns A Promise that resolves to a transaction object.
244
+ * Builds or fetches a transaction to update the validator fee for a
245
+ * validator in which the user has operation cap privileges.
246
+ *
247
+ * @param inputs - Contains the `walletAddress`, `validatorOperationCapId`,
248
+ * and `newFeePercentage`. Optionally includes a sponsored transaction flag.
249
+ * @returns A transaction object that can be signed and executed to
250
+ * update the validator's fee on-chain.
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * const updateFeeTx = await staking.getUpdateValidatorFeeTransaction({
255
+ * walletAddress: "0x...",
256
+ * validatorOperationCapId: "0x...",
257
+ * newFeePercentage: 0.01,
258
+ * isSponsoredTx: false
259
+ * });
260
+ * // sign and execute to update the validator fee
261
+ * ```
89
262
  */
90
263
  getUpdateValidatorFeeTransaction(inputs: ApiUpdateValidatorFeeBody): Promise<import("@mysten/sui/transactions").Transaction>;
264
+ /**
265
+ * Builds a "crank" transaction to update the epoch for afSUI. This can
266
+ * trigger certain internal processes within the Aftermath protocol,
267
+ * such as distributing rewards or rebalancing.
268
+ *
269
+ * @param inputs - Contains the `walletAddress` to sign the transaction.
270
+ * @returns A transaction object that can be signed and submitted to
271
+ * trigger an epoch update.
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * const crankTx = await staking.getCrankAfSuiTransaction({
276
+ * walletAddress: "0x..."
277
+ * });
278
+ * // sign and execute transaction
279
+ * ```
280
+ */
91
281
  getCrankAfSuiTransaction(inputs: {
92
282
  walletAddress: SuiAddress;
93
283
  }): import("@mysten/sui/transactions").Transaction;
94
284
  /**
95
- * Fetches the total value locked in SUI.
96
- * @returns A Promise that resolves to a `Balance` object.
285
+ * Retrieves the total value locked (TVL) in SUI across the Aftermath
286
+ * staking systems.
287
+ *
288
+ * @returns A promise that resolves to a `Balance` representing the total
289
+ * staked SUI in the protocol.
290
+ *
291
+ * @example
292
+ * ```typescript
293
+ * const tvl = await staking.getSuiTvl();
294
+ * console.log("Total value locked in SUI:", tvl);
295
+ * ```
97
296
  */
98
297
  getSuiTvl(): Promise<Balance>;
99
298
  /**
100
- * Fetches the exchange rate between afSUI and SUI.
101
- * @returns A Promise that resolves to a number.
299
+ * Retrieves the current exchange rate between afSUI and SUI. This rate
300
+ * is used to determine how much SUI a single afSUI token is worth.
301
+ *
302
+ * @returns A promise that resolves to a `number` representing the
303
+ * afSUI-to-SUI rate.
304
+ *
305
+ * @example
306
+ * ```typescript
307
+ * const rate = await staking.getAfSuiToSuiExchangeRate();
308
+ * console.log("1 afSUI =", rate, "SUI");
309
+ * ```
102
310
  */
103
311
  getAfSuiToSuiExchangeRate(): Promise<number>;
104
312
  /**
105
- * Fetches the state of the stakedSUI vault.
106
- * @returns A Promise that resolves to a `StakedSuiVaultStateObject` object.
313
+ * Retrieves the stakedSui vault state from the protocol, which holds
314
+ * important values for calculating fees, reserves, and total active
315
+ * stake.
316
+ *
317
+ * @returns A promise that resolves to a `StakedSuiVaultStateObject`,
318
+ * containing details like atomic unstake reserves, fees, and total SUI.
319
+ *
320
+ * @example
321
+ * ```typescript
322
+ * const vaultState = await staking.getStakedSuiVaultState();
323
+ * console.log("Vault State:", vaultState);
324
+ * ```
107
325
  */
108
326
  getStakedSuiVaultState(): Promise<StakedSuiVaultStateObject>;
109
327
  /**
110
- * Fetches the current APY for staking SUI.
111
- * @returns A Promise that resolves to a number.
328
+ * Retrieves the current APY (Annual Percentage Yield) for staking SUI
329
+ * through Aftermath.
330
+ *
331
+ * @returns A promise that resolves to a `number` representing the APY.
332
+ *
333
+ * @example
334
+ * ```typescript
335
+ * const apy = await staking.getApy();
336
+ * console.log("Current staking APY:", apy);
337
+ * ```
112
338
  */
113
339
  getApy(): Promise<number>;
340
+ /**
341
+ * Retrieves historical APY data points over a specified timeframe.
342
+ *
343
+ * @param inputs - Contains a `timeframe` key, such as `"1W"`, `"1M"`, `"1Y"`, etc.
344
+ * @returns A promise resolving to an array of `StakingApyDataPoint` objects,
345
+ * each containing a timestamp and an APY value.
346
+ *
347
+ * @example
348
+ * ```typescript
349
+ * const historicalApy = await staking.getHistoricalApy({ timeframe: "1M" });
350
+ * console.log(historicalApy); // e.g. [{ timestamp: 1686000000, apy: 0.045 }, ...]
351
+ * ```
352
+ */
114
353
  getHistoricalApy(inputs: {
115
354
  timeframe: StakingApyTimeframeKey;
116
355
  }): Promise<StakingApyDataPoint[]>;
117
356
  /**
118
- * Calculates the atomic unstake fee for a given stakedSUI vault state.
119
- * @param inputs - An object containing the stakedSUI vault state.
120
- * @returns A `Percentage` object representing the atomic unstake fee.
357
+ * Calculates the atomic unstake fee based on the current vault state. If
358
+ * the `atomicUnstakeSuiReserves` remain above the target, the minimum fee
359
+ * applies; otherwise, the fee adjusts proportionally up to the maximum
360
+ * possible fee.
361
+ *
362
+ * @param inputs - Contains the `stakedSuiVaultState`, which holds data on
363
+ * liquidity reserves, target values, and min/max fees.
364
+ * @returns A `Percentage` representing the resulting fee (0.01 = 1%).
365
+ *
366
+ * @example
367
+ * ```typescript
368
+ * const vaultState = await staking.getStakedSuiVaultState();
369
+ * const fee = Staking.calcAtomicUnstakeFee({ stakedSuiVaultState: vaultState });
370
+ * console.log("Current atomic unstake fee:", fee);
371
+ * ```
121
372
  */
122
373
  static calcAtomicUnstakeFee(inputs: {
123
374
  stakedSuiVaultState: StakedSuiVaultStateObject;
124
375
  }): Percentage;
376
+ /**
377
+ * Returns a provider instance for building transactions. Throws an error
378
+ * if `Provider` is not defined.
379
+ *
380
+ * @returns An instance of `AftermathApi.Staking`.
381
+ * @throws Will throw if the `Provider` is undefined.
382
+ */
125
383
  private useProvider;
126
384
  }
127
385
  //# sourceMappingURL=staking.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../../../src/packages/staking/staking.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,cAAc,EAEd,uBAAuB,EACvB,eAAe,EAEf,OAAO,EAGP,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,6BAA6B,EAC7B,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,yBAAyB,EACzB,UAAU,EACV,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;GAEG;AACH,qBAAa,OAAQ,SAAQ,MAAM;IAmCjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IA9B3B;;OAEG;IACH,gBAAuB,SAAS;;;;;;;;;YAS9B;;eAEG;;;;MAIH;IAMF;;;OAGG;gBAEF,MAAM,CAAC,EAAE,YAAY,EACJ,QAAQ,CAAC,0BAAc;IASzC;;;OAGG;IACU,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAIlE;;;OAGG;IACU,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC;IAIvD;;;OAGG;IACU,mBAAmB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAIpE;;;;OAIG;IACU,mBAAmB,CAC/B,MAAM,EAAE,uBAAuB,GAC7B,OAAO,CAAC,eAAe,EAAE,CAAC;IAI7B;;;;OAIG;IACU,kBAAkB,CAC9B,MAAM,EAAE,sBAAsB,GAC5B,OAAO,CAAC,iBAAiB,EAAE,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