Skip to content

Commit

Permalink
chore: synchronize the logic of the snap, no longer expose the showAl…
Browse files Browse the repository at this point in the history
…ert method for frontend invocation
  • Loading branch information
dmoosocool committed Dec 7, 2023
1 parent cb9661e commit 85184c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
10 changes: 2 additions & 8 deletions packages/site/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
// sendGetState,
// sendSetState,
shouldDisplayReconnectButton,
showAlert,
// showAlert,
// showAllActivities,
// showAllMonitoredAddresses,
// showLastUpdated,
Expand Down Expand Up @@ -58,13 +58,7 @@ const Index = () => {

const handleSendClearStateClick = async () => {
try {
const resp = await sendClearState();
if (resp) {
await showAlert(
'Clear Succeeded',
'Start adding some new addresses now!',
);
}
await sendClearState();
} catch (e) {
console.error(e);
dispatch({ type: MetamaskActions.SetError, payload: e });
Expand Down
30 changes: 15 additions & 15 deletions packages/site/src/utils/snap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,21 @@ export const addOwnWalletAddress = async () => {
return resp;
};

export const showAlert = async (title: string, content: string) => {
await window.ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId: defaultSnapOrigin,
request: {
method: 'showAlert',
params: {
title,
content,
},
},
},
});
};
// export const showAlert = async (title: string, content: string) => {
// await window.ethereum.request({
// method: 'wallet_invokeSnap',
// params: {
// snapId: defaultSnapOrigin,
// request: {
// method: 'showAlert',
// params: {
// title,
// content,
// },
// },
// },
// });
// };

export const showLastUpdated = async () => {
await window.ethereum.request({
Expand Down

0 comments on commit 85184c4

Please sign in to comment.