From 338abce7cd500616ffd4214bd9fac96401ff61bd Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Mon, 1 Jul 2024 20:02:10 +0100 Subject: [PATCH] Better exports --- packages/permissionless/actions/erc7579.ts | 58 +++++++------------ .../actions/erc7579/isModuleInstalled.test.ts | 2 +- 2 files changed, 23 insertions(+), 37 deletions(-) diff --git a/packages/permissionless/actions/erc7579.ts b/packages/permissionless/actions/erc7579.ts index 3f9530b3..64bf9c7b 100644 --- a/packages/permissionless/actions/erc7579.ts +++ b/packages/permissionless/actions/erc7579.ts @@ -15,10 +15,12 @@ import { type SupportsExecutionModeParameters, supportsExecutionMode } from "./erc7579/supportsExecutionMode" +import type { CallType, ExecutionMode } from "./erc7579/supportsExecutionMode" import { type SupportsModuleParameters, supportsModule } from "./erc7579/supportsModule" +import type { ModuleType } from "./erc7579/supportsModule" import { type UninstallModuleParameters, uninstallModule @@ -28,42 +30,6 @@ export type Erc7579Actions< TEntryPoint extends EntryPoint, TSmartAccount extends SmartAccount | undefined > = { - /** - * Get's the accountId of the smart account - * - * @param args - {@link SendTransactionParameters} - * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType} - * - * @example - * import { createSmartAccountClient, custom } from 'viem' - * import { mainnet } from 'viem/chains' - * - * const client = createSmartAccountClient({ - * chain: mainnet, - * transport: custom(window.ethereum), - * }) - * const hash = await client.sendTransaction({ - * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', - * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', - * value: 1000000000000000000n, - * }) - * - * @example - * // Account Hoisting - * import { createSmartAccountClient, http } from 'viem' - * import { privateKeyToAccount } from 'viem/accounts' - * import { mainnet } from 'viem/chains' - * - * const client = createSmartAccountClient({ - * account: privateKeyToAccount('0x…'), - * chain: mainnet, - * transport: http(), - * }) - * const hash = await client.sendTransaction({ - * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', - * value: 1000000000000000000n, - * }) - */ accountId: ( args?: TSmartAccount extends undefined ? GetAccountParameter @@ -86,6 +52,26 @@ export type Erc7579Actions< ) => Promise } +export type { + InstallModuleParameters, + IsModuleInstalledParameters, + CallType, + ExecutionMode, + SupportsExecutionModeParameters, + ModuleType, + SupportsModuleParameters, + UninstallModuleParameters +} + +export { + accountId, + installModule, + isModuleInstalled, + supportsExecutionMode, + supportsModule, + uninstallModule +} + export function erc7579Actions(_args: { entryPoint: TEntryPoint }) { diff --git a/packages/permissionless/actions/erc7579/isModuleInstalled.test.ts b/packages/permissionless/actions/erc7579/isModuleInstalled.test.ts index bcdd042e..8aebdbd6 100644 --- a/packages/permissionless/actions/erc7579/isModuleInstalled.test.ts +++ b/packages/permissionless/actions/erc7579/isModuleInstalled.test.ts @@ -8,7 +8,6 @@ import { } from "viem" import { generatePrivateKey, privateKeyToAccount } from "viem/accounts" import { describe, expect } from "vitest" -import { erc7579Actions } from "." import { testWithRpc } from "../../../permissionless-test/src/testWithRpc" import { getCoreSmartAccounts, @@ -19,6 +18,7 @@ import { createBundlerClient } from "../../clients/createBundlerClient" import type { SmartAccountClient } from "../../clients/createSmartAccountClient" import type { ENTRYPOINT_ADDRESS_V07_TYPE } from "../../types/entrypoint" import { ENTRYPOINT_ADDRESS_V07 } from "../../utils" +import { erc7579Actions } from "../erc7579" import { isModuleInstalled } from "./isModuleInstalled" describe.each(getCoreSmartAccounts())(