@deeeed/metamask-harness 0.92.23 → 0.92.24
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.92.24 - 2026-10-18
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Mobile Perps: `teardown_state` and the strategy cleanup in `start_state` no longer fail on a market whose provider doesn't advertise TWAP (Lighter on Mobile 8.17.0, where `getTwapOrders` throws). With a selected market, the cleanup asks `PerpsController.getOrderCapabilities` (for the first selected market) and reads no TWAP orders when `twap` isn't listed. Its result then reports `twap: { status: "unavailable", reason: "provider-does-not-advertise-twap" }`. Callers no longer need `strategies: false` there. `mode: all`, unavailable capabilities and apps without the capability reader read TWAP as before.
|
|
10
|
+
|
|
5
11
|
## 0.92.23 - 2026-10-18
|
|
6
12
|
|
|
7
13
|
### Changed
|
|
@@ -428,7 +428,16 @@ async function readOpenOrders(input) {
|
|
|
428
428
|
);
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
const TWAP_NOT_ADVERTISED = 'provider-does-not-advertise-twap';
|
|
432
|
+
|
|
431
433
|
async function readStrategyOrders(input) {
|
|
434
|
+
// Where the provider does not advertise TWAP (Lighter on Mobile 8.17),
|
|
435
|
+
// MetaMask cannot place TWAP, so there is none to clean, and getTwapOrders
|
|
436
|
+
// throws. Support is per provider today, so the first selected market speaks
|
|
437
|
+
// for the read.
|
|
438
|
+
const market = configuredSymbols(input, [])[0] ?? null;
|
|
439
|
+
const provider = typeof input.node?.provider === 'string' ? input.node.provider.toLowerCase() : null;
|
|
440
|
+
const capabilityQuery = market ? { symbol: market, ...(provider ? { providerId: provider } : {}) } : null;
|
|
432
441
|
return retryPerpsClientRead(
|
|
433
442
|
async () => {
|
|
434
443
|
const orders = await evalAsync(
|
|
@@ -438,14 +447,27 @@ async function readStrategyOrders(input) {
|
|
|
438
447
|
if (!controller || typeof controller.getTwapOrders !== 'function' || typeof controller.getChaseOrders !== 'function') {
|
|
439
448
|
throw new Error('PerpsController strategy readers are unavailable; cannot clean live TWAP and Chase orders.');
|
|
440
449
|
}
|
|
450
|
+
var capabilityQuery = ${JSON.stringify(capabilityQuery)};
|
|
451
|
+
var notAdvertised = ${JSON.stringify(TWAP_NOT_ADVERTISED)};
|
|
452
|
+
var twap = capabilityQuery && typeof controller.getOrderCapabilities === 'function'
|
|
453
|
+
? Promise.resolve(controller.getOrderCapabilities(capabilityQuery)).then(function(capabilities){
|
|
454
|
+
var advertised = capabilities && capabilities.status === 'ready' && Array.isArray(capabilities.supportedStrategies)
|
|
455
|
+
? capabilities.supportedStrategies
|
|
456
|
+
: null;
|
|
457
|
+
return advertised && advertised.indexOf('twap') < 0 ? notAdvertised : controller.getTwapOrders();
|
|
458
|
+
})
|
|
459
|
+
: controller.getTwapOrders();
|
|
441
460
|
return Promise.all([
|
|
442
|
-
|
|
461
|
+
twap,
|
|
443
462
|
controller.getChaseOrders()
|
|
444
463
|
]).then(function(values){
|
|
445
|
-
|
|
464
|
+
var skipped = values[0] === notAdvertised;
|
|
465
|
+
if (!(skipped || Array.isArray(values[0])) || !Array.isArray(values[1])) {
|
|
446
466
|
throw new Error('PerpsController strategy readers returned a non-array result.');
|
|
447
467
|
}
|
|
448
|
-
return JSON.stringify(
|
|
468
|
+
return JSON.stringify(skipped
|
|
469
|
+
? { twap: [], twapUnavailable: notAdvertised, chase: values[1] }
|
|
470
|
+
: { twap: values[0], chase: values[1] });
|
|
449
471
|
});
|
|
450
472
|
})()`,
|
|
451
473
|
);
|
|
@@ -574,6 +596,7 @@ async function closeStrategyOrders(input) {
|
|
|
574
596
|
chaseCount: 0,
|
|
575
597
|
acceptedCount: 0,
|
|
576
598
|
alreadyAbsentCount: 0,
|
|
599
|
+
...twapEvidence(orders),
|
|
577
600
|
proofPath: 'mobile-perps-controller-cancel-strategies',
|
|
578
601
|
};
|
|
579
602
|
}
|
|
@@ -641,10 +664,17 @@ async function closeStrategyOrders(input) {
|
|
|
641
664
|
chaseCount: chaseOrders.length,
|
|
642
665
|
acceptedCount: result.filter((entry) => entry.success === true).length,
|
|
643
666
|
alreadyAbsentCount: result.filter(isAlreadyAbsentStrategyResult).length,
|
|
667
|
+
...twapEvidence(orders),
|
|
644
668
|
proofPath: 'mobile-perps-controller-cancel-strategies',
|
|
645
669
|
};
|
|
646
670
|
}
|
|
647
671
|
|
|
672
|
+
// A TWAP count of 0 must not read as "checked and absent" when TWAP was not
|
|
673
|
+
// readable at all.
|
|
674
|
+
function twapEvidence(orders) {
|
|
675
|
+
return orders.twapUnavailable ? { twap: { status: 'unavailable', reason: orders.twapUnavailable } } : {};
|
|
676
|
+
}
|
|
677
|
+
|
|
648
678
|
export function clearPerformanceCachesExpression() {
|
|
649
679
|
return `(function(){
|
|
650
680
|
var metroRequire = globalThis.__r;
|