Skip to content

Commit

Permalink
Better exports
Browse files Browse the repository at this point in the history
  • Loading branch information
plusminushalf committed Jul 1, 2024
1 parent a4bc170 commit 338abce
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 37 deletions.
58 changes: 22 additions & 36 deletions packages/permissionless/actions/erc7579.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,42 +30,6 @@ export type Erc7579Actions<
TEntryPoint extends EntryPoint,
TSmartAccount extends SmartAccount<TEntryPoint> | 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<TEntryPoint, TSmartAccount>
Expand All @@ -86,6 +52,26 @@ export type Erc7579Actions<
) => Promise<Hash>
}

export type {
InstallModuleParameters,
IsModuleInstalledParameters,
CallType,
ExecutionMode,
SupportsExecutionModeParameters,
ModuleType,
SupportsModuleParameters,
UninstallModuleParameters
}

export {
accountId,
installModule,
isModuleInstalled,
supportsExecutionMode,
supportsModule,
uninstallModule
}

export function erc7579Actions<TEntryPoint extends EntryPoint>(_args: {
entryPoint: TEntryPoint
}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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())(
Expand Down

0 comments on commit 338abce

Please sign in to comment.