@0xmonaco/core 0.8.14 → 0.8.16
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/README.md +42 -48
- 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.js +23 -23
- package/dist/api/market/api.js +16 -16
- package/dist/api/orderbook/api.js +13 -13
- package/dist/api/perp/routes.d.ts +57 -53
- package/dist/api/perp/routes.js +1 -0
- package/dist/api/positions/api.js +19 -19
- 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 +6 -6
- package/dist/api/trading/api.js +69 -69
- package/dist/api/vault/api.js +4 -4
- package/dist/api/whitelist/api.d.ts +2 -2
- package/dist/api/whitelist/api.js +2 -2
- package/dist/api/withdrawals/api.d.ts +3 -2
- package/dist/api/withdrawals/api.js +7 -2
- package/dist/coverage.d.ts +1 -0
- package/dist/coverage.js +1 -0
- package/dist/sdk.js +3 -3
- package/package.json +3 -3
package/dist/api/vault/api.js
CHANGED
|
@@ -338,7 +338,7 @@ export class VaultAPIImpl extends BaseAPI {
|
|
|
338
338
|
const deadline = Date.now() + timeoutMs;
|
|
339
339
|
for (;;) {
|
|
340
340
|
try {
|
|
341
|
-
const {
|
|
341
|
+
const { vaultAddress, calldata } = await this.makePublicRequest(`/api/v1/withdrawals/${withdrawalIndex}`);
|
|
342
342
|
// Ready: non-empty calldata. (Defensively treat an empty/`0x` body as
|
|
343
343
|
// not-ready too, though the gateway returns an error in that case.)
|
|
344
344
|
if (calldata && calldata !== "0x") {
|
|
@@ -428,13 +428,13 @@ export class VaultAPIImpl extends BaseAPI {
|
|
|
428
428
|
const source = typeof sourceOrRetry === "string" ? sourceOrRetry : "spot";
|
|
429
429
|
const retryOptions = typeof sourceOrRetry === "string" ? retry : sourceOrRetry;
|
|
430
430
|
validate(WithdrawSchema, { assetId, amount, destination, autoWait, source });
|
|
431
|
-
// 1. Gateway allocates the
|
|
431
|
+
// 1. Gateway allocates the withdrawalIndex and debits the balance. No
|
|
432
432
|
// executable calldata yet — it needs the merkle proof, available only once
|
|
433
433
|
// the withdrawal root is confirmed on-chain.
|
|
434
|
-
const {
|
|
434
|
+
const { withdrawalIndex } = await this.makeAuthenticatedRequest("/api/v1/withdrawals", {
|
|
435
435
|
method: "POST",
|
|
436
436
|
body: JSON.stringify({
|
|
437
|
-
|
|
437
|
+
assetId: assetId,
|
|
438
438
|
amount: amount.toString(),
|
|
439
439
|
destination,
|
|
440
440
|
source,
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```typescript
|
|
11
|
-
* const { message,
|
|
12
|
-
*
|
|
11
|
+
* const { message, userId } = await sdk.whitelist.submit({
|
|
12
|
+
* walletAddress: "0x...",
|
|
13
13
|
* email: "user@example.com",
|
|
14
14
|
* });
|
|
15
15
|
* ```
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```typescript
|
|
11
|
-
* const { message,
|
|
12
|
-
*
|
|
11
|
+
* const { message, userId } = await sdk.whitelist.submit({
|
|
12
|
+
* walletAddress: "0x...",
|
|
13
13
|
* email: "user@example.com",
|
|
14
14
|
* });
|
|
15
15
|
* ```
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { InitiateWithdrawalRequest, WithdrawalResponse, WithdrawalsAPI } from "@0xmonaco/types";
|
|
1
|
+
import type { InitiateWithdrawalRequest, ListPendingWithdrawalsParams, ListPendingWithdrawalsResponse, WithdrawalResponse, WithdrawalsAPI } from "@0xmonaco/types";
|
|
2
2
|
import { BaseAPI } from "../base";
|
|
3
3
|
/**
|
|
4
4
|
* Low-level withdrawals client.
|
|
5
5
|
*
|
|
6
6
|
* `initiateWithdrawal` debits the caller's balance via the matching engine and
|
|
7
|
-
* allocates a `
|
|
7
|
+
* allocates a `withdrawalIndex` (its `calldata` is empty — the proof is not
|
|
8
8
|
* available until the withdrawal root is confirmed on-chain). `getWithdrawal`
|
|
9
9
|
* returns the `executeWithdrawal` calldata once that proof is ready, and throws
|
|
10
10
|
* an `APIError` (404 not-persisted-yet / 409 not-confirmed-yet) while it is not.
|
|
@@ -14,4 +14,5 @@ import { BaseAPI } from "../base";
|
|
|
14
14
|
export declare class WithdrawalsAPIImpl extends BaseAPI implements WithdrawalsAPI {
|
|
15
15
|
initiateWithdrawal(request: InitiateWithdrawalRequest): Promise<WithdrawalResponse>;
|
|
16
16
|
getWithdrawal(withdrawalIndex: number): Promise<WithdrawalResponse>;
|
|
17
|
+
listPendingWithdrawals(params?: ListPendingWithdrawalsParams): Promise<ListPendingWithdrawalsResponse>;
|
|
17
18
|
}
|
|
@@ -4,7 +4,7 @@ import { perpRoutes } from "../perp";
|
|
|
4
4
|
* Low-level withdrawals client.
|
|
5
5
|
*
|
|
6
6
|
* `initiateWithdrawal` debits the caller's balance via the matching engine and
|
|
7
|
-
* allocates a `
|
|
7
|
+
* allocates a `withdrawalIndex` (its `calldata` is empty — the proof is not
|
|
8
8
|
* available until the withdrawal root is confirmed on-chain). `getWithdrawal`
|
|
9
9
|
* returns the `executeWithdrawal` calldata once that proof is ready, and throws
|
|
10
10
|
* an `APIError` (404 not-persisted-yet / 409 not-confirmed-yet) while it is not.
|
|
@@ -16,7 +16,7 @@ export class WithdrawalsAPIImpl extends BaseAPI {
|
|
|
16
16
|
return this.makeAuthenticatedRequest(perpRoutes.withdrawals.initiate(), {
|
|
17
17
|
method: "POST",
|
|
18
18
|
body: JSON.stringify({
|
|
19
|
-
|
|
19
|
+
assetId: request.assetId,
|
|
20
20
|
amount: request.amount,
|
|
21
21
|
destination: request.destination,
|
|
22
22
|
source: request.source ?? "spot",
|
|
@@ -27,4 +27,9 @@ export class WithdrawalsAPIImpl extends BaseAPI {
|
|
|
27
27
|
// Public lookup — no auth required.
|
|
28
28
|
return this.makePublicRequest(perpRoutes.withdrawals.byIndex(withdrawalIndex));
|
|
29
29
|
}
|
|
30
|
+
async listPendingWithdrawals(params) {
|
|
31
|
+
// The gateway serves camelCase (the REST wire format), which matches the
|
|
32
|
+
// public surface, so the response is returned directly with no remapping.
|
|
33
|
+
return this.makeAuthenticatedRequest(perpRoutes.withdrawals.list({ page: params?.page, pageSize: params?.pageSize }));
|
|
34
|
+
}
|
|
30
35
|
}
|
package/dist/coverage.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export declare const COVERED: {
|
|
|
51
51
|
get_user_trades: string;
|
|
52
52
|
get_withdrawal: string;
|
|
53
53
|
initiate_withdrawal: string;
|
|
54
|
+
list_pending_withdrawals: string;
|
|
54
55
|
list_application_balances: string;
|
|
55
56
|
list_application_movements: string;
|
|
56
57
|
list_application_orders: string;
|
package/dist/coverage.js
CHANGED
|
@@ -51,6 +51,7 @@ export const COVERED = {
|
|
|
51
51
|
get_user_trades: "getUserTrades",
|
|
52
52
|
get_withdrawal: "getWithdrawal",
|
|
53
53
|
initiate_withdrawal: "initiateWithdrawal",
|
|
54
|
+
list_pending_withdrawals: "listPendingWithdrawals",
|
|
54
55
|
list_application_balances: "listApplicationBalances",
|
|
55
56
|
list_application_movements: "listApplicationMovements",
|
|
56
57
|
list_application_orders: "listApplicationOrders",
|
package/dist/sdk.js
CHANGED
|
@@ -242,10 +242,10 @@ export class MonacoSDKImpl {
|
|
|
242
242
|
this.authState = {
|
|
243
243
|
sessionPublicKey: session.publicKey,
|
|
244
244
|
sessionPrivateKey: session.privateKey,
|
|
245
|
-
expiresAt: delegatedSession.
|
|
245
|
+
expiresAt: delegatedSession.expiresAt,
|
|
246
246
|
user: {
|
|
247
|
-
id: delegatedSession.
|
|
248
|
-
address: delegatedSession.
|
|
247
|
+
id: delegatedSession.ownerUserId,
|
|
248
|
+
address: delegatedSession.agentAddress,
|
|
249
249
|
},
|
|
250
250
|
};
|
|
251
251
|
this.propagateSession(this.sessionFromAuthState(this.authState));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.16",
|
|
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": "0.8.
|
|
27
|
-
"@0xmonaco/types": "0.8.
|
|
26
|
+
"@0xmonaco/contracts": "0.8.16",
|
|
27
|
+
"@0xmonaco/types": "0.8.16",
|
|
28
28
|
"@noble/curves": "^1.9.1",
|
|
29
29
|
"@noble/hashes": "^1.8.0",
|
|
30
30
|
"http-status-codes": "^2.3.0"
|