@metamask-previews/perps-controller 15.0.0-preview-e3275932a → 15.0.0-preview-99421bfe4

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 (2) hide show
  1. package/README.md +33 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -12,22 +12,42 @@ or
12
12
 
13
13
  ## Usage
14
14
 
15
+ `PerpsController` provides a provider-agnostic API for perpetual trading. It
16
+ normalizes market data, account state, trading, funding, transfers, risk
17
+ calculations, and live subscriptions across enabled providers.
18
+
19
+ Applications construct the controller with a messenger and their
20
+ platform-specific dependencies:
21
+
15
22
  ```typescript
16
- import { PerpsController } from '@metamask/perps-controller';
23
+ import {
24
+ PerpsController,
25
+ type PerpsControllerOptions,
26
+ } from '@metamask/perps-controller';
27
+
28
+ export async function createPerpsController(
29
+ options: PerpsControllerOptions,
30
+ ): Promise<PerpsController> {
31
+ const controller = new PerpsController(options);
32
+ await controller.init();
33
+ return controller;
34
+ }
17
35
  ```
18
36
 
19
- Chase orders are client-managed post-only strategies. Use
20
- `controller.getChaseOrders()` to read retained lifecycle snapshots and
21
- `controller.suspendChaseOrders()` when the creating client leaves the
22
- foreground; suspension stops repricing while leaving the latest child order
23
- resting. Cancel a Chase through `cancelOrder` with its stable strategy handle
24
- and `orderType: 'chase'`. When using an aggregated provider, also pass the
25
- `providerId` returned with the Chase snapshot so cancellation routes to its
26
- owning venue. `chaseMaxDistanceBps` caps adverse movement from the arrival
27
- price and must be greater than 0 and less than 10,000. The stop follows the
28
- live touch; the final resting child can sit just inside the boundary after
29
- venue price-grid rounding, and `distanceChasedBps` reports that actual resting
30
- distance rounded to the nearest whole basis point.
37
+ The controller registers its public operations as `PerpsController:*`
38
+ messenger actions, and clients can call the same methods directly. Its main
39
+ capabilities are:
40
+
41
+ - Provider and network lifecycle management.
42
+ - Normalized market, account, position, order, and history reads.
43
+ - Trading, position, margin, deposit, and withdrawal operations with
44
+ preflight validation and risk calculations.
45
+ - Callback-based live prices, positions, orders, fills, order books, and
46
+ candles. Each subscription returns an unsubscribe function.
47
+
48
+ The package exports the controller's parameter, result, provider, and
49
+ messenger types for client integrations. Provider availability and aggregated
50
+ routing are controlled by client configuration and feature flags.
31
51
 
32
52
  ## Contributing
33
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/perps-controller",
3
- "version": "15.0.0-preview-e3275932a",
3
+ "version": "15.0.0-preview-99421bfe4",
4
4
  "description": "Controller for perpetual trading functionality in MetaMask",
5
5
  "keywords": [
6
6
  "Ethereum",