Skip to content

Commit

Permalink
crappy eoa for now
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Oct 17, 2024
1 parent 8af96e1 commit bc150f8
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion packages/entrykit/src/onboarding/useSetupAppAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { sendUserOperation, waitForUserOperationReceipt } from "viem/account-abs
import { useEntryKitConfig } from "../EntryKitConfigProvider";
import { ConnectedClient, unlimitedDelegationControlId, worldAbi } from "../common";
import { paymasterAbi } from "../paymaster";
import { writeContract } from "viem/actions";

function defineCall<abi extends Abi | readonly unknown[]>(
call: Omit<ContractFunctionParameters<abi>, "address"> & {
Expand Down Expand Up @@ -34,7 +35,30 @@ export function useSetupAppAccount() {
}): Promise<void> => {
// TODO: for non-smart accounts, collect signatures and store to be executed later?
if (userClient.account.type !== "smart") {
throw new Error("User account is not a smart account.");
await getAction(
userClient,
writeContract,
"writeContract",
)({
chain: userClient.chain,
account: userClient.account,
address: paymasterAddress,
abi: paymasterAbi,
functionName: "registerSpender",
args: [appAccountAddress],
});
await getAction(
userClient,
writeContract,
"writeContract",
)({
chain: userClient.chain,
account: userClient.account,
address: worldAddress,
abi: worldAbi,
functionName: "registerDelegation",
args: [appAccountAddress, unlimitedDelegationControlId, "0x"],
});
}

const calls = [];
Expand Down

0 comments on commit bc150f8

Please sign in to comment.