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
|
@@ -1,155 +1,575 @@
|
|
|
1
1
|
import { CoinType } from "../..";
|
|
2
|
-
import { ApiEventsBody, Balance, Event, Object, Percentage, Timestamp, ObjectId, SuiAddress, TransactionDigest, ExternalFee } from "../../general/types/generalTypes";
|
|
3
|
-
|
|
2
|
+
import { ApiEventsBody, Balance, Event, Object as SuiObject, Percentage, Timestamp, ObjectId, SuiAddress, TransactionDigest, ExternalFee } from "../../general/types/generalTypes";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a validator's configuration object, including its Sui address,
|
|
5
|
+
* operation cap ID, and fee percentage.
|
|
6
|
+
*/
|
|
7
|
+
export interface ValidatorConfigObject extends SuiObject {
|
|
8
|
+
/**
|
|
9
|
+
* The Sui address of the validator.
|
|
10
|
+
*/
|
|
4
11
|
suiAddress: SuiAddress;
|
|
12
|
+
/**
|
|
13
|
+
* The on-chain object ID referencing this validator's operation cap.
|
|
14
|
+
*/
|
|
5
15
|
operationCapId: ObjectId;
|
|
16
|
+
/**
|
|
17
|
+
* The current fee percentage for this validator (0.01 = 1%).
|
|
18
|
+
*/
|
|
6
19
|
fee: Percentage;
|
|
7
20
|
}
|
|
8
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Represents a validator's operation cap object, which authorizes changes to
|
|
23
|
+
* validator settings like fees.
|
|
24
|
+
*/
|
|
25
|
+
export interface ValidatorOperationCapObject extends SuiObject {
|
|
26
|
+
/**
|
|
27
|
+
* The validator address authorized by this operation cap.
|
|
28
|
+
*/
|
|
9
29
|
authorizerValidatorAddress: SuiAddress;
|
|
10
30
|
}
|
|
11
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Represents the on-chain state of the stakedSui vault, which tracks liquidity
|
|
33
|
+
* for atomic unstakes, total SUI amounts, rewards, and fees.
|
|
34
|
+
*/
|
|
35
|
+
export interface StakedSuiVaultStateObject extends SuiObject {
|
|
36
|
+
/**
|
|
37
|
+
* The target size for atomic unstake SUI reserves.
|
|
38
|
+
*/
|
|
12
39
|
atomicUnstakeSuiReservesTargetValue: Balance;
|
|
40
|
+
/**
|
|
41
|
+
* The current size of the SUI reserves for atomic unstakes.
|
|
42
|
+
*/
|
|
13
43
|
atomicUnstakeSuiReserves: Balance;
|
|
44
|
+
/**
|
|
45
|
+
* The minimum fee for atomic unstakes, expressed as a BigInt-based percentage
|
|
46
|
+
* (e.g., 50000000n = 5% if using 1e9-based decimals).
|
|
47
|
+
*/
|
|
14
48
|
minAtomicUnstakeFee: bigint;
|
|
49
|
+
/**
|
|
50
|
+
* The maximum fee for atomic unstakes.
|
|
51
|
+
*/
|
|
15
52
|
maxAtomicUnstakeFee: bigint;
|
|
53
|
+
/**
|
|
54
|
+
* The total amount of SUI rewards accumulated in the vault.
|
|
55
|
+
*/
|
|
16
56
|
totalRewardsAmount: Balance;
|
|
57
|
+
/**
|
|
58
|
+
* The total amount of SUI staked in the vault.
|
|
59
|
+
*/
|
|
17
60
|
totalSuiAmount: Balance;
|
|
61
|
+
/**
|
|
62
|
+
* The current epoch number, as a BigInt.
|
|
63
|
+
*/
|
|
18
64
|
activeEpoch: bigint;
|
|
19
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Represents a dynamic field holding a stake balance. Useful for tracking
|
|
68
|
+
* on-chain data related to a specific stake or delegator.
|
|
69
|
+
*/
|
|
20
70
|
export interface StakeBalanceDynamicField {
|
|
71
|
+
/**
|
|
72
|
+
* The on-chain object ID of this stake balance record.
|
|
73
|
+
*/
|
|
21
74
|
objectId: ObjectId;
|
|
75
|
+
/**
|
|
76
|
+
* The amount of SUI (or afSUI) represented by this field, expressed as a bigint.
|
|
77
|
+
*/
|
|
22
78
|
value: Balance;
|
|
23
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Enumerates the possible states of a delegated stake on the Sui network.
|
|
82
|
+
*
|
|
83
|
+
* - **Active**: The stake is actively earning rewards.
|
|
84
|
+
* - **Pending**: The stake has been requested but not yet activated.
|
|
85
|
+
* - **Unstaked**: The stake has been removed or the SUI is no longer earning rewards.
|
|
86
|
+
*/
|
|
24
87
|
export type SuiDelegatedStakeState = "Active" | "Pending" | "Unstaked";
|
|
88
|
+
/**
|
|
89
|
+
* Represents a delegated stake object in the Sui network. Unlike local
|
|
90
|
+
* Aftermath-specific stake positions, this is a more general Sui system stake
|
|
91
|
+
* that can earn protocol-level rewards.
|
|
92
|
+
*/
|
|
25
93
|
export interface SuiDelegatedStake {
|
|
94
|
+
/**
|
|
95
|
+
* The current state of the delegated stake (e.g., Active, Pending, Unstaked).
|
|
96
|
+
*/
|
|
26
97
|
status: SuiDelegatedStakeState;
|
|
98
|
+
/**
|
|
99
|
+
* The on-chain ID representing this stake position.
|
|
100
|
+
*/
|
|
27
101
|
stakedSuiId: ObjectId;
|
|
102
|
+
/**
|
|
103
|
+
* The epoch in which this stake request was made.
|
|
104
|
+
*/
|
|
28
105
|
stakeRequestEpoch: bigint;
|
|
106
|
+
/**
|
|
107
|
+
* The epoch in which this stake became (or will become) active.
|
|
108
|
+
*/
|
|
29
109
|
stakeActiveEpoch: bigint;
|
|
110
|
+
/**
|
|
111
|
+
* The principal amount of SUI delegated.
|
|
112
|
+
*/
|
|
30
113
|
principal: Balance;
|
|
114
|
+
/**
|
|
115
|
+
* The estimated rewards accumulated for this stake, if available.
|
|
116
|
+
*/
|
|
31
117
|
estimatedReward?: Balance | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* The validator to which this stake is delegated.
|
|
120
|
+
*/
|
|
32
121
|
validatorAddress: SuiAddress;
|
|
122
|
+
/**
|
|
123
|
+
* The staking pool on-chain object that manages this stake.
|
|
124
|
+
*/
|
|
33
125
|
stakingPool: SuiAddress;
|
|
34
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* A type guard utility function to check if a position is a native Sui delegated stake
|
|
129
|
+
* (`SuiDelegatedStake`) rather than an Aftermath-specific `StakingPosition`.
|
|
130
|
+
*
|
|
131
|
+
* @param stake - An object that could be either a `StakingPosition` or a `SuiDelegatedStake`.
|
|
132
|
+
* @returns True if the object matches the shape of `SuiDelegatedStake`; otherwise, false.
|
|
133
|
+
*/
|
|
35
134
|
export declare const isSuiDelegatedStake: (stake: StakingPosition | SuiDelegatedStake) => stake is SuiDelegatedStake;
|
|
135
|
+
/**
|
|
136
|
+
* Represents a single entry in the historical APY data, including a Unix
|
|
137
|
+
* timestamp and an APY value.
|
|
138
|
+
*/
|
|
36
139
|
export interface StakingApyDataPoint {
|
|
140
|
+
/**
|
|
141
|
+
* The Unix timestamp (in milliseconds or seconds) of the data point.
|
|
142
|
+
*/
|
|
37
143
|
timestamp: Timestamp;
|
|
144
|
+
/**
|
|
145
|
+
* The APY value recorded at that time (e.g., 0.045 = 4.5%).
|
|
146
|
+
*/
|
|
38
147
|
apy: number;
|
|
39
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Enumerates the timeframes available for retrieving historical APY data,
|
|
151
|
+
* such as `"1W"`, `"1M"`, `"1Y"`, etc.
|
|
152
|
+
*/
|
|
40
153
|
export type StakingApyTimeframeKey = "1W" | "1M" | "3M" | "6M" | "1Y" | "ALL";
|
|
41
|
-
|
|
42
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Represents an event when SUI has been staked, either newly or restaked.
|
|
156
|
+
*/
|
|
43
157
|
export interface StakedEvent extends Event {
|
|
158
|
+
/**
|
|
159
|
+
* The on-chain object ID referencing the newly created staked SUI object.
|
|
160
|
+
*/
|
|
44
161
|
stakedSuiId: ObjectId;
|
|
162
|
+
/**
|
|
163
|
+
* The original SUI coin ID used for staking.
|
|
164
|
+
*/
|
|
45
165
|
suiId: ObjectId;
|
|
166
|
+
/**
|
|
167
|
+
* The address of the user who performed the staking.
|
|
168
|
+
*/
|
|
46
169
|
staker: SuiAddress;
|
|
170
|
+
/**
|
|
171
|
+
* The validator address to which the user staked.
|
|
172
|
+
*/
|
|
47
173
|
validatorAddress: SuiAddress;
|
|
174
|
+
/**
|
|
175
|
+
* The epoch in which staking took place.
|
|
176
|
+
*/
|
|
48
177
|
epoch: bigint;
|
|
178
|
+
/**
|
|
179
|
+
* The amount of SUI staked.
|
|
180
|
+
*/
|
|
49
181
|
suiStakeAmount: Balance;
|
|
182
|
+
/**
|
|
183
|
+
* The validator fee percentage for this stake (0.01 = 1%).
|
|
184
|
+
*/
|
|
50
185
|
validatorFee: number;
|
|
186
|
+
/**
|
|
187
|
+
* Indicates whether this stake is a restake of an already staked position.
|
|
188
|
+
*/
|
|
51
189
|
isRestaked: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* The on-chain ID of the afSUI object received in exchange for staking.
|
|
192
|
+
*/
|
|
52
193
|
afSuiId: ObjectId;
|
|
194
|
+
/**
|
|
195
|
+
* The amount of afSUI received.
|
|
196
|
+
*/
|
|
53
197
|
afSuiAmount: Balance;
|
|
198
|
+
/**
|
|
199
|
+
* (Optional) Referrer address for the stake.
|
|
200
|
+
*/
|
|
54
201
|
referrer?: SuiAddress;
|
|
55
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Represents an event when a user initiates an unstake request, converting
|
|
205
|
+
* afSUI back into SUI.
|
|
206
|
+
*/
|
|
56
207
|
export interface UnstakeRequestedEvent extends Event {
|
|
208
|
+
/**
|
|
209
|
+
* The afSUI ID being provided to unstake.
|
|
210
|
+
*/
|
|
57
211
|
afSuiId: ObjectId;
|
|
212
|
+
/**
|
|
213
|
+
* The amount of afSUI provided by the user.
|
|
214
|
+
*/
|
|
58
215
|
providedAfSuiAmount: Balance;
|
|
216
|
+
/**
|
|
217
|
+
* The address requesting the unstake.
|
|
218
|
+
*/
|
|
59
219
|
requester: SuiAddress;
|
|
220
|
+
/**
|
|
221
|
+
* The epoch in which the unstake was requested.
|
|
222
|
+
*/
|
|
60
223
|
epoch: bigint;
|
|
61
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Represents an event after an unstake has fully processed and SUI has
|
|
227
|
+
* been returned to the user.
|
|
228
|
+
*/
|
|
62
229
|
export interface UnstakedEvent extends Event {
|
|
230
|
+
/**
|
|
231
|
+
* The afSUI ID that was burned or converted during the unstake.
|
|
232
|
+
*/
|
|
63
233
|
afSuiId: ObjectId;
|
|
234
|
+
/**
|
|
235
|
+
* The amount of afSUI provided.
|
|
236
|
+
*/
|
|
64
237
|
providedAfSuiAmount: Balance;
|
|
238
|
+
/**
|
|
239
|
+
* The resulting SUI coin ID received by the user.
|
|
240
|
+
*/
|
|
65
241
|
suiId: ObjectId;
|
|
242
|
+
/**
|
|
243
|
+
* The amount of SUI returned.
|
|
244
|
+
*/
|
|
66
245
|
returnedSuiAmount: Balance;
|
|
246
|
+
/**
|
|
247
|
+
* The address that initiated the unstake.
|
|
248
|
+
*/
|
|
67
249
|
requester: SuiAddress;
|
|
250
|
+
/**
|
|
251
|
+
* The epoch in which the unstake finalized.
|
|
252
|
+
*/
|
|
68
253
|
epoch: bigint;
|
|
69
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Represents a union type covering all possible unstake events, either
|
|
257
|
+
* requested or finalized.
|
|
258
|
+
*/
|
|
259
|
+
export type UnstakeEvent = UnstakeRequestedEvent | UnstakedEvent;
|
|
260
|
+
/**
|
|
261
|
+
* Type guard to check if an event is a `StakedEvent`.
|
|
262
|
+
*/
|
|
70
263
|
export declare const isStakeEvent: (event: StakeEvent | UnstakeEvent) => event is StakedEvent;
|
|
264
|
+
/**
|
|
265
|
+
* Type guard to check if an event is an `UnstakeEvent`.
|
|
266
|
+
*/
|
|
71
267
|
export declare const isUnstakeEvent: (event: StakeEvent | UnstakeEvent) => event is UnstakeEvent;
|
|
268
|
+
/**
|
|
269
|
+
* Represents an event that indicates the epoch has changed, generally used
|
|
270
|
+
* for distributing rewards and updating positions.
|
|
271
|
+
*/
|
|
72
272
|
export interface EpochWasChangedEvent extends Event {
|
|
273
|
+
/**
|
|
274
|
+
* The new active epoch as a BigInt.
|
|
275
|
+
*/
|
|
73
276
|
activeEpoch: bigint;
|
|
277
|
+
/**
|
|
278
|
+
* The total amount of afSUI in circulation.
|
|
279
|
+
*/
|
|
74
280
|
totalAfSuiSupply: Balance;
|
|
281
|
+
/**
|
|
282
|
+
* The total amount of SUI rewards accrued in the system.
|
|
283
|
+
*/
|
|
75
284
|
totalSuiRewardsAmount: Balance;
|
|
285
|
+
/**
|
|
286
|
+
* The total amount of SUI staked in the system.
|
|
287
|
+
*/
|
|
76
288
|
totalSuiAmount: Balance;
|
|
77
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Union type for stake events, which can represent any variant of staking.
|
|
292
|
+
*/
|
|
293
|
+
export type StakeEvent = StakedEvent;
|
|
294
|
+
/**
|
|
295
|
+
* Represents a user's staking position, which could be either a `StakePosition`
|
|
296
|
+
* or an `UnstakePosition`.
|
|
297
|
+
*/
|
|
78
298
|
export type StakingPosition = StakePosition | UnstakePosition;
|
|
299
|
+
/**
|
|
300
|
+
* Indicates a stake position, typically representing active or restaked SUI,
|
|
301
|
+
* along with its associated `afSuiAmount`.
|
|
302
|
+
*/
|
|
79
303
|
export interface StakePosition {
|
|
304
|
+
/**
|
|
305
|
+
* The staked SUI object ID referencing this position.
|
|
306
|
+
*/
|
|
80
307
|
stakedSuiId: ObjectId;
|
|
308
|
+
/**
|
|
309
|
+
* The original SUI coin ID.
|
|
310
|
+
*/
|
|
81
311
|
suiId: ObjectId;
|
|
312
|
+
/**
|
|
313
|
+
* The address of the staker.
|
|
314
|
+
*/
|
|
82
315
|
staker: SuiAddress;
|
|
316
|
+
/**
|
|
317
|
+
* The address of the validator to which SUI was staked.
|
|
318
|
+
*/
|
|
83
319
|
validatorAddress: SuiAddress;
|
|
320
|
+
/**
|
|
321
|
+
* The epoch in which the stake was established.
|
|
322
|
+
*/
|
|
84
323
|
epoch: bigint;
|
|
324
|
+
/**
|
|
325
|
+
* The amount of SUI staked.
|
|
326
|
+
*/
|
|
85
327
|
suiStakeAmount: Balance;
|
|
328
|
+
/**
|
|
329
|
+
* The validator fee percentage (0.01 = 1%).
|
|
330
|
+
*/
|
|
86
331
|
validatorFee: number;
|
|
332
|
+
/**
|
|
333
|
+
* Indicates if this stake is a restake operation.
|
|
334
|
+
*/
|
|
87
335
|
isRestaked: boolean;
|
|
336
|
+
/**
|
|
337
|
+
* The afSUI object ID generated from staking.
|
|
338
|
+
*/
|
|
88
339
|
afSuiId: ObjectId;
|
|
340
|
+
/**
|
|
341
|
+
* The amount of afSUI issued to the user.
|
|
342
|
+
*/
|
|
89
343
|
afSuiAmount: Balance;
|
|
344
|
+
/**
|
|
345
|
+
* The timestamp when the stake was recorded.
|
|
346
|
+
*/
|
|
90
347
|
timestamp: Timestamp | undefined;
|
|
348
|
+
/**
|
|
349
|
+
* The transaction digest where the stake operation occurred.
|
|
350
|
+
*/
|
|
91
351
|
txnDigest: TransactionDigest;
|
|
92
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Indicates a position related to an unstake operation, either requested or
|
|
355
|
+
* finalized, with optional references to the returned SUI coin and amount.
|
|
356
|
+
*/
|
|
93
357
|
export interface UnstakePosition {
|
|
358
|
+
/**
|
|
359
|
+
* The state of the unstake operation: `REQUEST` (in progress) or
|
|
360
|
+
* `SUI_MINTED` (finalized).
|
|
361
|
+
*/
|
|
94
362
|
state: UnstakePositionState;
|
|
363
|
+
/**
|
|
364
|
+
* The afSUI object ID being burned or converted.
|
|
365
|
+
*/
|
|
95
366
|
afSuiId: ObjectId;
|
|
367
|
+
/**
|
|
368
|
+
* The amount of afSUI used to initiate the unstake.
|
|
369
|
+
*/
|
|
96
370
|
providedAfSuiAmount: Balance;
|
|
371
|
+
/**
|
|
372
|
+
* The address of the requester.
|
|
373
|
+
*/
|
|
97
374
|
requester: SuiAddress;
|
|
375
|
+
/**
|
|
376
|
+
* The epoch in which the unstake was requested or finalized.
|
|
377
|
+
*/
|
|
98
378
|
epoch: bigint;
|
|
379
|
+
/**
|
|
380
|
+
* The SUI object ID returned to the user, if unstake has finalized.
|
|
381
|
+
*/
|
|
99
382
|
suiId?: ObjectId;
|
|
383
|
+
/**
|
|
384
|
+
* The amount of SUI returned to the user, if unstake has finalized.
|
|
385
|
+
*/
|
|
100
386
|
returnedSuiAmount?: Balance;
|
|
387
|
+
/**
|
|
388
|
+
* The timestamp when the unstake request was recorded or completed.
|
|
389
|
+
*/
|
|
101
390
|
timestamp: Timestamp | undefined;
|
|
391
|
+
/**
|
|
392
|
+
* The transaction digest where the unstake operation occurred.
|
|
393
|
+
*/
|
|
102
394
|
txnDigest: TransactionDigest;
|
|
103
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Enumerates the possible states of an unstake operation.
|
|
398
|
+
*/
|
|
104
399
|
export type UnstakePositionState = "REQUEST" | "SUI_MINTED";
|
|
400
|
+
/**
|
|
401
|
+
* Type guard that checks whether a given `StakingPosition` is a stake position.
|
|
402
|
+
*/
|
|
105
403
|
export declare const isStakePosition: (position: StakingPosition) => position is StakePosition;
|
|
404
|
+
/**
|
|
405
|
+
* Type guard that checks whether a given `StakingPosition` is an unstake position.
|
|
406
|
+
*/
|
|
106
407
|
export declare const isUnstakePosition: (position: StakingPosition) => position is UnstakePosition;
|
|
408
|
+
/**
|
|
409
|
+
* Body payload for staking SUI.
|
|
410
|
+
*/
|
|
107
411
|
export interface ApiStakeBody {
|
|
412
|
+
/**
|
|
413
|
+
* The address performing the stake.
|
|
414
|
+
*/
|
|
108
415
|
walletAddress: SuiAddress;
|
|
416
|
+
/**
|
|
417
|
+
* The amount of SUI to be staked.
|
|
418
|
+
*/
|
|
109
419
|
suiStakeAmount: Balance;
|
|
420
|
+
/**
|
|
421
|
+
* The validator address to stake with.
|
|
422
|
+
*/
|
|
110
423
|
validatorAddress: SuiAddress;
|
|
424
|
+
/**
|
|
425
|
+
* Optional address indicating a referrer.
|
|
426
|
+
*/
|
|
111
427
|
referrer?: SuiAddress;
|
|
428
|
+
/**
|
|
429
|
+
* Optional external fee object. Must not exceed `maxExternalFeePercentage`.
|
|
430
|
+
*/
|
|
112
431
|
externalFee?: ExternalFee;
|
|
432
|
+
/**
|
|
433
|
+
* Indicates whether the transaction should be sponsored.
|
|
434
|
+
*/
|
|
113
435
|
isSponsoredTx?: boolean;
|
|
114
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* Body payload for unstaking SUI (afSUI -> SUI).
|
|
439
|
+
*/
|
|
115
440
|
export interface ApiUnstakeBody {
|
|
441
|
+
/**
|
|
442
|
+
* The address performing the unstake.
|
|
443
|
+
*/
|
|
116
444
|
walletAddress: SuiAddress;
|
|
445
|
+
/**
|
|
446
|
+
* The amount of afSUI to be unstaked.
|
|
447
|
+
*/
|
|
117
448
|
afSuiUnstakeAmount: Balance;
|
|
449
|
+
/**
|
|
450
|
+
* If true, the unstake is done atomically if possible, using liquidity reserves.
|
|
451
|
+
*/
|
|
118
452
|
isAtomic: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* Optional address indicating a referrer.
|
|
455
|
+
*/
|
|
119
456
|
referrer?: SuiAddress;
|
|
457
|
+
/**
|
|
458
|
+
* Optional external fee object. Must not exceed `maxExternalFeePercentage`.
|
|
459
|
+
*/
|
|
120
460
|
externalFee?: ExternalFee;
|
|
461
|
+
/**
|
|
462
|
+
* Indicates whether the transaction should be sponsored.
|
|
463
|
+
*/
|
|
121
464
|
isSponsoredTx?: boolean;
|
|
122
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* Body payload for staking stakedSUI objects (re-staking).
|
|
468
|
+
*/
|
|
123
469
|
export interface ApiStakeStakedSuiBody {
|
|
470
|
+
/**
|
|
471
|
+
* The address performing the re-stake.
|
|
472
|
+
*/
|
|
124
473
|
walletAddress: SuiAddress;
|
|
474
|
+
/**
|
|
475
|
+
* An array of stakedSui object IDs to re-stake.
|
|
476
|
+
*/
|
|
125
477
|
stakedSuiIds: ObjectId[];
|
|
478
|
+
/**
|
|
479
|
+
* The validator address to stake with.
|
|
480
|
+
*/
|
|
126
481
|
validatorAddress: SuiAddress;
|
|
482
|
+
/**
|
|
483
|
+
* Optional address indicating a referrer.
|
|
484
|
+
*/
|
|
127
485
|
referrer?: SuiAddress;
|
|
486
|
+
/**
|
|
487
|
+
* Indicates whether the transaction should be sponsored.
|
|
488
|
+
*/
|
|
128
489
|
isSponsoredTx?: boolean;
|
|
129
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* Body payload for updating a validator's fee settings.
|
|
493
|
+
*/
|
|
130
494
|
export interface ApiUpdateValidatorFeeBody {
|
|
495
|
+
/**
|
|
496
|
+
* The address submitting the update transaction.
|
|
497
|
+
*/
|
|
131
498
|
walletAddress: SuiAddress;
|
|
499
|
+
/**
|
|
500
|
+
* The operation cap object ID that authorizes changes to this validator.
|
|
501
|
+
*/
|
|
132
502
|
validatorOperationCapId: ObjectId;
|
|
503
|
+
/**
|
|
504
|
+
* The new fee percentage to be set (0.01 = 1%).
|
|
505
|
+
*/
|
|
133
506
|
newFeePercentage: Percentage;
|
|
507
|
+
/**
|
|
508
|
+
* Indicates whether the transaction should be sponsored.
|
|
509
|
+
*/
|
|
134
510
|
isSponsoredTx?: boolean;
|
|
135
511
|
}
|
|
512
|
+
/**
|
|
513
|
+
* Body payload for retrieving staking positions, including pagination.
|
|
514
|
+
*/
|
|
136
515
|
export interface ApiStakingPositionsBody {
|
|
516
|
+
/**
|
|
517
|
+
* The address whose staking positions are being queried.
|
|
518
|
+
*/
|
|
137
519
|
walletAddress: SuiAddress;
|
|
520
|
+
/**
|
|
521
|
+
* Optional cursor for pagination.
|
|
522
|
+
*/
|
|
138
523
|
cursor?: number;
|
|
524
|
+
/**
|
|
525
|
+
* Optional limit on the number of positions returned.
|
|
526
|
+
*/
|
|
139
527
|
limit?: number;
|
|
140
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* Body payload for retrieving delegated stakes, given a wallet address.
|
|
531
|
+
*/
|
|
141
532
|
export interface ApiDelegatedStakesBody {
|
|
533
|
+
/**
|
|
534
|
+
* The address whose delegated stakes are being queried.
|
|
535
|
+
*/
|
|
142
536
|
walletAddress: SuiAddress;
|
|
143
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Body payload for retrieving validator operation caps, given a wallet address.
|
|
540
|
+
*/
|
|
144
541
|
export interface ApiValidatorOperationCapsBody {
|
|
542
|
+
/**
|
|
543
|
+
* The address whose validator operation caps are being queried.
|
|
544
|
+
*/
|
|
145
545
|
walletAddress: SuiAddress;
|
|
146
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* Body payload for retrieving staking-related events, including pagination.
|
|
549
|
+
*/
|
|
147
550
|
export type ApiStakingEventsBody = ApiEventsBody & {
|
|
551
|
+
/**
|
|
552
|
+
* The address whose events are being queried.
|
|
553
|
+
*/
|
|
148
554
|
walletAddress: SuiAddress;
|
|
149
555
|
};
|
|
556
|
+
/**
|
|
557
|
+
* Extends the `StakedSuiVaultStateObject` with additional fields relevant
|
|
558
|
+
* to the router pool. This includes the coin type for afSUI, the configured
|
|
559
|
+
* validator address, and the current exchange rate.
|
|
560
|
+
*/
|
|
150
561
|
export type AfSuiRouterPoolObject = StakedSuiVaultStateObject & {
|
|
562
|
+
/**
|
|
563
|
+
* The coin type string for afSUI (e.g., "0x<package>::afSUI::AFSUI").
|
|
564
|
+
*/
|
|
151
565
|
afSuiCoinType: CoinType;
|
|
566
|
+
/**
|
|
567
|
+
* The official Aftermath validator address.
|
|
568
|
+
*/
|
|
152
569
|
aftermathValidatorAddress: SuiAddress;
|
|
570
|
+
/**
|
|
571
|
+
* The current exchange rate from afSUI to SUI.
|
|
572
|
+
*/
|
|
153
573
|
afSuiToSuiExchangeRate: number;
|
|
154
574
|
};
|
|
155
575
|
//# sourceMappingURL=stakingTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stakingTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/staking/stakingTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EACN,aAAa,EACb,OAAO,EACP,KAAK,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"stakingTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/staking/stakingTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EACN,aAAa,EACb,OAAO,EACP,KAAK,EACL,MAAM,IAAI,SAAS,EACnB,UAAU,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,MAAM,kCAAkC,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACvD;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,QAAQ,CAAC;IACzB;;OAEG;IACH,GAAG,EAAE,UAAU,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC7D;;OAEG;IACH,0BAA0B,EAAE,UAAU,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC3D;;OAEG;IACH,mCAAmC,EAAE,OAAO,CAAC;IAC7C;;OAEG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC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IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;CAC1B;AAMD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IAClD;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;CAC1B,CAAC;AAMF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,yBAAyB,GAAG;IAC/D;;OAEG;IACH,aAAa,EAAE,QAAQ,CAAC;IACxB;;OAEG;IACH,yBAAyB,EAAE,UAAU,CAAC;IACtC;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;CAC/B,CAAC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isUnstakePosition = exports.isStakePosition = exports.isUnstakeEvent = exports.isStakeEvent = exports.isSuiDelegatedStake = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A type guard utility function to check if a position is a native Sui delegated stake
|
|
6
|
+
* (`SuiDelegatedStake`) rather than an Aftermath-specific `StakingPosition`.
|
|
7
|
+
*
|
|
8
|
+
* @param stake - An object that could be either a `StakingPosition` or a `SuiDelegatedStake`.
|
|
9
|
+
* @returns True if the object matches the shape of `SuiDelegatedStake`; otherwise, false.
|
|
10
|
+
*/
|
|
4
11
|
const isSuiDelegatedStake = (stake) => {
|
|
5
12
|
return ("stakeRequestEpoch" in stake &&
|
|
6
13
|
"stakeActiveEpoch" in stake &&
|
|
@@ -8,18 +15,30 @@ const isSuiDelegatedStake = (stake) => {
|
|
|
8
15
|
"stakingPool" in stake);
|
|
9
16
|
};
|
|
10
17
|
exports.isSuiDelegatedStake = isSuiDelegatedStake;
|
|
18
|
+
/**
|
|
19
|
+
* Type guard to check if an event is a `StakedEvent`.
|
|
20
|
+
*/
|
|
11
21
|
const isStakeEvent = (event) => {
|
|
12
22
|
return "staker" in event;
|
|
13
23
|
};
|
|
14
24
|
exports.isStakeEvent = isStakeEvent;
|
|
25
|
+
/**
|
|
26
|
+
* Type guard to check if an event is an `UnstakeEvent`.
|
|
27
|
+
*/
|
|
15
28
|
const isUnstakeEvent = (event) => {
|
|
16
29
|
return !(0, exports.isStakeEvent)(event);
|
|
17
30
|
};
|
|
18
31
|
exports.isUnstakeEvent = isUnstakeEvent;
|
|
32
|
+
/**
|
|
33
|
+
* Type guard that checks whether a given `StakingPosition` is a stake position.
|
|
34
|
+
*/
|
|
19
35
|
const isStakePosition = (position) => {
|
|
20
36
|
return "stakedSuiId" in position;
|
|
21
37
|
};
|
|
22
38
|
exports.isStakePosition = isStakePosition;
|
|
39
|
+
/**
|
|
40
|
+
* Type guard that checks whether a given `StakingPosition` is an unstake position.
|
|
41
|
+
*/
|
|
23
42
|
const isUnstakePosition = (position) => {
|
|
24
43
|
return !(0, exports.isStakePosition)(position);
|
|
25
44
|
};
|