@0xmonaco/core 0.8.7-develop.34bd452 → 0.8.7-develop.ab57a24

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.
Files changed (43) hide show
  1. package/dist/api/applications/api.d.ts +61 -8
  2. package/dist/api/applications/api.js +71 -7
  3. package/dist/api/auth/api.d.ts +7 -26
  4. package/dist/api/auth/api.js +6 -42
  5. package/dist/api/base.d.ts +35 -0
  6. package/dist/api/base.js +60 -0
  7. package/dist/api/delegated-agents/api.d.ts +2 -1
  8. package/dist/api/delegated-agents/api.js +4 -0
  9. package/dist/api/faucet/api.d.ts +25 -0
  10. package/dist/api/faucet/api.js +29 -0
  11. package/dist/api/faucet/index.d.ts +1 -0
  12. package/dist/api/faucet/index.js +1 -0
  13. package/dist/api/index.d.ts +4 -0
  14. package/dist/api/index.js +4 -0
  15. package/dist/api/margin-accounts/api.d.ts +2 -2
  16. package/dist/api/margin-accounts/api.js +6 -4
  17. package/dist/api/market/api.d.ts +3 -1
  18. package/dist/api/market/api.js +8 -0
  19. package/dist/api/perp/routes.d.ts +60 -1
  20. package/dist/api/perp/routes.js +27 -1
  21. package/dist/api/profile/api.d.ts +18 -1
  22. package/dist/api/profile/api.js +41 -1
  23. package/dist/api/sub-accounts/api.d.ts +62 -0
  24. package/dist/api/sub-accounts/api.js +80 -0
  25. package/dist/api/sub-accounts/index.d.ts +1 -0
  26. package/dist/api/sub-accounts/index.js +1 -0
  27. package/dist/api/trades/api.d.ts +12 -1
  28. package/dist/api/trades/api.js +13 -1
  29. package/dist/api/trading/api.d.ts +4 -0
  30. package/dist/api/trading/api.js +6 -0
  31. package/dist/api/whitelist/api.d.ts +27 -0
  32. package/dist/api/whitelist/api.js +32 -0
  33. package/dist/api/whitelist/index.d.ts +1 -0
  34. package/dist/api/whitelist/index.js +1 -0
  35. package/dist/api/withdrawals/api.d.ts +15 -0
  36. package/dist/api/withdrawals/api.js +27 -0
  37. package/dist/api/withdrawals/index.d.ts +1 -0
  38. package/dist/api/withdrawals/index.js +1 -0
  39. package/dist/coverage.d.ts +87 -0
  40. package/dist/coverage.js +87 -0
  41. package/dist/sdk.d.ts +23 -1
  42. package/dist/sdk.js +51 -0
  43. package/package.json +3 -3
