From d8f662c9d868fab1ecf397020d1a7c38e43432e3 Mon Sep 17 00:00:00 2001 From: aritroCoder Date: Sun, 10 Dec 2023 21:03:49 +0530 Subject: [PATCH] added copy capability in snap Signed-off-by: aritroCoder --- packages/snap/snap.manifest.json | 2 +- packages/snap/src/index.ts | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index 8cb3f6a..5823801 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/template-snap-monorepo.git" }, "source": { - "shasum": "YoKmyYOilAOCHHWdD7rLvEGM89tjQvAjitssnyIRFMU=", + "shasum": "KXUWUpOnKM55BwS0UbSTDZfeL2XpDMOOidcAPNAmKVE=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snap/src/index.ts b/packages/snap/src/index.ts index 4fb8791..281846b 100644 --- a/packages/snap/src/index.ts +++ b/packages/snap/src/index.ts @@ -1,5 +1,5 @@ import type { OnRpcRequestHandler } from '@metamask/snaps-types'; -import { heading, panel, text } from '@metamask/snaps-ui'; +import { copyable, heading, panel, text } from '@metamask/snaps-ui'; import createAccount from './utils/aptos/CreateAccount'; import transferCoin from './utils/aptos/TransferCoin'; @@ -101,7 +101,8 @@ export const onRpcRequest: OnRpcRequestHandler = async ({ type: 'confirmation', content: panel([ heading('Transfer Coin'), - text(`To: **${to}**`), + text(`To:`), + copyable(`${to}`), text(`Amount: **${amount}**`), panel([ heading('Gas fee insights'), @@ -126,9 +127,11 @@ export const onRpcRequest: OnRpcRequestHandler = async ({ type: 'alert', content: panel([ heading('Amount transferred successfully.'), - text(`To: **${to}**`), + text(`To:`), + copyable(`${to}`), text(`Amount: **${amount}**`), - text(`Transaction Hash: **${txHash.hash}**`), + text(`Transaction Hash:`), + copyable(`${txHash.hash}`), ]), }, }); @@ -144,7 +147,8 @@ export const onRpcRequest: OnRpcRequestHandler = async ({ type: 'alert', content: panel([ heading('Funded 1 APT successfully.'), - text(`Transaction Hash: **${txHash}**`), + text(`Transaction Hash:`), + copyable(`${txHash}`), ]), }, });