Skip to content

Commit

Permalink
Merge branch 'main' into fb/file-api
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding authored Oct 16, 2023
2 parents 76b77bb + d98032b commit c48177d
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 52 deletions.
3 changes: 1 addition & 2 deletions packages/examples/packages/name-lookup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"lint:dependencies": "depcheck"
},
"dependencies": {
"@metamask/snaps-types": "workspace:^",
"@metamask/utils": "^8.1.0"
"@metamask/snaps-types": "workspace:^"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/name-lookup/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "gg1ORyP0Yf+ypmuaTRCGqvtmGwvVSWCWtIKnjjfg+fI=",
"shasum": "7aIi2VIfpdpkMONT21Q/1m1mx9Mu7qYVmTy0Jkb+O9s=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/packages/name-lookup/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('onNameLookup', () => {
};

expect(await onNameLookup(request)).toStrictEqual({
resolvedDomain: 'example.domain - 0xc0f / 0x1',
resolvedDomain: 'c0f.1.test.domain',
});
});

Expand All @@ -38,7 +38,7 @@ describe('onNameLookup', () => {
} as any;

expect(await onNameLookup(request)).toStrictEqual({
resolvedDomain: 'example.domain - 0xc0f / 0x1',
resolvedDomain: 'c0f.1.test.domain',
});
});

Expand Down
6 changes: 2 additions & 4 deletions packages/examples/packages/name-lookup/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { OnNameLookupHandler } from '@metamask/snaps-types';
import { numberToHex } from '@metamask/utils';

/**
* Handle incoming name lookup requests from the MetaMask clients.
Expand All @@ -15,10 +14,9 @@ export const onNameLookup: OnNameLookupHandler = async (request) => {
const { chainId, address, domain } = request;

if (address) {
const shortAddress = `0x${address.substring(2, 5)}`;
const shortAddress = address.substring(2, 5);
const chainIdDecimal = parseInt(chainId.split(':')[1], 10);
const chainIdHex = numberToHex(chainIdDecimal);
const resolvedDomain = `example.domain - ${shortAddress} / ${chainIdHex}`;
const resolvedDomain = `${shortAddress}.${chainIdDecimal}.test.domain`;
return { resolvedDomain };
}

Expand Down
15 changes: 11 additions & 4 deletions packages/snaps-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
"@metamask/permission-controller": "^4.1.2",
"@metamask/post-message-stream": "^7.0.0",
"@metamask/rpc-methods": "workspace:^",
"@metamask/snaps-execution-environments": "workspace:^",
"@metamask/snaps-registry": "^2.0.0",
"@metamask/snaps-registry": "^2.1.0",
"@metamask/snaps-utils": "workspace:^",
"@metamask/utils": "^8.1.0",
"@xstate/fsm": "^2.0.0",
Expand All @@ -62,7 +61,7 @@
"json-rpc-middleware-stream": "^4.2.0",
"nanoid": "^3.1.31",
"readable-web-to-node-stream": "^3.0.2",
"tar-stream": "^2.2.0"
"tar-stream": "^3.1.6"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
Expand All @@ -84,7 +83,7 @@
"@types/mocha": "^10.0.1",
"@types/node": "18.14.2",
"@types/readable-stream": "^2.3.15",
"@types/tar-stream": "^2.2.2",
"@types/tar-stream": "^3.1.1",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"@wdio/browser-runner": "^8.15.9",
Expand Down Expand Up @@ -122,6 +121,14 @@
"wdio-geckodriver-service": "^5.0.2",
"webdriverio": "^8.15.9"
},
"peerDependencies": {
"@metamask/snaps-execution-environments": "workspace:^"
},
"peerDependenciesMeta": {
"@metamask/snaps-execution-environments": {
"optional": true
}
},
"engines": {
"node": "^18.16 || >=20"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class CronjobController extends BaseController<
/**
* Runs every 24 hours to check if new jobs need to be scheduled.
*
* This is necesary for longer running jobs that execute with more than 24 hours between them.
* This is necessary for longer running jobs that execute with more than 24 hours between them.
*/
async dailyCheckIn() {
const jobs = this.getAllJobs();
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/snaps/SnapController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ export class SnapController extends BaseController<
// Since we are requesting an update from within processRequestedSnap,
// we disable the emitting of the snapUpdated event and rely on the caller
// to publish this event after the update is complete.
// This is necesary as installSnaps may be installing multiple snaps
// This is necessary as installSnaps may be installing multiple snaps
// and we don't want to emit events prematurely.
false,
);
Expand Down
19 changes: 12 additions & 7 deletions packages/snaps-controllers/wdio.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable import/unambiguous, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
/* eslint-disable import/unambiguous, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/no-process-env */

