From 08253b0e3bd412dee688e588b650b3f3ff8d2a1b Mon Sep 17 00:00:00 2001 From: Phat <39623143+lukachi@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:26:45 +0300 Subject: [PATCH] Fixed RPC request serialization issue (#53) * fix request params * bump v * add proper description for fixed bug --- CHANGELOG.md | 11 ++++++++++- packages/connector/package.json | 2 +- packages/connector/src/methods.ts | 7 +++++-- packages/connector/src/version.json | 2 +- packages/snap/package.json | 2 +- packages/snap/snap.manifest.json | 4 ++-- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0a5840..ee89b87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [Unreleased] +## [2.1.1] - 2024-06-18 + +### Fixed +- `@rarimo/rarime-connector` +- - request params: `wallet_invokeSnap` method should accept `params` only if it exists, passing `undefined` would cause an error at least in Metamask Flask version `11.16.10-flask.0` and Metamask version `11.16.11` + +[Unreleased] + ## [2.1.0] - 2024-04-08 ### Added @@ -194,7 +202,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Implemented `@rarimo/rarime-connector` and `@rarimo/rarime` packages -[Unreleased]: https://github.com/rarimo/rarime/compare/2.1.0...HEAD +[Unreleased]: https://github.com/rarimo/rarime/compare/2.1.1...HEAD +[2.1.1]: https://github.com/rarimo/rarime/compare/2.1.0...2.1.1 [2.1.0]: https://github.com/rarimo/rarime/compare/2.0.3...2.1.0 [2.0.3]: https://github.com/rarimo/rarime/compare/2.0.2...2.0.3 [2.0.2]: https://github.com/rarimo/rarime/compare/2.0.1...2.0.2 diff --git a/packages/connector/package.json b/packages/connector/package.json index 0036a7d..cb95b80 100644 --- a/packages/connector/package.json +++ b/packages/connector/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/rarime-connector", - "version": "2.1.0", + "version": "2.1.1", "description": "Facilitates interaction between a DApp and RariMe MetaMask snap", "repository": { "type": "git", diff --git a/packages/connector/src/methods.ts b/packages/connector/src/methods.ts index c9e29c4..16cab6c 100644 --- a/packages/connector/src/methods.ts +++ b/packages/connector/src/methods.ts @@ -16,13 +16,16 @@ import type { import { RPCMethods } from './types'; const sendSnapMethod = async ( - request: unknown, + request: { method: string; params?: any }, snapId: string, ): Promise => { return await window.ethereum.request({ method: 'wallet_invokeSnap', params: { - request, + request: { + method: request.method, + ...(request.params && { params: request.params }), + }, snapId, }, }); diff --git a/packages/connector/src/version.json b/packages/connector/src/version.json index 87032da..23a340e 100644 --- a/packages/connector/src/version.json +++ b/packages/connector/src/version.json @@ -1,3 +1,3 @@ { - "version": "2.1.0" + "version": "2.1.1" } diff --git a/packages/snap/package.json b/packages/snap/package.json index 2853f9a..1455c4a 100644 --- a/packages/snap/package.json +++ b/packages/snap/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/rarime", - "version": "2.1.0", + "version": "2.1.1", "description": "RariMe is a MetaMask Snap that safely holds any of your credentials and allows you to prove your identity without revealing any personal data. Powered by Rarimo Protocol and Zero-Knowledge Proof technology.", "repository": { "type": "git", diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index 960c70e..06471c2 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -1,5 +1,5 @@ { - "version": "2.1.0", + "version": "2.1.1", "description": "Securely store and manage all of your identity credentials. Use them across chains with ZK-protected privacy guarantees.", "proposedName": "RariMe", "repository": { @@ -7,7 +7,7 @@ "url": "https://github.com/rarimo/rarime.git" }, "source": { - "shasum": "CQgk91hCMZDesbgW1yDO4bWYyHY6Lpwp3b1GK/zPxY8=", + "shasum": "8qJxnKDj9B1mL6nCqd3GcwaCpG4lPgfeOGaBKJk0Zpw=", "location": { "npm": { "filePath": "dist/bundle.js",