@0xmonaco/core 1.0.2 → 1.0.7
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/faucet/api.d.ts
CHANGED
|
@@ -17,9 +17,13 @@ export declare class FaucetAPIImpl extends BaseAPI implements FaucetAPI {
|
|
|
17
17
|
/**
|
|
18
18
|
* Mints the full set of testnet tokens to the authenticated user.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* Synchronous: resolves only when every faucet transaction confirmed
|
|
21
|
+
* on-chain (HTTP 200). Rejects with 429 when the daily quota is exhausted,
|
|
22
|
+
* 502 when transactions failed or were only partially confirmed (the error
|
|
23
|
+
* details carry the minted/failed breakdown; delivered legs still consume
|
|
24
|
+
* the quota), and 503 when the faucet is unavailable (safe to retry).
|
|
21
25
|
*
|
|
22
|
-
* @returns Promise resolving to the minted
|
|
26
|
+
* @returns Promise resolving to the minted tokens and remaining quota
|
|
23
27
|
*/
|
|
24
28
|
mint(): Promise<MintTokensResponse>;
|
|
25
29
|
}
|
package/dist/api/faucet/api.js
CHANGED
|
@@ -17,9 +17,13 @@ export class FaucetAPIImpl extends BaseAPI {
|
|
|
17
17
|
/**
|
|
18
18
|
* Mints the full set of testnet tokens to the authenticated user.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* Synchronous: resolves only when every faucet transaction confirmed
|
|
21
|
+
* on-chain (HTTP 200). Rejects with 429 when the daily quota is exhausted,
|
|
22
|
+
* 502 when transactions failed or were only partially confirmed (the error
|
|
23
|
+
* details carry the minted/failed breakdown; delivered legs still consume
|
|
24
|
+
* the quota), and 503 when the faucet is unavailable (safe to retry).
|
|
21
25
|
*
|
|
22
|
-
* @returns Promise resolving to the minted
|
|
26
|
+
* @returns Promise resolving to the minted tokens and remaining quota
|
|
23
27
|
*/
|
|
24
28
|
async mint() {
|
|
25
29
|
return await this.makeAuthenticatedRequest(perpRoutes.faucet.mint(), {
|
package/dist/api/vault/api.d.ts
CHANGED
|
@@ -211,12 +211,16 @@ export declare class VaultAPIImpl extends BaseAPI implements VaultAPI {
|
|
|
211
211
|
*
|
|
212
212
|
* @param assetId - The asset identifier (UUID) to withdraw
|
|
213
213
|
* @param amount - The raw token amount to withdraw (as bigint)
|
|
214
|
-
* @param autoWait -
|
|
214
|
+
* @param autoWait - When `true` (default) polls for the merkle-proof calldata
|
|
215
|
+
* and submits the on-chain `executeWithdrawal` transaction, then waits for
|
|
216
|
+
* confirmation. When `false`, returns `{ withdrawalIndex, status: "awaiting_proof" }`
|
|
217
|
+
* immediately after the POST — skipping both the calldata poll and the
|
|
218
|
+
* on-chain submission. Use `retryWithdrawal(withdrawalIndex)` to finish later.
|
|
215
219
|
* @param sourceOrRetry - Source ledger (`"spot"` or `"margin"`) or legacy retry options
|
|
216
220
|
* @param retry - Polling cadence/timeout while waiting for the proof when a source is supplied
|
|
217
221
|
* @returns Promise resolving to a [`WithdrawResult`]: on success the submitted
|
|
218
|
-
* transaction plus `withdrawalIndex`; on poll-timeout `
|
|
219
|
-
* status: "awaiting_proof" }`.
|
|
222
|
+
* transaction plus `withdrawalIndex`; on poll-timeout or `autoWait=false`
|
|
223
|
+
* returns `{ withdrawalIndex, status: "awaiting_proof" }`.
|
|
220
224
|
* @throws {APIError} When the asset is not found or the initiate request is rejected
|
|
221
225
|
* @throws {ContractError} When the on-chain submission fails
|
|
222
226
|
* @throws {InvalidConfigError} When wallet account is not available
|
package/dist/api/vault/api.js
CHANGED
|
@@ -382,12 +382,16 @@ export class VaultAPIImpl extends BaseAPI {
|
|
|
382
382
|
*
|
|
383
383
|
* @param assetId - The asset identifier (UUID) to withdraw
|
|
384
384
|
* @param amount - The raw token amount to withdraw (as bigint)
|
|
385
|
-
* @param autoWait -
|
|
385
|
+
* @param autoWait - When `true` (default) polls for the merkle-proof calldata
|
|
386
|
+
* and submits the on-chain `executeWithdrawal` transaction, then waits for
|
|
387
|
+
* confirmation. When `false`, returns `{ withdrawalIndex, status: "awaiting_proof" }`
|
|
388
|
+
* immediately after the POST — skipping both the calldata poll and the
|
|
389
|
+
* on-chain submission. Use `retryWithdrawal(withdrawalIndex)` to finish later.
|
|
386
390
|
* @param sourceOrRetry - Source ledger (`"spot"` or `"margin"`) or legacy retry options
|
|
387
391
|
* @param retry - Polling cadence/timeout while waiting for the proof when a source is supplied
|
|
388
392
|
* @returns Promise resolving to a [`WithdrawResult`]: on success the submitted
|
|
389
|
-
* transaction plus `withdrawalIndex`; on poll-timeout `
|
|
390
|
-
* status: "awaiting_proof" }`.
|
|
393
|
+
* transaction plus `withdrawalIndex`; on poll-timeout or `autoWait=false`
|
|
394
|
+
* returns `{ withdrawalIndex, status: "awaiting_proof" }`.
|
|
391
395
|
* @throws {APIError} When the asset is not found or the initiate request is rejected
|
|
392
396
|
* @throws {ContractError} When the on-chain submission fails
|
|
393
397
|
* @throws {InvalidConfigError} When wallet account is not available
|
|
@@ -440,7 +444,14 @@ export class VaultAPIImpl extends BaseAPI {
|
|
|
440
444
|
source,
|
|
441
445
|
}),
|
|
442
446
|
});
|
|
443
|
-
// 2.
|
|
447
|
+
// 2. When autoWait=false the caller wants the index immediately so it can
|
|
448
|
+
// finish on-chain later via retryWithdrawal(index). Skip the calldata poll
|
|
449
|
+
// entirely — the proof never lands this early, and the 5-minute default
|
|
450
|
+
// would block the wallet prompt indefinitely (the MACH1 bug).
|
|
451
|
+
if (!autoWait) {
|
|
452
|
+
return { withdrawalIndex, status: "awaiting_proof" };
|
|
453
|
+
}
|
|
454
|
+
// 3. Poll for the executeWithdrawal calldata until the proof is confirmed.
|
|
444
455
|
// The vault address comes back with it, keeping calldata + target contract
|
|
445
456
|
// in lockstep.
|
|
446
457
|
const poll = await this.pollWithdrawalCalldata(withdrawalIndex, retryOptions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"viem": "^2.45.2"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@0xmonaco/contracts": "1.0.
|
|
27
|
-
"@0xmonaco/types": "1.0.
|
|
26
|
+
"@0xmonaco/contracts": "1.0.7",
|
|
27
|
+
"@0xmonaco/types": "1.0.7",
|
|
28
28
|
"@noble/curves": "^1.9.1",
|
|
29
29
|
"@noble/hashes": "^1.8.0",
|
|
30
30
|
"http-status-codes": "^2.3.0"
|