@gearbox-protocol/sdk 14.12.0-next.34 → 14.12.0-next.35
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/cjs/abi/IWithdrawalCompressorV313.js +136 -0
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +24 -33
- package/dist/cjs/sdk/MultichainSDK.js +7 -0
- package/dist/cjs/sdk/OnchainSDK.js +14 -4
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +16 -3
- package/dist/cjs/sdk/accounts/index.js +2 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +207 -0
- package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +65 -0
- package/dist/cjs/sdk/accounts/liquidations/helpers.js +63 -0
- package/dist/cjs/sdk/accounts/liquidations/index.js +28 -0
- package/dist/cjs/sdk/accounts/liquidations/types.js +16 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +142 -74
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +97 -0
- package/dist/cjs/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +1 -7
- package/dist/cjs/sdk/accounts/withdrawal-compressor/types.js +20 -0
- package/dist/esm/abi/IWithdrawalCompressorV313.js +136 -0
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +24 -33
- package/dist/esm/sdk/MultichainSDK.js +7 -0
- package/dist/esm/sdk/OnchainSDK.js +16 -5
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +16 -3
- package/dist/esm/sdk/accounts/index.js +1 -0
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +188 -0
- package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +41 -0
- package/dist/esm/sdk/accounts/liquidations/helpers.js +36 -0
- package/dist/esm/sdk/accounts/liquidations/index.js +4 -0
- package/dist/esm/sdk/accounts/liquidations/types.js +0 -0
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +138 -74
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +104 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.js +1 -7
- package/dist/esm/sdk/accounts/withdrawal-compressor/types.js +12 -0
- package/dist/types/abi/IWithdrawalCompressorV313.d.ts +200 -0
- package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +7 -7
- package/dist/types/sdk/MultichainSDK.d.ts +6 -0
- package/dist/types/sdk/OnchainSDK.d.ts +8 -5
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/index.d.ts +1 -0
- package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +20 -0
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +23 -0
- package/dist/types/sdk/accounts/liquidations/helpers.d.ts +34 -0
- package/dist/types/sdk/accounts/liquidations/index.d.ts +4 -0
- package/dist/types/sdk/accounts/liquidations/types.d.ts +172 -0
- package/dist/types/sdk/accounts/types.d.ts +6 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +80 -6
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +222 -0
- package/dist/types/sdk/accounts/withdrawal-compressor/createWithdrawalCompressor.d.ts +5 -4
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +106 -7
- package/dist/types/sdk/types/state.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
4
|
+
import type { CurrentWithdrawals, GetWithdrawalRequestResultProps, RequestableWithdrawal, WithdrawalStatus } from "./types.js";
|
|
4
5
|
declare const abi: readonly [{
|
|
5
6
|
readonly type: "function";
|
|
6
7
|
readonly name: "contractType";
|
|
@@ -110,6 +111,137 @@ declare const abi: readonly [{
|
|
|
110
111
|
}];
|
|
111
112
|
}];
|
|
112
113
|
readonly stateMutability: "view";
|
|
114
|
+
}, {
|
|
115
|
+
readonly type: "function";
|
|
116
|
+
readonly name: "getExternalAccountCurrentWithdrawals";
|
|
117
|
+
readonly inputs: readonly [{
|
|
118
|
+
readonly name: "withdrawalToken";
|
|
119
|
+
readonly type: "address";
|
|
120
|
+
readonly internalType: "address";
|
|
121
|
+
}, {
|
|
122
|
+
readonly name: "account";
|
|
123
|
+
readonly type: "address";
|
|
124
|
+
readonly internalType: "address";
|
|
125
|
+
}];
|
|
126
|
+
readonly outputs: readonly [{
|
|
127
|
+
readonly name: "";
|
|
128
|
+
readonly type: "tuple[]";
|
|
129
|
+
readonly internalType: "struct ClaimableWithdrawal[]";
|
|
130
|
+
readonly components: readonly [{
|
|
131
|
+
readonly name: "token";
|
|
132
|
+
readonly type: "address";
|
|
133
|
+
readonly internalType: "address";
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "withdrawalPhantomToken";
|
|
136
|
+
readonly type: "address";
|
|
137
|
+
readonly internalType: "address";
|
|
138
|
+
}, {
|
|
139
|
+
readonly name: "withdrawalTokenSpent";
|
|
140
|
+
readonly type: "uint256";
|
|
141
|
+
readonly internalType: "uint256";
|
|
142
|
+
}, {
|
|
143
|
+
readonly name: "outputs";
|
|
144
|
+
readonly type: "tuple[]";
|
|
145
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
146
|
+
readonly components: readonly [{
|
|
147
|
+
readonly name: "token";
|
|
148
|
+
readonly type: "address";
|
|
149
|
+
readonly internalType: "address";
|
|
150
|
+
}, {
|
|
151
|
+
readonly name: "isDelayed";
|
|
152
|
+
readonly type: "bool";
|
|
153
|
+
readonly internalType: "bool";
|
|
154
|
+
}, {
|
|
155
|
+
readonly name: "amount";
|
|
156
|
+
readonly type: "uint256";
|
|
157
|
+
readonly internalType: "uint256";
|
|
158
|
+
}];
|
|
159
|
+
}, {
|
|
160
|
+
readonly name: "claimCalls";
|
|
161
|
+
readonly type: "tuple[]";
|
|
162
|
+
readonly internalType: "struct MultiCall[]";
|
|
163
|
+
readonly components: readonly [{
|
|
164
|
+
readonly name: "target";
|
|
165
|
+
readonly type: "address";
|
|
166
|
+
readonly internalType: "address";
|
|
167
|
+
}, {
|
|
168
|
+
readonly name: "callData";
|
|
169
|
+
readonly type: "bytes";
|
|
170
|
+
readonly internalType: "bytes";
|
|
171
|
+
}];
|
|
172
|
+
}, {
|
|
173
|
+
readonly name: "extraData";
|
|
174
|
+
readonly type: "bytes";
|
|
175
|
+
readonly internalType: "bytes";
|
|
176
|
+
}];
|
|
177
|
+
}, {
|
|
178
|
+
readonly name: "";
|
|
179
|
+
readonly type: "tuple[]";
|
|
180
|
+
readonly internalType: "struct PendingWithdrawal[]";
|
|
181
|
+
readonly components: readonly [{
|
|
182
|
+
readonly name: "token";
|
|
183
|
+
readonly type: "address";
|
|
184
|
+
readonly internalType: "address";
|
|
185
|
+
}, {
|
|
186
|
+
readonly name: "withdrawalPhantomToken";
|
|
187
|
+
readonly type: "address";
|
|
188
|
+
readonly internalType: "address";
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "expectedOutputs";
|
|
191
|
+
readonly type: "tuple[]";
|
|
192
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
193
|
+
readonly components: readonly [{
|
|
194
|
+
readonly name: "token";
|
|
195
|
+
readonly type: "address";
|
|
196
|
+
readonly internalType: "address";
|
|
197
|
+
}, {
|
|
198
|
+
readonly name: "isDelayed";
|
|
199
|
+
readonly type: "bool";
|
|
200
|
+
readonly internalType: "bool";
|
|
201
|
+
}, {
|
|
202
|
+
readonly name: "amount";
|
|
203
|
+
readonly type: "uint256";
|
|
204
|
+
readonly internalType: "uint256";
|
|
205
|
+
}];
|
|
206
|
+
}, {
|
|
207
|
+
readonly name: "claimableAt";
|
|
208
|
+
readonly type: "uint256";
|
|
209
|
+
readonly internalType: "uint256";
|
|
210
|
+
}, {
|
|
211
|
+
readonly name: "extraData";
|
|
212
|
+
readonly type: "bytes";
|
|
213
|
+
readonly internalType: "bytes";
|
|
214
|
+
}];
|
|
215
|
+
}];
|
|
216
|
+
readonly stateMutability: "view";
|
|
217
|
+
}, {
|
|
218
|
+
readonly type: "function";
|
|
219
|
+
readonly name: "getWithdrawalStatus";
|
|
220
|
+
readonly inputs: readonly [{
|
|
221
|
+
readonly name: "redeemer";
|
|
222
|
+
readonly type: "address";
|
|
223
|
+
readonly internalType: "address";
|
|
224
|
+
}];
|
|
225
|
+
readonly outputs: readonly [{
|
|
226
|
+
readonly name: "";
|
|
227
|
+
readonly type: "uint8";
|
|
228
|
+
readonly internalType: "enum WithdrawalStatus";
|
|
229
|
+
}];
|
|
230
|
+
readonly stateMutability: "view";
|
|
231
|
+
}, {
|
|
232
|
+
readonly type: "function";
|
|
233
|
+
readonly name: "getWithdrawalStatus";
|
|
234
|
+
readonly inputs: readonly [{
|
|
235
|
+
readonly name: "redeemers";
|
|
236
|
+
readonly type: "address[]";
|
|
237
|
+
readonly internalType: "address[]";
|
|
238
|
+
}];
|
|
239
|
+
readonly outputs: readonly [{
|
|
240
|
+
readonly name: "";
|
|
241
|
+
readonly type: "uint8[]";
|
|
242
|
+
readonly internalType: "enum WithdrawalStatus[]";
|
|
243
|
+
}];
|
|
244
|
+
readonly stateMutability: "view";
|
|
113
245
|
}, {
|
|
114
246
|
readonly type: "function";
|
|
115
247
|
readonly name: "getWithdrawableAssets";
|
|
@@ -218,6 +350,75 @@ declare const abi: readonly [{
|
|
|
218
350
|
}];
|
|
219
351
|
}];
|
|
220
352
|
readonly stateMutability: "view";
|
|
353
|
+
}, {
|
|
354
|
+
readonly type: "function";
|
|
355
|
+
readonly name: "getWithdrawalRequestResult";
|
|
356
|
+
readonly inputs: readonly [{
|
|
357
|
+
readonly name: "creditAccount";
|
|
358
|
+
readonly type: "address";
|
|
359
|
+
readonly internalType: "address";
|
|
360
|
+
}, {
|
|
361
|
+
readonly name: "token";
|
|
362
|
+
readonly type: "address";
|
|
363
|
+
readonly internalType: "address";
|
|
364
|
+
}, {
|
|
365
|
+
readonly name: "withdrawalToken";
|
|
366
|
+
readonly type: "address";
|
|
367
|
+
readonly internalType: "address";
|
|
368
|
+
}, {
|
|
369
|
+
readonly name: "amount";
|
|
370
|
+
readonly type: "uint256";
|
|
371
|
+
readonly internalType: "uint256";
|
|
372
|
+
}];
|
|
373
|
+
readonly outputs: readonly [{
|
|
374
|
+
readonly name: "";
|
|
375
|
+
readonly type: "tuple";
|
|
376
|
+
readonly internalType: "struct RequestableWithdrawal";
|
|
377
|
+
readonly components: readonly [{
|
|
378
|
+
readonly name: "token";
|
|
379
|
+
readonly type: "address";
|
|
380
|
+
readonly internalType: "address";
|
|
381
|
+
}, {
|
|
382
|
+
readonly name: "amountIn";
|
|
383
|
+
readonly type: "uint256";
|
|
384
|
+
readonly internalType: "uint256";
|
|
385
|
+
}, {
|
|
386
|
+
readonly name: "outputs";
|
|
387
|
+
readonly type: "tuple[]";
|
|
388
|
+
readonly internalType: "struct WithdrawalOutput[]";
|
|
389
|
+
readonly components: readonly [{
|
|
390
|
+
readonly name: "token";
|
|
391
|
+
readonly type: "address";
|
|
392
|
+
readonly internalType: "address";
|
|
393
|
+
}, {
|
|
394
|
+
readonly name: "isDelayed";
|
|
395
|
+
readonly type: "bool";
|
|
396
|
+
readonly internalType: "bool";
|
|
397
|
+
}, {
|
|
398
|
+
readonly name: "amount";
|
|
399
|
+
readonly type: "uint256";
|
|
400
|
+
readonly internalType: "uint256";
|
|
401
|
+
}];
|
|
402
|
+
}, {
|
|
403
|
+
readonly name: "requestCalls";
|
|
404
|
+
readonly type: "tuple[]";
|
|
405
|
+
readonly internalType: "struct MultiCall[]";
|
|
406
|
+
readonly components: readonly [{
|
|
407
|
+
readonly name: "target";
|
|
408
|
+
readonly type: "address";
|
|
409
|
+
readonly internalType: "address";
|
|
410
|
+
}, {
|
|
411
|
+
readonly name: "callData";
|
|
412
|
+
readonly type: "bytes";
|
|
413
|
+
readonly internalType: "bytes";
|
|
414
|
+
}];
|
|
415
|
+
}, {
|
|
416
|
+
readonly name: "claimableAt";
|
|
417
|
+
readonly type: "uint256";
|
|
418
|
+
readonly internalType: "uint256";
|
|
419
|
+
}];
|
|
420
|
+
}];
|
|
421
|
+
readonly stateMutability: "view";
|
|
221
422
|
}, {
|
|
222
423
|
readonly type: "function";
|
|
223
424
|
readonly name: "getWithdrawalRequestResult";
|
|
@@ -297,8 +498,29 @@ declare const abi: readonly [{
|
|
|
297
498
|
type abi = typeof abi;
|
|
298
499
|
/**
|
|
299
500
|
* V3.13 implementation of the {@link IWithdrawalCompressorContract} interface.
|
|
501
|
+
* Overrides the legacy fallbacks of the base class with features introduced
|
|
502
|
+
* in v313: withdrawal intents, withdrawal config selection, external account
|
|
503
|
+
* withdrawals and withdrawal statuses.
|
|
300
504
|
**/
|
|
301
505
|
export declare class WithdrawalCompressorV313Contract extends AbstractWithdrawalCompressorContract<abi> {
|
|
302
506
|
constructor(sdk: OnchainSDK, address: Address);
|
|
507
|
+
/**
|
|
508
|
+
* {@inheritDoc IWithdrawalCompressorContract.getExternalAccountCurrentWithdrawals}
|
|
509
|
+
**/
|
|
510
|
+
getExternalAccountCurrentWithdrawals(withdrawalToken: Address, account: Address): Promise<CurrentWithdrawals>;
|
|
511
|
+
/**
|
|
512
|
+
* {@inheritDoc IWithdrawalCompressorContract.getWithdrawalStatus}
|
|
513
|
+
**/
|
|
514
|
+
getWithdrawalStatus(...redeemers: Address[]): Promise<WithdrawalStatus[]>;
|
|
515
|
+
/**
|
|
516
|
+
* {@inheritDoc IWithdrawalCompressorContract.getWithdrawalRequestResult}
|
|
517
|
+
*
|
|
518
|
+
* When an intent is provided, it is abi-encoded and attached to the request
|
|
519
|
+
* as `extraData`. The contract overload accepting `extraData` also requires
|
|
520
|
+
* the withdrawal phantom token; when not provided by the caller, it is
|
|
521
|
+
* resolved the same way the 3-arg overload does it internally: via the
|
|
522
|
+
* withdrawable assets of the account's credit manager.
|
|
523
|
+
**/
|
|
524
|
+
getWithdrawalRequestResult({ creditAccount, token, amount, withdrawalPhantomToken, intent, }: GetWithdrawalRequestResultProps): Promise<RequestableWithdrawal>;
|
|
303
525
|
}
|
|
304
526
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
2
2
|
import type { IWithdrawalCompressorContract } from "./types.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Creates a withdrawal compressor contract for the current chain,
|
|
5
|
+
* or returns `undefined` if no withdrawal compressor is supported on it.
|
|
6
|
+
* Called once from the SDK constructor; consumers should access the
|
|
7
|
+
* instance via `sdk.withdrawalCompressor`.
|
|
6
8
|
* @param sdk
|
|
7
|
-
* @throws if no withdrawal compressor is supported on the current chain.
|
|
8
9
|
**/
|
|
9
|
-
export declare function createWithdrawalCompressor(sdk: OnchainSDK): IWithdrawalCompressorContract;
|
|
10
|
+
export declare function createWithdrawalCompressor(sdk: OnchainSDK): IWithdrawalCompressorContract | undefined;
|
|
@@ -260,30 +260,120 @@ export interface CurrentWithdrawals {
|
|
|
260
260
|
**/
|
|
261
261
|
pending: PendingWithdrawal[];
|
|
262
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Status of a single delayed withdrawal (redeemer contract).
|
|
265
|
+
* Mirrors the on-chain `WithdrawalStatus` enum.
|
|
266
|
+
**/
|
|
267
|
+
export type WithdrawalStatus = "NULL" | "PENDING" | "CLAIMABLE" | "CLAIMED";
|
|
268
|
+
/**
|
|
269
|
+
* Maps the on-chain `WithdrawalStatus` enum value to its string representation.
|
|
270
|
+
**/
|
|
271
|
+
export declare function toWithdrawalStatus(status: number): WithdrawalStatus;
|
|
272
|
+
/**
|
|
273
|
+
* Serializable snapshot of the withdrawal compressor's assets cache,
|
|
274
|
+
* stored in the core SDK state (`GearboxState.withdrawals`).
|
|
275
|
+
**/
|
|
276
|
+
export interface WithdrawalsState {
|
|
277
|
+
/**
|
|
278
|
+
* Cached withdrawable assets, keyed by credit manager
|
|
279
|
+
**/
|
|
280
|
+
withdrawableAssets: Record<Address, WithdrawableAsset[]>;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Props for {@link IWithdrawalCompressorContract.getWithdrawalRequestResult}.
|
|
284
|
+
**/
|
|
285
|
+
export interface GetWithdrawalRequestResultProps {
|
|
286
|
+
/**
|
|
287
|
+
* Credit account to withdraw from
|
|
288
|
+
**/
|
|
289
|
+
creditAccount: Address;
|
|
290
|
+
/**
|
|
291
|
+
* Source token to withdraw (e.g. a Mellow multivault share, a Securitize
|
|
292
|
+
* dsToken or a Midas mToken)
|
|
293
|
+
**/
|
|
294
|
+
token: Address;
|
|
295
|
+
/**
|
|
296
|
+
* Amount of `token` to withdraw; capped at the credit account's balance
|
|
297
|
+
* by the contract
|
|
298
|
+
**/
|
|
299
|
+
amount: bigint;
|
|
300
|
+
/**
|
|
301
|
+
* Withdrawal phantom token that selects a specific withdrawal config when
|
|
302
|
+
* the source token has more than one. When omitted, the contract resolves
|
|
303
|
+
* it from the first matching withdrawable asset of the account's credit
|
|
304
|
+
* manager
|
|
305
|
+
**/
|
|
306
|
+
withdrawalPhantomToken?: Address;
|
|
307
|
+
/**
|
|
308
|
+
* Delayed intent to attach to the request as `extraData` (v313+ only)
|
|
309
|
+
**/
|
|
310
|
+
intent?: DelayedIntent;
|
|
311
|
+
}
|
|
263
312
|
/**
|
|
264
313
|
* Version-agnostic interface of the WithdrawalCompressor contract.
|
|
265
314
|
**/
|
|
266
315
|
export interface IWithdrawalCompressorContract extends IBaseContract {
|
|
267
316
|
/**
|
|
268
|
-
* Returns assets that can be withdrawn
|
|
317
|
+
* Returns cached assets that can be withdrawn via delayed withdrawal.
|
|
318
|
+
* With no arguments, returns assets of all credit managers; with arguments,
|
|
319
|
+
* only assets of the given credit managers.
|
|
320
|
+
* @throws When the cache was never loaded (via {@link loadWithdrawableAssets}
|
|
321
|
+
* or state hydration).
|
|
322
|
+
**/
|
|
323
|
+
getWithdrawableAssets(...creditManagers: Address[]): WithdrawableAsset[];
|
|
324
|
+
/**
|
|
325
|
+
* Loads withdrawable assets of all credit managers known to the SDK's
|
|
326
|
+
* market register into the cache (a single multicall, only once per SDK
|
|
327
|
+
* lifetime) and returns them. Failed per-manager calls are logged and
|
|
328
|
+
* skipped.
|
|
329
|
+
* @param force - Invalidate the cache and refetch even if already loaded.
|
|
269
330
|
**/
|
|
270
|
-
|
|
331
|
+
loadWithdrawableAssets(force?: boolean): Promise<WithdrawableAsset[]>;
|
|
271
332
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
333
|
+
* Returns all withdrawal configs of a withdrawable source token
|
|
334
|
+
* (e.g. a Mellow multivault share) of the given credit manager.
|
|
335
|
+
* Loads the cache if necessary.
|
|
275
336
|
**/
|
|
276
|
-
|
|
337
|
+
findWithdrawableAssets(creditManager: Address, token: Address): Promise<WithdrawableAsset[]>;
|
|
338
|
+
/**
|
|
339
|
+
* Returns withdrawal configs with the given withdrawal phantom token
|
|
340
|
+
* across all credit managers. Loads the cache if necessary.
|
|
341
|
+
**/
|
|
342
|
+
findWithdrawableAssetsByPhantomToken(withdrawalPhantomToken: Address): Promise<WithdrawableAsset[]>;
|
|
277
343
|
/**
|
|
278
344
|
* Resolves the withdrawal phantom token for a withdrawable source token
|
|
279
345
|
* (e.g. a Mellow multivault share) of the given credit manager.
|
|
280
346
|
* @throws When the token is not withdrawable from the credit manager.
|
|
281
347
|
**/
|
|
282
348
|
getWithdrawalPhantomToken(creditManager: Address, token: Address): Promise<Address>;
|
|
349
|
+
/**
|
|
350
|
+
* Resolves the source token of a withdrawal phantom token (e.g. `ACRED` for
|
|
351
|
+
* `srpACRED_USDC`), or `undefined` when the token is not a known withdrawal
|
|
352
|
+
* phantom token. The phantom-to-source binding is fixed at phantom token
|
|
353
|
+
* deployment, so no credit manager is needed.
|
|
354
|
+
* @throws When the cache was never loaded (via {@link loadWithdrawableAssets}
|
|
355
|
+
* or state hydration).
|
|
356
|
+
**/
|
|
357
|
+
getWithdrawalSourceToken(withdrawalPhantomToken: Address): Address | undefined;
|
|
283
358
|
/**
|
|
284
359
|
* Returns claimable and pending delayed withdrawals of the given credit account.
|
|
285
360
|
**/
|
|
286
361
|
getCurrentWithdrawals(creditAccount: Address): Promise<CurrentWithdrawals>;
|
|
362
|
+
/**
|
|
363
|
+
* Returns claimable and pending delayed withdrawals of an external address
|
|
364
|
+
* (non-credit-account, e.g. liquidator EOA) in the given withdrawal phantom token.
|
|
365
|
+
* Only supported on v313+ compressors; on older versions throws if
|
|
366
|
+
* `sdk.strictContractTypes` is `true`, otherwise logs a warning and
|
|
367
|
+
* returns empty lists.
|
|
368
|
+
**/
|
|
369
|
+
getExternalAccountCurrentWithdrawals(withdrawalToken: Address, account: Address): Promise<CurrentWithdrawals>;
|
|
370
|
+
/**
|
|
371
|
+
* Returns statuses of the given redeemer contracts.
|
|
372
|
+
* Only supported on v313+ compressors; on older versions throws if
|
|
373
|
+
* `sdk.strictContractTypes` is `true`, otherwise logs a warning and
|
|
374
|
+
* returns `"NULL"` statuses.
|
|
375
|
+
**/
|
|
376
|
+
getWithdrawalStatus(...redeemers: Address[]): Promise<WithdrawalStatus[]>;
|
|
287
377
|
/**
|
|
288
378
|
* Previews a delayed withdrawal request.
|
|
289
379
|
*
|
|
@@ -292,5 +382,14 @@ export interface IWithdrawalCompressorContract extends IBaseContract {
|
|
|
292
382
|
* throws if `sdk.strictContractTypes` is `true`, otherwise a warning is
|
|
293
383
|
* logged and the intent is ignored.
|
|
294
384
|
**/
|
|
295
|
-
getWithdrawalRequestResult(
|
|
385
|
+
getWithdrawalRequestResult(props: GetWithdrawalRequestResultProps): Promise<RequestableWithdrawal>;
|
|
386
|
+
/**
|
|
387
|
+
* Seeds the assets cache from a previously serialized snapshot.
|
|
388
|
+
**/
|
|
389
|
+
hydrate(state: WithdrawalsState): void;
|
|
390
|
+
/**
|
|
391
|
+
* Serializable snapshot of the assets cache, or `undefined` if the cache
|
|
392
|
+
* was never loaded.
|
|
393
|
+
**/
|
|
394
|
+
readonly state: WithdrawalsState | undefined;
|
|
296
395
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WithdrawalsState } from "../accounts/withdrawal-compressor/types.js";
|
|
1
2
|
import type { MarketData } from "../base/index.js";
|
|
2
3
|
import type { NetworkType } from "../chain/chains.js";
|
|
3
4
|
import type { AddressProviderState } from "../core/index.js";
|
|
@@ -52,6 +53,13 @@ export interface GearboxState<Plugins extends PluginsMap = {}> {
|
|
|
52
53
|
* Present only when zappers were loaded (they are optional)
|
|
53
54
|
**/
|
|
54
55
|
zappers?: ZapperData[];
|
|
56
|
+
/**
|
|
57
|
+
* Withdrawal compressor's withdrawable assets cache.
|
|
58
|
+
*
|
|
59
|
+
* Present only when the compressor exists on the chain and its assets
|
|
60
|
+
* were loaded
|
|
61
|
+
**/
|
|
62
|
+
withdrawals?: WithdrawalsState;
|
|
55
63
|
/**
|
|
56
64
|
* Per-plugin serialised state.
|
|
57
65
|
**/
|