Skip to content

fix: typing of serializePermissionAccount #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hungry-maps-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zerodev/permissions": patch
---

fix typing of serializePermissionAccount
14 changes: 9 additions & 5 deletions plugins/permission/serializeMultiChainPermissionAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ import {
hashTypedData,
keccak256
} from "viem"
import type { SmartAccount } from "viem/account-abstraction"
import type { EntryPointVersion, SmartAccount } from "viem/account-abstraction"
import type { PermissionPlugin } from "./types.js"
import {
isPermissionValidatorPlugin,
serializePermissionAccountParams
} from "./utils.js"

export type MultiChainPermissionAccountsParams = {
account: SmartAccount<KernelSmartAccountImplementation>
export type MultiChainPermissionAccountsParams<
entryPointVersion extends EntryPointVersion
> = {
account: SmartAccount<KernelSmartAccountImplementation<entryPointVersion>>
privateKey?: Hex
}

export const serializeMultiChainPermissionAccounts = async (
params: MultiChainPermissionAccountsParams[]
export const serializeMultiChainPermissionAccounts = async <
entryPointVersion extends EntryPointVersion
>(
params: MultiChainPermissionAccountsParams<entryPointVersion>[]
): Promise<string[]> => {
if (params.length === 0) return []

Expand Down
8 changes: 5 additions & 3 deletions plugins/permission/serializePermissionAccount.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { KernelSmartAccountImplementation } from "@zerodev/sdk"
import type { Hex } from "viem"
import type { SmartAccount } from "viem/account-abstraction"
import type { EntryPointVersion, SmartAccount } from "viem/account-abstraction"
import {
isPermissionValidatorPlugin,
serializePermissionAccountParams
} from "./utils.js"

export const serializePermissionAccount = async (
account: SmartAccount<KernelSmartAccountImplementation>,
export const serializePermissionAccount = async <
entryPointVersion extends EntryPointVersion
>(
account: SmartAccount<KernelSmartAccountImplementation<entryPointVersion>>,
privateKey?: Hex,
enableSignature?: Hex
): Promise<string> => {
Expand Down