@0xmonaco/core 1.0.91 → 1.0.93

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 CHANGED
@@ -50,26 +50,12 @@ npm install viem@^2.31.7
50
50
 
51
51
  ## Network Support
52
52
 
53
- The SDK supports the following documented preset networks. Configure the network by providing the `network` and `seiRpcUrl` parameters:
54
-
55
- **Preset Networks:**
56
- - `"staging"` - Staging environment (https://staging.apimonaco.xyz)
57
- - `"mainnet"` - Production environment (https://apimonaco.xyz)
58
-
59
- WebSocket URLs are automatically resolved per network.
53
+ Configure the network by providing the `network` and `seiRpcUrl` parameters. Use the `"mainnet"` preset, which connects to Sei mainnet and the production API (https://apimonaco.xyz). WebSocket URLs are resolved automatically.
60
54
 
61
55
  ```typescript
62
56
  import { MonacoSDK } from "@0xmonaco/core";
63
57
 
64
- // Staging configuration
65
- const stagingSdk = new MonacoSDK({
66
- walletClient,
67
- network: "staging",
68
- seiRpcUrl: "https://evm-rpc-testnet.sei-apis.com",
69
- });
70
-
71
- // Mainnet configuration
72
- const mainnetSdk = new MonacoSDK({
58
+ const sdk = new MonacoSDK({
73
59
  walletClient,
74
60
  network: "mainnet",
75
61
  seiRpcUrl: "https://evm-rpc.sei-apis.com",
@@ -82,19 +68,20 @@ const mainnetSdk = new MonacoSDK({
82
68
  import { MonacoSDK } from "@0xmonaco/core";
83
69
  import { createWalletClient, http } from "viem";
84
70
  import { privateKeyToAccount } from "viem/accounts";
71
+ import { sei } from "viem/chains";
85
72
 
86
73
  // Initialize the SDK with wallet client
87
74
  const account = privateKeyToAccount("0x...");
88
75
  const walletClient = createWalletClient({
89
76
  account,
90
- chain: sei, // or seiTestnet
91
- transport: http("https://evm-rpc.sei-apis.com") // or https://evm-rpc-testnet.sei-apis.com for testnet
77
+ chain: sei,
78
+ transport: http("https://evm-rpc.sei-apis.com")
92
79
  });
93
80
 
94
81
  const monaco = new MonacoSDK({
95
82
  walletClient,
96
- network: "staging", // or "mainnet"
97
- seiRpcUrl: "https://evm-rpc-testnet.sei-apis.com", // or https://evm-rpc.sei-apis.com for mainnet
83
+ network: "mainnet",
84
+ seiRpcUrl: "https://evm-rpc.sei-apis.com", // public RPC; use a dedicated provider in production
98
85
  });
99
86
 
100
87
  // Authentication
@@ -230,7 +217,7 @@ interface SDKConfig {
230
217
  /** Wallet client for signing operations (optional - can be set later via setWalletClient) */
231
218
  walletClient?: WalletClient;
232
219
 
233
- /** Use "staging" for public testnet or "mainnet" for production. */
220
+ /** Use "mainnet" (Sei mainnet, production API). */
234
221
  network: Network;
235
222
 
236
223
  /** RPC URL for Sei blockchain interactions */
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Compliance API Implementation
3
+ *
4
+ * Reports whether Monaco is available in the caller's region. Every other
5
+ * endpoint refuses callers from a restricted region with HTTP 451
6
+ * `REGION_RESTRICTED`; this one always answers. Public — no authentication
7
+ * required.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const { restricted } = await sdk.compliance.getRegionStatus();
12
+ * if (restricted) showRegionNotice();
13
+ * ```
14
+ */
15
+ import type { ComplianceAPI, GetRegionStatusResponse } from "@0xmonaco/types";
16
+ import { BaseAPI } from "../base";
17
+ export declare class ComplianceAPIImpl extends BaseAPI implements ComplianceAPI {
18
+ /** Get the caller's region status (public, no auth headers). */
19
+ getRegionStatus(): Promise<GetRegionStatusResponse>;
20
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Compliance API Implementation
3
+ *
4
+ * Reports whether Monaco is available in the caller's region. Every other
5
+ * endpoint refuses callers from a restricted region with HTTP 451
6
+ * `REGION_RESTRICTED`; this one always answers. Public — no authentication
7
+ * required.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const { restricted } = await sdk.compliance.getRegionStatus();
12
+ * if (restricted) showRegionNotice();
13
+ * ```
14
+ */
15
+ import { BaseAPI } from "../base";
16
+ export class ComplianceAPIImpl extends BaseAPI {
17
+ /** Get the caller's region status (public, no auth headers). */
18
+ async getRegionStatus() {
19
+ return await this.makePublicRequest("/api/v1/compliance/region", {
20
+ method: "GET",
21
+ });
22
+ }
23
+ }
@@ -0,0 +1 @@
1
+ export { ComplianceAPIImpl } from "./api";
@@ -0,0 +1 @@
1
+ export { ComplianceAPIImpl } from "./api";
@@ -6,6 +6,7 @@
6
6
  export * from "./applications/index";
7
7
  export * from "./base";
8
8
  export * from "./buildercodes";
9
+ export * from "./compliance";
9
10
  export * from "./copy-trading";
10
11
  export * from "./delegated-agents";
11
12
  export * from "./faucet";
@@ -26,5 +27,4 @@ export * from "./trades";
26
27
  export * from "./trading";
27
28
  export * from "./vault";
28
29
  export * from "./websocket";
29
- export * from "./whitelist";
30
30
  export * from "./withdrawals";
package/dist/api/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
  export * from "./applications/index";
7
7
  export * from "./base";
8
8
  export * from "./buildercodes";
9
+ export * from "./compliance";
9
10
  export * from "./copy-trading";
10
11
  export * from "./delegated-agents";
11
12
  export * from "./faucet";
@@ -26,5 +27,4 @@ export * from "./trades";
26
27
  export * from "./trading";
27
28
  export * from "./vault";
28
29
  export * from "./websocket";
29
- export * from "./whitelist";
30
30
  export * from "./withdrawals";
@@ -198,9 +198,6 @@ export declare const perpRoutes: {
198
198
  pageToken?: string;
199
199
  }) => string;
200
200
  };
201
- readonly whitelist: {
202
- readonly submit: () => string;
203
- };
204
201
  readonly positions: {
205
202
  readonly list: (params?: {
206
203
  marginAccountId?: string;
@@ -98,9 +98,6 @@ export const perpRoutes = {
98
98
  deposits: (txHash) => `${API_V1}/sweeper/deposits/${encodeSegment(txHash)}`,
99
99
  listDeposits: (params) => withQuery(`${API_V1}/sweeper/deposits`, params),
100
100
  },
101
- whitelist: {
102
- submit: () => `${API_V1}/whitelist`,
103
- },
104
101
  positions: {
105
102
  list: (params) => withQuery(`${API_V1}/positions`, params),
106
103
  get: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}`,
@@ -1301,7 +1301,7 @@ export function createMonacoWebSocket(baseUrl, options = {}, serverClock = new S
1301
1301
  if (msg.code === "AUTH_FAILED") {
1302
1302
  lastAuthError = { code: msg.code, message: msg.message, session: pendingAuthSessions.shift() };
1303
1303
  }
1304
- else if (msg.code === "ACCOUNT_DEACTIVATED") {
1304
+ else if (msg.code === "ACCOUNT_DEACTIVATED" || msg.code === "ACCOUNT_RESTRICTED") {
1305
1305
  lastAuthError = { code: msg.code, message: msg.message, session: pendingAuthSessions.shift() ?? confirmedSession };
1306
1306
  }
1307
1307
  else if (msg.code === "SESSION_INVALID") {
@@ -1489,7 +1489,7 @@ export function createMonacoWebSocket(baseUrl, options = {}, serverClock = new S
1489
1489
  const authLoss = !skewRetry &&
1490
1490
  authError !== null &&
1491
1491
  authError.session !== undefined &&
1492
- (authError.code === "AUTH_FAILED" || authError.code === "ACCOUNT_DEACTIVATED" || event.code === 1008);
1492
+ (authError.code === "AUTH_FAILED" || authError.code === "ACCOUNT_DEACTIVATED" || authError.code === "ACCOUNT_RESTRICTED" || event.code === 1008);
1493
1493
  const terminalAuthLoss = authLoss && session === authError.session;
1494
1494
  if (terminalAuthLoss) {
1495
1495
  session = undefined;
@@ -57,6 +57,7 @@ export declare const COVERED: {
57
57
  get_market_stats: string;
58
58
  get_my_fee_tier: string;
59
59
  get_pulse: string;
60
+ get_region_status: string;
60
61
  list_managed_market_assignments: string;
61
62
  claim_managed_market_lease: string;
62
63
  refresh_managed_market_quotes: string;
@@ -135,7 +136,6 @@ export declare const COVERED: {
135
136
  simulate_fees: string;
136
137
  simulate_order_risk: string;
137
138
  simulate_parent_margin_order_risk: string;
138
- submit_whitelist: string;
139
139
  register_deposit_address: string;
140
140
  transfer_collateral_from_parent_margin_account: string;
141
141
  transfer_collateral_from_margin_account: string;
package/dist/coverage.js CHANGED
@@ -57,6 +57,7 @@ export const COVERED = {
57
57
  get_market_stats: "getMarketStats",
58
58
  get_my_fee_tier: "getMyFeeTier",
59
59
  get_pulse: "pulse.getPulse",
60
+ get_region_status: "compliance.getRegionStatus",
60
61
  list_managed_market_assignments: "managedMarkets.listAssignments",
61
62
  claim_managed_market_lease: "managedMarkets.claimLease",
62
63
  refresh_managed_market_quotes: "managedMarkets.refreshQuotes",
@@ -135,7 +136,6 @@ export const COVERED = {
135
136
  simulate_fees: "simulateFees",
136
137
  simulate_order_risk: "simulateOrderRisk",
137
138
  simulate_parent_margin_order_risk: "simulateParentMarginOrderRisk",
138
- submit_whitelist: "whitelist.submit",
139
139
  register_deposit_address: "sweeper.register",
140
140
  transfer_collateral_from_parent_margin_account: "transferCollateralFromParentMarginAccount",
141
141
  transfer_collateral_from_margin_account: "transferCollateralFromMarginAccount",
package/dist/sdk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ApplicationsAPI, AuthAPI, AuthState, BuildercodesAPI, CopyTradingAPI, DelegatedAgentsAPI, FaucetAPI, FeesAPI, ManagedMarketsAPI, MarginAccountsAPI, MarketAPI, MonacoSDK, Network, PortfolioAPI, PositionsAPI, ProfileAPI, PulseAPI, SDKConfig, SubAccountsAPI, SweeperAPI, TraderCodesAPI, TradingAPI, VaultAPI, WhitelistAPI, WithdrawalsAPI } from "@0xmonaco/types";
1
+ import type { ApplicationsAPI, AuthAPI, AuthState, BuildercodesAPI, ComplianceAPI, CopyTradingAPI, DelegatedAgentsAPI, FaucetAPI, FeesAPI, ManagedMarketsAPI, MarginAccountsAPI, MarketAPI, MonacoSDK, Network, PortfolioAPI, PositionsAPI, ProfileAPI, PulseAPI, SDKConfig, SubAccountsAPI, SweeperAPI, TraderCodesAPI, TradingAPI, VaultAPI, WithdrawalsAPI } from "@0xmonaco/types";
2
2
  import { type Address, 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 {
@@ -20,9 +20,9 @@ export declare class MonacoSDKImpl implements MonacoSDK {
20
20
  faucet: FaucetAPI;
21
21
  sweeper: SweeperAPI;
22
22
  managedMarkets: ManagedMarketsAPI;
23
- whitelist: WhitelistAPI;
24
23
  profile: ProfileAPI;
25
24
  pulse: PulseAPI;
25
+ compliance: ComplianceAPI;
26
26
  orderbook: OrderbookAPIImpl;
27
27
  trades: TradesAPIImpl;
28
28
  ws: MonacoWebSocket;
package/dist/sdk.js CHANGED
@@ -4,6 +4,7 @@ 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 { BuildercodesAPIImpl } from "./api/buildercodes";
7
+ import { ComplianceAPIImpl } from "./api/compliance";
7
8
  import { CopyTradingAPIImpl } from "./api/copy-trading";
8
9
  import { DelegatedAgentsAPIImpl } from "./api/delegated-agents";
9
10
  import { FaucetAPIImpl } from "./api/faucet";
@@ -20,7 +21,6 @@ import { SweeperAPIImpl } from "./api/sweeper";
20
21
  import { TraderCodesAPIImpl } from "./api/tradercodes";
21
22
  import { TradingAPIImpl } from "./api/trading";
22
23
  import { VaultAPIImpl } from "./api/vault";
23
- import { WhitelistAPIImpl } from "./api/whitelist";
24
24
  import { WithdrawalsAPIImpl } from "./api/withdrawals";
25
25
  import { generateSessionKeypair, privateKeyHex, publicKeyHex } from "./crypto/session";
26
26
  import { APIError, InvalidConfigError, InvalidStateError } from "./errors";
@@ -61,9 +61,9 @@ export class MonacoSDKImpl {
61
61
  faucet;
62
62
  sweeper;
63
63
  managedMarkets;
64
- whitelist;
65
64
  profile;
66
65
  pulse;
66
+ compliance;
67
67
  orderbook;
68
68
  trades;
69
69
  ws;
@@ -95,8 +95,8 @@ export class MonacoSDKImpl {
95
95
  this.faucet.setSessionKeypair(credentials);
96
96
  this.sweeper.setSessionKeypair(credentials);
97
97
  this.managedMarkets.setSessionKeypair(credentials);
98
- this.whitelist.setSessionKeypair(credentials);
99
98
  this.pulse.setSessionKeypair(credentials);
99
+ this.compliance.setSessionKeypair(credentials);
100
100
  this.profile.setSessionKeypair(credentials);
101
101
  this.orderbook.setSessionKeypair(credentials);
102
102
  this.trades.setSessionKeypair(credentials);
@@ -166,8 +166,8 @@ export class MonacoSDKImpl {
166
166
  this.faucet = configureSigning(new FaucetAPIImpl(apiUrl));
167
167
  this.sweeper = configureSigning(new SweeperAPIImpl(apiUrl));
168
168
  this.managedMarkets = configureSigning(new ManagedMarketsAPIImpl(apiUrl));
169
- this.whitelist = configureSigning(new WhitelistAPIImpl(apiUrl));
170
169
  this.pulse = configureSigning(new PulseAPIImpl(apiUrl));
170
+ this.compliance = configureSigning(new ComplianceAPIImpl(apiUrl));
171
171
  this.auth = configureSigning(new AuthAPIImpl(this.walletClient, this.chain, apiUrl));
172
172
  this.delegatedAgents = configureSigning(new DelegatedAgentsAPIImpl(apiUrl));
173
173
  this.fees = configureSigning(new FeesAPIImpl(apiUrl));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/core",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "type": "module",
5
5
  "homepage": "https://docs.0xmonaco.com/sdk/typescript",
6
6
  "main": "./dist/index.js",
@@ -19,8 +19,8 @@
19
19
  "viem": "^2.45.2"
20
20
  },
21
21
  "dependencies": {
22
- "@0xmonaco/contracts": "1.0.91",
23
- "@0xmonaco/types": "1.0.91",
22
+ "@0xmonaco/contracts": "1.0.93",
23
+ "@0xmonaco/types": "1.0.93",
24
24
  "@noble/curves": "^1.9.1",
25
25
  "@noble/hashes": "^2.4.0",
26
26
  "http-status-codes": "^2.3.0"
@@ -1,13 +0,0 @@
1
- /**
2
- * Retained client for the retired public whitelist endpoint.
3
- * Submissions return HTTP 403 FORBIDDEN without changing applicant data.
4
- */
5
- import type { SubmitWhitelistRequest, SubmitWhitelistResponse, WhitelistAPI } from "@0xmonaco/types";
6
- import { BaseAPI } from "../base";
7
- export declare class WhitelistAPIImpl extends BaseAPI implements WhitelistAPI {
8
- /**
9
- * @deprecated Public whitelist applications are closed. The server returns HTTP 403.
10
- * @param body - Legacy applicant details; the request shape is retained for compatibility.
11
- */
12
- submit(body: SubmitWhitelistRequest): Promise<SubmitWhitelistResponse>;
13
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Retained client for the retired public whitelist endpoint.
3
- * Submissions return HTTP 403 FORBIDDEN without changing applicant data.
4
- */
5
- import { BaseAPI } from "../base";
6
- import { perpRoutes } from "../perp/routes";
7
- export class WhitelistAPIImpl extends BaseAPI {
8
- /**
9
- * @deprecated Public whitelist applications are closed. The server returns HTTP 403.
10
- * @param body - Legacy applicant details; the request shape is retained for compatibility.
11
- */
12
- async submit(body) {
13
- return await this.makePublicRequest(perpRoutes.whitelist.submit(), {
14
- method: "POST",
15
- body: JSON.stringify(body),
16
- });
17
- }
18
- }
@@ -1 +0,0 @@
1
- export { WhitelistAPIImpl } from "./api";
@@ -1 +0,0 @@
1
- export { WhitelistAPIImpl } from "./api";