permissionless 0.0.19 → 0.0.21

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +76 -0
  3. package/_cjs/accounts/biconomy/privateKeyToBiconomySmartAccount.js.map +1 -1
  4. package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js +4 -1
  5. package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
  6. package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js +4 -1
  7. package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
  8. package/_cjs/accounts/privateKeyToSimpleSmartAccount.js.map +1 -1
  9. package/_cjs/accounts/signerToSafeSmartAccount.js.map +1 -1
  10. package/_cjs/accounts/signerToSimpleSmartAccount.js +4 -1
  11. package/_cjs/accounts/signerToSimpleSmartAccount.js.map +1 -1
  12. package/_cjs/accounts/types.js.map +1 -1
  13. package/_cjs/actions/smartAccount/deployContract.js.map +1 -1
  14. package/_cjs/actions/smartAccount/writeContract.js.map +1 -1
  15. package/_cjs/clients/decorators/smartAccount.js +5 -0
  16. package/_cjs/clients/decorators/smartAccount.js.map +1 -1
  17. package/_cjs/utils/walletClientToCustomSigner.js +3 -2
  18. package/_cjs/utils/walletClientToCustomSigner.js.map +1 -1
  19. package/_esm/accounts/biconomy/privateKeyToBiconomySmartAccount.js.map +1 -1
  20. package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js +4 -1
  21. package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
  22. package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js +4 -1
  23. package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
  24. package/_esm/accounts/privateKeyToSimpleSmartAccount.js.map +1 -1
  25. package/_esm/accounts/signerToSafeSmartAccount.js.map +1 -1
  26. package/_esm/accounts/signerToSimpleSmartAccount.js +4 -1
  27. package/_esm/accounts/signerToSimpleSmartAccount.js.map +1 -1
  28. package/_esm/accounts/types.js.map +1 -1
  29. package/_esm/actions/pimlico/sponsorUserOperation.js +1 -1
  30. package/_esm/actions/smartAccount/deployContract.js.map +1 -1
  31. package/_esm/actions/smartAccount/writeContract.js.map +1 -1
  32. package/_esm/clients/decorators/smartAccount.js +5 -0
  33. package/_esm/clients/decorators/smartAccount.js.map +1 -1
  34. package/_esm/utils/walletClientToCustomSigner.js +3 -2
  35. package/_esm/utils/walletClientToCustomSigner.js.map +1 -1
  36. package/_types/accounts/biconomy/privateKeyToBiconomySmartAccount.d.ts +1 -1
  37. package/_types/accounts/biconomy/privateKeyToBiconomySmartAccount.d.ts.map +1 -1
  38. package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts +1 -1
  39. package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts.map +1 -1
  40. package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts +1 -1
  41. package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts.map +1 -1
  42. package/_types/accounts/privateKeyToSimpleSmartAccount.d.ts +1 -1
  43. package/_types/accounts/privateKeyToSimpleSmartAccount.d.ts.map +1 -1
  44. package/_types/accounts/signerToSafeSmartAccount.d.ts.map +1 -1
  45. package/_types/accounts/signerToSimpleSmartAccount.d.ts +1 -1
  46. package/_types/accounts/signerToSimpleSmartAccount.d.ts.map +1 -1
  47. package/_types/accounts/types.d.ts +3 -6
  48. package/_types/accounts/types.d.ts.map +1 -1
  49. package/_types/actions/pimlico/sponsorUserOperation.d.ts +3 -3
  50. package/_types/actions/pimlico.d.ts +2 -2
  51. package/_types/actions/smartAccount/deployContract.d.ts +1 -1
  52. package/_types/actions/smartAccount/deployContract.d.ts.map +1 -1
  53. package/_types/actions/smartAccount/writeContract.d.ts +3 -3
  54. package/_types/actions/smartAccount/writeContract.d.ts.map +1 -1
  55. package/_types/clients/createSmartAccountClient.d.ts +11 -10
  56. package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
  57. package/_types/clients/decorators/pimlico.d.ts +3 -3
  58. package/_types/clients/decorators/smartAccount.d.ts +5 -3
  59. package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
  60. package/_types/utils/walletClientToCustomSigner.d.ts.map +1 -1
  61. package/accounts/biconomy/privateKeyToBiconomySmartAccount.ts +1 -1
  62. package/accounts/biconomy/signerToBiconomySmartAccount.ts +16 -3
  63. package/accounts/kernel/signerToEcdsaKernelSmartAccount.ts +16 -3
  64. package/accounts/privateKeyToSimpleSmartAccount.ts +1 -1
  65. package/accounts/signerToSafeSmartAccount.ts +11 -3
  66. package/accounts/signerToSimpleSmartAccount.ts +16 -3
  67. package/accounts/types.ts +2 -3
  68. package/actions/pimlico/sponsorUserOperation.ts +3 -3
  69. package/actions/pimlico.ts +2 -2
  70. package/actions/smartAccount/deployContract.ts +2 -9
  71. package/actions/smartAccount/writeContract.ts +24 -4
  72. package/clients/createSmartAccountClient.ts +2 -2
  73. package/clients/decorators/pimlico.ts +4 -4
  74. package/clients/decorators/smartAccount.ts +30 -5
  75. package/package.json +4 -2
  76. package/utils/walletClientToCustomSigner.ts +14 -10
