@deeeed/metamask-harness 0.22.0 → 0.23.1

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.
@@ -707,6 +707,14 @@
707
707
  },
708
708
  "timeout_ms": {
709
709
  "type": "number"
710
+ },
711
+ "network": {
712
+ "type": "string",
713
+ "enum": [
714
+ "testnet",
715
+ "mainnet"
716
+ ],
717
+ "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
710
718
  }
711
719
  },
712
720
  "additionalProperties": false
@@ -721,7 +729,7 @@
721
729
  "execution_capabilities": []
722
730
  },
723
731
  "metamask.perps.place_order": {
724
- "description": "core Place a real Perps order on HyperLiquid testnet by driving the headless perps controller placeOrder() through the full signing/provider path. Testnet only Supports market (default) and resting limit orders (order_type=limit with price/offset_pct).",
732
+ "description": "core Place a real Perps order on HyperLiquid testnet by driving the headless perps controller placeOrder() through the full signing/provider path. Supports market (default), resting limit orders (order_type=limit with price/offset_pct), and resting trigger placements (stop_market | stop_limit | take_profit_market | take_profit_limit with trigger_price/trigger_offset_pct), plus reduce_only and attached/partial TP/SL (take_profit_price/take_profit_size, stop_loss_price/stop_loss_size, tpsl_linkage). Venue is selected with network (testnet default; mainnet signs with REAL funds and also requires CORE_PERPS_ALLOW_MAINNET_WRITES=1). Plain limit orders accept time_in_force GTC | ALO (post-only).",
725
733
  "schema": {
726
734
  "type": "object",
727
735
  "properties": {
@@ -797,17 +805,45 @@
797
805
  "type": "string",
798
806
  "enum": [
799
807
  "market",
800
- "limit"
808
+ "limit",
809
+ "stop_market",
810
+ "stop_limit",
811
+ "take_profit_market",
812
+ "take_profit_limit"
813
+ ],
814
+ "description": "market (default) fills immediately; limit places a RESTING order at price/offset_pct that does not fill; stop_market | stop_limit | take_profit_market | take_profit_limit place a RESTING TRIGGER order that activates at trigger_price and then executes as a market or limit order per the suffix. Alias: orderType."
815
+ },
816
+ "orderType": {
817
+ "type": "string",
818
+ "enum": [
819
+ "market",
820
+ "limit",
821
+ "stop_market",
822
+ "stop_limit",
823
+ "take_profit_market",
824
+ "take_profit_limit"
801
825
  ],
802
- "description": "market (default) fills immediately; limit places a RESTING order at price/offset_pct that does not fill. Alias: orderType."
826
+ "description": "Alias for order_type."
803
827
  },
804
828
  "limit_price": {
805
829
  "type": "string",
806
830
  "description": "Absolute resting limit price (limit orders). Takes precedence over offset_pct. Alias: price/limitPrice."
807
831
  },
832
+ "limitPrice": {
833
+ "type": "string",
834
+ "description": "Alias for limit_price."
835
+ },
836
+ "price": {
837
+ "type": "string",
838
+ "description": "Alias for limit_price."
839
+ },
808
840
  "offset_pct": {
809
841
  "type": "number",
810
- "description": "Resting limit price as a percent offset from live mid for limit orders (e.g. -30 = 30%% below mid for a non-filling BUY; default -30 buy / +30 sell). Alias: offsetPct."
842
+ "description": "Limit price as a percent offset from live mid for plain limits, or from the trigger for *_limit orders. Plain limits default to -30 buy / +30 sell; trigger limits default to +1 buy / -1 sell so they are executable after activation. Alias: offsetPct."
843
+ },
844
+ "offsetPct": {
845
+ "type": "number",
846
+ "description": "Alias for offset_pct."
811
847
  },
812
848
  "amount": {
813
849
  "type": [
@@ -833,6 +869,120 @@
833
869
  },
834
870
  "timeout_ms": {
835
871
  "type": "number"
872
+ },
873
+ "trigger_price": {
874
+ "type": "string",
875
+ "description": "Absolute trigger price for stop_*/take_profit_* placements. Takes precedence over trigger_offset_pct. Alias: triggerPrice."
876
+ },
877
+ "triggerPrice": {
878
+ "type": "string",
879
+ "description": "Alias for trigger_price."
880
+ },
881
+ "trigger_offset_pct": {
882
+ "type": "number",
883
+ "description": "Trigger price as a percent offset from live mid (default keeps the trigger ~30% away so it does not fire during a proof). Alias: triggerOffsetPct."
884
+ },
885
+ "triggerOffsetPct": {
886
+ "type": "number",
887
+ "description": "Alias for trigger_offset_pct."
888
+ },
889
+ "reduce_only": {
890
+ "type": "boolean",
891
+ "description": "Place as reduce-only, so the order can only close an existing position. Alias: reduceOnly."
892
+ },
893
+ "reduceOnly": {
894
+ "type": "boolean",
895
+ "description": "Alias for reduce_only."
896
+ },
897
+ "take_profit_price": {
898
+ "type": "string",
899
+ "description": "Attached take profit price. Alias: takeProfitPrice."
900
+ },
901
+ "takeProfitPrice": {
902
+ "type": "string",
903
+ "description": "Alias for take_profit_price."
904
+ },
905
+ "take_profit_size": {
906
+ "type": "string",
907
+ "description": "Quantity covered by the attached take profit (partial TP). Omit to cover the whole order. Alias: takeProfitSize."
908
+ },
909
+ "takeProfitSize": {
910
+ "type": "string",
911
+ "description": "Alias for take_profit_size."
912
+ },
913
+ "stop_loss_price": {
914
+ "type": "string",
915
+ "description": "Attached stop loss price. Alias: stopLossPrice."
916
+ },
917
+ "stopLossPrice": {
918
+ "type": "string",
919
+ "description": "Alias for stop_loss_price."
920
+ },
921
+ "stop_loss_size": {
922
+ "type": "string",
923
+ "description": "Quantity covered by the attached stop loss (partial SL). Omit to cover the whole order. Alias: stopLossSize."
924
+ },
925
+ "stopLossSize": {
926
+ "type": "string",
927
+ "description": "Alias for stop_loss_size."
928
+ },
929
+ "tpsl_linkage": {
930
+ "type": "string",
931
+ "enum": [
932
+ "none",
933
+ "order",
934
+ "position"
935
+ ],
936
+ "description": "How an attached TP/SL is linked: to this order ('order'), to the resulting position ('position'), or absent ('none'). Provider-agnostic replacement for HyperLiquid grouping. Alias: tpslLinkage."
937
+ },
938
+ "tpslLinkage": {
939
+ "type": "string",
940
+ "enum": [
941
+ "none",
942
+ "order",
943
+ "position"
944
+ ],
945
+ "description": "Alias for tpsl_linkage."
946
+ },
947
+ "max_slippage_bps": {
948
+ "type": "number",
949
+ "description": "Slippage tolerance in basis points; also caps the limit price derived from the trigger for *_market trigger placements. Alias: maxSlippageBps."
950
+ },
951
+ "maxSlippageBps": {
952
+ "type": "number",
953
+ "description": "Alias for max_slippage_bps."
954
+ },
955
+ "network": {
956
+ "type": "string",
957
+ "enum": [
958
+ "testnet",
959
+ "mainnet"
960
+ ],
961
+ "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
962
+ },
963
+ "time_in_force": {
964
+ "type": "string",
965
+ "enum": [
966
+ "GTC",
967
+ "ALO"
968
+ ],
969
+ "description": "Time in force for plain limit orders: GTC (default) or ALO (post-only). Alias: timeInForce."
970
+ },
971
+ "timeInForce": {
972
+ "type": "string",
973
+ "enum": [
974
+ "GTC",
975
+ "ALO"
976
+ ],
977
+ "description": "Alias for time_in_force."
978
+ },
979
+ "post_only": {
980
+ "type": "boolean",
981
+ "description": "Protocol-agnostic post-only flag; maps to the controller time-in-force ALO. Alias: postOnly."
982
+ },
983
+ "postOnly": {
984
+ "type": "boolean",
985
+ "description": "Alias for post_only."
836
986
  }
837
987
  },
838
988
  "additionalProperties": false
@@ -951,6 +1101,14 @@
951
1101
  },
952
1102
  "timeout_ms": {
953
1103
  "type": "number"
1104
+ },
1105
+ "network": {
1106
+ "type": "string",
1107
+ "enum": [
1108
+ "testnet",
1109
+ "mainnet"
1110
+ ],
1111
+ "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
954
1112
  }
955
1113
  },
