@0xmonaco/core 0.8.7-develop.0e951a5 → 0.8.7-develop.5d0e403
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.d.ts +61 -8
- package/dist/api/applications/api.js +71 -7
- package/dist/api/auth/api.d.ts +7 -26
- package/dist/api/auth/api.js +6 -42
- package/dist/api/base.d.ts +35 -0
- package/dist/api/base.js +60 -0
- package/dist/api/delegated-agents/api.d.ts +2 -1
- package/dist/api/delegated-agents/api.js +4 -0
- package/dist/api/faucet/api.d.ts +25 -0
- package/dist/api/faucet/api.js +29 -0
- package/dist/api/faucet/index.d.ts +1 -0
- package/dist/api/faucet/index.js +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.js +4 -0
- package/dist/api/margin-accounts/api.d.ts +2 -2
- package/dist/api/margin-accounts/api.js +4 -4
- package/dist/api/market/api.d.ts +3 -1
- package/dist/api/market/api.js +8 -0
- package/dist/api/perp/routes.d.ts +60 -1
- package/dist/api/perp/routes.js +27 -1
- package/dist/api/sub-accounts/api.d.ts +62 -0
- package/dist/api/sub-accounts/api.js +80 -0
- package/dist/api/sub-accounts/index.d.ts +1 -0
- package/dist/api/sub-accounts/index.js +1 -0
- package/dist/api/trades/api.d.ts +12 -1
- package/dist/api/trades/api.js +13 -1
- package/dist/api/trading/api.d.ts +4 -0
- package/dist/api/trading/api.js +6 -0
- package/dist/api/whitelist/api.d.ts +27 -0
- package/dist/api/whitelist/api.js +32 -0
- package/dist/api/whitelist/index.d.ts +1 -0
- package/dist/api/whitelist/index.js +1 -0
- package/dist/api/withdrawals/api.d.ts +15 -0
- package/dist/api/withdrawals/api.js +27 -0
- package/dist/api/withdrawals/index.d.ts +1 -0
- package/dist/api/withdrawals/index.js +1 -0
- package/dist/coverage.d.ts +7 -0
- package/dist/coverage.js +7 -0
- package/dist/sdk.d.ts +23 -1
- package/dist/sdk.js +51 -0
- package/package.json +3 -3
package/dist/sdk.js
CHANGED
|
@@ -4,13 +4,17 @@ import { sei, seiTestnet } from "viem/chains";
|
|
|
4
4
|
import { ApplicationsAPIImpl, createMonacoWebSocket, OrderbookAPIImpl, TradesAPIImpl } from "./api";
|
|
5
5
|
import { AuthAPIImpl } from "./api/auth";
|
|
6
6
|
import { DelegatedAgentsAPIImpl } from "./api/delegated-agents";
|
|
7
|
+
import { FaucetAPIImpl } from "./api/faucet";
|
|
7
8
|
import { FeesAPIImpl } from "./api/fees";
|
|
8
9
|
import { MarginAccountsAPIImpl } from "./api/margin-accounts";
|
|
9
10
|
import { MarketAPIImpl } from "./api/market";
|
|
10
11
|
import { PositionsAPIImpl } from "./api/positions";
|
|
11
12
|
import { ProfileAPIImpl } from "./api/profile";
|
|
13
|
+
import { SubAccountsAPIImpl } from "./api/sub-accounts";
|
|
12
14
|
import { TradingAPIImpl } from "./api/trading";
|
|
13
15
|
import { VaultAPIImpl } from "./api/vault";
|
|
16
|
+
import { WhitelistAPIImpl } from "./api/whitelist";
|
|
17
|
+
import { WithdrawalsAPIImpl } from "./api/withdrawals";
|
|
14
18
|
import { APIError, InvalidConfigError, InvalidStateError } from "./errors";
|
|
15
19
|
import { resolveApiUrl, resolveWsUrl } from "./networks";
|
|
16
20
|
/** Validate a user-supplied URL override, returning it unchanged when valid. */
|
|
@@ -29,10 +33,14 @@ export class MonacoSDKImpl {
|
|
|
29
33
|
applications;
|
|
30
34
|
fees;
|
|
31
35
|
vault;
|
|
36
|
+
withdrawals;
|
|
32
37
|
trading;
|
|
33
38
|
market;
|
|
34
39
|
marginAccounts;
|
|
35
40
|
positions;
|
|
41
|
+
subAccounts;
|
|
42
|
+
faucet;
|
|
43
|
+
whitelist;
|
|
36
44
|
profile;
|
|
37
45
|
orderbook;
|
|
38
46
|
trades;
|
|
@@ -52,15 +60,54 @@ export class MonacoSDKImpl {
|
|
|
52
60
|
this.applications.setSessionKeypair(credentials);
|
|
53
61
|
this.fees.setSessionKeypair(credentials);
|
|
54
62
|
this.vault.setSessionKeypair(credentials);
|
|
63
|
+
this.withdrawals.setSessionKeypair(credentials);
|
|
55
64
|
this.trading.setSessionKeypair(credentials);
|
|
56
65
|
this.market.setSessionKeypair(credentials);
|
|
57
66
|
this.marginAccounts.setSessionKeypair(credentials);
|
|
58
67
|
this.positions.setSessionKeypair(credentials);
|
|
68
|
+
this.subAccounts.setSessionKeypair(credentials);
|
|
69
|
+
this.faucet.setSessionKeypair(credentials);
|
|
70
|
+
this.whitelist.setSessionKeypair(credentials);
|
|
59
71
|
this.profile.setSessionKeypair(credentials);
|
|
60
72
|
this.orderbook.setSessionKeypair(credentials);
|
|
61
73
|
this.trades.setSessionKeypair(credentials);
|
|
62
74
|
this.ws.setSessionKeypair(credentials);
|
|
63
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Set (or clear) the application secret key used for backend-authenticated
|
|
78
|
+
* requests (those annotated `#[require_backend]` on the gateway, e.g. the
|
|
79
|
+
* `applications` reporting endpoints).
|
|
80
|
+
*
|
|
81
|
+
* The raw `sk_...` key is sent in the `x-server-key` header on each such
|
|
82
|
+
* request. This is independent of {@link login}/session auth — a client may
|
|
83
|
+
* hold both a session and a server key at once.
|
|
84
|
+
*
|
|
85
|
+
* @param serverKey - The application secret key (`sk_...`), or `undefined` to clear.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* sdk.setServerKey("sk_live_...");
|
|
90
|
+
* const orders = await sdk.applications.listApplicationOrders({ status: "FILLED" });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
setServerKey(serverKey) {
|
|
94
|
+
this.auth.setServerKey(serverKey);
|
|
95
|
+
this.delegatedAgents.setServerKey(serverKey);
|
|
96
|
+
this.applications.setServerKey(serverKey);
|
|
97
|
+
this.fees.setServerKey(serverKey);
|
|
98
|
+
this.vault.setServerKey(serverKey);
|
|
99
|
+
this.withdrawals.setServerKey(serverKey);
|
|
100
|
+
this.trading.setServerKey(serverKey);
|
|
101
|
+
this.market.setServerKey(serverKey);
|
|
102
|
+
this.marginAccounts.setServerKey(serverKey);
|
|
103
|
+
this.positions.setServerKey(serverKey);
|
|
104
|
+
this.subAccounts.setServerKey(serverKey);
|
|
105
|
+
this.faucet.setServerKey(serverKey);
|
|
106
|
+
this.whitelist.setServerKey(serverKey);
|
|
107
|
+
this.profile.setServerKey(serverKey);
|
|
108
|
+
this.orderbook.setServerKey(serverKey);
|
|
109
|
+
this.trades.setServerKey(serverKey);
|
|
110
|
+
}
|
|
64
111
|
/** Extract the session keypair from an auth state. */
|
|
65
112
|
sessionFromAuthState(authState) {
|
|
66
113
|
return {
|
|
@@ -110,11 +157,15 @@ export class MonacoSDKImpl {
|
|
|
110
157
|
this.market = new MarketAPIImpl(apiUrl);
|
|
111
158
|
this.marginAccounts = new MarginAccountsAPIImpl(apiUrl);
|
|
112
159
|
this.positions = new PositionsAPIImpl(apiUrl);
|
|
160
|
+
this.subAccounts = new SubAccountsAPIImpl(apiUrl);
|
|
161
|
+
this.faucet = new FaucetAPIImpl(apiUrl);
|
|
162
|
+
this.whitelist = new WhitelistAPIImpl(apiUrl);
|
|
113
163
|
this.auth = new AuthAPIImpl(this.walletClient, this.chain, apiUrl);
|
|
114
164
|
this.delegatedAgents = new DelegatedAgentsAPIImpl(apiUrl);
|
|
115
165
|
this.fees = new FeesAPIImpl(apiUrl);
|
|
116
166
|
this.profile = new ProfileAPIImpl(apiUrl);
|
|
117
167
|
this.vault = new VaultAPIImpl(this.publicClient, this.walletClient, this.chain, this.applications, this.profile, apiUrl);
|
|
168
|
+
this.withdrawals = new WithdrawalsAPIImpl(apiUrl);
|
|
118
169
|
this.trading = new TradingAPIImpl(apiUrl);
|
|
119
170
|
this.orderbook = new OrderbookAPIImpl(apiUrl);
|
|
120
171
|
this.trades = new TradesAPIImpl(apiUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/core",
|
|
3
|
-
"version": "0.8.7-develop.
|
|
3
|
+
"version": "0.8.7-develop.5d0e403",
|
|
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.7-develop.
|
|
27
|
-
"@0xmonaco/types": "0.8.7-develop.
|
|
26
|
+
"@0xmonaco/contracts": "0.8.7-develop.5d0e403",
|
|
27
|
+
"@0xmonaco/types": "0.8.7-develop.5d0e403",
|
|
28
28
|
"@noble/curves": "^1.9.1",
|
|
29
29
|
"@noble/hashes": "^1.8.0",
|
|
30
30
|
"http-status-codes": "^2.3.0"
|