installValidationActions
Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with SmartAccountClient
.
Import
import { installValidationActions } from "@account-kit/smart-contracts";
Usage
import { createSMAV2AccountClient, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from "@account-kit/smart-contracts";
import { Address } from "viem";
const client = (await createSMAV2AccountClient({ ... })).extend(installValidationActions);
const sessionKeyAddress: Address = "0x1234";
const sessionKeyEntityId: number = 1;
await client.installValidation({
validationConfig: {
moduleAddress: getDefaultSingleSignerValidationModuleAddress(
client.chain
),
entityId: sessionKeyEntityId,
isGlobal: true,
isSignatureValidation: false,
isUserOpValidation: true,
},
selectors: [],
installData: SingleSignerValidationModule.encodeOnInstallData({
entityId: sessionKeyEntityId,
signer: sessionKeyAddress,
}),
hooks: [],
});
await client.uninstallValidation({
moduleAddress: sessionKeyAddress,
entityId: sessionKeyEntityId,
uninstallData: SingleSignerValidationModule.encodeOnUninstallData({
entityId: sessionKeyEntityId,
}),
hookUninstallDatas: [],
});
Parameters
client
object
-
The client instance which provides account and sendUserOperation functionality.
Returns
object
-
An object containing two methods,
installValidation
anduninstallValidation
.