@alchemy/aa-core
Version:
viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts
26 lines • 964 B
JavaScript
import { isBaseSmartAccountClient } from "../../client/isSmartAccountClient.js";
import { AccountNotFoundError } from "../../errors/account.js";
import { ChainNotFoundError, IncompatibleClientError, } from "../../errors/client.js";
import { deepHexlify, resolveProperties } from "../../utils/index.js";
export async function signUserOperation(client, args) {
const { account = client.account, context } = args;
if (!account) {
throw new AccountNotFoundError();
}
if (!isBaseSmartAccountClient(client)) {
throw new IncompatibleClientError("BaseSmartAccountClient", "signUserOperation", client);
}
if (!client.chain) {
throw new ChainNotFoundError();
}
return await client.middleware
.signUserOperation(args.uoStruct, {
...args,
account,
client,
context,
})
.then(resolveProperties)
.then(deepHexlify);
}
//# sourceMappingURL=signUserOperation.js.map