diff --git a/account-kit/rn-signer/example/metro.config.js b/account-kit/rn-signer/example/metro.config.js index 5afc444fb6..ead41fe3b5 100644 --- a/account-kit/rn-signer/example/metro.config.js +++ b/account-kit/rn-signer/example/metro.config.js @@ -11,33 +11,33 @@ const repoRoot = path.resolve(__dirname, "../../.."); const config = getDefaultConfig(projectRoot); const monorepoPackages = { - "@account-kit/signer": path.resolve(repoRoot, "account-kit/signer"), - "@aa-sdk/core": path.resolve(repoRoot, "aa-sdk/core"), - "@account-kit/logging": path.resolve(repoRoot, "account-kit/logging"), + "@account-kit/signer": path.resolve(repoRoot, "account-kit/signer"), + "@aa-sdk/core": path.resolve(repoRoot, "aa-sdk/core"), + "@account-kit/logging": path.resolve(repoRoot, "account-kit/logging"), }; config.watchFolders = [ - projectRoot, - rnSignerRoot, - ...Object.values(monorepoPackages), + projectRoot, + rnSignerRoot, + ...Object.values(monorepoPackages), ]; // Let Metro know where to resolve packages and in what order config.resolver.nodeModulesPaths = [ - path.resolve(projectRoot, "node_modules"), - path.resolve(rnSignerRoot, "node_modules"), - path.resolve(repoRoot, "node_modules"), + path.resolve(projectRoot, "node_modules"), + path.resolve(rnSignerRoot, "node_modules"), + path.resolve(repoRoot, "node_modules"), ]; // Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` config.resolver.disableHierarchicalLookup = true; config.resolver.extraNodeModules = { - ...config.resolver.extraNodeModules, - ...require("node-libs-react-native"), - ...monorepoPackages, - crypto: require.resolve("crypto-browserify"), - stream: require.resolve("stream-browserify"), + ...config.resolver.extraNodeModules, + ...require("node-libs-react-native"), + ...monorepoPackages, + crypto: require.resolve("crypto-browserify"), + stream: require.resolve("stream-browserify"), }; /** diff --git a/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2Account.mdx b/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2Account.mdx new file mode 100644 index 0000000000..d789f0559b --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2Account.mdx @@ -0,0 +1,28 @@ +--- +# This file is autogenerated +title: createSMAV2Account +description: Overview of the createSMAV2Account method +--- + +# createSMAV2Account + +Creates an SMAV2 account using defined parameters including chain, signer, salt, factory address, and more. +Handles account initialization code, nonce generation, transaction encoding, and more to construct a modular account with optional validation hooks. + +## Import + +```ts +import { createSMAV2Account } from "@account-kit/smart-contracts"; +``` + +## Parameters + +### config + +`CreateSMAV2AccountParams` +Configuration parameters for creating an SMAV2 account. Includes chain details, signer, salt, factory address, and more. + +## Returns + +`Promise` +A promise that resolves to an `MAV2Account` providing methods for nonce retrieval, transaction execution, and more. diff --git a/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2AccountClient.mdx b/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2AccountClient.mdx new file mode 100644 index 0000000000..8b7bcd96ab --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/createSMAV2AccountClient.mdx @@ -0,0 +1,52 @@ +--- +# This file is autogenerated + +title: createSMAV2AccountClient +description: Overview of the createSMAV2AccountClient method +--- + +# createSMAV2AccountClient + +Creates a SMAv2 account client using the provided configuration parameters. + +## Import + +```ts +import { createSMAV2AccountClient } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { http } from "viem"; +import { createSMAV2AccountClient } from "@account-kit/smart-contracts"; +import { LocalAccountSigner } from "@aa-sdk/core"; +import { sepolia } from "@account-kit/infra"; + +const MNEMONIC = "..."; +const RPC_URL = "..."; + +const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC); + +const chain = sepolia; + +const transport = http(RPC_URL); + +const SMAV2SignerAccountClient = await createSMAV2AccountClient({ + chain, + signer, + transport, +}); +``` + +## Parameters + +### config + +`CreateSMAV2AccountClientParams` +The configuration parameters required to create the MAv2 account client + +## Returns + +`Promise` +A promise that resolves to a `SmartAccountClient` instance diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultAllowlistModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultAllowlistModuleAddress.mdx new file mode 100644 index 0000000000..5522e43076 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultAllowlistModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultAllowlistModuleAddress +description: Overview of the getDefaultAllowlistModuleAddress method +--- + +# getDefaultAllowlistModuleAddress + +Maps a given chain to a specific address of the allowlist module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultAllowlistModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultAllowlistModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const allowlistModule: Address = getDefaultAllowlistModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The allowlist module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultNativeTokenLimitModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultNativeTokenLimitModuleAddress.mdx new file mode 100644 index 0000000000..54dcc49268 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultNativeTokenLimitModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultNativeTokenLimitModuleAddress +description: Overview of the getDefaultNativeTokenLimitModuleAddress method +--- + +# getDefaultNativeTokenLimitModuleAddress + +Maps a given chain to a specific address of the native token limit module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultNativeTokenLimitModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultNativeTokenLimitModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const nativeTokenLimitAddress: Address = getDefaultNativeTokenLimitModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The native token limit module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultPaymasterGuardModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultPaymasterGuardModuleAddress.mdx new file mode 100644 index 0000000000..11e25ca3b0 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultPaymasterGuardModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultPaymasterGuardModuleAddress +description: Overview of the getDefaultPaymasterGuardModuleAddress method +--- + +# getDefaultPaymasterGuardModuleAddress + +Maps a given chain to a specific address of the paymaster guard module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultPaymasterGuardModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultPaymasterGuardModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const paymasterGuardAddress: Address = getDefaultPaymasterGuardModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The paymaster guard module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultSingleSignerValidationModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultSingleSignerValidationModuleAddress.mdx new file mode 100644 index 0000000000..04c02888cc --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultSingleSignerValidationModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultSingleSignerValidationModuleAddress +description: Overview of the getDefaultSingleSignerValidationModuleAddress method +--- + +# getDefaultSingleSignerValidationModuleAddress + +Maps a given chain to a specific address of the single signer validation module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultSingleSignerValidationModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultSingleSignerValidationModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const singleSignerValidationAddress: Address = getDefaultSingleSignerValidationModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The single signer validation module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultTimeRangeModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultTimeRangeModuleAddress.mdx new file mode 100644 index 0000000000..3de832b874 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultTimeRangeModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultTimeRangeModuleAddress +description: Overview of the getDefaultTimeRangeModuleAddress method +--- + +# getDefaultTimeRangeModuleAddress + +Maps a given chain to a specific address of the time range module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultTimeRangeModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultTimeRangeModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const timeRangeModuleAddress: Address = getDefaultTimeRangeModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The time range module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/getDefaultWebauthnValidationModuleAddress.mdx b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultWebauthnValidationModuleAddress.mdx new file mode 100644 index 0000000000..fd27c9dac5 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/getDefaultWebauthnValidationModuleAddress.mdx @@ -0,0 +1,37 @@ +--- +# This file is autogenerated +title: getDefaultWebauthnValidationModuleAddress +description: Overview of the getDefaultWebauthnValidationModuleAddress method +--- + +# getDefaultWebauthnValidationModuleAddress + +Maps a given chain to a specific address of the webauthn validation module by its chain ID. If no direct mapping exists, it defaults to returning a specific address. + +## Import + +```ts +import { getDefaultWebauthnValidationModuleAddress } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { getDefaultWebauthnValidationModuleAddress } from "@account-kit/smart-contracts"; +import { Chain, Address } from "viem"; + +const chain: Chain = ... +const webauthnValidationAddress: Address = getDefaultWebauthnValidationModuleAddress(chain); +``` + +## Parameters + +### chain + +`Chain` +The chain object containing the chain ID to map + +## Returns + +`Address` +The webauthn validation module address associated with the specified chain ID or a default address if no specific mapping exists diff --git a/site/pages/reference/account-kit/smart-contracts/functions/installValidationActions.mdx b/site/pages/reference/account-kit/smart-contracts/functions/installValidationActions.mdx new file mode 100644 index 0000000000..602162dacc --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/installValidationActions.mdx @@ -0,0 +1,69 @@ +--- +# This file is autogenerated + +title: installValidationActions +description: Overview of the installValidationActions method +--- + +# installValidationActions + +Provides validation installation and uninstallation functionalities for a MA v2 client, ensuring compatibility with `SmartAccountClient`. + +## Import + +```ts +import { installValidationActions } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +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` and `uninstallValidation`. diff --git a/site/pages/reference/account-kit/smart-contracts/functions/nativeSMASigner.mdx b/site/pages/reference/account-kit/smart-contracts/functions/nativeSMASigner.mdx new file mode 100644 index 0000000000..0052b9b056 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/nativeSMASigner.mdx @@ -0,0 +1,53 @@ +--- +# This file is autogenerated +title: nativeSMASigner +description: Overview of the nativeSMASigner method +--- + +# nativeSMASigner + +Creates an object with methods for generating a dummy signature, signing user operation hashes, signing messages, and signing typed data. + +## Import + +```ts +import { nativeSMASigner } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { nativeSMASigner } from "@account-kit/smart-contracts"; + +import { LocalAccountSigner } from "@aa-sdk/core"; + +const MNEMONIC = "...": + +const account = createSMAV2Account({ config }); + +const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC); + +const messageSigner = nativeSMASigner(signer, chain, account.address); +``` + +## Parameters + +### signer + +`SmartAccountSigner` +Signer to use for signing operations + +### chain + +`Chain` +Chain object for the signer + +### accountAddress + +`Address` +address of the smart account using this signer + +## Returns + +`object` +an object with methods for signing operations and managing signatures diff --git a/site/pages/reference/account-kit/smart-contracts/functions/serializeHookConfig.mdx b/site/pages/reference/account-kit/smart-contracts/functions/serializeHookConfig.mdx new file mode 100644 index 0000000000..94b6f1f3b1 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/serializeHookConfig.mdx @@ -0,0 +1,49 @@ +--- +# This file is autogenerated + +title: serializeHookConfig +description: Overview of the serializeHookConfig method +--- + +# serializeHookConfig + +Serializes a `HookConfig` object into a `Hex` format by encoding the hook type, presence of post/pre hooks, address, and entity ID. + +## Import + +```ts +import { serializeHookConfig } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { type HookType, serializeHookConfig } from "@account-kit/smart-contracts"; +import { Address } from "viem"; + +const moduleAddress: Address = "0x1234"; +const entityId: number = 1234; +const hookType: HookType = HookType.Validation; +const hasPostHooks: boolean = false; +const hasPreHooks: boolean = true; + +const hookConfigHex = serializeHookConfig({ +moduleAddress, +entityId +hookType, +hasPostHooks, +hasPreHooks +}); +``` + +## Parameters + +### config + +`HookConfig` +The hook configuration containing address, entity ID, hook type, and post/pre hook indicators + +## Returns + +`Hex` +The serialized hook configuration in hexadecimal format diff --git a/site/pages/reference/account-kit/smart-contracts/functions/serializeModuleEntity.mdx b/site/pages/reference/account-kit/smart-contracts/functions/serializeModuleEntity.mdx new file mode 100644 index 0000000000..a95495eaa9 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/serializeModuleEntity.mdx @@ -0,0 +1,43 @@ +--- +# This file is autogenerated + +title: serializeModuleEntity +description: Overview of the serializeModuleEntity method +--- + +# serializeModuleEntity + +Serializes a module entity into a hexadecimal format by concatenating the module address and entity ID. + +## Import + +```ts +import { serializeModuleEntity } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { serializeModuleEntity } from "@account-kit/smart-contracts"; +import { Address } from "viem"; + +const moduleAddress: Address = "0x1234"; +const entityId: number = 1234; + +const moduleEntityHex = serializeModuleEntity({ + moduleAddress, + entityId, +}); +``` + +## Parameters + +### config + +`ModuleEntity` +The module entity configuration containing the module address and entity ID + +## Returns + +`Hex` +A hexadecimal string representation of the serialized module entity diff --git a/site/pages/reference/account-kit/smart-contracts/functions/serializeValidationConfig.mdx b/site/pages/reference/account-kit/smart-contracts/functions/serializeValidationConfig.mdx new file mode 100644 index 0000000000..f66a26e095 --- /dev/null +++ b/site/pages/reference/account-kit/smart-contracts/functions/serializeValidationConfig.mdx @@ -0,0 +1,49 @@ +--- +# This file is autogenerated + +title: serializeValidationConfig +description: Overview of the serializeValidationConfig method +--- + +# serializeValidationConfig + +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. + +## Import + +```ts +import { serializeValidationConfig } from "@account-kit/smart-contracts"; +``` + +## Usage + +```ts +import { serializeValidationConfig } from "@account-kit/smart-contracts"; +import { Address } from "viem"; + +const moduleAddress: Address = "0x1234"; +const entityId: number = 1234; +const isGlobal: boolean = true; +const isSignatureValidation: boolean = false; +const isUserOpValidation: boolean = true; + +const validationConfigHex = serializeValidationConfig({ +moduleAddress, +entityId +isGlobal, +isSignatureValidation, +isUserOpValidation +}); +``` + +## Parameters + +### config + +`ValidationConfig` +The validation configuration object containing details to serialize + +## Returns + +`Hex` +A hexadecimal string representing the serialized configuration