From 241c1a7d9f08b5bdad1551b384516e359f4132eb Mon Sep 17 00:00:00 2001 From: Stanley Yuen <102275989+stanleyyconsensys@users.noreply.github.com> Date: Fri, 22 Sep 2023 20:17:35 +0800 Subject: [PATCH] fix: remove hello method (#146) --- packages/starknet-snap/index.html | 21 --------------------- packages/starknet-snap/src/index.ts | 17 ----------------- 2 files changed, 38 deletions(-) diff --git a/packages/starknet-snap/index.html b/packages/starknet-snap/index.html index 3013ee08..3cad5b40 100644 --- a/packages/starknet-snap/index.html +++ b/packages/starknet-snap/index.html @@ -28,7 +28,6 @@

Hello, Snaps!


-
@@ -275,7 +274,6 @@

Hello, Snaps!

const snapId = `local:${window.location.href}`; const connectButton = document.querySelector('button.connect') - const sendHelloButton = document.querySelector('button.sendHello') const sendPingButton = document.querySelector('button.sendPing') const getErc20BalanceForm = document.getElementById('getErc20Balance') const getEstimateFeeForm = document.getElementById('getEstimateFee') @@ -299,7 +297,6 @@

Hello, Snaps!

const recoverUserAccountsForm = document.getElementById('recoverUserAccounts') connectButton.addEventListener('click', connect) - sendHelloButton.addEventListener('click', sendHello) sendPingButton.addEventListener('click', sendPing) getDeployedAccContractsForm.addEventListener('submit', getDeployedAccContracts) getErc20BalanceForm.addEventListener('submit', getErc20Balance) @@ -339,24 +336,6 @@

Hello, Snaps!

}) } - // here we call the snap's "hello" method - async function sendHello() { - try { - const response = await ethereum.request({ - method: 'wallet_invokeSnap', - params: { - snapId, - request: { - method: 'hello' - } - } - }) - } catch (err) { - console.error(err) - alert('Problem happened: ' + err.message || err) - } - } - // here we call the snap's "ping" method async function sendPing() { try { diff --git a/packages/starknet-snap/src/index.ts b/packages/starknet-snap/src/index.ts index 91086252..7c97a58c 100644 --- a/packages/starknet-snap/src/index.ts +++ b/packages/starknet-snap/src/index.ts @@ -31,8 +31,6 @@ import { Mutex } from 'async-mutex'; import { OnRpcRequestHandler } from '@metamask/snaps-types'; import { ApiParams, ApiRequestParams } from './types/snapApi'; import { estimateAccDeployFee } from './estimateAccountDeployFee'; -import { DialogType } from '@metamask/rpc-methods'; -import { copyable, heading, panel } from '@metamask/snaps-ui'; import { logger } from './utils/logger'; declare const snap; @@ -98,21 +96,6 @@ export const onRpcRequest: OnRpcRequestHandler = async ({ origin, request }) => }; switch (request.method) { - case 'hello': - logger.log(`Snap State:\n${toJson(state, 2)}`); - return snap.request({ - method: 'snap_dialog', - params: { - type: DialogType.Alert, - content: panel([ - heading(`${origin}, Hello!`), - copyable( - `# of accounts: ${state.accContracts.length}\n\n# of netwoks: ${state.networks.length}\n\n# of erc20Tokens: ${state.erc20Tokens.length}\n\n# of txns: ${state.transactions.length}`, - ), - ]), - }, - }); - case 'starkNet_createAccount': apiParams.keyDeriver = await getAddressKeyDeriver(snap); return createAccount(apiParams);