@deeeed/metamask-harness 0.35.0 → 0.36.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 +15 -0
- package/README.md +9 -1
- package/adapters/extension/check-infura-readiness.cjs +102 -0
- package/adapters/extension/inject.mjs +1 -0
- package/adapters/extension/live.sh +25 -10
- package/adapters/extension/start-watch.sh +15 -0
- package/adapters/extension/wallet-fixture-state.cjs +3 -1
- package/adapters/manifest.json +16 -0
- package/adapters/mobile/bridge-runtime/cdp-bridge.cjs +73 -42
- package/adapters/mobile/reset-app-data.sh +154 -0
- package/dist/adapters/extension/product-config.js +29 -1
- package/dist/adapters.js +18 -0
- package/dist/cli-commands.js +1 -1
- package/dist/cli.js +2 -2
- package/dist/command-contract.js +1 -1
- package/dist/commands/device-target.js +5 -0
- package/dist/commands/fixtures.js +106 -31
- package/dist/commands/launch/extension.js +39 -3
- package/dist/commands/launch/index.js +13 -0
- package/dist/mm-harness-cli.js +6 -3
- package/dist/recipe-security.js +3 -0
- package/docs/RECIPES.md +29 -0
- package/library/actions/extension/wallet/import.mjs +234 -0
- package/library/actions/extension/wallet/reset.mjs +98 -0
- package/library/actions/extension/wallet/state.mjs +1 -0
- package/library/actions/mobile/analytics/consent-settings.mjs +112 -0
- package/library/actions/mobile/analytics/set_consent.mjs +4 -112
- package/library/actions/mobile/platform/bridge.mjs +8 -0
- package/library/actions/mobile/wallet/import.mjs +259 -0
- package/library/actions/mobile/wallet/reset-helper.mjs +99 -0
- package/library/actions/mobile/wallet/reset.mjs +7 -0
- package/library/actions/shared/wallet/import-source.mjs +101 -0
- package/library/manifests/extension.action-manifest.json +112 -0
- package/library/manifests/mobile.action-manifest.json +108 -0
- package/library/recipes/wallet/import.recipe.json +83 -0
- package/library/recipes/wallet/reset-import.recipe.json +88 -0
- package/package.json +1 -1
- package/scripts/completions.sh +2 -2
|
@@ -1237,6 +1237,45 @@
|
|
|
1237
1237
|
],
|
|
1238
1238
|
"execution_capabilities": []
|
|
1239
1239
|
},
|
|
1240
|
+
"metamask.wallet.validate_import": {
|
|
1241
|
+
"description": "Validate wallet recovery credentials and derive the expected primary address without launching or mutating the app.",
|
|
1242
|
+
"schema": {
|
|
1243
|
+
"type": "object",
|
|
1244
|
+
"properties": {
|
|
1245
|
+
"credential_source": {
|
|
1246
|
+
"type": "string",
|
|
1247
|
+
"enum": ["auto", "environment", "fixture"]
|
|
1248
|
+
},
|
|
1249
|
+
"srp_env": {
|
|
1250
|
+
"type": "string"
|
|
1251
|
+
},
|
|
1252
|
+
"password_env": {
|
|
1253
|
+
"type": "string"
|
|
1254
|
+
},
|
|
1255
|
+
"metametrics": {
|
|
1256
|
+
"type": "boolean"
|
|
1257
|
+
},
|
|
1258
|
+
"interests": {
|
|
1259
|
+
"type": "array",
|
|
1260
|
+
"items": {
|
|
1261
|
+
"type": "string"
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
"additionalProperties": false
|
|
1266
|
+
},
|
|
1267
|
+
"examples": [
|
|
1268
|
+
{
|
|
1269
|
+
"action": "metamask.wallet.validate_import",
|
|
1270
|
+
"credential_source": "auto",
|
|
1271
|
+
"intent": "Validate recovery credentials before resetting a wallet",
|
|
1272
|
+
"next": "done"
|
|
1273
|
+
}
|
|
1274
|
+
],
|
|
1275
|
+
"execution_capabilities": [
|
|
1276
|
+
"host-read-export"
|
|
1277
|
+
]
|
|
1278
|
+
},
|
|
1240
1279
|
"metamask.wallet.setup": {
|
|
1241
1280
|
"description": "Import the wallet fixture accounts and password so the app starts from a known signed-in state.",
|
|
1242
1281
|
"schema": {
|
|
@@ -1253,6 +1292,75 @@
|
|
|
1253
1292
|
],
|
|
1254
1293
|
"execution_capabilities": ["app-mutation"]
|
|
1255
1294
|
},
|
|
1295
|
+
"metamask.wallet.import": {
|
|
1296
|
+
"description": "Make the wallet ready by reusing a fixture-backed profile or importing the primary mnemonic through visible onboarding UI.",
|
|
1297
|
+
"schema": {
|
|
1298
|
+
"type": "object",
|
|
1299
|
+
"properties": {
|
|
1300
|
+
"method": {
|
|
1301
|
+
"type": "string",
|
|
1302
|
+
"enum": ["auto", "profile", "ui"]
|
|
1303
|
+
},
|
|
1304
|
+
"credential_source": {
|
|
1305
|
+
"type": "string",
|
|
1306
|
+
"enum": ["auto", "environment", "fixture"]
|
|
1307
|
+
},
|
|
1308
|
+
"srp_env": {
|
|
1309
|
+
"type": "string"
|
|
1310
|
+
},
|
|
1311
|
+
"password_env": {
|
|
1312
|
+
"type": "string"
|
|
1313
|
+
},
|
|
1314
|
+
"metametrics": {
|
|
1315
|
+
"type": "boolean",
|
|
1316
|
+
"default": false,
|
|
1317
|
+
"description": "Enable MetaMetrics during visible onboarding."
|
|
1318
|
+
},
|
|
1319
|
+
"interests": {
|
|
1320
|
+
"type": "array",
|
|
1321
|
+
"items": {
|
|
1322
|
+
"type": "string",
|
|
1323
|
+
"enum": ["swap_tokens", "trade_perpetuals", "prediction_markets", "send_receive_crypto", "earn_and_spend", "use_other_crypto_apps"]
|
|
1324
|
+
},
|
|
1325
|
+
"default": [],
|
|
1326
|
+
"description": "Select optional onboarding interests; an empty list skips the questionnaire."
|
|
1327
|
+
},
|
|
1328
|
+
"timeout_ms": {
|
|
1329
|
+
"type": "number"
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1332
|
+
"additionalProperties": false
|
|
1333
|
+
},
|
|
1334
|
+
"examples": [
|
|
1335
|
+
{
|
|
1336
|
+
"action": "metamask.wallet.import",
|
|
1337
|
+
"method": "auto",
|
|
1338
|
+
"intent": "Use an existing fixture profile or import through onboarding",
|
|
1339
|
+
"next": "done"
|
|
1340
|
+
}
|
|
1341
|
+
],
|
|
1342
|
+
"execution_capabilities": ["app-mutation"]
|
|
1343
|
+
},
|
|
1344
|
+
"metamask.wallet.reset": {
|
|
1345
|
+
"description": "Delete the current wallet through the visible client reset flow and reach fresh onboarding.",
|
|
1346
|
+
"schema": {
|
|
1347
|
+
"type": "object",
|
|
1348
|
+
"properties": {
|
|
1349
|
+
"timeout_ms": {
|
|
1350
|
+
"type": "number"
|
|
1351
|
+
}
|
|
1352
|
+
},
|
|
1353
|
+
"additionalProperties": false
|
|
1354
|
+
},
|
|
1355
|
+
"examples": [
|
|
1356
|
+
{
|
|
1357
|
+
"action": "metamask.wallet.reset",
|
|
1358
|
+
"intent": "Reset the wallet through visible UI before importing it again",
|
|
1359
|
+
"next": "done"
|
|
1360
|
+
}
|
|
1361
|
+
],
|
|
1362
|
+
"execution_capabilities": ["app-mutation"]
|
|
1363
|
+
},
|
|
1256
1364
|
"metamask.wallet.ensure_unlocked": {
|
|
1257
1365
|
"description": "Unlock the wallet with the fixture password when it is currently locked.",
|
|
1258
1366
|
"schema": {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://farmslot.io/schemas/recipe-v1.schema.json",
|
|
3
|
+
"title": "Import or reuse a MetaMask wallet",
|
|
4
|
+
"description": "Make a Mobile or Extension wallet ready by reusing its fixture-backed profile or importing the primary mnemonic through visible onboarding UI.",
|
|
5
|
+
"paramsSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"method": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"enum": ["auto", "profile", "ui"],
|
|
12
|
+
"default": "auto",
|
|
13
|
+
"description": "Choose automatically from visible wallet state, require an existing profile, or require real-user onboarding UI."
|
|
14
|
+
},
|
|
15
|
+
"credential_source": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"enum": ["auto", "environment", "fixture"],
|
|
18
|
+
"default": "auto",
|
|
19
|
+
"description": "Read secrets from the named environment variables first, or require one source explicitly."
|
|
20
|
+
},
|
|
21
|
+
"srp_env": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"default": "MM_HARNESS_WALLET_SRP",
|
|
24
|
+
"description": "Environment variable containing the Secret Recovery Phrase; the value is never stored in the recipe or evidence."
|
|
25
|
+
},
|
|
26
|
+
"password_env": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"default": "MM_HARNESS_WALLET_PASSWORD",
|
|
29
|
+
"description": "Environment variable containing the wallet password; the value is never stored in the recipe or evidence."
|
|
30
|
+
},
|
|
31
|
+
"metametrics": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"default": false,
|
|
34
|
+
"description": "Enable MetaMetrics during visible onboarding; defaults off."
|
|
35
|
+
},
|
|
36
|
+
"interests": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"enum": ["swap_tokens", "trade_perpetuals", "prediction_markets", "send_receive_crypto", "earn_and_spend", "use_other_crypto_apps"]
|
|
41
|
+
},
|
|
42
|
+
"default": [],
|
|
43
|
+
"description": "Mobile-only onboarding interests; an empty list skips the optional questionnaire."
|
|
44
|
+
},
|
|
45
|
+
"timeout_ms": {
|
|
46
|
+
"type": "number",
|
|
47
|
+
"default": 120000,
|
|
48
|
+
"description": "Maximum time for each onboarding transition and final wallet readiness."
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"workflow": {
|
|
53
|
+
"entry": "fixture-status",
|
|
54
|
+
"nodes": {
|
|
55
|
+
"fixture-status": {
|
|
56
|
+
"action": "metamask.wallet.fixture_status",
|
|
57
|
+
"intent": "Record whether a canonical fixture is available without exposing its secrets",
|
|
58
|
+
"next": "import"
|
|
59
|
+
},
|
|
60
|
+
"import": {
|
|
61
|
+
"action": "metamask.wallet.import",
|
|
62
|
+
"method": "{{params.method}}",
|
|
63
|
+
"credential_source": "{{params.credential_source}}",
|
|
64
|
+
"srp_env": "{{params.srp_env}}",
|
|
65
|
+
"password_env": "{{params.password_env}}",
|
|
66
|
+
"metametrics": "{{params.metametrics}}",
|
|
67
|
+
"interests": "{{params.interests}}",
|
|
68
|
+
"timeout_ms": "{{params.timeout_ms}}",
|
|
69
|
+
"intent": "Reuse the fixture-backed wallet or import it through the visible onboarding flow",
|
|
70
|
+
"next": "state"
|
|
71
|
+
},
|
|
72
|
+
"state": {
|
|
73
|
+
"action": "metamask.wallet.read_state",
|
|
74
|
+
"intent": "Prove the wallet has a selected account after setup",
|
|
75
|
+
"next": "done"
|
|
76
|
+
},
|
|
77
|
+
"done": {
|
|
78
|
+
"action": "end",
|
|
79
|
+
"status": "pass"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://farmslot.io/schemas/recipe-v1.schema.json",
|
|
3
|
+
"title": "Reset and import a MetaMask wallet through visible UI",
|
|
4
|
+
"description": "Delete the current Mobile or Extension wallet through its visible reset flow, import the primary mnemonic through onboarding, and prove a selected account is ready.",
|
|
5
|
+
"paramsSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"credential_source": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"enum": ["auto", "environment", "fixture"],
|
|
12
|
+
"default": "auto",
|
|
13
|
+
"description": "Read secrets from the named environment variables first, or require one source explicitly."
|
|
14
|
+
},
|
|
15
|
+
"srp_env": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"default": "MM_HARNESS_WALLET_SRP",
|
|
18
|
+
"description": "Environment variable containing the Secret Recovery Phrase; the value is never stored in the recipe or evidence."
|
|
19
|
+
},
|
|
20
|
+
"password_env": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"default": "MM_HARNESS_WALLET_PASSWORD",
|
|
23
|
+
"description": "Environment variable containing the wallet password; the value is never stored in the recipe or evidence."
|
|
24
|
+
},
|
|
25
|
+
"metametrics": {
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"default": false,
|
|
28
|
+
"description": "Enable MetaMetrics during visible onboarding; defaults off."
|
|
29
|
+
},
|
|
30
|
+
"interests": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": ["swap_tokens", "trade_perpetuals", "prediction_markets", "send_receive_crypto", "earn_and_spend", "use_other_crypto_apps"]
|
|
35
|
+
},
|
|
36
|
+
"default": [],
|
|
37
|
+
"description": "Mobile-only onboarding interests; an empty list skips the optional questionnaire."
|
|
38
|
+
},
|
|
39
|
+
"timeout_ms": {
|
|
40
|
+
"type": "number",
|
|
41
|
+
"default": 120000,
|
|
42
|
+
"description": "Maximum time for each reset/import transition and final wallet readiness."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"workflow": {
|
|
47
|
+
"entry": "validate_import",
|
|
48
|
+
"nodes": {
|
|
49
|
+
"validate_import": {
|
|
50
|
+
"action": "metamask.wallet.validate_import",
|
|
51
|
+
"credential_source": "{{params.credential_source}}",
|
|
52
|
+
"srp_env": "{{params.srp_env}}",
|
|
53
|
+
"password_env": "{{params.password_env}}",
|
|
54
|
+
"metametrics": "{{params.metametrics}}",
|
|
55
|
+
"interests": "{{params.interests}}",
|
|
56
|
+
"intent": "Validate recovery credentials before deleting the current wallet",
|
|
57
|
+
"next": "reset"
|
|
58
|
+
},
|
|
59
|
+
"reset": {
|
|
60
|
+
"action": "metamask.wallet.reset",
|
|
61
|
+
"timeout_ms": "{{params.timeout_ms}}",
|
|
62
|
+
"intent": "Delete the current wallet through the client-visible reset flow and reach fresh onboarding",
|
|
63
|
+
"next": "import"
|
|
64
|
+
},
|
|
65
|
+
"import": {
|
|
66
|
+
"action": "metamask.wallet.import",
|
|
67
|
+
"method": "ui",
|
|
68
|
+
"credential_source": "{{params.credential_source}}",
|
|
69
|
+
"srp_env": "{{params.srp_env}}",
|
|
70
|
+
"password_env": "{{params.password_env}}",
|
|
71
|
+
"metametrics": "{{params.metametrics}}",
|
|
72
|
+
"interests": "{{params.interests}}",
|
|
73
|
+
"timeout_ms": "{{params.timeout_ms}}",
|
|
74
|
+
"intent": "Import the primary mnemonic through visible onboarding UI",
|
|
75
|
+
"next": "state"
|
|
76
|
+
},
|
|
77
|
+
"state": {
|
|
78
|
+
"action": "metamask.wallet.read_state",
|
|
79
|
+
"intent": "Prove the imported wallet has a selected account",
|
|
80
|
+
"next": "done"
|
|
81
|
+
},
|
|
82
|
+
"done": {
|
|
83
|
+
"action": "end",
|
|
84
|
+
"status": "pass"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
package/package.json
CHANGED
package/scripts/completions.sh
CHANGED
|
@@ -77,7 +77,7 @@ if [ -n "${BASH_VERSION:-}" ]; then
|
|
|
77
77
|
|
|
78
78
|
case "$cmd" in
|
|
79
79
|
launch) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "ios android" -- "$cur")) ;;
|
|
80
|
-
fixtures) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "init sync set generate finalize" -- "$cur")) ;;
|
|
80
|
+
fixtures) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "init sync set reset generate finalize" -- "$cur")) ;;
|
|
81
81
|
checklist) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "mark closeout" -- "$cur")) ;;
|
|
82
82
|
completions) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "install bash zsh status" -- "$cur")) ;;
|
|
83
83
|
call) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "$(_mmh_actions)" -- "$cur")) ;;
|
|
@@ -111,7 +111,7 @@ if [ -n "${ZSH_VERSION:-}" ]; then
|
|
|
111
111
|
|
|
112
112
|
case "$cmd" in
|
|
113
113
|
launch) (( CURRENT == 3 )) && { candidates=(ios android); compadd -a candidates; } ;;
|
|
114
|
-
fixtures) (( CURRENT == 3 )) && { candidates=(init sync set generate finalize); compadd -a candidates; } ;;
|
|
114
|
+
fixtures) (( CURRENT == 3 )) && { candidates=(init sync set reset generate finalize); compadd -a candidates; } ;;
|
|
115
115
|
checklist) (( CURRENT == 3 )) && { candidates=(mark closeout); compadd -a candidates; } ;;
|
|
116
116
|
completions) (( CURRENT == 3 )) && { candidates=(install bash zsh status); compadd -a candidates; } ;;
|
|
117
117
|
call) (( CURRENT == 3 )) && { candidates=("${(@f)$(_mmh_actions)}"); compadd -a candidates; } ;;
|