Skip to content

Commit

Permalink
remove old social recovery function
Browse files Browse the repository at this point in the history
  • Loading branch information
Nobuhito Kurose committed Apr 15, 2023
1 parent 3ea03fa commit 5832152
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions packages/site/src/snapMock/aaWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,44 +311,3 @@ export const setupSocialRecovery = async ({

return txHash;
};

export const executeSocialRecovery = async (signature: string) => {
const aaProvider = new ethers.providers.JsonRpcProvider(config.rpcUrl);
const ethProvider = new ethers.providers.Web3Provider(
window.ethereum as unknown as BaseProvider,
);

await ethProvider.send('eth_requestAccounts', []);
const signer = ethProvider.getSigner();

const accountAPI = new SimpleAccountAPI({
provider: aaProvider,
owner: signer,
entryPointAddress,
factoryAddress,
});
const myAddress = await accountAPI.getAccountAddress();
const myContract = new Contract(myAddress, WalletAccount.abi, aaProvider);
const op = await accountAPI.createSignedUserOp({
target: myAddress,
data: myContract.interface.encodeFunctionData('executeSocialRecovery', [
signature,
]),
maxPriorityFeePerGas: 0x2540be400, // 15gwei
maxFeePerGas: 0x6fc23ac00, // 30gewi
});

const client = new HttpRpcClient(
bundlerUrl,
entryPointAddress,
Number(ChainId.mumbai),
);

const uoHash = await client.sendUserOpToBundler(op);
console.log(`UserOpHash: ${uoHash}`);

console.log('Waiting for transaction...');
const txHash = await accountAPI.getUserOpReceipt(uoHash);
console.log(`Transaction hash: ${txHash}`);
return txHash;
};

0 comments on commit 5832152

Please sign in to comment.