From 63fac32dd961578b881e9fed7c1d3d551b9be987 Mon Sep 17 00:00:00 2001 From: lukachi Date: Tue, 19 Mar 2024 13:05:29 +0200 Subject: [PATCH 1/3] add onUpdate hook --- packages/connector/package.json | 2 +- packages/connector/src/version.json | 2 +- packages/snap/package.json | 2 +- packages/snap/snap.manifest.json | 7 ++++--- packages/snap/src/index.ts | 21 +++++++++++++++++++++ packages/zkp-iden3/package.json | 2 +- 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/packages/connector/package.json b/packages/connector/package.json index 860a602c..bfda50a1 100644 --- a/packages/connector/package.json +++ b/packages/connector/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/rarime-connector", - "version": "2.1.0-rc.13", + "version": "2.1.0-rc.14", "description": "Facilitates interaction between a DApp and RariMe MetaMask snap", "repository": { "type": "git", diff --git a/packages/connector/src/version.json b/packages/connector/src/version.json index c122a403..9a060e5a 100644 --- a/packages/connector/src/version.json +++ b/packages/connector/src/version.json @@ -1,3 +1,3 @@ { - "version": "2.1.0-rc.13" + "version": "2.1.0-rc.14" } diff --git a/packages/snap/package.json b/packages/snap/package.json index e02d2143..9ba92ea2 100644 --- a/packages/snap/package.json +++ b/packages/snap/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/rarime", - "version": "2.1.0-rc.13", + "version": "2.1.0-rc.14", "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 8561bdc7..bec7fc4c 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -1,5 +1,5 @@ { - "version": "2.1.0-rc.13", + "version": "2.1.0-rc.14", "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": "ABVTZiQu17L4Wp76l5HtJdnF9Oy/QeqaFccW0pLykv0=", + "shasum": "1dF5D+8LILwbMHcVN5u0Nj8VvHNHSnOKJQbdRACrN0w=", "location": { "npm": { "filePath": "dist/bundle.js", @@ -33,7 +33,8 @@ "endowment:network-access": {}, "endowment:webassembly": {}, "endowment:ethereum-provider": {}, - "snap_getEntropy": {} + "snap_getEntropy": {}, + "endowment:lifecycle-hooks": {} }, "manifestVersion": "0.1" } diff --git a/packages/snap/src/index.ts b/packages/snap/src/index.ts index de90d9b3..6ed3ecac 100644 --- a/packages/snap/src/index.ts +++ b/packages/snap/src/index.ts @@ -1,6 +1,8 @@ // eslint-disable-next-line import/no-unassigned-import import './polyfill'; +import type { OnUpdateHandler } from '@metamask/snaps-sdk'; +import { heading, panel, text } from '@metamask/snaps-sdk'; import type { JsonRpcRequest } from '@metamask/utils'; import { RPCMethods } from '@rarimo/rarime-connector'; @@ -98,3 +100,22 @@ export const onRpcRequest = async ({ throw new Error('Method not found.'); } }; + +export const onUpdate: OnUpdateHandler = async (args: { + request: JsonRpcRequest; +}) => { + console.log('onUpdate', JSON.stringify(args)); + + await snap.request({ + method: 'snap_dialog', + params: { + type: 'alert', + content: panel([ + text('New features added in this version:'), + text('• Cosmos compatible wallet'), + text('• Import & Export identity'), + text('• Remove credentials'), + ]), + }, + }); +}; diff --git a/packages/zkp-iden3/package.json b/packages/zkp-iden3/package.json index a909f356..568b073c 100644 --- a/packages/zkp-iden3/package.json +++ b/packages/zkp-iden3/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/zkp-iden3", - "version": "2.1.0-rc.13", + "version": "2.1.0-rc.14", "description": "Tools that generate zero-knowledge proofs for the Iden3 protocol.", "repository": { "type": "git", From 00fc117460f973777ca8626104ca8f267fa4930b Mon Sep 17 00:00:00 2001 From: lukachi Date: Tue, 19 Mar 2024 13:10:51 +0200 Subject: [PATCH 2/3] hotfix unused import --- packages/snap/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/snap/src/index.ts b/packages/snap/src/index.ts index 6ed3ecac..210bbf5b 100644 --- a/packages/snap/src/index.ts +++ b/packages/snap/src/index.ts @@ -2,7 +2,7 @@ import './polyfill'; import type { OnUpdateHandler } from '@metamask/snaps-sdk'; -import { heading, panel, text } from '@metamask/snaps-sdk'; +import { panel, text } from '@metamask/snaps-sdk'; import type { JsonRpcRequest } from '@metamask/utils'; import { RPCMethods } from '@rarimo/rarime-connector'; From 0f0b459600859919a73cbdefbca0e79c3f283e2c Mon Sep 17 00:00:00 2001 From: lukachi Date: Tue, 19 Mar 2024 13:28:44 +0200 Subject: [PATCH 3/3] bump v, make on update hook as confirmation --- packages/connector/package.json | 2 +- packages/connector/src/version.json | 2 +- packages/snap/package.json | 2 +- packages/snap/snap.manifest.json | 4 ++-- packages/snap/src/index.ts | 2 +- packages/zkp-iden3/package.json | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/connector/package.json b/packages/connector/package.json index bfda50a1..c18dc3d8 100644 --- a/packages/connector/package.json +++ b/packages/connector/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/rarime-connector", - "version": "2.1.0-rc.14", + "version": "2.1.0-rc.15", "description": "Facilitates interaction between a DApp and RariMe MetaMask snap", "repository": { "type": "git", diff --git a/packages/connector/src/version.json b/packages/connector/src/version.json index 9a060e5a..db0fed76 100644 --- a/packages/connector/src/version.json +++ b/packages/connector/src/version.json @@ -1,3 +1,3 @@ { - "version": "2.1.0-rc.14" + "version": "2.1.0-rc.15" } diff --git a/packages/snap/package.json b/packages/snap/package.json index 9ba92ea2..c6e7e51c 100644 --- a/packages/snap/package.json +++ b/packages/snap/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/rarime", - "version": "2.1.0-rc.14", + "version": "2.1.0-rc.15", "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 bec7fc4c..32531f00 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -1,5 +1,5 @@ { - "version": "2.1.0-rc.14", + "version": "2.1.0-rc.15", "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": "1dF5D+8LILwbMHcVN5u0Nj8VvHNHSnOKJQbdRACrN0w=", + "shasum": "HCQY+s8gv6YX5IKmEFvZokMhmYJcMWiEQOKpuIrtGP8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snap/src/index.ts b/packages/snap/src/index.ts index 210bbf5b..9f063b77 100644 --- a/packages/snap/src/index.ts +++ b/packages/snap/src/index.ts @@ -109,7 +109,7 @@ export const onUpdate: OnUpdateHandler = async (args: { await snap.request({ method: 'snap_dialog', params: { - type: 'alert', + type: 'confirmation', content: panel([ text('New features added in this version:'), text('• Cosmos compatible wallet'), diff --git a/packages/zkp-iden3/package.json b/packages/zkp-iden3/package.json index 568b073c..5af78353 100644 --- a/packages/zkp-iden3/package.json +++ b/packages/zkp-iden3/package.json @@ -1,6 +1,6 @@ { "name": "@rarimo/zkp-iden3", - "version": "2.1.0-rc.14", + "version": "2.1.0-rc.15", "description": "Tools that generate zero-knowledge proofs for the Iden3 protocol.", "repository": { "type": "git",