@0xmonaco/core 1.0.34 → 1.0.36

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.
@@ -18,6 +18,7 @@ export * from "./positions";
18
18
  export * from "./profile";
19
19
  export * from "./pulse";
20
20
  export * from "./sub-accounts";
21
+ export * from "./sweeper";
21
22
  export * from "./trades";
22
23
  export * from "./trading";
23
24
  export * from "./vault";
package/dist/api/index.js CHANGED
@@ -18,6 +18,7 @@ export * from "./positions";
18
18
  export * from "./profile";
19
19
  export * from "./pulse";
20
20
  export * from "./sub-accounts";
21
+ export * from "./sweeper";
21
22
  export * from "./trades";
22
23
  export * from "./trading";
23
24
  export * from "./vault";
@@ -152,6 +152,9 @@ export declare const perpRoutes: {
152
152
  readonly mint: () => string;
153
153
  readonly info: () => string;
154
154
  };
155
+ readonly sweeper: {
156
+ readonly register: () => string;
157
+ };
155
158
  readonly whitelist: {
156
159
  readonly submit: () => string;
157
160
  };
@@ -82,6 +82,9 @@ export const perpRoutes = {
82
82
  mint: () => `${API_V1}/faucet/mint`,
83
83
  info: () => `${API_V1}/faucet/info`,
84
84
  },