@@ -103,7 +103,7 @@ const adjustVInSignature = (
103
103
 
104
104
  const generateSafeMessageMessage = <
105
105
  const TTypedData extends TypedData | { [key: string]: unknown },
106
- TPrimaryType extends string = string
106
+ TPrimaryType extends keyof TTypedData | "EIP712Domain" = keyof TTypedData
107
107
  >(
108
108
  message: SignableMessage | TypedDataDefinition<TTypedData, TPrimaryType>
109
109
  ): Hex => {
@@ -606,7 +606,12 @@ export async function signerToSafeSmartAccount<
606
606
  async signTransaction(_, __) {
607
607
  throw new SignTransactionNotSupportedBySmartAccount()
608
608
  },
609
- async signTypedData(typedData) {
609
+ async signTypedData<
610
+ const TTypedData extends TypedData | Record<string, unknown>,
611
+ TPrimaryType extends
612
+ | keyof TTypedData
613
+ | "EIP712Domain" = keyof TTypedData
614
+ >(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) {
610
615
  return adjustVInSignature(
611
616
  "eth_signTypedData",
612
617
  await signTypedData(client, {
@@ -620,7 +625,10 @@ export async function signerToSafeSmartAccount<
620
625
  },
621
626
  primaryType: "SafeMessage",
622
627
  message: {
623
- message: generateSafeMessageMessage(typedData)
628
+ message: generateSafeMessageMessage<
629
+ TTypedData,
630
+ TPrimaryType
631
+ >(typedData)
624
632
  }
625
633
  })
626
634
  )
@@ -1,3 +1,4 @@
1
+ import type { TypedData } from "abitype"
1
2
  import {
2
3
  type Address,
3
4
  type Chain,
@@ -5,6 +6,7 @@ import {
5
6
  type Hex,
6
7
  type LocalAccount,
7
8
  type Transport,
9
+ type TypedDataDefinition,
8
10
  concatHex,
9
11
  encodeFunctionData
10
12
  } from "viem"
@@ -106,7 +108,7 @@ export async function signerToSimpleSmartAccount<
106
108
  TSource extends string = "custom",
107
109
  TAddress extends Address = Address
108
110
  >(
109
- client: Client<TTransport, TChain>,
111
+ client: Client<TTransport, TChain, undefined>,
110
112
  {
111
113
  signer,
112
114
  factoryAddress,
@@ -147,8 +149,19 @@ export async function signerToSimpleSmartAccount<
147
149
  async signTransaction(_, __) {
148
150
  throw new SignTransactionNotSupportedBySmartAccount()
149
151
  },
150
- async signTypedData(typedData) {
151
- return signTypedData(client, { account: viemSigner, ...typedData })
152
+ async signTypedData<
153
+ const TTypedData extends TypedData | Record<string, unknown>,
154
+ TPrimaryType extends
155
+ | keyof TTypedData
156
+ | "EIP712Domain" = keyof TTypedData
157
+ >(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) {
158
+ return signTypedData<TTypedData, TPrimaryType, TChain, undefined>(
159
+ client,
160
+ {
161
+ account: viemSigner,
162
+ ...typedData
163
+ }
164
+ )
152
165
  }
153
166
  })
154
167
 
package/accounts/types.ts CHANGED
@@ -3,11 +3,10 @@ import {
3
3
  type Address,
4
4
  BaseError,
5
5
  type Client,
6
- type GetConstructorArgs,
7
6
  type Hex,
8
7
  type LocalAccount
9
8
  } from "viem"
10
- import type { Chain, Transport } from "viem"
9
+ import type { Chain, EncodeDeployDataParameters, Transport } from "viem"
11
10
  import { type UserOperation } from "../types/index.js"
12
11
 
13
12
  export class SignTransactionNotSupportedBySmartAccount extends BaseError {
@@ -53,7 +52,7 @@ export type SmartAccount<
53
52
  abi,
54
53
  args,
55
54
  bytecode
56
- }: { abi: TAbi; bytecode: Hex } & GetConstructorArgs<TAbi>) => Promise<Hex>
55
+ }: EncodeDeployDataParameters<TAbi>) => Promise<Hex>
57
56
  signUserOperation: (userOperation: UserOperation) => Promise<Hex>
58
57
  }
59
58
 
@@ -7,7 +7,7 @@ import type {
7
7
  } from "../../types/userOperation.js"
8
8
  import { deepHexlify } from "../../utils/deepHexlify.js"
9
9
 
10
- export type PimlocoSponsorUserOperationParameters = {
10
+ export type PimlicoSponsorUserOperationParameters = {
11
11
  userOperation: PartialBy<
12
12
  UserOperation,
13
13
  | "callGasLimit"
@@ -27,7 +27,7 @@ export type SponsorUserOperationReturnType = UserOperation
27
27
  * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
28
28
  *
29
29
  * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
30
- * @param args {@link PimlocoSponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
30
+ * @param args {@link PimlicoSponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
31
31
  * @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
32
32
  *
33
33
  *
@@ -52,7 +52,7 @@ export const sponsorUserOperation = async <
52
52
  TAccount extends Account | undefined = Account | undefined
53
53
  >(
54
54
  client: Client<TTransport, TChain, TAccount, PimlicoPaymasterRpcSchema>,
55
- args: PimlocoSponsorUserOperationParameters
55
+ args: PimlicoSponsorUserOperationParameters
56
56
  ): Promise<SponsorUserOperationReturnType> => {
57
57
  const response = await client.request({
58
58
  method: "pm_sponsorUserOperation",
@@ -8,7 +8,7 @@ import {
8
8
  getUserOperationStatus
9
9
  } from "./pimlico/getUserOperationStatus.js"
10
10
  import {
11
- type PimlocoSponsorUserOperationParameters,
11
+ type PimlicoSponsorUserOperationParameters,
12
12
  type SponsorUserOperationReturnType,
13
13
  sponsorUserOperation
14
14
  } from "./pimlico/sponsorUserOperation.js"
@@ -32,7 +32,7 @@ export type {
32
32
  GetUserOperationGasPriceReturnType,
33
33
  GetUserOperationStatusParameters,
34
34
  GetUserOperationStatusReturnType,
35
- PimlocoSponsorUserOperationParameters,
35
+ PimlicoSponsorUserOperationParameters,
36
36
  SponsorUserOperationReturnType,
37
37
  PimlicoBundlerActions,
38
38
  PimlicoPaymasterClientActions,
@@ -51,10 +51,8 @@ export type DeployContractParametersWithPaymaster<
51
51
  * })
52
52
  */
53
53
  export async function deployContract<
54
- const TAbi extends Abi | readonly unknown[],
55
54
  TChain extends Chain | undefined,
56
- TAccount extends SmartAccount | undefined,
57
- TChainOverride extends Chain | undefined
55
+ TAccount extends SmartAccount | undefined
58
56
  >(
59
57
  client: Client<Transport, TChain, TAccount>,
60
58
  {
@@ -88,12 +86,7 @@ export async function deployContract<
88
86
  abi,
89
87
  args,
90
88
  bytecode
91
- } as unknown as DeployContractParameters<
92
- TAbi,
93
- TChain,
94
- TAccount,
95
- TChainOverride
96
- >)
89
+ })
97
90
  },
98
91
  account: account,
99
92
  sponsorUserOperation
@@ -2,6 +2,8 @@ import {
2
2
  type Abi,
3
3
  type Chain,
4
4
  type Client,
5
+ type ContractFunctionArgs,
6
+ type ContractFunctionName,
5
7
  type EncodeFunctionDataParameters,
6
8
  type Transport,
7
9
  type WriteContractParameters,
@@ -71,11 +73,20 @@ export type WriteContractWithPaymasterParameters<
71
73
  TChain extends Chain | undefined = Chain | undefined,
72
74
  TAccount extends SmartAccount | undefined = SmartAccount | undefined,
73
75
  TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[],
74
- TFunctionName extends string = string,
76
+ TFunctionName extends ContractFunctionName<
77
+ TAbi,
78
+ "nonpayable" | "payable"
79
+ > = ContractFunctionName<TAbi, "nonpayable" | "payable">,
80
+ TArgs extends ContractFunctionArgs<
81
+ TAbi,
82
+ "nonpayable" | "payable",
83
+ TFunctionName
84
+ > = ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>,
75
85
  TChainOverride extends Chain | undefined = undefined
76
86
  > = WriteContractParameters<
77
87
  TAbi,
78
88
  TFunctionName,
89
+ TArgs,
79
90
  TChain,
80
91
  TAccount,
81
92
  TChainOverride
@@ -86,7 +97,15 @@ export async function writeContract<
86
97
  TChain extends Chain | undefined,
87
98
  TAccount extends SmartAccount | undefined,
88
99
  const TAbi extends Abi | readonly unknown[],
89
- TFunctionName extends string,
100
+ TFunctionName extends ContractFunctionName<
101
+ TAbi,
102
+ "nonpayable" | "payable"
103
+ > = ContractFunctionName<TAbi, "nonpayable" | "payable">,
104
+ TArgs extends ContractFunctionArgs<
105
+ TAbi,
106
+ "nonpayable" | "payable",
107
+ TFunctionName
108
+ > = ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>,
90
109
  TChainOverride extends Chain | undefined = undefined
91
110
  >(
92
111
  client: Client<Transport, TChain, TAccount>,
@@ -102,14 +121,15 @@ export async function writeContract<
102
121
  TAccount,
103
122
  TAbi,
104
123
  TFunctionName,
124
+ TArgs,
105
125
  TChainOverride
106
126
  >
107
127
  ): Promise<WriteContractReturnType> {
108
- const data = encodeFunctionData({
128
+ const data = encodeFunctionData<TAbi, TFunctionName>({
109
129
  abi,
110
130
  args,
111
131
  functionName
112
- } as unknown as EncodeFunctionDataParameters<TAbi, TFunctionName>)
132
+ } as EncodeFunctionDataParameters<TAbi, TFunctionName>)
113
133
  const hash = await getAction(
114
134
  client,
115
135
  sendTransaction<TChain, TAccount, TChainOverride>
@@ -73,8 +73,8 @@ export type SmartAccountClientConfig<
73
73
  */
74
74
  export const createSmartAccountClient = <
75
75
  TTransport extends Transport,
76
- TChain extends Chain | undefined = undefined,
77
- TSmartAccount extends SmartAccount | undefined = undefined
76
+ TChain extends Chain | undefined = Chain | undefined,
77
+ TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined
78
78
  >(
79
79
  parameters: SmartAccountClientConfig<TTransport, TChain, TSmartAccount> &
80
80
  SponsorUserOperationMiddleware
@@ -14,7 +14,7 @@ import {
14
14
  getUserOperationStatus
15
15
  } from "../../actions/pimlico/getUserOperationStatus.js"
16
16
  import {
17
- type PimlocoSponsorUserOperationParameters,
17
+ type PimlicoSponsorUserOperationParameters,
18
18
  type SponsorUserOperationReturnType,
19
19
  sponsorUserOperation
20
20
  } from "../../actions/pimlico/sponsorUserOperation.js"
@@ -83,7 +83,7 @@ export type PimlicoPaymasterClientActions = {
83
83
  *
84
84
  * https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
85
85
  *
86
- * @param args {@link PimlocoSponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
86
+ * @param args {@link PimlicoSponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
87
87
  * @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
88
88
  *
89
89
  * @example
@@ -102,7 +102,7 @@ export type PimlicoPaymasterClientActions = {
102
102
  *
103
103
  */
104
104
  sponsorUserOperation: (
105
- args: PimlocoSponsorUserOperationParameters
105
+ args: PimlicoSponsorUserOperationParameters
106
106
  ) => Promise<SponsorUserOperationReturnType>
107
107
 
108
108
  validateSponsorshipPolicies: (
@@ -148,7 +148,7 @@ export type PimlicoPaymasterClientActions = {
148
148
  export const pimlicoPaymasterActions = (
149
149
  client: Client
150
150
  ): PimlicoPaymasterClientActions => ({
151
- sponsorUserOperation: async (args: PimlocoSponsorUserOperationParameters) =>
151
+ sponsorUserOperation: async (args: PimlicoSponsorUserOperationParameters) =>
152
152
  sponsorUserOperation(client as PimlicoPaymasterClient, args),
153
153
  validateSponsorshipPolicies: async (
154
154
  args: ValidateSponsorshipPoliciesParameters
@@ -2,6 +2,8 @@ import type {
2
2
  Abi,
3
3
  Chain,
4
4
  Client,
5
+ ContractFunctionArgs,
6
+ ContractFunctionName,
5
7
  DeployContractParameters,
6
8
  SendTransactionParameters,
7
9
  Transport,
@@ -26,6 +28,11 @@ import {
26
28
  type SendTransactionWithPaymasterParameters,
27
29
  sendTransaction
28
30
  } from "../../actions/smartAccount/sendTransaction.js"
31
+ import {
32
+ type SendUserOperationParameters,
33
+ type SendUserOperationReturnType,
34
+ sendUserOperation
35
+ } from "../../actions/smartAccount/sendUserOperation.js"
29
36
  import { signMessage } from "../../actions/smartAccount/signMessage.js"
30
37
  import { signTypedData } from "../../actions/smartAccount/signTypedData.js"
31
38
  import {
@@ -278,9 +285,7 @@ export type SmartAccountActions<
278
285
  TSmartAccount,
279
286
  TChainOverride
280
287
  >
281
- ) => ReturnType<
282
- typeof deployContract<TAbi, TChain, TSmartAccount, TChainOverride>
283
- >
288
+ ) => ReturnType<typeof deployContract<TChain, TSmartAccount>>
284
289
  /**
285
290
  * Executes a write function on a contract.
286
291
  * This function also allows you to sponsor this transaction if sender is a smartAccount
@@ -331,12 +336,21 @@ export type SmartAccountActions<
331
336
  */
332
337
  writeContract: <
333
338
  const TAbi extends Abi | readonly unknown[],
334
- TFunctionName extends string,
339
+ TFunctionName extends ContractFunctionName<
340
+ TAbi,
341
+ "nonpayable" | "payable"
342
+ > = ContractFunctionName<TAbi, "nonpayable" | "payable">,
343
+ TArgs extends ContractFunctionArgs<
344
+ TAbi,
345
+ "nonpayable" | "payable",
346
+ TFunctionName
347
+ > = ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>,
335
348
  TChainOverride extends Chain | undefined = undefined
336
349
  >(
337
350
  args: WriteContractParameters<
338
351
  TAbi,
339
352
  TFunctionName,
353
+ TArgs,
340
354
  TChain,
341
355
  TSmartAccount,
342
356
  TChainOverride
@@ -347,6 +361,7 @@ export type SmartAccountActions<
347
361
  TSmartAccount,
348
362
  TAbi,
349
363
  TFunctionName,
364
+ TArgs,
350
365
  TChainOverride
351
366
  >
352
367
  >
@@ -359,6 +374,11 @@ export type SmartAccountActions<
359
374
  >
360
375
  >[1]
361
376
  ) => Promise<PrepareUserOperationRequestReturnType>
377
+ sendUserOperation: <TTransport extends Transport>(
378
+ args: Parameters<
379
+ typeof sendUserOperation<TTransport, TChain, TSmartAccount>
380
+ >[1]
381
+ ) => Promise<SendUserOperationReturnType>
362
382
  /**
363
383
  * Creates, signs, and sends a new transaction to the network.
364
384
  * This function also allows you to sponsor this transaction if sender is a smartAccount
@@ -441,11 +461,16 @@ export const smartAccountActions =
441
461
  ...args,
442
462
  sponsorUserOperation
443
463
  } as SendTransactionsWithPaymasterParameters),
464
+ sendUserOperation: (args) =>
465
+ sendUserOperation(client, {
466
+ ...args,
467
+ sponsorUserOperation
468
+ } as SendUserOperationParameters),
444
469
  signMessage: (args) => signMessage(client, args),
445
470
  signTypedData: (args) => signTypedData(client, args),
446
471
  writeContract: (args) =>
447
472
  writeContract(client, {
448
473
  ...args,
449
474
  sponsorUserOperation
450
- } as WriteContractWithPaymasterParameters)
475
+ } as WriteContractWithPaymasterParameters<TChain, TSmartAccount>)
451
476
  })
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "permissionless",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "author": "Pimlico",
5
+ "homepage": "https://docs.pimlico.io/permissionless",
6
+ "repository": "github:pimlicolabs/permissionless.js",
5
7
  "main": "./_cjs/index.js",
6
8
  "module": "./_esm/index.js",
7
9
  "types": "./_types/index.d.ts",
@@ -70,6 +72,6 @@
70
72
  }
71
73
  },
72
74
  "peerDependencies": {
73
- "viem": "^1.19.4"
75
+ "viem": "^2.0.0"
74
76
  }
75
77
  }
@@ -10,6 +10,7 @@ import type {
10
10
  WalletClient
11
11
  } from "viem"
12
12
 
13
+ import { signTypedData } from "viem/actions"
13
14
  import type { SmartAccountSigner } from "../accounts/types.js"
14
15
 
15
16
  export function walletClientToCustomSigner<
@@ -27,16 +28,19 @@ export function walletClientToCustomSigner<
27
28
  }: { message: SignableMessage }): Promise<Hex> => {
28
29
  return walletClient.signMessage({ message })
29
30
  },
30
- signTypedData: async <
31
- const TTypedData extends TypedData | { [key: string]: unknown },
32
- TPrimaryType extends string = string
33
- >(
34
- typedData: TypedDataDefinition<TTypedData, TPrimaryType>
35
- ): Promise<Hex> => {
36
- return walletClient.signTypedData({
37
- account: walletClient.account,
38
- ...typedData
39
- })
31
+ async signTypedData<
32
+ const TTypedData extends TypedData | Record<string, unknown>,
33
+ TPrimaryType extends
34
+ | keyof TTypedData
35
+ | "EIP712Domain" = keyof TTypedData
36
+ >(typedData: TypedDataDefinition<TTypedData, TPrimaryType>) {
37
+ return signTypedData<TTypedData, TPrimaryType, TChain, Account>(
38
+ walletClient,
39
+ {
40
+ account: walletClient.account,
41
+ ...typedData
42
+ }
43
+ )
40
44
  }
41
45
  }
42
46
  }