Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
4 changes: 2 additions & 2 deletions app/scripts/lib/createStreamSink.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Writable as WritableStream } from 'readable-stream';
import { Writable } from 'readable-stream';
import promiseToCallback from 'promise-to-callback';

class AsyncWritableStream extends WritableStream {
class AsyncWritableStream extends Writable {
constructor(asyncWriteFn, _opts) {
const opts = { objectMode: true, ..._opts };
super(opts);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was needed to fix a weird lint issue.

Expand Down
12 changes: 11 additions & 1 deletion app/scripts/lib/ppom/ppom-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ const ConfirmationMethods = Object.freeze([
'personal_sign',
]);

export const SUPPORTED_CHAIN_IDS: string[] = [
CHAIN_IDS.MAINNET,
CHAIN_IDS.BSC,
CHAIN_IDS.POLYGON,
CHAIN_IDS.ARBITRUM,
CHAIN_IDS.OPTIMISM,
CHAIN_IDS.AVALANCHE,
CHAIN_IDS.LINEA_MAINNET,
];

/**
* Middleware function that handles JSON RPC requests.
* This function will be called for every JSON RPC request.
Expand Down Expand Up @@ -49,7 +59,7 @@ export function createPPOMMiddleware(
if (
securityAlertsEnabled &&
ConfirmationMethods.includes(req.method) &&
chainId === CHAIN_IDS.MAINNET
SUPPORTED_CHAIN_IDS.includes(chainId)
) {
// eslint-disable-next-line require-atomic-updates
req.securityAlertResponse = await ppomController.usePPOM(
Expand Down
5 changes: 1 addition & 4 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,16 +769,13 @@ export default class MetamaskController extends EventEmitter {
this.ppomController = new PPOMController({
messenger: this.controllerMessenger.getRestricted({
name: 'PPOMController',
allowedEvents: ['NetworkController:stateChange'],
}),
storageBackend: new IndexedDBPPOMStorage('PPOMDB', 1),
provider: this.provider,
ppomProvider: { PPOM: PPOMModule.PPOM, ppomInit: PPOMModule.default },
state: initState.PPOMController,
chainId: this.networkController.state.providerConfig.chainId,
onNetworkChange: networkControllerMessenger.subscribe.bind(
networkControllerMessenger,
'NetworkController:stateChange',
),
securityAlertsEnabled:
this.preferencesController.store.getState().securityAlertsEnabled,
onPreferencesChange: this.preferencesController.store.subscribe.bind(
Expand Down
19 changes: 9 additions & 10 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1886,12 +1886,14 @@
"URL": true,
"clearInterval": true,
"console.error": true,
"crypto": true,
"setInterval": true
},
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
"@metamask/ppom-validator>@metamask/base-controller": true,
"@metamask/ppom-validator>@metamask/controller-utils": true,
"@metamask/ppom-validator>crypto-js": true,
"@metamask/ppom-validator>elliptic": true,
"await-semaphore": true,
"browserify>buffer": true
Expand All @@ -1914,25 +1916,22 @@
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/controller-utils>ethjs-unit": true,
"@metamask/ppom-validator>@metamask/controller-utils>@metamask/utils": true,
"@metamask/ethjs>@metamask/ethjs-unit": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true
}
},
"@metamask/ppom-validator>@metamask/controller-utils>@metamask/utils": {
"@metamask/ppom-validator>crypto-js": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
"crypto": true,
"define": true,
"msCrypto": true
},
"packages": {
"@metamask/utils>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
"browserify>browser-resolve": true
}
},
"@metamask/ppom-validator>elliptic": {
Expand Down
19 changes: 9 additions & 10 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1809,12 +1809,14 @@
"URL": true,
"clearInterval": true,
"console.error": true,
"crypto": true,
"setInterval": true
},
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
"@metamask/ppom-validator>@metamask/base-controller": true,
"@metamask/ppom-validator>@metamask/controller-utils": true,
"@metamask/ppom-validator>crypto-js": true,
"@metamask/ppom-validator>elliptic": true,
"await-semaphore": true,
"browserify>buffer": true
Expand All @@ -1837,25 +1839,22 @@
},
"packages": {
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"@metamask/controller-utils>ethjs-unit": true,
"@metamask/ppom-validator>@metamask/controller-utils>@metamask/utils": true,
"@metamask/ethjs>@metamask/ethjs-unit": true,
"@metamask/utils": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true
}
},
"@metamask/ppom-validator>@metamask/controller-utils>@metamask/utils": {
"@metamask/ppom-validator>crypto-js": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
"crypto": true,
"define": true,
"msCrypto": true
},
"packages": {
"@metamask/utils>@noble/hashes": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true,
"superstruct": true
"browserify>browser-resolve": true
}
},
"@metamask/ppom-validator>elliptic": {
Expand Down
6 changes: 3 additions & 3 deletions lavamoat/build-system/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,10 @@
"@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-annotate-as-pure": true,
"@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-optimise-call-expression": true,
"@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-replace-supers": true,
"@babel/preset-env>@babel/plugin-transform-classes>globals": true,
"depcheck>@babel/traverse>@babel/helper-environment-visitor": true,
"depcheck>@babel/traverse>@babel/helper-function-name": true,
"depcheck>@babel/traverse>@babel/helper-split-export-declaration": true,
"depcheck>@babel/traverse>globals": true
"depcheck>@babel/traverse>@babel/helper-split-export-declaration": true
}
},
"@babel/preset-env>@babel/plugin-transform-classes>@babel/helper-annotate-as-pure": {
Expand Down Expand Up @@ -3116,8 +3116,8 @@
"eslint-plugin-prettier": true,
"eslint-plugin-react": true,
"eslint-plugin-react-hooks": true,
"eslint>@eslint/eslintrc>globals": true,
"eslint>ajv": true,
"eslint>globals": true,
"eslint>ignore": true,
"eslint>minimatch": true,
"mocha>strip-json-comments": true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"@metamask/phishing-controller": "^8.0.0",
"@metamask/polling-controller": "^4.0.0",
"@metamask/post-message-stream": "^7.0.0",
"@metamask/ppom-validator": "^0.10.0",
"@metamask/ppom-validator": "^0.22.0",
"@metamask/providers": "^14.0.2",
"@metamask/queued-request-controller": "^0.3.0",
"@metamask/rate-limit-controller": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions test/e2e/tests/errors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const removedBackgroundFields = [
'AppStateController.currentPopupId',
'AppStateController.timeoutMinutes',
'PPOMController.chainStatus.0x539.lastVisited',
'PPOMController.versionInfo',
];

const removedUiFields = removedBackgroundFields.map(backgroundToUiField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"versionInfo": {},
"storageMetadata": {},
"chainStatus": {
"0x539": { "chainId": "0x539", "dataFetched": false, "versionInfo": [] }
"0x539": { "chainId": "0x539", "versionInfo": [] }
},
"versionFileETag": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"versionInfo": {},
"storageMetadata": {},
"chainStatus": {
"0x539": { "chainId": "0x539", "dataFetched": false, "versionInfo": [] }
"0x539": { "chainId": "0x539", "versionInfo": [] }
},
"versionFileETag": "string",
"userOperations": "object"
Expand Down
1 change: 1 addition & 0 deletions ui/components/component-library/icon/icon.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export enum IconName {
Bold = 'bold',
CircleX = 'circle-x',
Download = 'download',
// eslint-disable-next-line @typescript-eslint/no-shadow
File = 'file',
Flask = 'flask',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-01-25 at 10 49 03 AM

I renamed the variable to fix lint issue cc @georgewrmarshall

Plug = 'plug',
Expand Down
Loading