Skip to content

Commit

Permalink
Use an EmailRecoveryCommandHandler for the safe 1.4 flow
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraSuegami committed Nov 11, 2024
1 parent 70ee1e8 commit b9406ef
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
5 changes: 2 additions & 3 deletions contracts.base-sepolia.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"safeEmailRecoveryModule": "0xf2Fcd6b51F1a58E76667DBAF06B5E655166fb738",
"universalEmailRecoveryModule": "0x29a26b4f4fDA819415Ef2d93255998E8FF864066",
"validatorsAddress": "0xd9Ef4a48E4C067d640a9f784dC302E97B21Fd691",
"universalEmailRecoveryModule": "0x79E6B8e37cbD8Db5235086eda870393860246587",
"safe4337ModuleAddress": "0x31724D48Ba93c3c31617d3346cB7Ec79705013e3",
"erc7569LaunchpadAddress": "0xEBe001b3D534B9B6E2500FB78E67a1A137f561CE"
}
}
11 changes: 5 additions & 6 deletions src/components/burnerWallet/GuardianSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
erc7569LaunchpadAddress,
safe4337ModuleAddress,
universalEmailRecoveryModule,
validatorsAddress,
} from "../../../contracts.base-sepolia.json";
import { abi as universalEmailRecoveryModuleAbi } from "../../abi/UniversalEmailRecoveryModule.json";
import { StepsContext } from "../../App";
Expand Down Expand Up @@ -140,10 +139,10 @@ const GuardianSetup = () => {
safe4337ModuleAddress: safe4337ModuleAddress as `0x${string}`,
erc7569LaunchpadAddress: erc7569LaunchpadAddress as `0x${string}`,
validators: [
{
address: validatorsAddress as `0x${string}`,
context: "0x",
},
// {
// address: validatorsAddress as `0x${string}`,
// context: "0x",
// },
],
});

Expand Down Expand Up @@ -423,7 +422,7 @@ const GuardianSetup = () => {
)
}
title="Recovery Delay"
// helperText="This is the delay you the actual wallet owner has to cancel recovery after recovery has been initiated, helpful for preventing malicious behavior from guardians."
// helperText="This is the delay you the actual wallet owner has to cancel recovery after recovery has been initiated, helpful for preventing malicious behavior from guardians."
/>

<Select
Expand Down
21 changes: 18 additions & 3 deletions src/components/burnerWallet/RequestedRecoveries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import completeRecoveryIcon from "../../assets/completeRecoveryIcon.svg";
import infoIcon from "../../assets/infoIcon.svg";
import { STEPS } from "../../constants";
import { useAppContext } from "../../context/AppContextHook";

import { encodeAbiParameters, encodeFunctionData, keccak256 } from "viem"

Check warning on line 15 in src/components/burnerWallet/RequestedRecoveries.tsx

View workflow job for this annotation

GitHub Actions / eslint

`viem` import should occur before import of `wagmi/actions`

Check failure on line 15 in src/components/burnerWallet/RequestedRecoveries.tsx

View workflow job for this annotation

GitHub Actions / eslint

'encodeAbiParameters' is defined but never used

Check failure on line 15 in src/components/burnerWallet/RequestedRecoveries.tsx

View workflow job for this annotation

GitHub Actions / eslint

'encodeFunctionData' is defined but never used
import { useBurnerAccount } from "../../context/BurnerAccountContext";
import { config } from "../../providers/config";
import { relayer } from "../../services/relayer";
Expand Down Expand Up @@ -134,6 +134,22 @@ const RequestedRecoveries = () => {
})) as [][];

try {
const prevOwner = getPreviousOwnerInLinkedList(
safeOwnersData[0],
safeOwnersData
);

const recoveryCallData = getRecoveryCallData(
prevOwner,
safeOwnersData[0],
newOwner!
);
const recoveryData = getRecoveryData(safeWalletAddress, recoveryCallData) as `0x${string}`;
const recoveryDataHash = keccak256(recoveryData);
// keccak256(
// new TextEncoder().encode("swapOwner(address,address,address)")
// ).slice(0, 10);
// const recoveryData =
// requestId
await relayer.recoveryRequest(
universalEmailRecoveryModule as string,
Expand All @@ -143,8 +159,7 @@ const RequestedRecoveries = () => {
.join()
?.replaceAll(",", " ")
.replace("{ethAddr}", safeWalletAddress)
.replace("{ethAddr}", safeOwnersData[0])
.replace("{ethAddr}", newOwner)
.replace("{string}", recoveryDataHash)
);

intervalRef.current = setInterval(() => {
Expand Down

0 comments on commit b9406ef

Please sign in to comment.