@deeeed/metamask-harness 0.23.1 → 0.25.0
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 +44 -0
- package/adapters/extension/live.sh +2 -2
- package/adapters/extension/wallet-fixture-state.cjs +57 -19
- package/adapters/shared/ensure-runner-deps.sh +64 -5
- package/bin/mm-harness +26 -8
- package/dist/adapters/extension/runtime.js +1 -10
- package/dist/adapters.js +5 -1
- package/dist/commands/run-engine.js +18 -13
- package/dist/commands/runtime-launch.js +7 -2
- package/dist/live-adapter-contract.js +4 -2
- package/dist/recipe-security.js +10 -2
- package/dist/run-recording.js +156 -39
- package/library/actions/core/perps/_controller.mjs +138 -5
- package/library/actions/core/perps/assert_orders.mjs +174 -10
- package/library/actions/core/perps/assert_positions.mjs +20 -2
- package/library/actions/core/perps/close_orders.mjs +24 -5
- package/library/actions/core/perps/close_positions.mjs +22 -8
- package/library/actions/core/perps/edit_order.mjs +331 -0
- package/library/actions/core/perps/place_order.mjs +192 -43
- package/library/actions/core/perps/update_position_tpsl.mjs +121 -15
- package/library/actions/extension/analytics/set_consent.mjs +165 -0
- package/library/actions/extension/platform/cdp.mjs +112 -14
- package/library/actions/mobile/analytics/set_consent.mjs +90 -0
- package/library/actions/shared/analytics/_adapter.mjs +24 -0
- package/library/actions/shared/analytics/assert_events.mjs +168 -0
- package/library/actions/shared/analytics/collector.mjs +505 -0
- package/library/actions/shared/analytics/consent.mjs +14 -0
- package/library/actions/shared/analytics/read_events.mjs +22 -0
- package/library/actions/shared/analytics/start_capture.mjs +24 -0
- package/library/manifests/core.action-manifest.json +468 -27
- package/library/manifests/extension.action-manifest.json +188 -1
- package/library/manifests/mobile.action-manifest.json +161 -0
- package/package.json +3 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { runAdapter } from './_adapter.mjs';
|
|
2
|
+
import { readCollected } from './collector.mjs';
|
|
3
|
+
|
|
4
|
+
runAdapter(async (input) => {
|
|
5
|
+
const since = input.node?.since === undefined ? 0 : Number(input.node.since);
|
|
6
|
+
if (input.node?.since === '' || !Number.isFinite(since) || since < 0) {
|
|
7
|
+
throw new Error(`metamask.analytics.read_events since must be a non-negative number, got ${JSON.stringify(input.node?.since)}.`);
|
|
8
|
+
}
|
|
9
|
+
const event = input.node?.event ?? null;
|
|
10
|
+
if (event !== null && (typeof event !== 'string' || event.length === 0)) {
|
|
11
|
+
throw new Error('metamask.analytics.read_events event must be a non-empty string when provided.');
|
|
12
|
+
}
|
|
13
|
+
const events = await readCollected(input, { since, event });
|
|
14
|
+
return {
|
|
15
|
+
action: input.action,
|
|
16
|
+
since,
|
|
17
|
+
count: events.length,
|
|
18
|
+
events,
|
|
19
|
+
// Names alone are usually what a human wants to eyeball in the artifact.
|
|
20
|
+
names: events.map((entry) => entry.event).filter(Boolean),
|
|
21
|
+
};
|
|
22
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { runAdapter } from './_adapter.mjs';
|
|
2
|
+
import { startCollector } from './collector.mjs';
|
|
3
|
+
|
|
4
|
+
// Returns a cursor so later reads can be bracketed to this flow. Without it,
|
|
5
|
+
// repeated event names (`Perp Screen Viewed`) cross-match between flows.
|
|
6
|
+
runAdapter(async (input) => {
|
|
7
|
+
const {
|
|
8
|
+
port,
|
|
9
|
+
pid,
|
|
10
|
+
eventsFile,
|
|
11
|
+
reused,
|
|
12
|
+
androidDevice,
|
|
13
|
+
} = await startCollector(input);
|
|
14
|
+
return {
|
|
15
|
+
action: input.action,
|
|
16
|
+
cursor: Date.now(),
|
|
17
|
+
port,
|
|
18
|
+
pid,
|
|
19
|
+
eventsFile,
|
|
20
|
+
reused,
|
|
21
|
+
androidDevice,
|
|
22
|
+
note: `Client must be built with its Segment host pointed at http://localhost:${port} (extension SEGMENT_HOST, mobile SEGMENT_PROXY_URL) and a non-empty write key.`,
|
|
23
|
+
};
|
|
24
|
+
});
|