From 625aa521104a16e432f2f8b3d157fe3612ad20a0 Mon Sep 17 00:00:00 2001 From: Nikita Sukhachev Date: Thu, 15 Aug 2024 15:11:12 +0700 Subject: [PATCH] feat: add getAddress method --- packages/site/src/pages/index.tsx | 3 ++- packages/snap/package.json | 2 +- packages/snap/snap.manifest.json | 4 ++-- packages/snap/src/index.tsx | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/site/src/pages/index.tsx b/packages/site/src/pages/index.tsx index 7001003..ea2b8bb 100644 --- a/packages/site/src/pages/index.tsx +++ b/packages/site/src/pages/index.tsx @@ -111,7 +111,8 @@ const Index = () => { : snapsDetected; const handleSendHelloClick = async () => { - await invokeSnap({ method: 'hello' }); + const result = await invokeSnap({ method: 'getAddress' }); + console.log(result); }; const installSnap = async () => { diff --git a/packages/snap/package.json b/packages/snap/package.json index ae52d24..882a9d3 100644 --- a/packages/snap/package.json +++ b/packages/snap/package.json @@ -1,6 +1,6 @@ { "name": "nomis", - "version": "0.1.3", + "version": "0.1.4", "description": "Onchain Reputation and Decentralized Identity Protocol", "repository": { "type": "git", diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index 52c7c38..a503fef 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -1,5 +1,5 @@ { - "version": "0.1.3", + "version": "0.1.4", "description": "Onchain Reputation and Decentralized Identity Protocol", "proposedName": "Nomis Protocol", "repository": { @@ -7,7 +7,7 @@ "url": "https://github.com/Nomis-cc/nomis-snaps.git" }, "source": { - "shasum": "xgurEG5jHmrFcnBO3CHBriCEkSOvJ8PdLRTWRtKoE7g=", + "shasum": "DGI3POjXiBCuVZmCbG2cciqSi+qJdpVBgZixWcs6Ph8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snap/src/index.tsx b/packages/snap/src/index.tsx index ef29f18..b04e536 100644 --- a/packages/snap/src/index.tsx +++ b/packages/snap/src/index.tsx @@ -17,6 +17,8 @@ import { convertCAIP2ToHex, getAccount, getChainId } from './utils'; export const onRpcRequest: OnRpcRequestHandler = async ({ request }) => { switch (request.method) { + case 'getAddress': + return await getAccount(); default: throw new Error('Method not found.'); }