85
+ sweeper: {
86
+ register: () => `${API_V1}/sweeper/register`,
87
+ },
85
88
  whitelist: {
86
89
  submit: () => `${API_V1}/whitelist`,
87
90
  },
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Sweeper API Implementation
3
+ *
4
+ * Public (unauthenticated) deposit-address registration. Every (application,
5
+ * user) pair has a deterministic deposit address; registering the pair makes
6
+ * the backend monitor that address and sweep every ERC20 deposit into the
7
+ * rollup automatically, crediting the user.
8
+ *
9
+ * The reply returns immediately with the derived address; the one-time
10
+ * initial balance check (sweeping anything already sitting on the address)
11
+ * runs in the background and is reported by `initialSweepCheck`.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const { status, sweeperAddress, initialSweepCheck } = await sdk.sweeper.register({
16
+ * clientId: "60eb377aab9f4ea18dcdf4747204c792",
17
+ * userAddress: "0x...",
18
+ * });
19
+ * ```
20
+ */
21
+ import type { RegisterSweeperRequest, RegisterSweeperResponse, SweeperAPI } from "@0xmonaco/types";
22
+ import { BaseAPI } from "../base";
23
+ export declare class SweeperAPIImpl extends BaseAPI implements SweeperAPI {
24
+ /**
25
+ * Registers an (application, user) deposit address for monitoring. Public —
26
+ * no auth required.
27
+ *
28
+ * `registered` means the pair was added by this call, `already_registered`
29
+ * that it was known before; both carry the same derived deposit address.
30
+ * Idempotent and safe to retry — a repeat never re-triggers the initial
31
+ * balance check.
32
+ *
33
+ * @param body - The application and user identifying the pair
34
+ * @returns Promise resolving to the deposit address and the initial-check
35
+ * state
36
+ */
37
+ register(body: RegisterSweeperRequest): Promise<RegisterSweeperResponse>;
38
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Sweeper API Implementation
3
+ *
4
+ * Public (unauthenticated) deposit-address registration. Every (application,
5
+ * user) pair has a deterministic deposit address; registering the pair makes
6
+ * the backend monitor that address and sweep every ERC20 deposit into the
7
+ * rollup automatically, crediting the user.
8
+ *
9
+ * The reply returns immediately with the derived address; the one-time
10
+ * initial balance check (sweeping anything already sitting on the address)
11
+ * runs in the background and is reported by `initialSweepCheck`.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const { status, sweeperAddress, initialSweepCheck } = await sdk.sweeper.register({
16
+ * clientId: "60eb377aab9f4ea18dcdf4747204c792",
17
+ * userAddress: "0x...",
18
+ * });
19
+ * ```
20
+ */
21
+ import { BaseAPI } from "../base";
22
+ import { perpRoutes } from "../perp/routes";
23
+ export class SweeperAPIImpl extends BaseAPI {
24
+ /**
25
+ * Registers an (application, user) deposit address for monitoring. Public —
26
+ * no auth required.
27
+ *
28
+ * `registered` means the pair was added by this call, `already_registered`
29
+ * that it was known before; both carry the same derived deposit address.
30
+ * Idempotent and safe to retry — a repeat never re-triggers the initial
31
+ * balance check.
32
+ *
33
+ * @param body - The application and user identifying the pair
34
+ * @returns Promise resolving to the deposit address and the initial-check
35
+ * state
36
+ */
37
+ async register(body) {
38
+ return await this.makePublicRequest(perpRoutes.sweeper.register(), {
39
+ method: "POST",
40
+ body: JSON.stringify(body),
41
+ });
42
+ }
43
+ }
@@ -0,0 +1 @@
1
+ export { SweeperAPIImpl } from "./api";
@@ -0,0 +1 @@
1
+ export { SweeperAPIImpl } from "./api";
@@ -94,6 +94,7 @@ export declare const COVERED: {
94
94
  simulate_order_risk: string;
95
95
  simulate_parent_margin_order_risk: string;
96
96
  submit_whitelist: string;
97
+ register_deposit_address: string;
97
98
  transfer_collateral_from_parent_margin_account: string;
98
99
  transfer_collateral_from_margin_account: string;
99
100
  transfer_collateral_to_margin_account: string;
package/dist/coverage.js CHANGED
@@ -94,6 +94,7 @@ export const COVERED = {
94
94
  simulate_order_risk: "simulateOrderRisk",
95
95
  simulate_parent_margin_order_risk: "simulateParentMarginOrderRisk",
96
96
  submit_whitelist: "whitelist.submit",
97
+ register_deposit_address: "sweeper.register",
97
98
  transfer_collateral_from_parent_margin_account: "transferCollateralFromParentMarginAccount",
98
99
  transfer_collateral_from_margin_account: "transferCollateralFromMarginAccount",
99
100
  transfer_collateral_to_margin_account: "transferCollateralToMarginAccount",
package/dist/sdk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ApplicationsAPI, AuthAPI, AuthState, DelegatedAgentsAPI, FaucetAPI, FeesAPI, MarginAccountsAPI, MarketAPI, MonacoSDK, Network, PitpassAPI, PortfolioAPI, PositionsAPI, ProfileAPI, PulseAPI, SDKConfig, SubAccountsAPI, TradingAPI, VaultAPI, WhitelistAPI, WithdrawalsAPI } from "@0xmonaco/types";
1
+ import type { ApplicationsAPI, AuthAPI, AuthState, DelegatedAgentsAPI, FaucetAPI, FeesAPI, MarginAccountsAPI, MarketAPI, MonacoSDK, Network, PitpassAPI, PortfolioAPI, PositionsAPI, ProfileAPI, PulseAPI, SDKConfig, SubAccountsAPI, SweeperAPI, TradingAPI, VaultAPI, WhitelistAPI, 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 {
@@ -16,6 +16,7 @@ export declare class MonacoSDKImpl implements MonacoSDK {
16
16
  portfolio: PortfolioAPI;
17
17
  subAccounts: SubAccountsAPI;
18
18
  faucet: FaucetAPI;
19
+ sweeper: SweeperAPI;
19
20
  whitelist: WhitelistAPI;
20
21
  profile: ProfileAPI;
21
22
  pulse: PulseAPI;
package/dist/sdk.js CHANGED
@@ -14,6 +14,7 @@ import { PositionsAPIImpl } from "./api/positions";
14
14
  import { ProfileAPIImpl } from "./api/profile";
15
15
  import { PulseAPIImpl } from "./api/pulse";
16
16
  import { SubAccountsAPIImpl } from "./api/sub-accounts";
17
+ import { SweeperAPIImpl } from "./api/sweeper";
17
18
  import { TradingAPIImpl } from "./api/trading";
18
19
  import { VaultAPIImpl } from "./api/vault";
19
20
  import { WhitelistAPIImpl } from "./api/whitelist";
@@ -53,6 +54,7 @@ export class MonacoSDKImpl {
53
54
  portfolio;
54
55
  subAccounts;
55
56
  faucet;
57
+ sweeper;
56
58
  whitelist;
57
59
  profile;
58
60
  pulse;
@@ -83,6 +85,7 @@ export class MonacoSDKImpl {
83
85
  this.portfolio.setSessionKeypair(credentials);
84
86
  this.subAccounts.setSessionKeypair(credentials);
85
87
  this.faucet.setSessionKeypair(credentials);
88
+ this.sweeper.setSessionKeypair(credentials);
86
89
  this.whitelist.setSessionKeypair(credentials);
87
90
  this.pulse.setSessionKeypair(credentials);
88
91
  this.profile.setSessionKeypair(credentials);
@@ -122,6 +125,7 @@ export class MonacoSDKImpl {
122
125
  this.portfolio.setServerKey(serverKey);
123
126
  this.subAccounts.setServerKey(serverKey);
124
127
  this.faucet.setServerKey(serverKey);
128
+ this.sweeper.setServerKey(serverKey);
125
129
  this.whitelist.setServerKey(serverKey);
126
130
  this.pulse.setServerKey(serverKey);
127
131
  this.profile.setServerKey(serverKey);
@@ -184,6 +188,7 @@ export class MonacoSDKImpl {
184
188
  this.portfolio = new PortfolioAPIImpl(apiUrl);
185
189
  this.subAccounts = new SubAccountsAPIImpl(apiUrl);
186
190
  this.faucet = new FaucetAPIImpl(apiUrl);
191
+ this.sweeper = new SweeperAPIImpl(apiUrl);
187
192
  this.whitelist = new WhitelistAPIImpl(apiUrl);
188
193
  this.pulse = new PulseAPIImpl(apiUrl);
189
194
  this.auth = new AuthAPIImpl(this.walletClient, this.chain, apiUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/core",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
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.34",
27
- "@0xmonaco/types": "1.0.34",
26
+ "@0xmonaco/contracts": "1.0.36",
27
+ "@0xmonaco/types": "1.0.36",
28
28
  "@noble/curves": "^1.9.1",
29
29
  "@noble/hashes": "^1.8.0",
30
30
  "http-status-codes": "^2.3.0"