Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST: Patch @metamask/utils v8.0.0 with https://github.com/MetaMask/utils/pull/134 #1705

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .yarn/patches/@metamask-utils-npm-8.0.0-7a3c3a899a.patch

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
"resolutions": {
"@babel/core": "patch:@babel/core@npm%3A7.21.0#./.yarn/patches/@babel-core-npm-7.21.0-fb3817b0e5.patch",
"@lavamoat/lavapack@^5.2.1": "patch:@lavamoat/lavapack@npm%3A5.2.1#./.yarn/patches/@lavamoat-lavapack-npm-5.2.1-6ac9929a63.patch",
"@metamask/utils@^5.0.0": "patch:@metamask/utils@npm%3A8.0.0#./.yarn/patches/@metamask-utils-npm-8.0.0-7a3c3a899a.patch",
"@metamask/utils@^5.0.1": "patch:@metamask/utils@npm%3A8.0.0#./.yarn/patches/@metamask-utils-npm-8.0.0-7a3c3a899a.patch",
"@metamask/utils@^5.0.2": "patch:@metamask/utils@npm%3A8.0.0#./.yarn/patches/@metamask-utils-npm-8.0.0-7a3c3a899a.patch",
"@metamask/utils@^6.0.1": "patch:@metamask/utils@npm%3A8.0.0#./.yarn/patches/@metamask-utils-npm-8.0.0-7a3c3a899a.patch",
"@metamask/utils@^6.2.0": "patch:@metamask/utils@npm%3A8.0.0#./.yarn/patches/@metamask-utils-npm-8.0.0-7a3c3a899a.patch",
"@metamask/utils@^7.1.0": "patch:@metamask/utils@npm%3A8.0.0#./.yarn/patches/@metamask-utils-npm-8.0.0-7a3c3a899a.patch",
"@metamask/utils@^8.0.0": "patch:@metamask/utils@npm%3A8.0.0#./.yarn/patches/@metamask-utils-npm-8.0.0-7a3c3a899a.patch",
"@types/glob@*": "patch:@types/glob@npm%3A7.1.4#./.yarn/patches/@types-glob-npm-7.1.4-d45247eaa2.patch",
"@types/glob@^7.1.1": "patch:@types/glob@npm%3A7.1.4#./.yarn/patches/@types-glob-npm-7.1.4-d45247eaa2.patch",
"@types/mocha@^10.0.1": "patch:@types/mocha@npm:10.0.1#.yarn/patches/@types-mocha-npm-10.0.1-7c94e9e170.patch",
Expand All @@ -67,7 +74,7 @@
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.1.0",
"@metamask/eslint-config-typescript": "^12.1.0",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@swc/cli": "^0.1.62",
"@swc/core": "1.3.78",
"@types/jest": "^27.5.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"dependencies": {
"@metamask/snaps-utils": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"yargs": "^17.7.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@metamask/rpc-errors": "^5.1.1",
"@metamask/snaps-types": "workspace:^",
"@metamask/snaps-ui": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@noble/ed25519": "^1.6.0",
"@noble/secp256k1": "^1.7.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip44/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@metamask/rpc-errors": "^5.1.1",
"@metamask/snaps-types": "workspace:^",
"@metamask/snaps-ui": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@noble/bls12-381": "^1.2.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/dialogs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@metamask/eslint-config-typescript": "^12.1.0",
"@metamask/snaps-cli": "workspace:^",
"@metamask/snaps-jest": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@swc/core": "1.3.78",
"@swc/jest": "^0.2.26",
"@typescript-eslint/eslint-plugin": "^5.42.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@metamask/rpc-errors": "^5.1.1",
"@metamask/snaps-types": "workspace:^",
"@metamask/utils": "^7.1.0"
"@metamask/utils": "^8.0.0"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@metamask/eslint-config-typescript": "^12.1.0",
"@metamask/snaps-cli": "workspace:^",
"@metamask/snaps-jest": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@swc/core": "1.3.78",
"@swc/jest": "^0.2.26",
"@typescript-eslint/eslint-plugin": "^5.42.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-entropy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@metamask/rpc-errors": "^5.1.1",
"@metamask/snaps-types": "workspace:^",
"@metamask/snaps-ui": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@noble/bls12-381": "^1.2.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-locale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@metamask/rpc-errors": "^5.1.1",
"@metamask/snaps-types": "workspace:^",
"@metamask/snaps-ui": "workspace:^",
"@metamask/utils": "^7.1.0"
"@metamask/utils": "^8.0.0"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@metamask/key-tree": "^9.0.0",
"@metamask/rpc-errors": "^5.1.1",
"@metamask/snaps-types": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@noble/hashes": "^1.3.1"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@metamask/rpc-errors": "^5.1.1",
"@metamask/snaps-types": "workspace:^",
"@metamask/snaps-ui": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@noble/curves": "^1.1.0",
"async-mutex": "^0.4.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/json-rpc/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": "Vjp8paYaHuaEZzNA1KmLTSEHNvO5BxO5g8m58+92gDY=",
"shasum": "eu72QWkIH8a7FL2J+NqwNzfmsVoKmnLQ6pUuTP+B2DE=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@metamask/snaps-types": "workspace:^",
"@metamask/snaps-ui": "workspace:^",
"@metamask/utils": "^7.1.0"
"@metamask/utils": "^8.0.0"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc-methods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@metamask/snaps-ui": "workspace:^",
"@metamask/snaps-utils": "workspace:^",
"@metamask/types": "^1.1.0",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@noble/hashes": "^1.3.1",
"eth-rpc-errors": "^4.0.3",
"superstruct": "^1.0.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@babel/preset-typescript": "^7.20.12",
"@metamask/snaps-utils": "workspace:^",
"@metamask/snaps-webpack-plugin": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@swc/core": "1.3.78",
"assert": "^2.0.0",
"babelify": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@metamask/snaps-execution-environments": "workspace:^",
"@metamask/snaps-registry": "^1.2.2",
"@metamask/snaps-utils": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@xstate/fsm": "^2.0.0",
"concat-stream": "^2.0.0",
"eth-rpc-errors": "^4.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,8 @@
"removeEventListener": true
},
"packages": {
"@metamask/post-message-stream>@metamask/utils": true,
"@metamask/post-message-stream>readable-stream": true
}
},
"@metamask/post-message-stream>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@swc/cli>semver": true,
"browserify>buffer": true,
"eslint>debug": true,
"superstruct": true
"@metamask/post-message-stream>readable-stream": true,
"@metamask/utils": true
}
},
"@metamask/post-message-stream>readable-stream": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,11 @@
"removeEventListener": true
},
"packages": {
"@metamask/post-message-stream>@metamask/utils": true,
"@metamask/post-message-stream>readable-stream": true,
"@metamask/utils": true,
"worker_threads": true
}
},
"@metamask/post-message-stream>@metamask/utils": {
"builtin": {
"buffer.Buffer": true
},
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@swc/cli>semver": true,
"buffer": true,
"eslint>debug": true,
"superstruct": true
}
},
"@metamask/post-message-stream>readable-stream": {
"builtin": {
"events.EventEmitter": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,11 @@
"removeEventListener": true
},
"packages": {
"@metamask/post-message-stream>@metamask/utils": true,
"@metamask/post-message-stream>readable-stream": true,
"@metamask/utils": true,
"worker_threads": true
}
},
"@metamask/post-message-stream>@metamask/utils": {
"builtin": {
"buffer.Buffer": true
},
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@swc/cli>semver": true,
"buffer": true,
"eslint>debug": true,
"superstruct": true
}
},
"@metamask/post-message-stream>readable-stream": {
"builtin": {
"events.EventEmitter": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,8 @@
"removeEventListener": true
},
"packages": {
"@metamask/post-message-stream>@metamask/utils": true,
"@metamask/post-message-stream>readable-stream": true
}
},
"@metamask/post-message-stream>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@swc/cli>semver": true,
"browserify>buffer": true,
"eslint>debug": true,
"superstruct": true
"@metamask/post-message-stream>readable-stream": true,
"@metamask/utils": true
}
},
"@metamask/post-message-stream>readable-stream": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,8 @@
"removeEventListener": true
},
"packages": {
"@metamask/post-message-stream>@metamask/utils": true,
"@metamask/post-message-stream>readable-stream": true
}
},
"@metamask/post-message-stream>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@swc/cli>semver": true,
"browserify>buffer": true,
"eslint>debug": true,
"superstruct": true
"@metamask/post-message-stream>readable-stream": true,
"@metamask/utils": true
}
},
"@metamask/post-message-stream>readable-stream": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,8 @@
"removeEventListener": true
},
"packages": {
"@metamask/post-message-stream>@metamask/utils": true,
"@metamask/post-message-stream>readable-stream": true
}
},
"@metamask/post-message-stream>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@swc/cli>semver": true,
"browserify>buffer": true,
"eslint>debug": true,
"superstruct": true
"@metamask/post-message-stream>readable-stream": true,
"@metamask/utils": true
}
},
"@metamask/post-message-stream>readable-stream": {
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-execution-environments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@metamask/providers": "^11.1.1",
"@metamask/rpc-methods": "workspace:^",
"@metamask/snaps-utils": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"eth-rpc-errors": "^4.0.3",
"json-rpc-engine": "^6.1.0",
"nanoid": "^3.1.31",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@metamask/snaps-simulator": "workspace:^",
"@metamask/snaps-ui": "workspace:^",
"@metamask/snaps-utils": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"express": "^4.18.2",
"jest-environment-node": "^29.5.0",
"jest-matcher-utils": "^29.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-simulator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@metamask/snaps-execution-environments": "workspace:^",
"@metamask/snaps-ui": "workspace:^",
"@metamask/snaps-utils": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@minoru/react-dnd-treeview": "^3.4.4",
"@reduxjs/toolkit": "^1.9.5",
"date-fns": "^2.30.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@metamask/providers": "^11.1.1",
"@metamask/rpc-methods": "workspace:^",
"@metamask/snaps-utils": "workspace:^",
"@metamask/utils": "^7.1.0"
"@metamask/utils": "^8.0.0"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^2.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"lint:dependencies": "depcheck"
},
"dependencies": {
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"superstruct": "^1.0.3"
},
"devDependencies": {
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 @@ -73,7 +73,7 @@
"@metamask/permission-controller": "^4.1.0",
"@metamask/snaps-registry": "^1.2.2",
"@metamask/snaps-ui": "workspace:^",
"@metamask/utils": "^7.1.0",
"@metamask/utils": "^8.0.0",
"@noble/hashes": "^1.3.1",
"@scure/base": "^1.1.1",
"chalk": "^4.1.2",
Expand Down
26 changes: 21 additions & 5 deletions packages/snaps-utils/src/cronjob.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Json } from '@metamask/utils';
import { JsonRpcRequestStruct } from '@metamask/utils';
import { parseExpression } from 'cron-parser';
import type { Infer } from 'superstruct';
import type { Infer, Struct } from 'superstruct';
import {
array,
assign,
Expand All @@ -15,10 +16,25 @@ import {
string,
} from 'superstruct';

export const CronjobRpcRequestStruct = assign(
partial(pick(JsonRpcRequestStruct, ['id', 'jsonrpc'])),
omit(JsonRpcRequestStruct, ['id', 'jsonrpc']),
);
type MTCronjobRpcRequestStructType = Struct<
{
method: string;
params?: Record<string, Json> | Json[];
id?: string | number | null;
jsonrpc?: '2.0';
},
{
params?: Struct<Record<string, Json> | Json[], null>;
method: Struct<string, null>;
id?: Struct<string | number | null>;
jsonrpc?: Struct<'2.0'>;
}
>;
export const CronjobRpcRequestStruct: MTCronjobRpcRequestStructType = assign(
partial(pick(JsonRpcRequestStruct as any, ['id', 'jsonrpc'])),
omit(JsonRpcRequestStruct as any, ['id', 'jsonrpc']),
) as any as MTCronjobRpcRequestStructType;

export type CronjobRpcRequest = Infer<typeof CronjobRpcRequestStruct>;

export const CronExpressionStruct = refine(
Expand Down
Loading
Loading