@@ -0,0 +1,87 @@
1
+ /** operationId → the @0xmonaco/core client method that covers it. */
2
+ export declare const COVERED: {
3
+ add_position_margin: string;
4
+ attach_position_tp_sl: string;
5
+ batch_cancel_all: string;
6
+ batch_cancel_all_by_pair: string;
7
+ batch_cancel_orders: string;
8
+ batch_create_orders: string;
9
+ batch_replace_orders: string;
10
+ cancel_conditional_order: string;
11
+ cancel_order: string;
12
+ close_position: string;
13
+ create_challenge: string;
14
+ create_conditional_order: string;
15
+ create_delegated_session: string;
16
+ create_order: string;
17
+ create_sub_account_limit: string;
18
+ delete_sub_account_limit: string;
19
+ ensure_parent_margin_account: string;
20
+ get_application_config: string;
21
+ get_application_stats: string;
22
+ get_available_collateral: string;
23
+ get_candles: string;
24
+ get_funding_state: string;
25
+ get_index_price: string;
26
+ get_margin_account_movements: string;
27
+ get_margin_account_summary: string;
28
+ get_mark_price: string;
29
+ get_market_metadata: string;
30
+ get_open_interest: string;
31
+ get_order_by_id: string;
32
+ get_orderbook_snapshot: string;
33
+ get_orders: string;
34
+ get_perp_market_config: string;
35
+ get_perp_market_summary: string;
36
+ get_portfolio_chart: string;
37
+ get_portfolio_stats: string;
38
+ get_position: string;
39
+ get_position_risk: string;
40
+ get_screener: string;
41
+ get_sub_account_limits: string;
42
+ get_trade_by_id: string;
43
+ get_trades: string;
44
+ get_trading_pair_by_id: string;
45
+ get_user_balance_by_asset: string;
46
+ get_user_balances: string;
47
+ get_user_movements: string;
48
+ get_user_profile: string;
49
+ get_user_trades: string;
50
+ get_withdrawal: string;
51
+ initiate_withdrawal: string;
52
+ list_application_balances: string;
53
+ list_application_movements: string;
54
+ list_application_orders: string;
55
+ list_application_users: string;
56
+ list_conditional_orders: string;
57
+ list_delegated_agent_owners: string;
58
+ list_delegated_agents: string;
59
+ list_funding_history: string;
60
+ list_funding_payments: string;
61
+ list_margin_accounts: string;
62
+ list_position_history: string;
63
+ list_positions: string;
64
+ list_sub_accounts_with_balances: string;
65
+ list_trading_pairs: string;
66
+ mint_tokens: string;
67
+ reduce_position_margin: string;
68
+ refresh_session: string;
69
+ replace_order: string;
70
+ revoke_delegated_agent: string;
71
+ revoke_session: string;
72
+ simulate_auto_margin_order_risk: string;
73
+ simulate_fees: string;
74
+ simulate_order_risk: string;
75
+ submit_whitelist: string;
76
+ transfer_collateral_from_margin_account: string;
77
+ transfer_collateral_to_auto_margin_account: string;
78
+ transfer_collateral_to_margin_account: string;
79
+ update_sub_account_limit: string;
80
+ upsert_delegated_agent: string;
81
+ verify_signature: string;
82
+ };
83
+ /** operationId → reason it is intentionally not covered by @0xmonaco/core. */
84
+ export declare const INTENTIONALLY_EXCLUDED: {
85
+ authenticate_backend: string;
86
+ health_check: string;
87
+ };
@@ -0,0 +1,87 @@
1
+ /** operationId → the @0xmonaco/core client method that covers it. */
2
+ export const COVERED = {
3
+ add_position_margin: "addPositionMargin",
4
+ attach_position_tp_sl: "attachPositionTpSl",
5
+ batch_cancel_all: "batchCancelAll",
6
+ batch_cancel_all_by_pair: "batchCancelAll (with tradingPairId)",
7
+ batch_cancel_orders: "batchCancel",
8
+ batch_create_orders: "batchCreate",
9
+ batch_replace_orders: "batchReplace",
10
+ cancel_conditional_order: "cancelConditionalOrder",
11
+ cancel_order: "cancelOrder",
12
+ close_position: "closePosition",
13
+ create_challenge: "createChallenge",
14
+ create_conditional_order: "createConditionalOrder",
15
+ create_delegated_session: "createDelegatedSession",
16
+ create_order: "placeLimitOrder / placeMarketOrder",
17
+ create_sub_account_limit: "subAccounts.createLimit",
18
+ delete_sub_account_limit: "subAccounts.deleteLimit",
19
+ ensure_parent_margin_account: "ensureParentMarginAccount",
20
+ get_application_config: "getApplicationConfig",
21
+ get_application_stats: "getApplicationStats",
22
+ get_available_collateral: "getAvailableCollateral",
23
+ get_candles: "getCandlesticks",
24
+ get_funding_state: "getFundingState",
25
+ get_index_price: "getIndexPrice",
26
+ get_margin_account_movements: "getMarginAccountMovements",
27
+ get_margin_account_summary: "getMarginAccountSummary",
28
+ get_mark_price: "getMarkPrice",
29
+ get_market_metadata: "getMarketMetadata",
30
+ get_open_interest: "getOpenInterest",
31
+ get_order_by_id: "getOrder",
32
+ get_orderbook_snapshot: "getOrderbook",
33
+ get_orders: "getPaginatedOrders",
34
+ get_perp_market_config: "getPerpMarketConfig",
35
+ get_perp_market_summary: "getPerpMarketSummary",
36
+ get_portfolio_chart: "getPortfolioChart",
37
+ get_portfolio_stats: "getPortfolioStats",
38
+ get_position: "getPosition",
39
+ get_position_risk: "getPositionRisk",
40
+ get_screener: "getScreener",
41
+ get_sub_account_limits: "subAccounts.getLimits",
42
+ get_trade_by_id: "getTradeById",
43
+ get_trades: "getTrades",
44
+ get_trading_pair_by_id: "getTradingPair",
45
+ get_user_balance_by_asset: "getUserBalanceByAssetId",
46
+ get_user_balances: "getUserBalances",
47
+ get_user_movements: "getPaginatedUserMovements",
48
+ get_user_profile: "getProfile",
49
+ get_user_trades: "getUserTrades",
50
+ get_withdrawal: "getWithdrawal",
51
+ initiate_withdrawal: "initiateWithdrawal",
52
+ list_application_balances: "listApplicationBalances",
53
+ list_application_movements: "listApplicationMovements",
54
+ list_application_orders: "listApplicationOrders",
55
+ list_application_users: "listApplicationUsers",
56
+ list_conditional_orders: "listConditionalOrders",
57
+ list_delegated_agent_owners: "listDelegatedOwners",
58
+ list_delegated_agents: "listDelegatedAgents",
59
+ list_funding_history: "listFundingHistory",
60
+ list_funding_payments: "listFundingPayments",
61
+ list_margin_accounts: "listMarginAccounts",
62
+ list_position_history: "listPositionHistory",
63
+ list_positions: "listPositions",
64
+ list_sub_accounts_with_balances: "subAccounts.list",
65
+ list_trading_pairs: "getPaginatedTradingPairs",
66
+ mint_tokens: "faucet.mint",
67
+ reduce_position_margin: "reducePositionMargin",
68
+ refresh_session: "refreshSession",
69
+ replace_order: "replaceOrder",
70
+ revoke_delegated_agent: "revokeDelegatedAgent",
71
+ revoke_session: "revokeSession",
72
+ simulate_auto_margin_order_risk: "simulateAutoMarginOrderRisk",
73
+ simulate_fees: "simulateFees",
74
+ simulate_order_risk: "simulateOrderRisk",
75
+ submit_whitelist: "whitelist.submit",
76
+ transfer_collateral_from_margin_account: "transferCollateralFromMarginAccount",
77
+ transfer_collateral_to_auto_margin_account: "transferCollateralToAutoMarginAccount",
78
+ transfer_collateral_to_margin_account: "transferCollateralToMarginAccount",
79
+ update_sub_account_limit: "subAccounts.updateLimit",
80
+ upsert_delegated_agent: "upsertDelegatedAgent",
81
+ verify_signature: "verifySignature",
82
+ };
83
+ /** operationId → reason it is intentionally not covered by @0xmonaco/core. */
84
+ export const INTENTIONALLY_EXCLUDED = {
85
+ authenticate_backend: "Backend auth is header-based via setServerKey()/the x-server-key header, not an endpoint method (MON-1486).",
86
+ health_check: "Infrastructure liveness probe (GET /health); not part of the data SDK surface.",
87
+ };
package/dist/sdk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ApplicationsAPI, AuthAPI, AuthState, DelegatedAgentsAPI, FeesAPI, MarginAccountsAPI, MarketAPI, MonacoSDK, Network, PositionsAPI, ProfileAPI, SDKConfig, TradingAPI, VaultAPI } from "@0xmonaco/types";
1
+ import type { ApplicationsAPI, AuthAPI, AuthState, DelegatedAgentsAPI, FaucetAPI, FeesAPI, MarginAccountsAPI, MarketAPI, MonacoSDK, Network, PositionsAPI, ProfileAPI, SDKConfig, SubAccountsAPI, TradingAPI, VaultAPI, WhitelistAPI, WithdrawalsAPI } from "@0xmonaco/types";
2
2
  import { type PublicClient, type TransactionReceipt, type WalletClient } from "viem";
