@0xmonaco/core 0.8.11 → 0.8.15
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/api/applications/api.js +4 -4
- package/dist/api/auth/api.d.ts +1 -1
- package/dist/api/auth/api.js +10 -10
- package/dist/api/base.d.ts +2 -2
- package/dist/api/base.js +2 -2
- package/dist/api/delegated-agents/api.js +12 -12
- package/dist/api/faucet/api.d.ts +1 -1
- package/dist/api/faucet/api.js +1 -1
- package/dist/api/fees/api.d.ts +13 -13
- package/dist/api/fees/api.js +18 -18
- package/dist/api/margin-accounts/api.d.ts +8 -3
- package/dist/api/margin-accounts/api.js +69 -25
- package/dist/api/market/api.d.ts +2 -2
- package/dist/api/market/api.js +19 -17
- package/dist/api/orderbook/api.js +13 -13
- package/dist/api/perp/routes.d.ts +68 -52
- package/dist/api/perp/routes.js +9 -2
- package/dist/api/positions/api.d.ts +2 -1
- package/dist/api/positions/api.js +30 -18
- package/dist/api/profile/api.d.ts +23 -23
- package/dist/api/profile/api.js +46 -46
- package/dist/api/sub-accounts/api.d.ts +2 -2
- package/dist/api/sub-accounts/api.js +2 -2
- package/dist/api/trades/api.d.ts +11 -11
- package/dist/api/trades/api.js +10 -10
- package/dist/api/trading/api.d.ts +10 -10
- package/dist/api/trading/api.js +69 -69
- package/dist/api/vault/api.d.ts +71 -28
- package/dist/api/vault/api.js +139 -39
- package/dist/api/whitelist/api.d.ts +2 -2
- package/dist/api/whitelist/api.js +2 -2
- package/dist/api/withdrawals/api.d.ts +8 -5
- package/dist/api/withdrawals/api.js +13 -5
- package/dist/coverage.d.ts +9 -2
- package/dist/coverage.js +9 -2
- package/dist/sdk.d.ts +2 -2
- package/dist/sdk.js +3 -3
- package/package.json +3 -3
package/dist/api/trading/api.js
CHANGED
|
@@ -28,12 +28,12 @@ function parentTpSlLegToRequest(leg) {
|
|
|
28
28
|
if (!leg)
|
|
29
29
|
return undefined;
|
|
30
30
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
triggerPrice: leg.triggerPrice,
|
|
32
|
+
orderType: leg.orderType,
|
|
33
|
+
limitPrice: leg.limitPrice,
|
|
34
|
+
timeInForce: leg.timeInForce,
|
|
35
|
+
slippageToleranceBps: leg.slippageToleranceBps,
|
|
36
|
+
expiresAt: leg.expiresAt,
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
export class TradingAPIImpl extends BaseAPI {
|
|
@@ -97,24 +97,24 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
97
97
|
options,
|
|
98
98
|
});
|
|
99
99
|
const requestBody = {
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
tradingPairId: tradingPairId,
|
|
101
|
+
orderType: "LIMIT",
|
|
102
102
|
side,
|
|
103
103
|
price,
|
|
104
104
|
quantity,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
tradingMode: options?.tradingMode || "SPOT",
|
|
106
|
+
useMasterBalance: options?.useMasterBalance,
|
|
107
|
+
expirationDate: options?.expirationDate,
|
|
108
|
+
timeInForce: options?.timeInForce,
|
|
109
|
+
marginAccountId: options?.marginAccountId,
|
|
110
|
+
riskBucketId: options?.riskBucketId,
|
|
111
|
+
riskBucketCollateral: options?.riskBucketCollateral,
|
|
112
|
+
strategyKey: options?.strategyKey,
|
|
113
|
+
positionSide: options?.positionSide,
|
|
114
114
|
leverage: options?.leverage,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
reduceOnly: options?.reduceOnly,
|
|
116
|
+
takeProfit: parentTpSlLegToRequest(options?.takeProfit),
|
|
117
|
+
stopLoss: parentTpSlLegToRequest(options?.stopLoss),
|
|
118
118
|
};
|
|
119
119
|
return await this.makeAuthenticatedRequest(perpRoutes.orders.create(), {
|
|
120
120
|
method: "POST",
|
|
@@ -171,22 +171,22 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
171
171
|
options,
|
|
172
172
|
});
|
|
173
173
|
const requestBody = {
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
tradingPairId: tradingPairId,
|
|
175
|
+
orderType: "MARKET",
|
|
176
176
|
side,
|
|
177
|
-
|
|
177
|
+
slippageToleranceBps: options?.slippageTolerance !== undefined ? Math.round(options.slippageTolerance * 10000) : undefined,
|
|
178
178
|
price: null, // Market orders don't need price
|
|
179
179
|
quantity,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
tradingMode: options?.tradingMode || "SPOT",
|
|
181
|
+
marginAccountId: options?.marginAccountId,
|
|
182
|
+
riskBucketId: options?.riskBucketId,
|
|
183
|
+
riskBucketCollateral: options?.riskBucketCollateral,
|
|
184
|
+
strategyKey: options?.strategyKey,
|
|
185
|
+
positionSide: options?.positionSide,
|
|
186
186
|
leverage: options?.leverage,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
reduceOnly: options?.reduceOnly,
|
|
188
|
+
takeProfit: parentTpSlLegToRequest(options?.takeProfit),
|
|
189
|
+
stopLoss: parentTpSlLegToRequest(options?.stopLoss),
|
|
190
190
|
};
|
|
191
191
|
return await this.makeAuthenticatedRequest(perpRoutes.orders.create(), {
|
|
192
192
|
method: "POST",
|
|
@@ -213,7 +213,7 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
213
213
|
// Validate inputs before making API call
|
|
214
214
|
validate(CancelOrderSchema, { orderId });
|
|
215
215
|
const requestBody = {
|
|
216
|
-
|
|
216
|
+
orderId: orderId,
|
|
217
217
|
};
|
|
218
218
|
return await this.makeAuthenticatedRequest(perpRoutes.orders.cancel(), {
|
|
219
219
|
method: "POST",
|
|
@@ -230,12 +230,12 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
230
230
|
if (params) {
|
|
231
231
|
validate(ListConditionalOrdersSchema, params);
|
|
232
232
|
}
|
|
233
|
-
const { page = 1,
|
|
233
|
+
const { page = 1, pageSize = 20, marginAccountId, tradingPairId, state } = params || {};
|
|
234
234
|
return await this.makeAuthenticatedRequest(perpRoutes.orders.listConditional({
|
|
235
235
|
page,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
pageSize: Math.min(Math.max(pageSize, 1), 100),
|
|
237
|
+
marginAccountId,
|
|
238
|
+
tradingPairId,
|
|
239
239
|
state,
|
|
240
240
|
}), { method: "GET" });
|
|
241
241
|
}
|
|
@@ -257,7 +257,7 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
257
257
|
}
|
|
258
258
|
return this.makeAuthenticatedRequest(perpRoutes.orders.batchCancel(), {
|
|
259
259
|
method: "POST",
|
|
260
|
-
body: JSON.stringify({
|
|
260
|
+
body: JSON.stringify({ orderIds: orderIds }),
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
/**
|
|
@@ -286,7 +286,7 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
286
286
|
// Validate inputs before making API call
|
|
287
287
|
validate(ReplaceOrderSchema, { orderId, newOrder });
|
|
288
288
|
const requestBody = {
|
|
289
|
-
|
|
289
|
+
useMasterBalance: newOrder.useMasterBalance ?? false,
|
|
290
290
|
};
|
|
291
291
|
if (newOrder.price !== undefined) {
|
|
292
292
|
requestBody.price = newOrder.price;
|
|
@@ -333,23 +333,23 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
333
333
|
validate(BatchCreateOrdersSchema, { orders });
|
|
334
334
|
const requestBody = {
|
|
335
335
|
orders: orders.map((order) => ({
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
tradingPairId: order.tradingPairId,
|
|
337
|
+
orderType: order.orderType,
|
|
338
338
|
side: order.side,
|
|
339
339
|
price: order.price,
|
|
340
340
|
quantity: order.quantity,
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
341
|
+
tradingMode: order.tradingMode || "SPOT",
|
|
342
|
+
slippageToleranceBps: order.slippageTolerance !== undefined ? Math.round(order.slippageTolerance * 10000) : undefined,
|
|
343
|
+
useMasterBalance: order.useMasterBalance,
|
|
344
|
+
expirationDate: order.expirationDate,
|
|
345
|
+
timeInForce: order.timeInForce,
|
|
346
|
+
marginAccountId: order.marginAccountId,
|
|
347
|
+
riskBucketId: order.riskBucketId,
|
|
348
|
+
riskBucketCollateral: order.riskBucketCollateral,
|
|
349
|
+
strategyKey: order.strategyKey,
|
|
350
|
+
positionSide: order.positionSide,
|
|
351
351
|
leverage: order.leverage,
|
|
352
|
-
|
|
352
|
+
reduceOnly: order.reduceOnly,
|
|
353
353
|
})),
|
|
354
354
|
};
|
|
355
355
|
return this.makeAuthenticatedRequest(perpRoutes.orders.batchCreate(), {
|
|
@@ -386,10 +386,10 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
386
386
|
validate(BatchReplaceOrdersSchema, { orders });
|
|
387
387
|
const requestBody = {
|
|
388
388
|
orders: orders.map((order) => ({
|
|
389
|
-
|
|
389
|
+
orderId: order.orderId,
|
|
390
390
|
price: order.price,
|
|
391
391
|
quantity: order.quantity,
|
|
392
|
-
|
|
392
|
+
useMasterBalance: order.useMasterBalance,
|
|
393
393
|
})),
|
|
394
394
|
};
|
|
395
395
|
return this.makeAuthenticatedRequest(perpRoutes.orders.batchReplace(), {
|
|
@@ -405,9 +405,9 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
405
405
|
*
|
|
406
406
|
* @param params - Query parameters for filtering orders
|
|
407
407
|
* @param params.status - Filter by order status (e.g., "SUBMITTED", "FILLED") (optional)
|
|
408
|
-
* @param params.
|
|
408
|
+
* @param params.tradingPairId - Filter by trading pair UUID (optional)
|
|
409
409
|
* @param params.page - Page number for pagination (defaults to 1, must be > 0)
|
|
410
|
-
* @param params.
|
|
410
|
+
* @param params.pageSize - Number of orders per page (defaults to 10, max 100, must be > 0)
|
|
411
411
|
* @returns Promise resolving to GetPaginatedOrdersResponse with orders and pagination info
|
|
412
412
|
* @throws {APIError} When API communication fails
|
|
413
413
|
*
|
|
@@ -416,13 +416,13 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
416
416
|
* // Get submitted orders for a specific trading pair with custom pagination
|
|
417
417
|
* const orders = await tradingAPI.getPaginatedOrders({
|
|
418
418
|
* status: "SUBMITTED",
|
|
419
|
-
*
|
|
419
|
+
* tradingPairId: "456e7890-e12b-12d3-a456-426614174000",
|
|
420
420
|
* page: 1,
|
|
421
|
-
*
|
|
421
|
+
* pageSize: 20
|
|
422
422
|
* });
|
|
423
423
|
* console.log(`Found ${orders.total} orders, showing page ${orders.page}`);
|
|
424
424
|
*
|
|
425
|
-
* // Get all orders with default pagination (page=1,
|
|
425
|
+
* // Get all orders with default pagination (page=1, pageSize=10)
|
|
426
426
|
* const allOrders = await tradingAPI.getPaginatedOrders();
|
|
427
427
|
* ```
|
|
428
428
|
*/
|
|
@@ -432,25 +432,25 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
432
432
|
validate(GetPaginatedOrdersSchema, params);
|
|
433
433
|
}
|
|
434
434
|
// Set pagination defaults with destructuring and validation
|
|
435
|
-
const { page = 1,
|
|
435
|
+
const { page = 1, pageSize: requestedPageSize = 10, status, tradingPairId, tradingMode, marginAccountId } = params || {};
|
|
436
436
|
const validPage = page > 0 ? page : 1;
|
|
437
|
-
const validPageSize =
|
|
437
|
+
const validPageSize = requestedPageSize > 0 ? requestedPageSize : 10;
|
|
438
438
|
const pageSize = Math.min(validPageSize, 100);
|
|
439
439
|
const searchParams = new URLSearchParams();
|
|
440
440
|
// Always include pagination parameters for consistent API behavior
|
|
441
441
|
searchParams.append("page", validPage.toString());
|
|
442
|
-
searchParams.append("
|
|
442
|
+
searchParams.append("pageSize", pageSize.toString());
|
|
443
443
|
if (status) {
|
|
444
444
|
searchParams.append("status", status);
|
|
445
445
|
}
|
|
446
|
-
if (
|
|
447
|
-
searchParams.append("
|
|
446
|
+
if (tradingPairId) {
|
|
447
|
+
searchParams.append("tradingPairId", tradingPairId);
|
|
448
448
|
}
|
|
449
|
-
if (
|
|
450
|
-
searchParams.append("
|
|
449
|
+
if (tradingMode) {
|
|
450
|
+
searchParams.append("tradingMode", tradingMode);
|
|
451
451
|
}
|
|
452
|
-
if (
|
|
453
|
-
searchParams.append("
|
|
452
|
+
if (marginAccountId) {
|
|
453
|
+
searchParams.append("marginAccountId", marginAccountId);
|
|
454
454
|
}
|
|
455
455
|
const endpoint = `/api/v1/orders?${searchParams.toString()}`;
|
|
456
456
|
return await this.makeAuthenticatedRequest(endpoint, {
|
|
@@ -472,7 +472,7 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
472
472
|
* // Get order details by ID
|
|
473
473
|
* const orderDetails = await tradingAPI.getOrder("order_123");
|
|
474
474
|
* console.log(`Order status: ${orderDetails.order.status}`);
|
|
475
|
-
* console.log(`Remaining quantity: ${orderDetails.order.
|
|
475
|
+
* console.log(`Remaining quantity: ${orderDetails.order.remainingQuantity}`);
|
|
476
476
|
* ```
|
|
477
477
|
*/
|
|
478
478
|
async getOrder(orderId) {
|
package/dist/api/vault/api.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* console.log(`Deposit transaction: ${result.hash}`);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
import type { ApplicationsAPI, Balance, DepositTarget, ProfileAPI, TransactionResult, VaultAPI, WithdrawResult } from "@0xmonaco/types";
|
|
26
|
+
import type { ApplicationsAPI, Balance, DepositTarget, ProfileAPI, TransactionResult, VaultAPI, WithdrawalRetryOptions, WithdrawalSource, WithdrawResult } from "@0xmonaco/types";
|
|
27
27
|
import { type Address, type Chain, type PublicClient, type WalletClient } from "viem";
|
|
28
28
|
import { BaseAPI } from "../base";
|
|
29
29
|
/**
|
|
@@ -172,21 +172,52 @@ export declare class VaultAPIImpl extends BaseAPI implements VaultAPI {
|
|
|
172
172
|
*/
|
|
173
173
|
deposit(assetId: string, amount: bigint, autoWait?: boolean, target?: DepositTarget): Promise<TransactionResult>;
|
|
174
174
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
175
|
+
* Polls `GET /api/v1/withdrawals/{index}` until the gateway can serve the
|
|
176
|
+
* `executeWithdrawal` calldata, then returns it with the vault address.
|
|
177
177
|
*
|
|
178
|
-
* The
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
178
|
+
* The calldata only exists once the withdrawal's root is confirmed on-chain
|
|
179
|
+
* and its merkle proof is persisted. Until then the gateway returns 404 (the
|
|
180
|
+
* row is written asynchronously by the persistor after `initiate`) or 409
|
|
181
|
+
* (the proof is not confirmed yet); both are transient for a freshly-allocated
|
|
182
|
+
* index, so we retry on each until ready or the timeout elapses.
|
|
183
|
+
*
|
|
184
|
+
* Returns `null` when the timeout elapses before the proof is available — the
|
|
185
|
+
* index is still valid and the balance already debited, so callers surface
|
|
186
|
+
* this as `awaiting_proof` (with the index intact) rather than as a thrown
|
|
187
|
+
* error that would strand the index. Only non-transient errors (anything
|
|
188
|
+
* other than 404/409) throw.
|
|
189
|
+
*
|
|
190
|
+
* @throws {APIError} On non-transient errors while polling.
|
|
191
|
+
*/
|
|
192
|
+
private pollWithdrawalCalldata;
|
|
193
|
+
/**
|
|
194
|
+
* Initiates a withdrawal through the API Gateway, waits for its on-chain
|
|
195
|
+
* confirmation, then submits the resulting `executeWithdrawal` calldata via
|
|
196
|
+
* the connected wallet.
|
|
197
|
+
*
|
|
198
|
+
* The gateway allocates a `withdrawalIndex` via the matching engine and debits
|
|
199
|
+
* the balance immediately, but the executable calldata needs the withdrawal's
|
|
200
|
+
* merkle proof, which only exists once its root is confirmed on-chain. This
|
|
201
|
+
* method polls until the calldata is available (see `retry`), then submits it.
|
|
202
|
+
* The connected wallet pays gas; the contract authorises the withdrawal
|
|
203
|
+
* against the merkle proof embedded in the calldata. The wallet's address is
|
|
204
|
+
* sent as the on-chain `destination`.
|
|
205
|
+
*
|
|
206
|
+
* If the proof does not become available within the poll window, this method
|
|
207
|
+
* does NOT throw — it returns `{ withdrawalIndex, status: "awaiting_proof" }`
|
|
208
|
+
* with nothing submitted on-chain. The balance is already debited, so losing
|
|
209
|
+
* the index would strand the funds; the caller keeps it and finishes the
|
|
210
|
+
* withdrawal later with `retryWithdrawal(withdrawalIndex)`.
|
|
184
211
|
*
|
|
185
212
|
* @param assetId - The asset identifier (UUID) to withdraw
|
|
186
213
|
* @param amount - The raw token amount to withdraw (as bigint)
|
|
187
214
|
* @param autoWait - Whether to automatically wait for transaction confirmation (defaults to true)
|
|
188
|
-
* @
|
|
189
|
-
* @
|
|
215
|
+
* @param sourceOrRetry - Source ledger (`"spot"` or `"margin"`) or legacy retry options
|
|
216
|
+
* @param retry - Polling cadence/timeout while waiting for the proof when a source is supplied
|
|
217
|
+
* @returns Promise resolving to a [`WithdrawResult`]: on success the submitted
|
|
218
|
+
* transaction plus `withdrawalIndex`; on poll-timeout `{ withdrawalIndex,
|
|
219
|
+
* status: "awaiting_proof" }`.
|
|
220
|
+
* @throws {APIError} When the asset is not found or the initiate request is rejected
|
|
190
221
|
* @throws {ContractError} When the on-chain submission fails
|
|
191
222
|
* @throws {InvalidConfigError} When wallet account is not available
|
|
192
223
|
*
|
|
@@ -198,38 +229,50 @@ export declare class VaultAPIImpl extends BaseAPI implements VaultAPI {
|
|
|
198
229
|
* parseUnits("50", 6),
|
|
199
230
|
* );
|
|
200
231
|
* console.log(`Withdrawal index: ${result.withdrawalIndex}`);
|
|
201
|
-
*
|
|
232
|
+
* if (result.status === "awaiting_proof") {
|
|
233
|
+
* // Proof not ready yet — balance already debited. Finish later:
|
|
234
|
+
* await vaultAPI.retryWithdrawal(result.withdrawalIndex);
|
|
235
|
+
* } else {
|
|
236
|
+
* console.log(`Tx hash: ${result.hash}, status: ${result.status}`);
|
|
237
|
+
* }
|
|
202
238
|
*
|
|
203
|
-
* //
|
|
239
|
+
* // Custom polling (check every 10s, wait up to an hour)
|
|
204
240
|
* const result = await vaultAPI.withdraw(
|
|
205
241
|
* "123e4567-e89b-12d3-a456-426614174000",
|
|
206
242
|
* parseUnits("50", 6),
|
|
207
|
-
*
|
|
243
|
+
* true,
|
|
244
|
+
* { pollIntervalMs: 10_000, timeoutMs: 3_600_000 },
|
|
208
245
|
* );
|
|
209
|
-
* const receipt = await sdk.waitForTransaction(result.hash);
|
|
210
246
|
* ```
|
|
211
247
|
*/
|
|
212
|
-
withdraw(assetId: string, amount: bigint, autoWait?: boolean): Promise<WithdrawResult>;
|
|
248
|
+
withdraw(assetId: string, amount: bigint, autoWait?: boolean, sourceOrRetry?: WithdrawalSource | WithdrawalRetryOptions, retry?: WithdrawalRetryOptions): Promise<WithdrawResult>;
|
|
213
249
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
250
|
+
* Submits (or resubmits) a previously-initiated withdrawal on-chain.
|
|
251
|
+
*
|
|
252
|
+
* Use this when the original `withdraw()` could not complete — e.g. the proof
|
|
253
|
+
* was not yet confirmed within its polling window, the wallet rejected the tx,
|
|
254
|
+
* the page reloaded before the receipt came back, or a stuck mempool entry
|
|
255
|
+
* needs resending. Polls `GET /withdrawals/{index}` for the
|
|
256
|
+
* `executeWithdrawal` calldata (retrying while it is not yet confirmed), then
|
|
257
|
+
* submits it through the connected wallet. Does NOT initiate a new withdrawal
|
|
258
|
+
* — the matching engine already debited the balance and allocated the index.
|
|
259
|
+
* The contract is idempotent against double-submission of a settled
|
|
260
|
+
* withdrawal: it reverts once the index is consumed on-chain.
|
|
217
261
|
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* already debited the balance and allocated the index. The contract is
|
|
222
|
-
* idempotent against double-submission of a settled withdrawal: it will
|
|
223
|
-
* revert once the index is consumed on-chain.
|
|
262
|
+
* Like `withdraw()`, if the proof is still unavailable within the poll window
|
|
263
|
+
* this returns `{ withdrawalIndex, status: "awaiting_proof" }` instead of
|
|
264
|
+
* throwing, so the caller can simply retry again later.
|
|
224
265
|
*
|
|
225
266
|
* @param withdrawalIndex - The index returned by the original `withdraw()` call
|
|
226
267
|
* @param autoWait - Whether to await on-chain confirmation (defaults to true)
|
|
227
|
-
* @
|
|
228
|
-
* @
|
|
268
|
+
* @param retry - Polling cadence/timeout while waiting for the proof
|
|
269
|
+
* @returns Promise resolving to a [`WithdrawResult`]: the submitted transaction
|
|
270
|
+
* plus `withdrawalIndex`, or `{ withdrawalIndex, status: "awaiting_proof" }`
|
|
271
|
+
* if the proof did not arrive within the poll window.
|
|
229
272
|
* @throws {ContractError} When the on-chain submission fails
|
|
230
273
|
* @throws {InvalidConfigError} When wallet account is not available
|
|
231
274
|
*/
|
|
232
|
-
retryWithdrawal(withdrawalIndex: number, autoWait?: boolean): Promise<WithdrawResult>;
|
|
275
|
+
retryWithdrawal(withdrawalIndex: number, autoWait?: boolean, retry?: WithdrawalRetryOptions): Promise<WithdrawResult>;
|
|
233
276
|
/**
|
|
234
277
|
* Retrieves the user's token balance in the vault.
|
|
235
278
|
*
|