956
1114
  "additionalProperties": false
@@ -1208,6 +1366,14 @@
1208
1366
  },
1209
1367
  "timeout_ms": {
1210
1368
  "type": "number"
1369
+ },
1370
+ "network": {
1371
+ "type": "string",
1372
+ "enum": [
1373
+ "testnet",
1374
+ "mainnet"
1375
+ ],
1376
+ "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
1211
1377
  }
1212
1378
  },
1213
1379
  "required": [
@@ -1321,6 +1487,14 @@
1321
1487
  },
1322
1488
  "timeout_ms": {
1323
1489
  "type": "number"
1490
+ },
1491
+ "network": {
1492
+ "type": "string",
1493
+ "enum": [
1494
+ "testnet",
1495
+ "mainnet"
1496
+ ],
1497
+ "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
1324
1498
  }
1325
1499
  },
1326
1500
  "additionalProperties": false
@@ -1345,7 +1519,7 @@
1345
1519
  ]
1346
1520
  },
1347
1521
  "metamask.perps.assert_orders": {
1348
- "description": "core Assert live Perps open orders are present or absent for an explicit market selection or mode=all.",
1522
+ "description": "core Assert live Perps open orders are present or absent for an explicit market selection or mode=all. Optional expect_* fields assert the trigger data of the matching orders (placement type, trigger price, execution mode, reduce-only flag, size).",
1349
1523
  "schema": {
1350
1524
  "type": "object",
1351
1525
  "properties": {
@@ -1447,6 +1621,40 @@
1447
1621
  "present"
1448
1622
  ],
1449
1623
  "description": "Desired/expected selected collection state."
1624
+ },
1625
+ "expect_trigger_order_type": {
1626
+ "type": "string",
1627
+ "enum": [
1628
+ "stop_market",
1629
+ "stop_limit",
1630
+ "take_profit_market",
1631
+ "take_profit_limit"
1632
+ ],
1633
+ "description": "Require every matching order to be this trigger placement type (read back from the exchange)."
1634
+ },
1635
+ "expect_trigger_price": {
1636
+ "type": "string",
1637
+ "description": "Require every matching order to carry this trigger price."
1638
+ },
1639
+ "expect_execution": {
1640
+ "type": "string",
1641
+ "enum": [
1642
+ "market",
1643
+ "limit"
1644
+ ],
1645
+ "description": "Require the execution mode a matching trigger order runs as once it fires."
1646
+ },
1647
+ "expect_reduce_only": {
1648
+ "type": "boolean",
1649
+ "description": "Require the reduce-only flag on every matching order."
1650
+ },
1651
+ "expect_size": {
1652
+ "type": "string",
1653
+ "description": "Require this size on every matching order (proves a partial TP/SL quantity)."
1654
+ },
1655
+ "only_trigger_orders": {
1656
+ "type": "boolean",
1657
+ "description": "Consider only trigger orders (stop / take profit) on the selected market, so expectations are not applied to a plain parent order resting alongside them. Alias: onlyTriggerOrders."
1450
1658
  }
1451
1659
  },