const {
NodeGlobalsPolyfillPlugin,
Expand All @@ -9,9 +9,10 @@ const {
const { resolve } = require('path');
const { default: tsconfigPaths } = require('vite-tsconfig-paths');

// eslint-disable-next-line n/no-process-env
const IS_CI = Boolean(process.env.CI);
const MAX_WORKERS = IS_CI ? 1 : 5;
const MAX_WORKERS = process.env.MAX_WORKERS
? parseInt(process.env.MAX_WORKERS, 10)
: 1;

const config = {
runner: [
Expand Down Expand Up @@ -56,10 +57,14 @@ const config = {
maxInstances: MAX_WORKERS,
browserName: 'chrome',
},
{
maxInstances: MAX_WORKERS,
browserName: 'firefox',
},
...(IS_CI
? [
{
maxInstances: MAX_WORKERS,
browserName: 'firefox',
},
]
: []),
],

logLevel: 'error',
Expand Down
19 changes: 12 additions & 7 deletions packages/snaps-execution-environments/wdio.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable import/unambiguous, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
/* eslint-disable import/unambiguous, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/no-process-env */

const {
NodeGlobalsPolyfillPlugin,
Expand All @@ -9,9 +9,10 @@ const {
const { resolve } = require('path');
const { default: tsconfigPaths } = require('vite-tsconfig-paths');

// eslint-disable-next-line n/no-process-env
const IS_CI = Boolean(process.env.CI);
const MAX_WORKERS = IS_CI ? 1 : 5;
const MAX_WORKERS = process.env.MAX_WORKERS
? parseInt(process.env.MAX_WORKERS, 10)
: 1;

const config = {
runner: [
Expand Down Expand Up @@ -55,10 +56,14 @@ const config = {
maxInstances: MAX_WORKERS,
browserName: 'chrome',
},
{
maxInstances: MAX_WORKERS,
browserName: 'firefox',
},
...(IS_CI
? [
{
maxInstances: MAX_WORKERS,
browserName: 'firefox',
},
]
: []),
],

logLevel: 'error',
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@metamask/base-controller": "^3.2.0",
"@metamask/key-tree": "^9.0.0",
"@metamask/permission-controller": "^4.1.2",
"@metamask/snaps-registry": "^2.0.0",
"@metamask/snaps-registry": "^2.1.0",
"@metamask/snaps-ui": "workspace:^",
"@metamask/utils": "^8.1.0",
"@noble/hashes": "^1.3.1",
Expand Down
19 changes: 12 additions & 7 deletions packages/snaps-utils/wdio.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable import/unambiguous, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
/* eslint-disable import/unambiguous, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/no-process-env */

const {
NodeGlobalsPolyfillPlugin,
Expand All @@ -9,9 +9,10 @@ const {
const { resolve } = require('path');
const { default: tsconfigPaths } = require('vite-tsconfig-paths');

// eslint-disable-next-line n/no-process-env
const IS_CI = Boolean(process.env.CI);
const MAX_WORKERS = IS_CI ? 1 : 5;
const MAX_WORKERS = process.env.MAX_WORKERS
? parseInt(process.env.MAX_WORKERS, 10)
: 1;

const config = {
runner: [
Expand Down Expand Up @@ -55,10 +56,14 @@ const config = {
maxInstances: MAX_WORKERS,
browserName: 'chrome',
},
{
maxInstances: MAX_WORKERS,
browserName: 'firefox',
},
...(IS_CI
? [
{
maxInstances: MAX_WORKERS,
browserName: 'firefox',
},
]
: []),
],

logLevel: 'error',
Expand Down
33 changes: 18 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4711,7 +4711,6 @@ __metadata:
"@metamask/snaps-cli": "workspace:^"
"@metamask/snaps-jest": "workspace:^"
"@metamask/snaps-types": "workspace:^"
"@metamask/utils": ^8.1.0
"@swc/core": 1.3.78
"@swc/jest": ^0.2.26
"@typescript-eslint/eslint-plugin": ^5.42.1
Expand Down Expand Up @@ -5149,8 +5148,7 @@ __metadata:
"@metamask/permission-controller": ^4.1.2
"@metamask/post-message-stream": ^7.0.0
"@metamask/rpc-methods": "workspace:^"
"@metamask/snaps-execution-environments": "workspace:^"
"@metamask/snaps-registry": ^2.0.0
"@metamask/snaps-registry": ^2.1.0
"@metamask/snaps-utils": "workspace:^"
"@metamask/template-snap": ^0.7.0
"@metamask/utils": ^8.1.0
Expand All @@ -5164,7 +5162,7 @@ __metadata:
"@types/mocha": ^10.0.1
"@types/node": 18.14.2
"@types/readable-stream": ^2.3.15
"@types/tar-stream": ^2.2.2
"@types/tar-stream": ^3.1.1
"@typescript-eslint/eslint-plugin": ^5.42.1
"@typescript-eslint/parser": ^5.42.1
"@wdio/browser-runner": ^8.15.9
Expand Down Expand Up @@ -5203,14 +5201,19 @@ __metadata:
prettier-plugin-packagejson: ^2.2.11
readable-web-to-node-stream: ^3.0.2
rimraf: ^4.1.2
tar-stream: ^2.2.0
tar-stream: ^3.1.6
ts-node: ^10.9.1
typescript: ~4.8.4
vite: ^4.3.9
vite-tsconfig-paths: ^4.0.5
wdio-chromedriver-service: ^8.1.1
wdio-geckodriver-service: ^5.0.2
webdriverio: ^8.15.9
peerDependencies:
"@metamask/snaps-execution-environments": "workspace:^"
peerDependenciesMeta:
"@metamask/snaps-execution-environments":
optional: true
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -5347,14 +5350,14 @@ __metadata:
languageName: unknown
linkType: soft

"@metamask/snaps-registry@npm:^2.0.0":
version: 2.0.0
resolution: "@metamask/snaps-registry@npm:2.0.0"
"@metamask/snaps-registry@npm:^2.1.0":
version: 2.1.0
resolution: "@metamask/snaps-registry@npm:2.1.0"
dependencies:
"@metamask/utils": ^8.1.0
"@noble/secp256k1": ^1.7.1
superstruct: ^1.0.3
checksum: 621baf98c53c490d4bf8bf784910943e3c147cc2abdbcf5ea56ae6fcd45a1a412da79b0ef778b8f9d8c46b9272068d3dd5909be6691579590d2632c6baee8992
checksum: 652e8c5cc0be43325ba6cf9382db982380f34d1710bfbcc27c9d58cf0e0c14bd354e112b2feb27c1ca7264a0793795d9020a4315ffcf10fa6fed8f38cf18fcde
languageName: node
linkType: hard

Expand Down Expand Up @@ -5593,7 +5596,7 @@ __metadata:
"@metamask/key-tree": ^9.0.0
"@metamask/permission-controller": ^4.1.2
"@metamask/post-message-stream": ^7.0.0
"@metamask/snaps-registry": ^2.0.0
"@metamask/snaps-registry": ^2.1.0
"@metamask/snaps-ui": "workspace:^"
"@metamask/utils": ^8.1.0
"@noble/hashes": ^1.3.1
Expand Down Expand Up @@ -7510,12 +7513,12 @@ __metadata:
languageName: node
linkType: hard

"@types/tar-stream@npm:^2.2.2":
version: 2.2.2
resolution: "@types/tar-stream@npm:2.2.2"
"@types/tar-stream@npm:^3.1.1":
version: 3.1.1
resolution: "@types/tar-stream@npm:3.1.1"
dependencies:
"@types/node": "*"
checksum: 4b33bc0d53770e952d6e2e8acb8889190510326a3e255d0c6edd94136d6027ecae939a7b49188d1d02d774328d9a3742ff633d505709d1a1200b3413c88d793d
checksum: ba9e5c3bc31a4eefe2c519d06bd9f563d1ddadb83ea272d23390276aeeda4766cb74ba5217a765994a65c86bdf0ba41fa731633c0b3dc63e6c4d959f4672cf86
languageName: node
linkType: hard

Expand Down Expand Up @@ -21541,7 +21544,7 @@ __metadata:
languageName: node
linkType: hard

"tar-stream@npm:^3.1.5":
"tar-stream@npm:^3.1.5, tar-stream@npm:^3.1.6":
version: 3.1.6
resolution: "tar-stream@npm:3.1.6"
dependencies:
Expand Down

0 comments on commit c48177d

Please sign in to comment.