Skip to content

Commit

Permalink
fix: remove hello method (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleyyconsensys authored Sep 22, 2023
1 parent 148e96e commit 241c1a7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
21 changes: 0 additions & 21 deletions packages/starknet-snap/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ <h1>Hello, Snaps!</h1>
<br />

<button class="connect">Connect</button>
<button class="sendHello">Send Hello</button>
<button class="sendPing">Send Ping</button>
<br>
<label for="targetChainId">Target Chain Id in Hex (optional, default Goerli testnet)</label>
Expand Down Expand Up @@ -275,7 +274,6 @@ <h1>Hello, Snaps!</h1>

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')
Expand All @@ -299,7 +297,6 @@ <h1>Hello, Snaps!</h1>
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)
Expand Down Expand Up @@ -339,24 +336,6 @@ <h1>Hello, Snaps!</h1>
})
}

// 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 {
Expand Down
17 changes: 0 additions & 17 deletions packages/starknet-snap/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 241c1a7

Please sign in to comment.