3
3
  import { type MonacoWebSocket, OrderbookAPIImpl, TradesAPIImpl } from "./api";
4
4
  export declare class MonacoSDKImpl implements MonacoSDK {
@@ -7,10 +7,14 @@ export declare class MonacoSDKImpl implements MonacoSDK {
7
7
  applications: ApplicationsAPI;
8
8
  fees: FeesAPI;
9
9
  vault: VaultAPI;
10
+ withdrawals: WithdrawalsAPI;
10
11
  trading: TradingAPI;
11
12
  market: MarketAPI;
12
13
  marginAccounts: MarginAccountsAPI;
13
14
  positions: PositionsAPI;
15
+ subAccounts: SubAccountsAPI;
16
+ faucet: FaucetAPI;
17
+ whitelist: WhitelistAPI;
14
18
  profile: ProfileAPI;
15
19
  orderbook: OrderbookAPIImpl;
16
20
  trades: TradesAPIImpl;
@@ -25,6 +29,24 @@ export declare class MonacoSDKImpl implements MonacoSDK {
25
29
  * the WebSocket client.
26
30
  */
27
31
  private propagateSession;
32
+ /**
33
+ * Set (or clear) the application secret key used for backend-authenticated
34
+ * requests (those annotated `#[require_backend]` on the gateway, e.g. the
35
+ * `applications` reporting endpoints).
36
+ *
37
+ * The raw `sk_...` key is sent in the `x-server-key` header on each such
38
+ * request. This is independent of {@link login}/session auth — a client may
39
+ * hold both a session and a server key at once.
40
+ *
41
+ * @param serverKey - The application secret key (`sk_...`), or `undefined` to clear.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * sdk.setServerKey("sk_live_...");
46
+ * const orders = await sdk.applications.listApplicationOrders({ status: "FILLED" });
47
+ * ```
48
+ */
49
+ setServerKey(serverKey: string | undefined): void;
28
50
  /** Extract the session keypair from an auth state. */
29
51
  private sessionFromAuthState;
30
52
  constructor(cfg: SDKConfig);
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.34bd452",
3
+ "version": "0.8.7-develop.ab57a24",
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.34bd452",
27
- "@0xmonaco/types": "0.8.7-develop.34bd452",
26
+ "@0xmonaco/contracts": "0.8.7-develop.ab57a24",
27
+ "@0xmonaco/types": "0.8.7-develop.ab57a24",
28
28
  "@noble/curves": "^1.9.1",
29
29
  "@noble/hashes": "^1.8.0",
30
30
  "http-status-codes": "^2.3.0"