1452
1660
  "required": [
@@ -1577,6 +1785,14 @@
1577
1785
  "present"
1578
1786
  ],
1579
1787
  "description": "Desired/expected selected collection state."
1788
+ },
1789
+ "network": {
1790
+ "type": "string",
1791
+ "enum": [
1792
+ "testnet",
1793
+ "mainnet"
1794
+ ],
1795
+ "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds: reads work with network=mainnet alone, while signing additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1 in the environment."
1580
1796
  }
1581
1797
  },
1582
1798
  "required": [
@@ -2239,6 +2455,109 @@
2239
2455
  "app-mutation",
2240
2456
  "external-mutation"
2241
2457
  ]
2458
+ },
2459
+ "metamask.perps.update_position_tpsl": {
2460
+ "description": "core Set or replace the TP/SL attached to an existing Perps POSITION by driving the headless perps controller updatePositionTPSL() through the full signing/provider path. Covers whole-position TP/SL and PARTIAL (quantity-scoped) TP/SL via take_profit_size / stop_loss_size, which the provider expresses as standalone reduce-only trigger orders because a position-bound TP/SL always closes the whole position. Venue is selected with network (testnet default; mainnet signs with REAL funds and also requires CORE_PERPS_ALLOW_MAINNET_WRITES=1).",
2461
+ "schema": {
2462
+ "type": "object",
2463
+ "properties": {
2464
+ "market": {
2465
+ "type": "string",
2466
+ "description": "Single market symbol whose position the TP/SL attaches to. Alias: symbol."
2467
+ },
2468
+ "symbol": {
2469
+ "type": "string",
2470
+ "description": "Alias for market."
2471
+ },
2472
+ "markets": {
2473
+ "type": "array",
2474
+ "items": {
2475
+ "type": "string"
2476
+ },
2477
+ "description": "Explicit market list (requires exactly one)."
2478
+ },
2479
+ "symbols": {
2480
+ "type": "array",
2481
+ "items": {
2482
+ "type": "string"
2483
+ },
2484
+ "description": "Alias for markets."
2485
+ },
2486
+ "selector": {
2487
+ "type": "object",
2488
+ "description": "Optional structured selector with mode and symbols/markets."
2489
+ },
2490
+ "take_profit_price": {
2491
+ "type": "string",
2492
+ "description": "Take profit trigger price. Omit to leave the take profit unset. Alias: takeProfitPrice."
2493
+ },
2494
+ "takeProfitPrice": {
2495
+ "type": "string",
2496
+ "description": "Alias for take_profit_price."
2497
+ },
2498
+ "take_profit_size": {
2499
+ "type": "string",
2500
+ "description": "Quantity the take profit covers (partial TP). Omit to cover the whole position. Alias: takeProfitSize."
2501
+ },
2502
+ "takeProfitSize": {
2503
+ "type": "string",
2504
+ "description": "Alias for take_profit_size."
2505
+ },
2506
+ "stop_loss_price": {
2507
+ "type": "string",
2508
+ "description": "Stop loss trigger price. Omit to leave the stop loss unset. Alias: stopLossPrice."
2509
+ },
2510
+ "stopLossPrice": {
2511
+ "type": "string",
2512
+ "description": "Alias for stop_loss_price."
2513
+ },
2514
+ "stop_loss_size": {
2515
+ "type": "string",
2516
+ "description": "Quantity the stop loss covers (partial SL). Omit to cover the whole position. Alias: stopLossSize."
2517
+ },
2518
+ "stopLossSize": {
2519
+ "type": "string",
2520
+ "description": "Alias for stop_loss_size."
2521
+ },
2522
+ "network": {
2523
+ "type": "string",
2524
+ "enum": [
2525
+ "testnet",
2526
+ "mainnet"
2527
+ ],
2528
+ "description": "Venue to act on. Defaults to testnet. Mainnet uses REAL funds and additionally requires CORE_PERPS_ALLOW_MAINNET_WRITES=1."
2529
+ },
2530
+ "account": {
2531
+ "type": "string",
2532
+ "description": "EVM address to act for; defaults to MM_TEST_ACCOUNT_ADDRESS."
2533
+ },
2534
+ "timeout_ms": {
2535
+ "type": "number"
2536
+ }
2537
+ },
2538
+ "additionalProperties": false
2539
+ },
2540
+ "examples": [
2541
+ {
2542
+ "action": "metamask.perps.update_position_tpsl",
2543
+ "market": "BTC",
2544
+ "take_profit_price": "120000",
2545
+ "intent": "Attach a whole-position take profit to the open BTC position",
2546
+ "next": "done"
2547
+ },
2548
+ {
2549
+ "action": "metamask.perps.update_position_tpsl",
2550
+ "market": "BTC",
2551
+ "take_profit_price": "120000",
2552
+ "take_profit_size": "0.0002",
2553
+ "intent": "Attach a partial (quantity-scoped) take profit to the open BTC position",
2554
+ "next": "done"
2555
+ }
2556
+ ],
2557
+ "execution_capabilities": [
2558
+ "app-mutation",
2559
+ "external-mutation"
2560
+ ]
2242
2561
  }
2243
2562
  }
2244
2563
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeeed/metamask-harness",
3
- "version": "0.22.0",
3
+ "version": "0.23.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mm-harness": "bin/mm-harness"