@account-kit/smart-contracts 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/src/ma-v2/abis/accountFactoryAbi.d.ts +492 -0
- package/dist/esm/src/ma-v2/abis/accountFactoryAbi.js +639 -0
- package/dist/esm/src/ma-v2/abis/accountFactoryAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/abis/modularAccountAbi.d.ts +954 -0
- package/dist/esm/src/ma-v2/abis/modularAccountAbi.js +1242 -0
- package/dist/esm/src/ma-v2/abis/modularAccountAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/abis/semiModularAccountBytecodeAbi.d.ts +991 -0
- package/dist/esm/src/ma-v2/abis/semiModularAccountBytecodeAbi.js +1289 -0
- package/dist/esm/src/ma-v2/abis/semiModularAccountBytecodeAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/abis/semiModularAccountStorageAbi.d.ts +1001 -0
- package/dist/esm/src/ma-v2/abis/semiModularAccountStorageAbi.js +1302 -0
- package/dist/esm/src/ma-v2/abis/semiModularAccountStorageAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/account/nativeSMASigner.d.ts +238 -0
- package/dist/esm/src/ma-v2/account/nativeSMASigner.js +88 -0
- package/dist/esm/src/ma-v2/account/nativeSMASigner.js.map +1 -0
- package/dist/esm/src/ma-v2/account/semiModularAccountV2.d.ts +41 -0
- package/dist/esm/src/ma-v2/account/semiModularAccountV2.js +148 -0
- package/dist/esm/src/ma-v2/account/semiModularAccountV2.js.map +1 -0
- package/dist/esm/src/ma-v2/actions/common/types.d.ts +31 -0
- package/dist/esm/src/ma-v2/actions/common/types.js +6 -0
- package/dist/esm/src/ma-v2/actions/common/types.js.map +1 -0
- package/dist/esm/src/ma-v2/actions/common/utils.d.ts +76 -0
- package/dist/esm/src/ma-v2/actions/common/utils.js +100 -0
- package/dist/esm/src/ma-v2/actions/common/utils.js.map +1 -0
- package/dist/esm/src/ma-v2/actions/install-validation/installValidation.d.ts +71 -0
- package/dist/esm/src/ma-v2/actions/install-validation/installValidation.js +109 -0
- package/dist/esm/src/ma-v2/actions/install-validation/installValidation.js.map +1 -0
- package/dist/esm/src/ma-v2/client/client.d.ts +6 -0
- package/dist/esm/src/ma-v2/client/client.js +40 -0
- package/dist/esm/src/ma-v2/client/client.js.map +1 -0
- package/dist/esm/src/ma-v2/index.d.ts +26 -0
- package/dist/esm/src/ma-v2/index.js +24 -0
- package/dist/esm/src/ma-v2/index.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.d.ts +556 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.js +716 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/module.d.ts +579 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/module.js +56 -0
- package/dist/esm/src/ma-v2/modules/allowlist-module/module.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.d.ts +312 -0
- package/dist/esm/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.js +404 -0
- package/dist/esm/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/native-token-limit-module/module.d.ts +322 -0
- package/dist/esm/src/ma-v2/modules/native-token-limit-module/module.js +14 -0
- package/dist/esm/src/ma-v2/modules/native-token-limit-module/module.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.d.ts +186 -0
- package/dist/esm/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.js +242 -0
- package/dist/esm/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/paymaster-guard-module/module.d.ts +196 -0
- package/dist/esm/src/ma-v2/modules/paymaster-guard-module/module.js +25 -0
- package/dist/esm/src/ma-v2/modules/paymaster-guard-module/module.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.d.ts +45 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.js +331 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/module.d.ts +10 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/module.js +16 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/module.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/signer.d.ts +239 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/signer.js +93 -0
- package/dist/esm/src/ma-v2/modules/single-signer-validation/signer.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.d.ts +229 -0
- package/dist/esm/src/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.js +296 -0
- package/dist/esm/src/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/time-range-module/module.d.ts +245 -0
- package/dist/esm/src/ma-v2/modules/time-range-module/module.js +42 -0
- package/dist/esm/src/ma-v2/modules/time-range-module/module.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/utils.d.ts +91 -0
- package/dist/esm/src/ma-v2/modules/utils.js +188 -0
- package/dist/esm/src/ma-v2/modules/utils.js.map +1 -0
- package/dist/esm/src/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.d.ts +287 -0
- package/dist/esm/src/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.js +374 -0
- package/dist/esm/src/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.js.map +1 -0
- package/dist/esm/src/ma-v2/utils.d.ts +16 -0
- package/dist/esm/src/ma-v2/utils.js +105 -0
- package/dist/esm/src/ma-v2/utils.js.map +1 -0
- package/dist/types/src/ma-v2/abis/accountFactoryAbi.d.ts +493 -0
- package/dist/types/src/ma-v2/abis/accountFactoryAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/abis/modularAccountAbi.d.ts +955 -0
- package/dist/types/src/ma-v2/abis/modularAccountAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/abis/semiModularAccountBytecodeAbi.d.ts +992 -0
- package/dist/types/src/ma-v2/abis/semiModularAccountBytecodeAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/abis/semiModularAccountStorageAbi.d.ts +1002 -0
- package/dist/types/src/ma-v2/abis/semiModularAccountStorageAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/account/nativeSMASigner.d.ts +239 -0
- package/dist/types/src/ma-v2/account/nativeSMASigner.d.ts.map +1 -0
- package/dist/types/src/ma-v2/account/semiModularAccountV2.d.ts +42 -0
- package/dist/types/src/ma-v2/account/semiModularAccountV2.d.ts.map +1 -0
- package/dist/types/src/ma-v2/actions/common/types.d.ts +32 -0
- package/dist/types/src/ma-v2/actions/common/types.d.ts.map +1 -0
- package/dist/types/src/ma-v2/actions/common/utils.d.ts +77 -0
- package/dist/types/src/ma-v2/actions/common/utils.d.ts.map +1 -0
- package/dist/types/src/ma-v2/actions/install-validation/installValidation.d.ts +72 -0
- package/dist/types/src/ma-v2/actions/install-validation/installValidation.d.ts.map +1 -0
- package/dist/types/src/ma-v2/client/client.d.ts +7 -0
- package/dist/types/src/ma-v2/client/client.d.ts.map +1 -0
- package/dist/types/src/ma-v2/index.d.ts +27 -0
- package/dist/types/src/ma-v2/index.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.d.ts +557 -0
- package/dist/types/src/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/allowlist-module/module.d.ts +580 -0
- package/dist/types/src/ma-v2/modules/allowlist-module/module.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.d.ts +313 -0
- package/dist/types/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/native-token-limit-module/module.d.ts +323 -0
- package/dist/types/src/ma-v2/modules/native-token-limit-module/module.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.d.ts +187 -0
- package/dist/types/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/paymaster-guard-module/module.d.ts +197 -0
- package/dist/types/src/ma-v2/modules/paymaster-guard-module/module.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.d.ts +46 -0
- package/dist/types/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/single-signer-validation/module.d.ts +11 -0
- package/dist/types/src/ma-v2/modules/single-signer-validation/module.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/single-signer-validation/signer.d.ts +240 -0
- package/dist/types/src/ma-v2/modules/single-signer-validation/signer.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.d.ts +230 -0
- package/dist/types/src/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/time-range-module/module.d.ts +246 -0
- package/dist/types/src/ma-v2/modules/time-range-module/module.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/utils.d.ts +92 -0
- package/dist/types/src/ma-v2/modules/utils.d.ts.map +1 -0
- package/dist/types/src/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.d.ts +288 -0
- package/dist/types/src/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.d.ts.map +1 -0
- package/dist/types/src/ma-v2/utils.d.ts +17 -0
- package/dist/types/src/ma-v2/utils.d.ts.map +1 -0
- package/package.json +10 -5
- package/src/ma-v2/abis/accountFactoryAbi.ts +638 -0
- package/src/ma-v2/abis/modularAccountAbi.ts +1241 -0
- package/src/ma-v2/abis/semiModularAccountBytecodeAbi.ts +1288 -0
- package/src/ma-v2/abis/semiModularAccountStorageAbi.ts +1301 -0
- package/src/ma-v2/account/nativeSMASigner.ts +121 -0
- package/src/ma-v2/account/semiModularAccountV2.ts +289 -0
- package/src/ma-v2/actions/common/types.ts +37 -0
- package/src/ma-v2/actions/common/utils.ts +103 -0
- package/src/ma-v2/actions/install-validation/installValidation.ts +213 -0
- package/src/ma-v2/client/client.ts +74 -0
- package/src/ma-v2/index.ts +47 -0
- package/src/ma-v2/modules/allowlist-module/abis/allowlistModuleAbi.ts +715 -0
- package/src/ma-v2/modules/allowlist-module/module.ts +87 -0
- package/src/ma-v2/modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.ts +403 -0
- package/src/ma-v2/modules/native-token-limit-module/module.ts +21 -0
- package/src/ma-v2/modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.ts +241 -0
- package/src/ma-v2/modules/paymaster-guard-module/module.ts +35 -0
- package/src/ma-v2/modules/single-signer-validation/abis/singleSignerValidationModuleAbi.ts +330 -0
- package/src/ma-v2/modules/single-signer-validation/module.ts +24 -0
- package/src/ma-v2/modules/single-signer-validation/signer.ts +127 -0
- package/src/ma-v2/modules/time-range-module/abis/timeRangeModuleAbi.ts +295 -0
- package/src/ma-v2/modules/time-range-module/module.ts +63 -0
- package/src/ma-v2/modules/utils.ts +213 -0
- package/src/ma-v2/modules/webauthn-validation/abis/webauthnValidationAbi.ts +373 -0
- package/src/ma-v2/utils.ts +138 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semiModularAccountV2.js","sourceRoot":"","sources":["../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AAW;QACd,eAAe;QACf,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM;QACvB,YAAY;QACZ,gBAAgB;QAChB,iBAAiB;QACjB,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import type {\n EntryPointDef,\n SmartAccountSigner,\n AccountOp,\n SmartContractAccountWithSigner,\n ToSmartContractAccountParams,\n} from \"@aa-sdk/core\";\nimport {\n createBundlerClient,\n getEntryPoint,\n toSmartContractAccount,\n InvalidEntityIdError,\n InvalidNonceKeyError,\n getAccountAddress,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n getContract,\n maxUint32,\n maxUint152,\n zeroAddress,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { accountFactoryAbi } from \"../abis/accountFactoryAbi.js\";\nimport {\n getDefaultMAV2FactoryAddress,\n DEFAULT_OWNER_ENTITY_ID,\n} from \"../utils.js\";\nimport { singleSignerMessageSigner } from \"../modules/single-signer-validation/signer.js\";\nimport { nativeSMASigner } from \"./nativeSMASigner.js\";\nimport { modularAccountAbi } from \"../abis/modularAccountAbi.js\";\nimport { serializeModuleEntity } from \"../actions/common/utils.js\";\n\nconst executeUserOpSelector: Hex = \"0x8DD7712F\";\n\nexport type SignerEntity = {\n isGlobalValidation: boolean;\n entityId: number;\n};\n\nexport type ExecutionDataView = {\n module: Address;\n skipRuntimeValidation: boolean;\n allowGlobalValidation: boolean;\n executionHooks: readonly Hex[];\n};\n\nexport type ValidationDataView = {\n validationHooks: readonly Hex[];\n executionHooks: readonly Hex[];\n selectors: readonly Hex[];\n validationFlags: number;\n};\n\nexport type ValidationDataParams =\n | {\n validationModuleAddress: Address;\n entityId?: never;\n }\n | {\n validationModuleAddress?: never;\n entityId: number;\n };\n\nexport type MAV2Account<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartContractAccountWithSigner<\"MAV2Account\", TSigner, \"0.7.0\"> & {\n signerEntity: SignerEntity;\n getExecutionData: (selector: Hex) => Promise<ExecutionDataView>;\n getValidationData: (\n args: ValidationDataParams\n ) => Promise<ValidationDataView>;\n encodeCallData: (callData: Hex) => Promise<Hex>;\n};\n\nexport type CreateSMAV2AccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = Pick<\n ToSmartContractAccountParams<\"MAV2Account\", TTransport, Chain, \"0.7.0\">,\n \"transport\" | \"chain\" | \"accountAddress\"\n> & {\n signer: TSigner;\n salt?: bigint;\n factoryAddress?: Address;\n initCode?: Hex;\n initialOwner?: Address;\n entryPoint?: EntryPointDef<\"0.7.0\", Chain>;\n signerEntity?: SignerEntity;\n};\n\nexport async function createSMAV2Account<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n config: CreateSMAV2AccountParams<TTransport, TSigner>\n): Promise<MAV2Account<TSigner>>;\n\n/**\n * Creates an SMAV2 account using defined parameters including chain, signer, salt, factory address, and more.\n * Handles account initialization code, nonce generation, transaction encoding, and more to construct a modular account with optional validation hooks.\n *\n * @param {CreateSMAV2AccountParams} config Configuration parameters for creating an SMAV2 account. Includes chain details, signer, salt, factory address, and more.\n * @returns {Promise<MAV2Account>} A promise that resolves to an `MAV2Account` providing methods for nonce retrieval, transaction execution, and more.\n */\nexport async function createSMAV2Account(\n config: CreateSMAV2AccountParams\n): Promise<MAV2Account> {\n const {\n transport,\n chain,\n signer,\n salt = 0n,\n factoryAddress = getDefaultMAV2FactoryAddress(chain),\n initCode,\n initialOwner,\n accountAddress,\n entryPoint = getEntryPoint(chain, { version: \"0.7.0\" }),\n signerEntity = {\n isGlobalValidation: true,\n entityId: DEFAULT_OWNER_ENTITY_ID,\n },\n signerEntity: {\n isGlobalValidation = true,\n entityId = DEFAULT_OWNER_ENTITY_ID,\n } = {},\n } = config;\n\n if (entityId > Number(maxUint32)) {\n throw new InvalidEntityIdError(entityId);\n }\n\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const getAccountInitCode = async () => {\n if (initCode) {\n return initCode;\n }\n\n // If an initial owner is not provided, use the signer's address\n const ownerAddress = initialOwner ?? (await signer.getAddress());\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: accountFactoryAbi,\n functionName: \"createSemiModularAccount\",\n args: [ownerAddress, salt],\n }),\n ]);\n };\n\n const encodeExecute: (tx: AccountOp) => Promise<Hex> = async ({\n target,\n data,\n value,\n }) =>\n await encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"execute\",\n args: [target, value ?? 0n, data],\n })\n );\n\n const encodeBatchExecute: (txs: AccountOp[]) => Promise<Hex> = async (txs) =>\n await encodeCallData(\n encodeFunctionData({\n abi: modularAccountAbi,\n functionName: \"executeBatch\",\n args: [\n txs.map((tx) => ({\n target: tx.target,\n data: tx.data,\n value: tx.value ?? 0n,\n })),\n ],\n })\n );\n\n const _accountAddress = await getAccountAddress({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n const baseAccount = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress: _accountAddress,\n source: `MAV2Account`,\n encodeExecute,\n encodeBatchExecute,\n getAccountInitCode,\n ...(entityId === DEFAULT_OWNER_ENTITY_ID\n ? nativeSMASigner(signer, chain, _accountAddress)\n : singleSignerMessageSigner(signer, chain, _accountAddress, entityId)),\n });\n\n // TODO: add deferred action flag\n const getAccountNonce = async (nonceKey: bigint = 0n): Promise<bigint> => {\n if (nonceKey > maxUint152) {\n throw new InvalidNonceKeyError(nonceKey);\n }\n\n const entryPointContract = getContract({\n address: entryPoint.address,\n abi: entryPoint.abi,\n client,\n });\n\n const fullNonceKey: bigint =\n (nonceKey << 40n) +\n BigInt(entityId << 8) +\n (isGlobalValidation ? 1n : 0n);\n\n return entryPointContract.read.getNonce([\n _accountAddress,\n fullNonceKey,\n ]) as Promise<bigint>;\n };\n\n const accountContract = getContract({\n address: _accountAddress,\n abi: modularAccountAbi,\n client,\n });\n\n const getExecutionData = async (selector: Hex) => {\n if (!(await baseAccount.isAccountDeployed())) {\n return {\n module: zeroAddress,\n skipRuntimeValidation: false,\n allowGlobalValidation: false,\n executionHooks: [],\n };\n }\n\n return await accountContract.read.getExecutionData([selector]);\n };\n\n const getValidationData = async (args: ValidationDataParams) => {\n if (!(await baseAccount.isAccountDeployed())) {\n return {\n validationHooks: [],\n executionHooks: [],\n selectors: [],\n validationFlags: 0,\n };\n }\n\n const { validationModuleAddress, entityId } = args;\n return await accountContract.read.getValidationData([\n serializeModuleEntity({\n moduleAddress: validationModuleAddress ?? zeroAddress,\n entityId: entityId ?? Number(maxUint32),\n }),\n ]);\n };\n\n const encodeCallData = async (callData: Hex): Promise<Hex> => {\n const validationData = await getValidationData({\n entityId: Number(entityId),\n });\n\n return validationData.executionHooks.length\n ? concatHex([executeUserOpSelector, callData])\n : callData;\n };\n\n return {\n ...baseAccount,\n getAccountNonce,\n getSigner: () => signer,\n signerEntity,\n getExecutionData,\n getValidationData,\n encodeCallData,\n };\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
export type ModuleEntity = {
|
|
3
|
+
moduleAddress: Address;
|
|
4
|
+
entityId: number;
|
|
5
|
+
};
|
|
6
|
+
export type ValidationConfig = {
|
|
7
|
+
moduleAddress: Address;
|
|
8
|
+
entityId: number;
|
|
9
|
+
isGlobal: boolean;
|
|
10
|
+
isSignatureValidation: boolean;
|
|
11
|
+
isUserOpValidation: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare enum HookType {
|
|
14
|
+
EXECUTION = "0x00",
|
|
15
|
+
VALIDATION = "0x01"
|
|
16
|
+
}
|
|
17
|
+
export type HookConfig = {
|
|
18
|
+
address: Address;
|
|
19
|
+
entityId: number;
|
|
20
|
+
hookType: HookType;
|
|
21
|
+
hasPreHooks: boolean;
|
|
22
|
+
hasPostHooks: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type ValidationData = {
|
|
25
|
+
isGlobal: boolean;
|
|
26
|
+
isSignatureValidation: boolean;
|
|
27
|
+
isUserOpValidation: boolean;
|
|
28
|
+
validationHooks: HookConfig[];
|
|
29
|
+
executionHooks: Hex[];
|
|
30
|
+
selectors: Hex[];
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ma-v2/actions/common/types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,8BAAkB,CAAA;IAClB,+BAAmB,CAAA;AACrB,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB","sourcesContent":["import type { Address, Hex } from \"viem\";\n\nexport type ModuleEntity = {\n moduleAddress: Address;\n entityId: number;\n};\n\nexport type ValidationConfig = {\n moduleAddress: Address;\n entityId: number; // uint32\n isGlobal: boolean;\n isSignatureValidation: boolean;\n isUserOpValidation: boolean;\n};\n\nexport enum HookType {\n EXECUTION = \"0x00\",\n VALIDATION = \"0x01\",\n}\n\nexport type HookConfig = {\n address: Address;\n entityId: number; // uint32\n hookType: HookType;\n hasPreHooks: boolean;\n hasPostHooks: boolean;\n};\n\n// maps to type ValidationStorage in MAv2 implementation\nexport type ValidationData = {\n isGlobal: boolean; // validation flag\n isSignatureValidation: boolean; // validation flag\n isUserOpValidation: boolean;\n validationHooks: HookConfig[];\n executionHooks: Hex[];\n selectors: Hex[];\n};\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type Hex } from "viem";
|
|
2
|
+
import type { ValidationConfig, HookConfig, ModuleEntity } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Serializes a validation configuration into a hexadecimal string representation. This involves converting boolean flags into bitwise representation and combining them with serialized module entity data.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { serializeValidationConfig } from "@account-kit/smart-contracts";
|
|
9
|
+
* import { Address } from "viem";
|
|
10
|
+
*
|
|
11
|
+
* const moduleAddress: Address = "0x1234";
|
|
12
|
+
* const entityId: number = 1234;
|
|
13
|
+
* const isGlobal: boolean = true;
|
|
14
|
+
* const isSignatureValidation: boolean = false;
|
|
15
|
+
* const isUserOpValidation: boolean = true;
|
|
16
|
+
*
|
|
17
|
+
* const validationConfigHex = serializeValidationConfig({
|
|
18
|
+
* moduleAddress,
|
|
19
|
+
* entityId
|
|
20
|
+
* isGlobal,
|
|
21
|
+
* isSignatureValidation,
|
|
22
|
+
* isUserOpValidation
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
* @param {ValidationConfig} config The validation configuration object containing details to serialize
|
|
26
|
+
* @returns {Hex} A hexadecimal string representing the serialized configuration
|
|
27
|
+
*/
|
|
28
|
+
export declare function serializeValidationConfig(config: ValidationConfig): Hex;
|
|
29
|
+
/**
|
|
30
|
+
* Serializes a `HookConfig` object into a `Hex` format by encoding the hook type, presence of post/pre hooks, address, and entity ID.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { type HookType, serializeHookConfig } from "@account-kit/smart-contracts";
|
|
35
|
+
* import { Address } from "viem";
|
|
36
|
+
*
|
|
37
|
+
* const moduleAddress: Address = "0x1234";
|
|
38
|
+
* const entityId: number = 1234;
|
|
39
|
+
* const hookType: HookType = HookType.Validation;
|
|
40
|
+
* const hasPostHooks: boolean = false;
|
|
41
|
+
* const hasPreHooks: boolean = true;
|
|
42
|
+
*
|
|
43
|
+
* const hookConfigHex = serializeHookConfig({
|
|
44
|
+
* moduleAddress,
|
|
45
|
+
* entityId
|
|
46
|
+
* hookType,
|
|
47
|
+
* hasPostHooks,
|
|
48
|
+
* hasPreHooks
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param {HookConfig} config The hook configuration containing address, entity ID, hook type, and post/pre hook indicators
|
|
53
|
+
* @returns {Hex} The serialized hook configuration in hexadecimal format
|
|
54
|
+
*/
|
|
55
|
+
export declare function serializeHookConfig(config: HookConfig): Hex;
|
|
56
|
+
/**
|
|
57
|
+
* Serializes a module entity into a hexadecimal format by concatenating the module address and entity ID.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { serializeModuleEntity } from "@account-kit/smart-contracts";
|
|
62
|
+
* import { Address } from "viem";
|
|
63
|
+
*
|
|
64
|
+
* const moduleAddress: Address = "0x1234";
|
|
65
|
+
* const entityId: number = 1234;
|
|
66
|
+
*
|
|
67
|
+
* const moduleEntityHex = serializeModuleEntity({
|
|
68
|
+
* moduleAddress,
|
|
69
|
+
* entityId
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @param {ModuleEntity} config The module entity configuration containing the module address and entity ID
|
|
74
|
+
* @returns {Hex} A hexadecimal string representation of the serialized module entity
|
|
75
|
+
*/
|
|
76
|
+
export declare function serializeModuleEntity(config: ModuleEntity): Hex;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { toHex, concatHex } from "viem";
|
|
2
|
+
import { HookType } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Serializes a validation configuration into a hexadecimal string representation. This involves converting boolean flags into bitwise representation and combining them with serialized module entity data.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { serializeValidationConfig } from "@account-kit/smart-contracts";
|
|
9
|
+
* import { Address } from "viem";
|
|
10
|
+
*
|
|
11
|
+
* const moduleAddress: Address = "0x1234";
|
|
12
|
+
* const entityId: number = 1234;
|
|
13
|
+
* const isGlobal: boolean = true;
|
|
14
|
+
* const isSignatureValidation: boolean = false;
|
|
15
|
+
* const isUserOpValidation: boolean = true;
|
|
16
|
+
*
|
|
17
|
+
* const validationConfigHex = serializeValidationConfig({
|
|
18
|
+
* moduleAddress,
|
|
19
|
+
* entityId
|
|
20
|
+
* isGlobal,
|
|
21
|
+
* isSignatureValidation,
|
|
22
|
+
* isUserOpValidation
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
* @param {ValidationConfig} config The validation configuration object containing details to serialize
|
|
26
|
+
* @returns {Hex} A hexadecimal string representing the serialized configuration
|
|
27
|
+
*/
|
|
28
|
+
export function serializeValidationConfig(config) {
|
|
29
|
+
const isUserOpValidationBit = config.isUserOpValidation ? 1 : 0;
|
|
30
|
+
const isSignatureValidationBit = config.isSignatureValidation ? 2 : 0;
|
|
31
|
+
const isGlobalBit = config.isGlobal ? 4 : 0;
|
|
32
|
+
return concatHex([
|
|
33
|
+
serializeModuleEntity(config),
|
|
34
|
+
toHex(isUserOpValidationBit + isSignatureValidationBit + isGlobalBit, {
|
|
35
|
+
size: 1,
|
|
36
|
+
}),
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Serializes a `HookConfig` object into a `Hex` format by encoding the hook type, presence of post/pre hooks, address, and entity ID.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { type HookType, serializeHookConfig } from "@account-kit/smart-contracts";
|
|
45
|
+
* import { Address } from "viem";
|
|
46
|
+
*
|
|
47
|
+
* const moduleAddress: Address = "0x1234";
|
|
48
|
+
* const entityId: number = 1234;
|
|
49
|
+
* const hookType: HookType = HookType.Validation;
|
|
50
|
+
* const hasPostHooks: boolean = false;
|
|
51
|
+
* const hasPreHooks: boolean = true;
|
|
52
|
+
*
|
|
53
|
+
* const hookConfigHex = serializeHookConfig({
|
|
54
|
+
* moduleAddress,
|
|
55
|
+
* entityId
|
|
56
|
+
* hookType,
|
|
57
|
+
* hasPostHooks,
|
|
58
|
+
* hasPreHooks
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param {HookConfig} config The hook configuration containing address, entity ID, hook type, and post/pre hook indicators
|
|
63
|
+
* @returns {Hex} The serialized hook configuration in hexadecimal format
|
|
64
|
+
*/
|
|
65
|
+
export function serializeHookConfig(config) {
|
|
66
|
+
const hookTypeBit = config.hookType === HookType.VALIDATION ? 1 : 0;
|
|
67
|
+
const hasPostHooksBit = config.hasPostHooks ? 2 : 0;
|
|
68
|
+
const hasPreHooksBit = config.hasPreHooks ? 4 : 0;
|
|
69
|
+
return concatHex([
|
|
70
|
+
config.address,
|
|
71
|
+
toHex(config.entityId, { size: 4 }),
|
|
72
|
+
toHex(hookTypeBit + hasPostHooksBit + hasPreHooksBit, {
|
|
73
|
+
size: 1,
|
|
74
|
+
}),
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Serializes a module entity into a hexadecimal format by concatenating the module address and entity ID.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { serializeModuleEntity } from "@account-kit/smart-contracts";
|
|
83
|
+
* import { Address } from "viem";
|
|
84
|
+
*
|
|
85
|
+
* const moduleAddress: Address = "0x1234";
|
|
86
|
+
* const entityId: number = 1234;
|
|
87
|
+
*
|
|
88
|
+
* const moduleEntityHex = serializeModuleEntity({
|
|
89
|
+
* moduleAddress,
|
|
90
|
+
* entityId
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @param {ModuleEntity} config The module entity configuration containing the module address and entity ID
|
|
95
|
+
* @returns {Hex} A hexadecimal string representation of the serialized module entity
|
|
96
|
+
*/
|
|
97
|
+
export function serializeModuleEntity(config) {
|
|
98
|
+
return concatHex([config.moduleAddress, toHex(config.entityId, { size: 4 })]);
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../src/ma-v2/actions/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC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M,UAAU,qBAAqB,CAAC,MAAoB;IACxD,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import { type Hex, toHex, concatHex } from \"viem\";\nimport type { ValidationConfig, HookConfig, ModuleEntity } from \"./types\";\nimport { HookType } from \"./types.js\";\n\n/**\n * Serializes a validation configuration into a hexadecimal string representation. This involves converting boolean flags into bitwise representation and combining them with serialized module entity data.\n *\n * @example\n * ```ts\n * import { serializeValidationConfig } from \"@account-kit/smart-contracts\";\n * import { Address } from \"viem\";\n *\n * const moduleAddress: Address = \"0x1234\";\n * const entityId: number = 1234;\n * const isGlobal: boolean = true;\n * const isSignatureValidation: boolean = false;\n * const isUserOpValidation: boolean = true;\n *\n * const validationConfigHex = serializeValidationConfig({\n * moduleAddress,\n * entityId\n * isGlobal,\n * isSignatureValidation,\n * isUserOpValidation\n * });\n * ```\n * @param {ValidationConfig} config The validation configuration object containing details to serialize\n * @returns {Hex} A hexadecimal string representing the serialized configuration\n */\nexport function serializeValidationConfig(config: ValidationConfig): Hex {\n const isUserOpValidationBit = config.isUserOpValidation ? 1 : 0;\n const isSignatureValidationBit = config.isSignatureValidation ? 2 : 0;\n const isGlobalBit = config.isGlobal ? 4 : 0;\n return concatHex([\n serializeModuleEntity(config),\n toHex(isUserOpValidationBit + isSignatureValidationBit + isGlobalBit, {\n size: 1,\n }),\n ]);\n}\n\n/**\n * Serializes a `HookConfig` object into a `Hex` format by encoding the hook type, presence of post/pre hooks, address, and entity ID.\n *\n * @example\n * ```ts\n * import { type HookType, serializeHookConfig } from \"@account-kit/smart-contracts\";\n * import { Address } from \"viem\";\n *\n * const moduleAddress: Address = \"0x1234\";\n * const entityId: number = 1234;\n * const hookType: HookType = HookType.Validation;\n * const hasPostHooks: boolean = false;\n * const hasPreHooks: boolean = true;\n *\n * const hookConfigHex = serializeHookConfig({\n * moduleAddress,\n * entityId\n * hookType,\n * hasPostHooks,\n * hasPreHooks\n * });\n * ```\n *\n * @param {HookConfig} config The hook configuration containing address, entity ID, hook type, and post/pre hook indicators\n * @returns {Hex} The serialized hook configuration in hexadecimal format\n */\nexport function serializeHookConfig(config: HookConfig): Hex {\n const hookTypeBit = config.hookType === HookType.VALIDATION ? 1 : 0;\n const hasPostHooksBit = config.hasPostHooks ? 2 : 0;\n const hasPreHooksBit = config.hasPreHooks ? 4 : 0;\n return concatHex([\n config.address,\n toHex(config.entityId, { size: 4 }),\n toHex(hookTypeBit + hasPostHooksBit + hasPreHooksBit, {\n size: 1,\n }),\n ]);\n}\n\n/**\n * Serializes a module entity into a hexadecimal format by concatenating the module address and entity ID.\n *\n * @example\n * ```ts\n * import { serializeModuleEntity } from \"@account-kit/smart-contracts\";\n * import { Address } from \"viem\";\n *\n * const moduleAddress: Address = \"0x1234\";\n * const entityId: number = 1234;\n *\n * const moduleEntityHex = serializeModuleEntity({\n * moduleAddress,\n * entityId\n * });\n * ```\n *\n * @param {ModuleEntity} config The module entity configuration containing the module address and entity ID\n * @returns {Hex} A hexadecimal string representation of the serialized module entity\n */\nexport function serializeModuleEntity(config: ModuleEntity): Hex {\n return concatHex([config.moduleAddress, toHex(config.entityId, { size: 4 })]);\n}\n"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type GetEntryPointFromAccount, type SendUserOperationResult, type UserOperationOverridesParameter, type SmartAccountSigner } from "@aa-sdk/core";
|
|
2
|
+
import { type Address, type Hex } from "viem";
|
|
3
|
+
import type { HookConfig, ValidationConfig } from "../common/types.js";
|
|
4
|
+
import { type SMAV2AccountClient } from "../../client/client.js";
|
|
5
|
+
import { type MAV2Account } from "../../account/semiModularAccountV2.js";
|
|
6
|
+
export type InstallValidationParams<TSigner extends SmartAccountSigner = SmartAccountSigner> = {
|
|
7
|
+
validationConfig: ValidationConfig;
|
|
8
|
+
selectors: Hex[];
|
|
9
|
+
installData: Hex;
|
|
10
|
+
hooks: {
|
|
11
|
+
hookConfig: HookConfig;
|
|
12
|
+
initData: Hex;
|
|
13
|
+
}[];
|
|
14
|
+
account?: MAV2Account<TSigner> | undefined;
|
|
15
|
+
} & UserOperationOverridesParameter<GetEntryPointFromAccount<MAV2Account<TSigner>>>;
|
|
16
|
+
export type UninstallValidationParams<TSigner extends SmartAccountSigner = SmartAccountSigner> = {
|
|
17
|
+
moduleAddress: Address;
|
|
18
|
+
entityId: number;
|
|
19
|
+
uninstallData: Hex;
|
|
20
|
+
hookUninstallDatas: Hex[];
|
|
21
|
+
account?: MAV2Account<TSigner> | undefined;
|
|
22
|
+
} & UserOperationOverridesParameter<GetEntryPointFromAccount<MAV2Account<TSigner>>>;
|
|
23
|
+
export type InstallValidationActions<TSigner extends SmartAccountSigner = SmartAccountSigner> = {
|
|
24
|
+
installValidation: (args: InstallValidationParams<TSigner>) => Promise<SendUserOperationResult>;
|
|
25
|
+
uninstallValidation: (args: UninstallValidationParams<TSigner>) => Promise<SendUserOperationResult>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { createSMAV2AccountClient, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from "@account-kit/smart-contracts";
|
|
33
|
+
* import { Address } from "viem";
|
|
34
|
+
*
|
|
35
|
+
* const client = (await createSMAV2AccountClient({ ... })).extend(installValidationActions);
|
|
36
|
+
* const sessionKeyAddress: Address = "0x1234";
|
|
37
|
+
* const sessionKeyEntityId: number = 1;
|
|
38
|
+
*
|
|
39
|
+
* await client.installValidation({
|
|
40
|
+
* validationConfig: {
|
|
41
|
+
* moduleAddress: getDefaultSingleSignerValidationModuleAddress(
|
|
42
|
+
* client.chain
|
|
43
|
+
* ),
|
|
44
|
+
* entityId: sessionKeyEntityId,
|
|
45
|
+
* isGlobal: true,
|
|
46
|
+
* isSignatureValidation: false,
|
|
47
|
+
* isUserOpValidation: true,
|
|
48
|
+
* },
|
|
49
|
+
* selectors: [],
|
|
50
|
+
* installData: SingleSignerValidationModule.encodeOnInstallData({
|
|
51
|
+
* entityId: sessionKeyEntityId,
|
|
52
|
+
* signer: sessionKeyAddress,
|
|
53
|
+
* }),
|
|
54
|
+
* hooks: [],
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* await client.uninstallValidation({
|
|
58
|
+
* moduleAddress: sessionKeyAddress,
|
|
59
|
+
* entityId: sessionKeyEntityId,
|
|
60
|
+
* uninstallData: SingleSignerValidationModule.encodeOnUninstallData({
|
|
61
|
+
* entityId: sessionKeyEntityId,
|
|
62
|
+
* }),
|
|
63
|
+
* hookUninstallDatas: [],
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param {object} client - The client instance which provides account and sendUserOperation functionality.
|
|
69
|
+
* @returns {object} - An object containing two methods, `installValidation` and `uninstallValidation`.
|
|
70
|
+
*/
|
|
71
|
+
export declare const installValidationActions: <TSigner extends SmartAccountSigner = SmartAccountSigner>(client: SMAV2AccountClient<TSigner>) => InstallValidationActions<TSigner>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { AccountNotFoundError, IncompatibleClientError, isSmartAccountClient, EntityIdOverrideError, } from "@aa-sdk/core";
|
|
2
|
+
import { encodeFunctionData, concatHex, zeroAddress, } from "viem";
|
|
3
|
+
import { semiModularAccountBytecodeAbi } from "../../abis/semiModularAccountBytecodeAbi.js";
|
|
4
|
+
import { serializeValidationConfig, serializeHookConfig, serializeModuleEntity, } from "../common/utils.js";
|
|
5
|
+
import {} from "../../client/client.js";
|
|
6
|
+
import {} from "../../account/semiModularAccountV2.js";
|
|
7
|
+
import { DEFAULT_OWNER_ENTITY_ID } from "../../utils.js";
|
|
8
|
+
/**
|
|
9
|
+
* Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { createSMAV2AccountClient, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from "@account-kit/smart-contracts";
|
|
14
|
+
* import { Address } from "viem";
|
|
15
|
+
*
|
|
16
|
+
* const client = (await createSMAV2AccountClient({ ... })).extend(installValidationActions);
|
|
17
|
+
* const sessionKeyAddress: Address = "0x1234";
|
|
18
|
+
* const sessionKeyEntityId: number = 1;
|
|
19
|
+
*
|
|
20
|
+
* await client.installValidation({
|
|
21
|
+
* validationConfig: {
|
|
22
|
+
* moduleAddress: getDefaultSingleSignerValidationModuleAddress(
|
|
23
|
+
* client.chain
|
|
24
|
+
* ),
|
|
25
|
+
* entityId: sessionKeyEntityId,
|
|
26
|
+
* isGlobal: true,
|
|
27
|
+
* isSignatureValidation: false,
|
|
28
|
+
* isUserOpValidation: true,
|
|
29
|
+
* },
|
|
30
|
+
* selectors: [],
|
|
31
|
+
* installData: SingleSignerValidationModule.encodeOnInstallData({
|
|
32
|
+
* entityId: sessionKeyEntityId,
|
|
33
|
+
* signer: sessionKeyAddress,
|
|
34
|
+
* }),
|
|
35
|
+
* hooks: [],
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* await client.uninstallValidation({
|
|
39
|
+
* moduleAddress: sessionKeyAddress,
|
|
40
|
+
* entityId: sessionKeyEntityId,
|
|
41
|
+
* uninstallData: SingleSignerValidationModule.encodeOnUninstallData({
|
|
42
|
+
* entityId: sessionKeyEntityId,
|
|
43
|
+
* }),
|
|
44
|
+
* hookUninstallDatas: [],
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param {object} client - The client instance which provides account and sendUserOperation functionality.
|
|
50
|
+
* @returns {object} - An object containing two methods, `installValidation` and `uninstallValidation`.
|
|
51
|
+
*/
|
|
52
|
+
export const installValidationActions = (client) => ({
|
|
53
|
+
installValidation: async ({ validationConfig, selectors, installData, hooks, account = client.account, overrides, }) => {
|
|
54
|
+
if (!account) {
|
|
55
|
+
throw new AccountNotFoundError();
|
|
56
|
+
}
|
|
57
|
+
if (!isSmartAccountClient(client)) {
|
|
58
|
+
throw new IncompatibleClientError("SmartAccountClient", "installValidation", client);
|
|
59
|
+
}
|
|
60
|
+
// an entityId of zero is only allowed if we're installing or uninstalling hooks on the fallback validation
|
|
61
|
+
if (validationConfig.entityId === DEFAULT_OWNER_ENTITY_ID &&
|
|
62
|
+
validationConfig.moduleAddress !== zeroAddress) {
|
|
63
|
+
throw new EntityIdOverrideError();
|
|
64
|
+
}
|
|
65
|
+
const { encodeCallData } = account;
|
|
66
|
+
const callData = await encodeCallData(encodeFunctionData({
|
|
67
|
+
abi: semiModularAccountBytecodeAbi,
|
|
68
|
+
functionName: "installValidation",
|
|
69
|
+
args: [
|
|
70
|
+
serializeValidationConfig(validationConfig),
|
|
71
|
+
selectors,
|
|
72
|
+
installData,
|
|
73
|
+
hooks.map((hook) => concatHex([serializeHookConfig(hook.hookConfig), hook.initData])),
|
|
74
|
+
],
|
|
75
|
+
}));
|
|
76
|
+
return client.sendUserOperation({
|
|
77
|
+
uo: callData,
|
|
78
|
+
account,
|
|
79
|
+
overrides,
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
uninstallValidation: async ({ moduleAddress, entityId, uninstallData, hookUninstallDatas, account = client.account, overrides, }) => {
|
|
83
|
+
if (!account) {
|
|
84
|
+
throw new AccountNotFoundError();
|
|
85
|
+
}
|
|
86
|
+
if (!isSmartAccountClient(client)) {
|
|
87
|
+
throw new IncompatibleClientError("SmartAccountClient", "uninstallValidation", client);
|
|
88
|
+
}
|
|
89
|
+
const { encodeCallData } = account;
|
|
90
|
+
const callData = await encodeCallData(encodeFunctionData({
|
|
91
|
+
abi: semiModularAccountBytecodeAbi,
|
|
92
|
+
functionName: "uninstallValidation",
|
|
93
|
+
args: [
|
|
94
|
+
serializeModuleEntity({
|
|
95
|
+
moduleAddress,
|
|
96
|
+
entityId,
|
|
97
|
+
}),
|
|
98
|
+
uninstallData,
|
|
99
|
+
hookUninstallDatas,
|
|
100
|
+
],
|
|
101
|
+
}));
|
|
102
|
+
return client.sendUserOperation({
|
|
103
|
+
uo: callData,
|
|
104
|
+
account,
|
|
105
|
+
overrides,
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=installValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installValidation.js","sourceRoot":"","sources":["../../../../../../src/ma-v2/actions/install-validation/installValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,GAKtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,kBAAkB,EAClB,SAAS,EACT,WAAW,GACZ,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAE5F,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAA2B,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAoB,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAwCzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAII,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpD,iBAAiB,EAAE,KAAK,EAAE,EACxB,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,KAAK,EACL,OAAO,GAAG,MAAM,CAAC,OAAO,EACxB,SAAS,GACV,EAAE,EAAE;QACH,IAAI,CAAC,OAAO,EAAE,CAAC;Y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B,qBAAqB,EACrB,MAAM,CACP,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;QAEnC,MAAM,QAAQ,GAAG,MAAM,cAAc,CACnC,kBAAkB,CAAC;YACjB,GAAG,EAAE,6BAA6B;YAClC,YAAY,EAAE,qBAAqB;YACnC,IAAI,EAAE;gBACJ,qBAAqB,CAAC;oBACpB,aAAa;oBACb,QAAQ;iBACT,CAAC;gBACF,aAAa;gBACb,kBAAkB;aACnB;SACF,CAAC,CACH,CAAC;QAEF,OAAO,MAAM,CAAC,iBAAiB,CAAC;YAC9B,EAAE,EAAE,QAAQ;YACZ,OAAO;YACP,SAAS;SACV,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n EntityIdOverrideError,\n type GetEntryPointFromAccount,\n type SendUserOperationResult,\n type UserOperationOverridesParameter,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n type Address,\n type Hex,\n encodeFunctionData,\n concatHex,\n zeroAddress,\n} from \"viem\";\n\nimport { semiModularAccountBytecodeAbi } from \"../../abis/semiModularAccountBytecodeAbi.js\";\nimport type { HookConfig, ValidationConfig } from \"../common/types.js\";\nimport {\n serializeValidationConfig,\n serializeHookConfig,\n serializeModuleEntity,\n} from \"../common/utils.js\";\n\nimport { type SMAV2AccountClient } from \"../../client/client.js\";\nimport { type MAV2Account } from \"../../account/semiModularAccountV2.js\";\nimport { DEFAULT_OWNER_ENTITY_ID } from \"../../utils.js\";\n\nexport type InstallValidationParams<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n validationConfig: ValidationConfig;\n selectors: Hex[];\n installData: Hex;\n hooks: {\n hookConfig: HookConfig;\n initData: Hex;\n }[];\n account?: MAV2Account<TSigner> | undefined;\n} & UserOperationOverridesParameter<\n GetEntryPointFromAccount<MAV2Account<TSigner>>\n>;\n\nexport type UninstallValidationParams<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n moduleAddress: Address;\n entityId: number;\n uninstallData: Hex;\n hookUninstallDatas: Hex[];\n account?: MAV2Account<TSigner> | undefined;\n} & UserOperationOverridesParameter<\n GetEntryPointFromAccount<MAV2Account<TSigner>>\n>;\n\nexport type InstallValidationActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = {\n installValidation: (\n args: InstallValidationParams<TSigner>\n ) => Promise<SendUserOperationResult>;\n uninstallValidation: (\n args: UninstallValidationParams<TSigner>\n ) => Promise<SendUserOperationResult>;\n};\n\n/**\n * Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`.\n *\n * @example\n * ```ts\n * import { createSMAV2AccountClient, installValidationActions, getDefaultSingleSignerValidationModuleAddress, SingleSignerValidationModule } from \"@account-kit/smart-contracts\";\n * import { Address } from \"viem\";\n *\n * const client = (await createSMAV2AccountClient({ ... })).extend(installValidationActions);\n * const sessionKeyAddress: Address = \"0x1234\";\n * const sessionKeyEntityId: number = 1;\n *\n * await client.installValidation({\n * validationConfig: {\n * moduleAddress: getDefaultSingleSignerValidationModuleAddress(\n * client.chain\n * ),\n * entityId: sessionKeyEntityId,\n * isGlobal: true,\n * isSignatureValidation: false,\n * isUserOpValidation: true,\n * },\n * selectors: [],\n * installData: SingleSignerValidationModule.encodeOnInstallData({\n * entityId: sessionKeyEntityId,\n * signer: sessionKeyAddress,\n * }),\n * hooks: [],\n * });\n *\n * await client.uninstallValidation({\n * moduleAddress: sessionKeyAddress,\n * entityId: sessionKeyEntityId,\n * uninstallData: SingleSignerValidationModule.encodeOnUninstallData({\n * entityId: sessionKeyEntityId,\n * }),\n * hookUninstallDatas: [],\n * });\n *\n * ```\n *\n * @param {object} client - The client instance which provides account and sendUserOperation functionality.\n * @returns {object} - An object containing two methods, `installValidation` and `uninstallValidation`.\n */\nexport const installValidationActions: <\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n client: SMAV2AccountClient<TSigner>\n) => InstallValidationActions<TSigner> = (client) => ({\n installValidation: async ({\n validationConfig,\n selectors,\n installData,\n hooks,\n account = client.account,\n overrides,\n }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"installValidation\",\n client\n );\n }\n\n // an entityId of zero is only allowed if we're installing or uninstalling hooks on the fallback validation\n if (\n validationConfig.entityId === DEFAULT_OWNER_ENTITY_ID &&\n validationConfig.moduleAddress !== zeroAddress\n ) {\n throw new EntityIdOverrideError();\n }\n\n const { encodeCallData } = account;\n\n const callData = await encodeCallData(\n encodeFunctionData({\n abi: semiModularAccountBytecodeAbi,\n functionName: \"installValidation\",\n args: [\n serializeValidationConfig(validationConfig),\n selectors,\n installData,\n hooks.map((hook: { hookConfig: HookConfig; initData: Hex }) =>\n concatHex([serializeHookConfig(hook.hookConfig), hook.initData])\n ),\n ],\n })\n );\n\n return client.sendUserOperation({\n uo: callData,\n account,\n overrides,\n });\n },\n\n uninstallValidation: async ({\n moduleAddress,\n entityId,\n uninstallData,\n hookUninstallDatas,\n account = client.account,\n overrides,\n }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"uninstallValidation\",\n client\n );\n }\n\n const { encodeCallData } = account;\n\n const callData = await encodeCallData(\n encodeFunctionData({\n abi: semiModularAccountBytecodeAbi,\n functionName: \"uninstallValidation\",\n args: [\n serializeModuleEntity({\n moduleAddress,\n entityId,\n }),\n uninstallData,\n hookUninstallDatas,\n ],\n })\n );\n\n return client.sendUserOperation({\n uo: callData,\n account,\n overrides,\n });\n },\n});\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SmartAccountClient, type SmartAccountSigner, type SmartAccountClientConfig } from "@aa-sdk/core";
|
|
2
|
+
import { type Chain, type Transport } from "viem";
|
|
3
|
+
import { type CreateSMAV2AccountParams, type MAV2Account } from "../account/semiModularAccountV2.js";
|
|
4
|
+
export type SMAV2AccountClient<TSigner extends SmartAccountSigner = SmartAccountSigner> = SmartAccountClient<Transport, Chain, MAV2Account<TSigner>>;
|
|
5
|
+
export type CreateSMAV2AccountClientParams<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner> = CreateSMAV2AccountParams<TTransport, TSigner> & Omit<SmartAccountClientConfig<TTransport, TChain>, "transport" | "account" | "chain">;
|
|
6
|
+
export declare function createSMAV2AccountClient<TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner>(args: CreateSMAV2AccountClientParams<Transport, TChain, TSigner>): Promise<SMAV2AccountClient<TSigner>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createSmartAccountClient, } from "@aa-sdk/core";
|
|
2
|
+
import {} from "viem";
|
|
3
|
+
import { createSMAV2Account, } from "../account/semiModularAccountV2.js";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a SMAv2 account client using the provided configuration parameters.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { http } from "viem";
|
|
10
|
+
* import { createSMAV2AccountClient } from "@account-kit/smart-contracts";
|
|
11
|
+
* import { LocalAccountSigner } from "@aa-sdk/core";
|
|
12
|
+
* import { sepolia } from "@account-kit/infra";
|
|
13
|
+
*
|
|
14
|
+
* const MNEMONIC = "...";
|
|
15
|
+
* const RPC_URL = "...";
|
|
16
|
+
*
|
|
17
|
+
* const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);
|
|
18
|
+
*
|
|
19
|
+
* const chain = sepolia;
|
|
20
|
+
*
|
|
21
|
+
* const transport = http(RPC_URL);
|
|
22
|
+
*
|
|
23
|
+
* const SMAV2SignerAccountClient = await createSMAV2AccountClient({
|
|
24
|
+
* chain,
|
|
25
|
+
* signer,
|
|
26
|
+
* transport,
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param {CreateSMAV2AccountClientParams} config The configuration parameters required to create the MAv2 account client
|
|
31
|
+
* @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance
|
|
32
|
+
*/
|
|
33
|
+
export async function createSMAV2AccountClient(config) {
|
|
34
|
+
const smaV2Account = await createSMAV2Account(config);
|
|
35
|
+
return createSmartAccountClient({
|
|
36
|
+
...config,
|
|
37
|
+
account: smaV2Account,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/ma-v2/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAIzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA8B,MAAM,MAAM,CAAC;AAElD,OAAO,EACL,kBAAkB,GAGnB,MAAM,oCAAoC,CAAC;AAuB5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsC;IAEtC,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAEtD,OAAO,wBAAwB,CAAC;QAC9B,GAAG,MAAM;QACT,OAAO,EAAE,YAAY;KACtB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n createSmartAccountClient,\n type SmartAccountClient,\n type SmartAccountSigner,\n type SmartAccountClientConfig,\n} from \"@aa-sdk/core\";\nimport { type Chain, type Transport } from \"viem\";\n\nimport {\n createSMAV2Account,\n type CreateSMAV2AccountParams,\n type MAV2Account,\n} from \"../account/semiModularAccountV2.js\";\n\nexport type SMAV2AccountClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = SmartAccountClient<Transport, Chain, MAV2Account<TSigner>>;\n\nexport type CreateSMAV2AccountClientParams<\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n> = CreateSMAV2AccountParams<TTransport, TSigner> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createSMAV2AccountClient<\n TChain extends Chain = Chain,\n TSigner extends SmartAccountSigner = SmartAccountSigner\n>(\n args: CreateSMAV2AccountClientParams<Transport, TChain, TSigner>\n): Promise<SMAV2AccountClient<TSigner>>;\n\n/**\n * Creates a SMAv2 account client using the provided configuration parameters.\n *\n * @example\n * ```ts\n * import { http } from \"viem\";\n * import { createSMAV2AccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const MNEMONIC = \"...\";\n * const RPC_URL = \"...\";\n *\n * const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);\n *\n * const chain = sepolia;\n *\n * const transport = http(RPC_URL);\n *\n * const SMAV2SignerAccountClient = await createSMAV2AccountClient({\n * chain,\n * signer,\n * transport,\n * });\n * ```\n *\n * @param {CreateSMAV2AccountClientParams} config The configuration parameters required to create the MAv2 account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` instance\n */\nexport async function createSMAV2AccountClient(\n config: CreateSMAV2AccountClientParams\n): Promise<SmartAccountClient> {\n const smaV2Account = await createSMAV2Account(config);\n\n return createSmartAccountClient({\n ...config,\n account: smaV2Account,\n });\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { accountFactoryAbi } from "./abis/accountFactoryAbi.js";
|
|
2
|
+
export { modularAccountAbi } from "./abis/modularAccountAbi.js";
|
|
3
|
+
export { semiModularAccountBytecodeAbi } from "./abis/semiModularAccountBytecodeAbi.js";
|
|
4
|
+
export { semiModularAccountStorageAbi } from "./abis/semiModularAccountStorageAbi.js";
|
|
5
|
+
export { nativeSMASigner } from "./account/nativeSMASigner.js";
|
|
6
|
+
export type * from "./account/semiModularAccountV2.js";
|
|
7
|
+
export { createSMAV2Account } from "./account/semiModularAccountV2.js";
|
|
8
|
+
export type { ModuleEntity, ValidationConfig, HookConfig, ValidationData, } from "./actions/common/types.js";
|
|
9
|
+
export { HookType } from "./actions/common/types.js";
|
|
10
|
+
export { serializeValidationConfig, serializeHookConfig, serializeModuleEntity, } from "./actions/common/utils.js";
|
|
11
|
+
export type * from "./actions/install-validation/installValidation.js";
|
|
12
|
+
export { installValidationActions } from "./actions/install-validation/installValidation.js";
|
|
13
|
+
export type * from "./client/client.js";
|
|
14
|
+
export { createSMAV2AccountClient } from "./client/client.js";
|
|
15
|
+
export { getDefaultAllowlistModuleAddress, getDefaultNativeTokenLimitModuleAddress, getDefaultPaymasterGuardModuleAddress, getDefaultSingleSignerValidationModuleAddress, getDefaultTimeRangeModuleAddress, getDefaultWebauthnValidationModuleAddress, } from "./modules/utils.js";
|
|
16
|
+
export { allowlistModuleAbi } from "./modules/allowlist-module/abis/allowlistModuleAbi.js";
|
|
17
|
+
export { AllowlistModule } from "./modules/allowlist-module/module.js";
|
|
18
|
+
export { nativeTokenLimitModuleAbi } from "./modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.js";
|
|
19
|
+
export { NativeTokenLimitModule } from "./modules/native-token-limit-module/module.js";
|
|
20
|
+
export { paymasterGuardModuleAbi } from "./modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.js";
|
|
21
|
+
export { PaymasterGuardModule } from "./modules/paymaster-guard-module/module.js";
|
|
22
|
+
export { singleSignerValidationModuleAbi } from "./modules/single-signer-validation/abis/singleSignerValidationModuleAbi.js";
|
|
23
|
+
export { SingleSignerValidationModule } from "./modules/single-signer-validation/module.js";
|
|
24
|
+
export { timeRangeModuleAbi } from "./modules/time-range-module/abis/timeRangeModuleAbi.js";
|
|
25
|
+
export { TimeRangeModule } from "./modules/time-range-module/module.js";
|
|
26
|
+
export { webauthnValidationModuleAbi } from "./modules/webauthn-validation/abis/webauthnValidationAbi.js";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// ma v2 exports
|
|
2
|
+
export { accountFactoryAbi } from "./abis/accountFactoryAbi.js";
|
|
3
|
+
export { modularAccountAbi } from "./abis/modularAccountAbi.js";
|
|
4
|
+
export { semiModularAccountBytecodeAbi } from "./abis/semiModularAccountBytecodeAbi.js";
|
|
5
|
+
export { semiModularAccountStorageAbi } from "./abis/semiModularAccountStorageAbi.js";
|
|
6
|
+
export { nativeSMASigner } from "./account/nativeSMASigner.js";
|
|
7
|
+
export { createSMAV2Account } from "./account/semiModularAccountV2.js";
|
|
8
|
+
export { HookType } from "./actions/common/types.js";
|
|
9
|
+
export { serializeValidationConfig, serializeHookConfig, serializeModuleEntity, } from "./actions/common/utils.js";
|
|
10
|
+
export { installValidationActions } from "./actions/install-validation/installValidation.js";
|
|
11
|
+
export { createSMAV2AccountClient } from "./client/client.js";
|
|
12
|
+
export { getDefaultAllowlistModuleAddress, getDefaultNativeTokenLimitModuleAddress, getDefaultPaymasterGuardModuleAddress, getDefaultSingleSignerValidationModuleAddress, getDefaultTimeRangeModuleAddress, getDefaultWebauthnValidationModuleAddress, } from "./modules/utils.js";
|
|
13
|
+
export { allowlistModuleAbi } from "./modules/allowlist-module/abis/allowlistModuleAbi.js";
|
|
14
|
+
export { AllowlistModule } from "./modules/allowlist-module/module.js";
|
|
15
|
+
export { nativeTokenLimitModuleAbi } from "./modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.js";
|
|
16
|
+
export { NativeTokenLimitModule } from "./modules/native-token-limit-module/module.js";
|
|
17
|
+
export { paymasterGuardModuleAbi } from "./modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.js";
|
|
18
|
+
export { PaymasterGuardModule } from "./modules/paymaster-guard-module/module.js";
|
|
19
|
+
export { singleSignerValidationModuleAbi } from "./modules/single-signer-validation/abis/singleSignerValidationModuleAbi.js";
|
|
20
|
+
export { SingleSignerValidationModule } from "./modules/single-signer-validation/module.js";
|
|
21
|
+
export { timeRangeModuleAbi } from "./modules/time-range-module/abis/timeRangeModuleAbi.js";
|
|
22
|
+
export { TimeRangeModule } from "./modules/time-range-module/module.js";
|
|
23
|
+
export { webauthnValidationModuleAbi } from "./modules/webauthn-validation/abis/webauthnValidationAbi.js";
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ma-v2/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAQvE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAG7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EACL,gCAAgC,EAChC,uCAAuC,EACvC,qCAAqC,EACrC,6CAA6C,EAC7C,gCAAgC,EAChC,yCAAyC,GAC1C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uEAAuE,CAAC;AAClH,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAC;AAC3G,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,+BAA+B,EAAE,MAAM,4EAA4E,CAAC;AAC7H,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAC","sourcesContent":["// ma v2 exports\nexport { accountFactoryAbi } from \"./abis/accountFactoryAbi.js\";\nexport { modularAccountAbi } from \"./abis/modularAccountAbi.js\";\nexport { semiModularAccountBytecodeAbi } from \"./abis/semiModularAccountBytecodeAbi.js\";\nexport { semiModularAccountStorageAbi } from \"./abis/semiModularAccountStorageAbi.js\";\n\nexport { nativeSMASigner } from \"./account/nativeSMASigner.js\";\nexport type * from \"./account/semiModularAccountV2.js\";\nexport { createSMAV2Account } from \"./account/semiModularAccountV2.js\";\n\nexport type {\n ModuleEntity,\n ValidationConfig,\n HookConfig,\n ValidationData,\n} from \"./actions/common/types.js\";\nexport { HookType } from \"./actions/common/types.js\";\nexport {\n serializeValidationConfig,\n serializeHookConfig,\n serializeModuleEntity,\n} from \"./actions/common/utils.js\";\nexport type * from \"./actions/install-validation/installValidation.js\";\nexport { installValidationActions } from \"./actions/install-validation/installValidation.js\";\n\nexport type * from \"./client/client.js\";\nexport { createSMAV2AccountClient } from \"./client/client.js\";\n\nexport {\n getDefaultAllowlistModuleAddress,\n getDefaultNativeTokenLimitModuleAddress,\n getDefaultPaymasterGuardModuleAddress,\n getDefaultSingleSignerValidationModuleAddress,\n getDefaultTimeRangeModuleAddress,\n getDefaultWebauthnValidationModuleAddress,\n} from \"./modules/utils.js\";\nexport { allowlistModuleAbi } from \"./modules/allowlist-module/abis/allowlistModuleAbi.js\";\nexport { AllowlistModule } from \"./modules/allowlist-module/module.js\";\nexport { nativeTokenLimitModuleAbi } from \"./modules/native-token-limit-module/abis/nativeTokenLimitModuleAbi.js\";\nexport { NativeTokenLimitModule } from \"./modules/native-token-limit-module/module.js\";\nexport { paymasterGuardModuleAbi } from \"./modules/paymaster-guard-module/abis/paymasterGuardModuleAbi.js\";\nexport { PaymasterGuardModule } from \"./modules/paymaster-guard-module/module.js\";\nexport { singleSignerValidationModuleAbi } from \"./modules/single-signer-validation/abis/singleSignerValidationModuleAbi.js\";\nexport { SingleSignerValidationModule } from \"./modules/single-signer-validation/module.js\";\nexport { timeRangeModuleAbi } from \"./modules/time-range-module/abis/timeRangeModuleAbi.js\";\nexport { TimeRangeModule } from \"./modules/time-range-module/module.js\";\nexport { webauthnValidationModuleAbi } from \"./modules/webauthn-validation/abis/webauthnValidationAbi.js\";\n"]}
|