Skip to content

Commit

Permalink
fix: intermediary audit
Browse files Browse the repository at this point in the history
  • Loading branch information
Arch0125 committed Jul 14, 2023
1 parent 1a6a32e commit 7ee0189
Show file tree
Hide file tree
Showing 10 changed files with 440 additions and 105 deletions.
54 changes: 35 additions & 19 deletions push-snap-site/components/buttons/ConfirmButton.tsx
Expand Up @@ -12,34 +12,50 @@ export default function ConfirmButton() {
method: "wallet_invokeSnap",
params: {
snapId: defaultSnapOrigin,
request: { method: 'pushproto_addaddress', params: { address: address } },
request: {
method: "pushproto_addaddress",
params: { address: address },
},
},
});
};

const { data, isError, isLoading, isSuccess, signMessage } = useSignMessage({
message:
`Confirm your Address ${address}, \n this will be added to MetaMask for sending notifications`,
});
const removeAddress = async (address: string) => {
await window.ethereum?.request({
method: "wallet_invokeSnap",
params: {
snapId: defaultSnapOrigin,
request: {
method: "pushproto_removeaddress",
params: { address: address },
},
},
});
};

function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
const confirmAddition = async () => {
await sendHello(String(address));
};

const confirmAddition=async()=>{
signMessage();
if(isSuccess){
await sleep(5000);
await sendHello(String(address));
}
}
const confirmDeletion = async () => {
await removeAddress(String(address));
};

return (
<button
className="flex bg-white text-black font-bold text-sm w-max p-2 rounded-lg border-2 border-text-secondary ring-1 ring-white"
onClick={() => confirmAddition()}
<>
<button
className="flex bg-white text-black font-bold text-sm w-max p-2 rounded-lg border-2 border-text-secondary ring-1 ring-white"
onClick={() => confirmAddition()}
>
Confirm Addition
</button>

<button
className="flex bg-white text-black font-bold text-sm w-max p-2 rounded-lg border-2 border-text-secondary ring-1 ring-white mt-3"
onClick={() => confirmDeletion()}
>
Confirm
Confirm Removal
</button>
</>
);
}
4 changes: 2 additions & 2 deletions push-snap-site/utils/constants.tsx
Expand Up @@ -22,6 +22,6 @@ export const NOTE = {
}

export const ADD_ADDRESS = {
HEAD_1: "Add Address for Notifications",
PARA_1: "Add your address to receive notifications from the snap.",
HEAD_1: "Add/Remove Address for Notifications",
PARA_1: "",
}

0 comments on commit 7ee0189

Please sign in to comment.