From 2de4c88b47e151c2423620006be45ddb4f62c0a4 Mon Sep 17 00:00:00 2001 From: Ihor Diachenko Date: Thu, 21 Mar 2024 00:26:46 +0200 Subject: [PATCH] Extended snap RPC timeout to 3 minutes (#50) * tmp * tmp2 * Use updated snap-cli * Added changelogg --- CHANGELOG.md | 2 + packages/connector/src/consts/general.ts | 2 +- packages/snap/package.json | 6 +- packages/snap/post-process.js | 2 +- packages/snap/snap.config.ts | 1 + packages/snap/snap.manifest.json | 5 +- yarn.lock | 169 ++++++++++++++++++++--- 7 files changed, 160 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e6f5646..62bf1b32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). [Unreleased] + ### Added - `@rarimo/rarime`: - `RemoveCredentials` credentials RPC method @@ -21,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update Jest config for testing - Use latest MetaMask snap libraries - Use `workspace` version inside packages +- Extended snap RPC timeouts to 3 minutes ### Removed - `packages/site` package diff --git a/packages/connector/src/consts/general.ts b/packages/connector/src/consts/general.ts index ed7d4255..afc71c31 100644 --- a/packages/connector/src/consts/general.ts +++ b/packages/connector/src/consts/general.ts @@ -1,2 +1,2 @@ export const CORE_POLLING_INTERVAL = 5_000; -export const SUPPORTED_METAMASK_VERSION = '11.5.0'; +export const SUPPORTED_METAMASK_VERSION = '11.12.0'; diff --git a/packages/snap/package.json b/packages/snap/package.json index c9e91f13..a4014f10 100644 --- a/packages/snap/package.json +++ b/packages/snap/package.json @@ -51,8 +51,8 @@ "@iden3/js-jwz": "1.3.0", "@iden3/js-merkletree": "1.1.2", "@metamask/snaps-jest": "^5.0.0", - "@metamask/snaps-sdk": "^2.0.0", - "@metamask/snaps-utils": "^6.0.0", + "@metamask/snaps-sdk": "^3.0.1", + "@metamask/snaps-utils": "^7.0.3", "@rarimo/rarime-connector": "workspace:^", "buffer": "6.0.3", "dids": "4.0.4", @@ -76,7 +76,7 @@ "@jest/globals": "29.5.0", "@lavamoat/allow-scripts": "2.0.3", "@metamask/auto-changelog": "^3.4.4", - "@metamask/snaps-cli": "^5.0.0", + "@metamask/snaps-cli": "^6.1.0", "@typechain/ethers-v5": "11.1.1", "@types/intl": "1.2.0", "@types/lodash": "^4.14.202", diff --git a/packages/snap/post-process.js b/packages/snap/post-process.js index b62baef8..badce278 100644 --- a/packages/snap/post-process.js +++ b/packages/snap/post-process.js @@ -1,6 +1,6 @@ const fs = require('fs'); const pathUtils = require('path'); -const { postProcessBundle } = require('@metamask/snaps-utils'); +const { postProcessBundle } = require('@metamask/snaps-utils/node'); const bundlePath = pathUtils.join('dist', 'bundle.js'); console.log('Bundle replace code to SES', bundlePath); diff --git a/packages/snap/snap.config.ts b/packages/snap/snap.config.ts index 492801d1..53ab9eed 100644 --- a/packages/snap/snap.config.ts +++ b/packages/snap/snap.config.ts @@ -3,6 +3,7 @@ import type { SnapConfig } from '@metamask/snaps-cli'; const config: SnapConfig = { bundler: 'webpack', // default: 'browserify' input: 'src/index.ts', + evaluate: true, output: { path: 'dist', }, diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index cdc622e4..2fc4e168 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/rarimo/rarime.git" }, "source": { - "shasum": "pR/GHO8ZzuPevQqqoN4Qt1F5Yo/90qjJom/1cLj2EAk=", + "shasum": "nrGz6gduclcvGp8OGetbqt0y1rdDNmycW7LeQsGmioU=", "location": { "npm": { "filePath": "dist/bundle.js", @@ -27,7 +27,8 @@ "snap_dialog": {}, "endowment:rpc": { "dapps": true, - "snaps": true + "snaps": true, + "maxRequestTime": 180000 }, "snap_manageState": {}, "endowment:network-access": {}, diff --git a/yarn.lock b/yarn.lock index f7f2244d..fee9aa3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4056,6 +4056,16 @@ __metadata: languageName: node linkType: hard +"@metamask/base-controller@npm:^5.0.1": + version: 5.0.1 + resolution: "@metamask/base-controller@npm:5.0.1" + dependencies: + "@metamask/utils": "npm:^8.3.0" + immer: "npm:^9.0.6" + checksum: 10/62fe2c0047ea5ae88821ab6bf3e2d72f1b732a9157cd0632a4309721fe84b7e07c21ecdbf24eebfc742d00a53963e9b72bc1bc45540ce1075cf5407cec50d8a2 + languageName: node + linkType: hard + "@metamask/controller-utils@npm:^8.0.2, @metamask/controller-utils@npm:^8.0.3": version: 8.0.4 resolution: "@metamask/controller-utils@npm:8.0.4" @@ -4071,6 +4081,23 @@ __metadata: languageName: node linkType: hard +"@metamask/controller-utils@npm:^9.0.1": + version: 9.0.2 + resolution: "@metamask/controller-utils@npm:9.0.2" + dependencies: + "@ethereumjs/util": "npm:^8.1.0" + "@metamask/eth-query": "npm:^4.0.0" + "@metamask/ethjs-unit": "npm:^0.3.0" + "@metamask/utils": "npm:^8.3.0" + "@spruceid/siwe-parser": "npm:1.1.3" + "@types/bn.js": "npm:^5.1.5" + bn.js: "npm:^5.2.1" + eth-ens-namehash: "npm:^2.0.8" + fast-deep-equal: "npm:^3.1.3" + checksum: 10/edf8f23d349da01bb9e9906bc2825612eaa422f5c13d19b820ee84c3366d79900f9cd98e6e89b02b9ffd241510c1d7615b99b4263ce79a43d88ad4dffdb028f7 + languageName: node + linkType: hard + "@metamask/eslint-config-jest@npm:^12.1.0": version: 12.1.0 resolution: "@metamask/eslint-config-jest@npm:12.1.0" @@ -4196,6 +4223,17 @@ __metadata: languageName: node linkType: hard +"@metamask/json-rpc-engine@npm:^8.0.1": + version: 8.0.1 + resolution: "@metamask/json-rpc-engine@npm:8.0.1" + dependencies: + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/safe-event-emitter": "npm:^3.0.0" + "@metamask/utils": "npm:^8.3.0" + checksum: 10/340ea9be62f65b69ae552571f0176af23097e874bae276aa2349f13086dbd018ce58a4b9bbd902eff81ab959b143fb2821930564a5739353312968210308cff7 + languageName: node + linkType: hard + "@metamask/json-rpc-middleware-stream@npm:^6.0.2": version: 6.0.2 resolution: "@metamask/json-rpc-middleware-stream@npm:6.0.2" @@ -4261,6 +4299,25 @@ __metadata: languageName: node linkType: hard +"@metamask/permission-controller@npm:^9.0.2": + version: 9.0.2 + resolution: "@metamask/permission-controller@npm:9.0.2" + dependencies: + "@metamask/base-controller": "npm:^5.0.1" + "@metamask/controller-utils": "npm:^9.0.1" + "@metamask/json-rpc-engine": "npm:^8.0.1" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/utils": "npm:^8.3.0" + "@types/deep-freeze-strict": "npm:^1.1.0" + deep-freeze-strict: "npm:^1.1.1" + immer: "npm:^9.0.6" + nanoid: "npm:^3.1.31" + peerDependencies: + "@metamask/approval-controller": ^6.0.0 + checksum: 10/8af8b2949f19ace5b2c2580b5291a5ee5745fad4d24b333f53477d9c5daddf2d53aeb05d15eb23338f60c78ad96a8033fcebf4e1d6d3e6a26640fd65dfce0660 + languageName: node + linkType: hard + "@metamask/phishing-controller@npm:^8.0.2": version: 8.0.2 resolution: "@metamask/phishing-controller@npm:8.0.2" @@ -4304,6 +4361,26 @@ __metadata: languageName: node linkType: hard +"@metamask/providers@npm:^16.0.0": + version: 16.0.0 + resolution: "@metamask/providers@npm:16.0.0" + dependencies: + "@metamask/json-rpc-engine": "npm:^7.3.2" + "@metamask/json-rpc-middleware-stream": "npm:^6.0.2" + "@metamask/object-multiplex": "npm:^2.0.0" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/safe-event-emitter": "npm:^3.0.0" + "@metamask/utils": "npm:^8.3.0" + detect-browser: "npm:^5.2.0" + extension-port-stream: "npm:^3.0.0" + fast-deep-equal: "npm:^3.1.3" + is-stream: "npm:^2.0.0" + readable-stream: "npm:^3.6.2" + webextension-polyfill: "npm:^0.10.0" + checksum: 10/87dc29c91634bbe29a445f20e26edeb2f5e534af45f4a870608f73fcfd7aa28afe83974bbea632b61862ff8ca51f5322004ed79fc6d954b253155dc5f51488f5 + languageName: node + linkType: hard + "@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.1.0, @metamask/rpc-errors@npm:^6.2.1": version: 6.2.1 resolution: "@metamask/rpc-errors@npm:6.2.1" @@ -4338,9 +4415,9 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-cli@npm:^5.0.0": - version: 5.1.1 - resolution: "@metamask/snaps-cli@npm:5.1.1" +"@metamask/snaps-cli@npm:^6.1.0": + version: 6.1.0 + resolution: "@metamask/snaps-cli@npm:6.1.0" dependencies: "@babel/core": "npm:^7.23.2" "@babel/plugin-transform-class-properties": "npm:^7.22.5" @@ -4350,9 +4427,9 @@ __metadata: "@babel/plugin-transform-runtime": "npm:^7.13.2" "@babel/preset-env": "npm:^7.23.2" "@babel/preset-typescript": "npm:^7.23.2" - "@metamask/snaps-sdk": "npm:^2.1.0" - "@metamask/snaps-utils": "npm:^6.1.0" - "@metamask/snaps-webpack-plugin": "npm:^3.2.0" + "@metamask/snaps-sdk": "npm:^3.2.0" + "@metamask/snaps-utils": "npm:^7.0.4" + "@metamask/snaps-webpack-plugin": "npm:^4.0.1" "@metamask/utils": "npm:^8.3.0" "@swc/core": "npm:1.3.78" assert: "npm:^2.0.0" @@ -4361,7 +4438,6 @@ __metadata: browserify-zlib: "npm:^0.2.0" buffer: "npm:^6.0.3" chalk: "npm:^4.1.2" - chokidar: "npm:^3.5.2" console-browserify: "npm:^1.2.0" constants-browserify: "npm:^1.0.0" crypto-browserify: "npm:^3.12.0" @@ -4393,8 +4469,8 @@ __metadata: webpack-merge: "npm:^5.9.0" yargs: "npm:^17.7.1" bin: - mm-snap: ./dist/cjs/main.js - checksum: 10/e3eb64b24ba60c7b4caadda6bf92c96ca8e72745306149b5193894d3713b9e39faeff6e4bfed6838cfceb29eac06c7e6fd43b960ea78ae5fa1787c5fccf5248f + mm-snap: ./dist/main.js + checksum: 10/672f005839372a6b5d573db3f894de5be246f4e601cec67c2b8213c329f014b720ae36a1b26753b10d804c57ec066d9c63baf1a30cb08c7844c6d8e47b0e84ca languageName: node linkType: hard @@ -4484,7 +4560,7 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-registry@npm:^3.0.0": +"@metamask/snaps-registry@npm:^3.0.0, @metamask/snaps-registry@npm:^3.0.1": version: 3.0.1 resolution: "@metamask/snaps-registry@npm:3.0.1" dependencies: @@ -4526,6 +4602,20 @@ __metadata: languageName: node linkType: hard +"@metamask/snaps-sdk@npm:^3.0.1, @metamask/snaps-sdk@npm:^3.2.0": + version: 3.2.0 + resolution: "@metamask/snaps-sdk@npm:3.2.0" + dependencies: + "@metamask/key-tree": "npm:^9.0.0" + "@metamask/providers": "npm:^16.0.0" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/utils": "npm:^8.3.0" + fast-xml-parser: "npm:^4.3.4" + superstruct: "npm:^1.0.3" + checksum: 10/989cb05cfb4eca5a676e4b4f0c3a720d9407bf67a60665dfba243c599255ebd84733505e2109146049ada9936254bcdb80d7ac887a2cffbbac2f9f6ecbdefb50 + languageName: node + linkType: hard + "@metamask/snaps-utils@npm:^6.0.0, @metamask/snaps-utils@npm:^6.1.0": version: 6.1.0 resolution: "@metamask/snaps-utils@npm:6.1.0" @@ -4555,15 +4645,45 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-webpack-plugin@npm:^3.2.0": - version: 3.2.0 - resolution: "@metamask/snaps-webpack-plugin@npm:3.2.0" +"@metamask/snaps-utils@npm:^7.0.1, @metamask/snaps-utils@npm:^7.0.3, @metamask/snaps-utils@npm:^7.0.4": + version: 7.0.4 + resolution: "@metamask/snaps-utils@npm:7.0.4" dependencies: - "@metamask/snaps-sdk": "npm:^2.1.0" - "@metamask/snaps-utils": "npm:^6.1.0" + "@babel/core": "npm:^7.23.2" + "@babel/types": "npm:^7.23.0" + "@metamask/base-controller": "npm:^5.0.1" + "@metamask/key-tree": "npm:^9.0.0" + "@metamask/permission-controller": "npm:^9.0.2" + "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/slip44": "npm:^3.1.0" + "@metamask/snaps-registry": "npm:^3.0.1" + "@metamask/snaps-sdk": "npm:^3.2.0" + "@metamask/utils": "npm:^8.3.0" + "@noble/hashes": "npm:^1.3.1" + "@scure/base": "npm:^1.1.1" + chalk: "npm:^4.1.2" + cron-parser: "npm:^4.5.0" + fast-deep-equal: "npm:^3.1.3" + fast-json-stable-stringify: "npm:^2.1.0" + marked: "npm:^12.0.1" + rfdc: "npm:^1.3.0" + semver: "npm:^7.5.4" + ses: "npm:^1.1.0" + superstruct: "npm:^1.0.3" + validate-npm-package-name: "npm:^5.0.0" + checksum: 10/df5ae4979252adc966612c0341af4247eebcfebc5c20c934730dd28af88834b565441e1484d925ecb02d440bde439feab2a15fc1574493a1330ce7edf248b06e + languageName: node + linkType: hard + +"@metamask/snaps-webpack-plugin@npm:^4.0.1": + version: 4.0.1 + resolution: "@metamask/snaps-webpack-plugin@npm:4.0.1" + dependencies: + "@metamask/snaps-sdk": "npm:^3.0.1" + "@metamask/snaps-utils": "npm:^7.0.1" "@metamask/utils": "npm:^8.3.0" webpack-sources: "npm:^3.2.3" - checksum: 10/4cbd8ba2add237bbd16a7f6e1f59d55b41b631e9577c0746ccef3152bf685d6227cee8ca5a3e27d6d6675b44cf74d23b09b6dbbf609f00bc3339042d2adfd87f + checksum: 10/93c27ab689973c2284317c187f0eaef1fe10d0effee6e2d836280252c05020eb5c215887f538f92bfd75c8a2e5241f85121b19b7f38d52c4e56e38fb6474b865 languageName: node linkType: hard @@ -4853,10 +4973,10 @@ __metadata: "@jest/globals": "npm:29.5.0" "@lavamoat/allow-scripts": "npm:2.0.3" "@metamask/auto-changelog": "npm:^3.4.4" - "@metamask/snaps-cli": "npm:^5.0.0" + "@metamask/snaps-cli": "npm:^6.1.0" "@metamask/snaps-jest": "npm:^5.0.0" - "@metamask/snaps-sdk": "npm:^2.0.0" - "@metamask/snaps-utils": "npm:^6.0.0" + "@metamask/snaps-sdk": "npm:^3.0.1" + "@metamask/snaps-utils": "npm:^7.0.3" "@rarimo/rarime-connector": "workspace:^" "@typechain/ethers-v5": "npm:11.1.1" "@types/intl": "npm:1.2.0" @@ -5571,7 +5691,7 @@ __metadata: languageName: node linkType: hard -"@types/bn.js@npm:^5.1.0": +"@types/bn.js@npm:^5.1.0, @types/bn.js@npm:^5.1.5": version: 5.1.5 resolution: "@types/bn.js@npm:5.1.5" dependencies: @@ -13156,6 +13276,15 @@ __metadata: languageName: node linkType: hard +"marked@npm:^12.0.1": + version: 12.0.1 + resolution: "marked@npm:12.0.1" + bin: + marked: bin/marked.js + checksum: 10/34fd0044ebeda28b3f3f94f340e2388666408315557f125d561b59b49baec4c6e6777f54b6fb12aa5c2bf3b75a4aa9f1809679bfb6502da73053d0461c1a232d + languageName: node + linkType: hard + "md5.js@npm:^1.3.4": version: 1.3.5 resolution: "md5.js@npm:1.3.5"