permissionless 0.0.26 → 0.0.28

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 (180) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js +16 -13
  3. package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
  4. package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js +16 -13
  5. package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
  6. package/_cjs/accounts/signerToSafeSmartAccount.js +20 -17
  7. package/_cjs/accounts/signerToSafeSmartAccount.js.map +1 -1
  8. package/_cjs/accounts/signerToSimpleSmartAccount.js +15 -12
  9. package/_cjs/accounts/signerToSimpleSmartAccount.js.map +1 -1
  10. package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
  11. package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -1
  12. package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -1
  13. package/_cjs/actions/bundler/sendUserOperation.js.map +1 -1
  14. package/_cjs/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
  15. package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
  16. package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -1
  17. package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
  18. package/_cjs/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
  19. package/_cjs/actions/public/getAccountNonce.js +2 -1
  20. package/_cjs/actions/public/getAccountNonce.js.map +1 -1
  21. package/_cjs/actions/public/getSenderAddress.js +2 -1
  22. package/_cjs/actions/public/getSenderAddress.js.map +1 -1
  23. package/_cjs/actions/smartAccount/deployContract.js +4 -3
  24. package/_cjs/actions/smartAccount/deployContract.js.map +1 -1
  25. package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
  26. package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -1
  27. package/_cjs/actions/smartAccount/sendTransactions.js.map +1 -1
  28. package/_cjs/actions/smartAccount/sendUserOperation.js +1 -2
  29. package/_cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
  30. package/_cjs/actions/smartAccount/signTypedData.js.map +1 -1
  31. package/_cjs/actions/smartAccount.js.map +1 -1
  32. package/_cjs/clients/createSmartAccountClient.js.map +1 -1
  33. package/_cjs/clients/decorators/bundler.js.map +1 -1
  34. package/_cjs/clients/decorators/pimlico.js.map +1 -1
  35. package/_cjs/clients/decorators/smartAccount.js +30 -28
  36. package/_cjs/clients/decorators/smartAccount.js.map +1 -1
  37. package/_cjs/utils/deepHexlify.js.map +1 -1
  38. package/_cjs/utils/index.js +3 -1
  39. package/_cjs/utils/index.js.map +1 -1
  40. package/_cjs/utils/isSmartAccountDeployed.js +15 -0
  41. package/_cjs/utils/isSmartAccountDeployed.js.map +1 -0
  42. package/_cjs/utils/observe.js.map +1 -1
  43. package/_cjs/utils/signUserOperationHashWithECDSA.js.map +1 -1
  44. package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js +17 -14
  45. package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
  46. package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js +17 -14
  47. package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
  48. package/_esm/accounts/signerToSafeSmartAccount.js +21 -18
  49. package/_esm/accounts/signerToSafeSmartAccount.js.map +1 -1
  50. package/_esm/accounts/signerToSimpleSmartAccount.js +16 -13
  51. package/_esm/accounts/signerToSimpleSmartAccount.js.map +1 -1
  52. package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
  53. package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -1
  54. package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
  55. package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
  56. package/_esm/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
  57. package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
  58. package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -1
  59. package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
  60. package/_esm/actions/pimlico/validateSponsorshipPolicies.js +1 -1
  61. package/_esm/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
  62. package/_esm/actions/public/getAccountNonce.js +2 -1
  63. package/_esm/actions/public/getAccountNonce.js.map +1 -1
  64. package/_esm/actions/public/getSenderAddress.js +2 -1
  65. package/_esm/actions/public/getSenderAddress.js.map +1 -1
  66. package/_esm/actions/smartAccount/deployContract.js +5 -5
  67. package/_esm/actions/smartAccount/deployContract.js.map +1 -1
  68. package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
  69. package/_esm/actions/smartAccount/sendTransaction.js +1 -1
  70. package/_esm/actions/smartAccount/sendTransaction.js.map +1 -1
  71. package/_esm/actions/smartAccount/sendTransactions.js +1 -1
  72. package/_esm/actions/smartAccount/sendTransactions.js.map +1 -1
  73. package/_esm/actions/smartAccount/sendUserOperation.js +1 -2
  74. package/_esm/actions/smartAccount/sendUserOperation.js.map +1 -1
  75. package/_esm/actions/smartAccount/signTypedData.js.map +1 -1
  76. package/_esm/actions/smartAccount.js.map +1 -1
  77. package/_esm/clients/createSmartAccountClient.js.map +1 -1
  78. package/_esm/clients/decorators/bundler.js.map +1 -1
  79. package/_esm/clients/decorators/pimlico.js +1 -1
  80. package/_esm/clients/decorators/pimlico.js.map +1 -1
  81. package/_esm/clients/decorators/smartAccount.js +30 -28
  82. package/_esm/clients/decorators/smartAccount.js.map +1 -1
  83. package/_esm/utils/deepHexlify.js.map +1 -1
  84. package/_esm/utils/index.js +2 -1
  85. package/_esm/utils/index.js.map +1 -1
  86. package/_esm/utils/isSmartAccountDeployed.js +11 -0
  87. package/_esm/utils/isSmartAccountDeployed.js.map +1 -0
  88. package/_esm/utils/observe.js.map +1 -1
  89. package/_esm/utils/signUserOperationHashWithECDSA.js.map +1 -1
  90. package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts +2 -1
  91. package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts.map +1 -1
  92. package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts +2 -1
  93. package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts.map +1 -1
  94. package/_types/accounts/signerToSafeSmartAccount.d.ts +3 -2
  95. package/_types/accounts/signerToSafeSmartAccount.d.ts.map +1 -1
  96. package/_types/accounts/signerToSimpleSmartAccount.d.ts +2 -1
  97. package/_types/accounts/signerToSimpleSmartAccount.d.ts.map +1 -1
  98. package/_types/accounts/types.d.ts +3 -3
  99. package/_types/accounts/types.d.ts.map +1 -1
  100. package/_types/actions/bundler/estimateUserOperationGas.d.ts +2 -1
  101. package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
  102. package/_types/actions/bundler/getUserOperationByHash.d.ts +3 -2
  103. package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
  104. package/_types/actions/bundler/getUserOperationReceipt.d.ts +2 -1
  105. package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
  106. package/_types/actions/bundler/sendUserOperation.d.ts +2 -1
  107. package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
  108. package/_types/actions/bundler/waitForUserOperationReceipt.d.ts +2 -1
  109. package/_types/actions/bundler/waitForUserOperationReceipt.d.ts.map +1 -1
  110. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +2 -1
  111. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
  112. package/_types/actions/pimlico/getUserOperationStatus.d.ts +2 -1
  113. package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -1
  114. package/_types/actions/pimlico/sponsorUserOperation.d.ts +2 -1
  115. package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
  116. package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts +5 -4
  117. package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts.map +1 -1
  118. package/_types/actions/pimlico.d.ts +2 -2
  119. package/_types/actions/pimlico.d.ts.map +1 -1
  120. package/_types/actions/public/getAccountNonce.d.ts +2 -1
  121. package/_types/actions/public/getAccountNonce.d.ts.map +1 -1
  122. package/_types/actions/public/getSenderAddress.d.ts +2 -1
  123. package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
  124. package/_types/actions/smartAccount/deployContract.d.ts +4 -3
  125. package/_types/actions/smartAccount/deployContract.d.ts.map +1 -1
  126. package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +2 -2
  127. package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -1
  128. package/_types/actions/smartAccount/sendTransaction.d.ts +4 -3
  129. package/_types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
  130. package/_types/actions/smartAccount/sendTransactions.d.ts +4 -4
  131. package/_types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
  132. package/_types/actions/smartAccount/sendUserOperation.d.ts +3 -4
  133. package/_types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
  134. package/_types/actions/smartAccount/writeContract.d.ts +3 -3
  135. package/_types/actions/smartAccount/writeContract.d.ts.map +1 -1
  136. package/_types/actions/smartAccount.d.ts +2 -2
  137. package/_types/actions/smartAccount.d.ts.map +1 -1
  138. package/_types/clients/createSmartAccountClient.d.ts +5 -3
  139. package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
  140. package/_types/clients/decorators/bundler.d.ts +6 -5
  141. package/_types/clients/decorators/bundler.d.ts.map +1 -1
  142. package/_types/clients/decorators/pimlico.d.ts +7 -6
  143. package/_types/clients/decorators/pimlico.d.ts.map +1 -1
  144. package/_types/clients/decorators/smartAccount.d.ts +8 -7
  145. package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
  146. package/_types/utils/index.d.ts +2 -1
  147. package/_types/utils/index.d.ts.map +1 -1
  148. package/_types/utils/isSmartAccountDeployed.d.ts +3 -0
  149. package/_types/utils/isSmartAccountDeployed.d.ts.map +1 -0
  150. package/accounts/biconomy/signerToBiconomySmartAccount.ts +25 -18
  151. package/accounts/kernel/signerToEcdsaKernelSmartAccount.ts +24 -13
  152. package/accounts/signerToSafeSmartAccount.ts +24 -18
  153. package/accounts/signerToSimpleSmartAccount.ts +25 -18
  154. package/accounts/types.ts +4 -3
  155. package/actions/bundler/estimateUserOperationGas.ts +3 -2
  156. package/actions/bundler/getUserOperationByHash.ts +4 -3
  157. package/actions/bundler/getUserOperationReceipt.ts +3 -2
  158. package/actions/bundler/sendUserOperation.ts +2 -1
  159. package/actions/bundler/waitForUserOperationReceipt.ts +3 -2
  160. package/actions/pimlico/getUserOperationGasPrice.ts +2 -1
  161. package/actions/pimlico/getUserOperationStatus.ts +3 -2
  162. package/actions/pimlico/sponsorUserOperation.ts +3 -2
  163. package/actions/pimlico/validateSponsorshipPolicies.ts +6 -5
  164. package/actions/pimlico.ts +2 -2
  165. package/actions/public/getAccountNonce.ts +4 -1
  166. package/actions/public/getSenderAddress.ts +4 -1
  167. package/actions/smartAccount/deployContract.ts +19 -15
  168. package/actions/smartAccount/prepareUserOperationRequest.ts +3 -2
  169. package/actions/smartAccount/sendTransaction.ts +6 -7
  170. package/actions/smartAccount/sendTransactions.ts +5 -5
  171. package/actions/smartAccount/sendUserOperation.ts +5 -12
  172. package/actions/smartAccount/writeContract.ts +3 -3
  173. package/actions/smartAccount.ts +0 -2
  174. package/clients/createSmartAccountClient.ts +10 -16
  175. package/clients/decorators/bundler.ts +12 -9
  176. package/clients/decorators/pimlico.ts +12 -9
  177. package/clients/decorators/smartAccount.ts +34 -25
  178. package/package.json +1 -1
  179. package/utils/index.ts +3 -1
  180. package/utils/isSmartAccountDeployed.ts +16 -0
@@ -1,6 +1,7 @@
1
1
  import type { Account, Address, Chain, Client, Hash, Transport } from "viem"
2
2
  import type { BundlerClient } from "../../clients/createBundlerClient.js"
3
3
  import type { BundlerRpcSchema } from "../../types/bundler.js"
4
+ import type { Prettify } from "../../types/index.js"
4
5
  import type { UserOperation } from "../../types/userOperation.js"
5
6
 
6
7
  export type GetUserOperationByHashParameters = {
@@ -13,7 +14,7 @@ export type GetUserOperationByHashReturnType = {
13
14
  transactionHash: Hash
14
15
  blockHash: Hash
15
16
  blockNumber: bigint
16
- } | null
17
+ }
17
18
 
18
19
  /**
19
20
  * Returns the user operation from userOpHash
@@ -43,8 +44,8 @@ export const getUserOperationByHash = async <
43
44
  TAccount extends Account | undefined = Account | undefined
44
45
  >(
45
46
  client: Client<TTransport, TChain, TAccount, BundlerRpcSchema>,
46
- { hash }: GetUserOperationByHashParameters
47
- ): Promise<GetUserOperationByHashReturnType> => {
47
+ { hash }: Prettify<GetUserOperationByHashParameters>
48
+ ): Promise<Prettify<GetUserOperationByHashReturnType> | null> => {
48
49
  const params: [Hash] = [hash]
49
50
 
50
51
  const response = await client.request({
@@ -9,6 +9,7 @@ import type {
9
9
  } from "viem"
10
10
  import type { BundlerClient } from "../../clients/createBundlerClient.js"
11
11
  import type { BundlerRpcSchema } from "../../types/bundler.js"
12
+ import type { Prettify } from "../../types/index.js"
12
13
  import type { TStatus } from "../../types/userOperation.js"
13
14
  import { transactionReceiptStatus } from "../../utils/deepHexlify.js"
14
15
 
@@ -77,8 +78,8 @@ export const getUserOperationReceipt = async <
77
78
  TAccount extends Account | undefined = Account | undefined
78
79
  >(
79
80
  client: Client<TTransport, TChain, TAccount, BundlerRpcSchema>,
80
- { hash }: GetUserOperationReceiptParameters
81
- ): Promise<GetUserOperationReceiptReturnType | null> => {
81
+ { hash }: Prettify<GetUserOperationReceiptParameters>
82
+ ): Promise<Prettify<GetUserOperationReceiptReturnType> | null> => {
82
83
  const params: [Hash] = [hash]
83
84
 
84
85
  const response = await client.request({
@@ -1,6 +1,7 @@
1
1
  import type { Account, Address, Chain, Client, Hash, Transport } from "viem"
2
2
  import type { BundlerClient } from "../../clients/createBundlerClient.js"
3
3
  import type { BundlerRpcSchema } from "../../types/bundler.js"
4
+ import type { Prettify } from "../../types/index.js"
4
5
  import type {
5
6
  UserOperation,
6
7
  UserOperationWithBigIntAsHex
@@ -43,7 +44,7 @@ export const sendUserOperation = async <
43
44
  TAccount extends Account | undefined = Account | undefined
44
45
  >(
45
46
  client: Client<TTransport, TChain, TAccount, BundlerRpcSchema>,
46
- args: SendUserOperationParameters
47
+ args: Prettify<SendUserOperationParameters>
47
48
  ): Promise<Hash> => {
48
49
  const { userOperation, entryPoint } = args
49
50
 
@@ -7,6 +7,7 @@ import {
7
7
  type Transport,
8
8
  stringify
9
9
  } from "viem"
10
+ import type { Prettify } from "../../types/index.js"
10
11
  import { getAction } from "../../utils/getAction.js"
11
12
  import { observe } from "../../utils/observe.js"
12
13
  import {
@@ -66,8 +67,8 @@ export const waitForUserOperationReceipt = <
66
67
  hash,
67
68
  pollingInterval = bundlerClient.pollingInterval,
68
69
  timeout
69
- }: WaitForUserOperationReceiptParameters
70
- ): Promise<GetUserOperationReceiptReturnType> => {
70
+ }: Prettify<WaitForUserOperationReceiptParameters>
71
+ ): Promise<Prettify<GetUserOperationReceiptReturnType>> => {
71
72
  const observerId = stringify([
72
73
  "waitForUserOperationReceipt",
73
74
  bundlerClient.uid,
@@ -1,4 +1,5 @@
1
1
  import type { Account, Chain, Client, Transport } from "viem"
2
+ import type { Prettify } from "../../types/index.js"
2
3
  import type { PimlicoBundlerRpcSchema } from "../../types/pimlico.js"
3
4
 
4
5
  export type GetUserOperationGasPriceReturnType = {
@@ -43,7 +44,7 @@ export const getUserOperationGasPrice = async <
43
44
  TAccount extends Account | undefined = Account | undefined
44
45
  >(
45
46
  client: Client<TTransport, TChain, TAccount, PimlicoBundlerRpcSchema>
46
- ): Promise<GetUserOperationGasPriceReturnType> => {
47
+ ): Promise<Prettify<GetUserOperationGasPriceReturnType>> => {
47
48
  const gasPrices = await client.request({
48
49
  method: "pimlico_getUserOperationGasPrice",
49
50
  params: []
@@ -1,5 +1,6 @@
1
1
  import type { Account, Chain, Client, Hash, Transport } from "viem"
2
2
  import type { PimlicoBundlerClient } from "../../clients/pimlico.js"
3
+ import type { Prettify } from "../../types/index.js"
3
4
  import type {
4
5
  PimlicoBundlerRpcSchema,
5
6
  PimlicoUserOperationStatus
@@ -39,8 +40,8 @@ export const getUserOperationStatus = async <
39
40
  TAccount extends Account | undefined = Account | undefined
40
41
  >(
41
42
  client: Client<TTransport, TChain, TAccount, PimlicoBundlerRpcSchema>,
42
- { hash }: GetUserOperationStatusParameters
43
- ): Promise<GetUserOperationStatusReturnType> => {
43
+ { hash }: Prettify<GetUserOperationStatusParameters>
44
+ ): Promise<Prettify<GetUserOperationStatusReturnType>> => {
44
45
  return client.request({
45
46
  method: "pimlico_getUserOperationStatus",
46
47
  params: [hash]
@@ -1,5 +1,6 @@
1
1
  import type { Account, Address, Chain, Client, Transport } from "viem"
2
2
  import type { PartialBy } from "viem/types/utils"
3
+ import type { Prettify } from "../../types/index.js"
3
4
  import type { PimlicoPaymasterRpcSchema } from "../../types/pimlico.js"
4
5
  import type {
5
6
  UserOperation,
@@ -52,8 +53,8 @@ export const sponsorUserOperation = async <
52
53
  TAccount extends Account | undefined = Account | undefined
53
54
  >(
54
55
  client: Client<TTransport, TChain, TAccount, PimlicoPaymasterRpcSchema>,
55
- args: PimlicoSponsorUserOperationParameters
56
- ): Promise<SponsorUserOperationReturnType> => {
56
+ args: Prettify<PimlicoSponsorUserOperationParameters>
57
+ ): Promise<Prettify<SponsorUserOperationReturnType>> => {
57
58
  const response = await client.request({
58
59
  method: "pm_sponsorUserOperation",
59
60
  params: args.sponsorshipPolicyId
@@ -1,4 +1,5 @@
1
1
  import type { Account, Address, Chain, Client, Transport } from "viem"
2
+ import type { Prettify } from "../../types/index.js"
2
3
  import type { PimlicoPaymasterRpcSchema } from "../../types/pimlico.js"
3
4
  import type {
4
5
  UserOperation,
@@ -12,7 +13,7 @@ export type ValidateSponsorshipPoliciesParameters = {
12
13
  sponsorshipPolicyIds: string[]
13
14
  }
14
15
 
15
- export type ValidateSponsorshipPoliciesReturnType = {
16
+ export type ValidateSponsorshipPolicies = {
16
17
  sponsorshipPolicyId: string
17
18
  data: {
18
19
  name: string | null
@@ -20,7 +21,7 @@ export type ValidateSponsorshipPoliciesReturnType = {
20
21
  icon: string | null
21
22
  description: string | null
22
23
  }
23
- }[]
24
+ }
24
25
 
25
26
  /**
26
27
  * Returns valid sponsorship policies for a userOperation from the list of ids passed
@@ -28,7 +29,7 @@ export type ValidateSponsorshipPoliciesReturnType = {
28
29
  *
29
30
  * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
30
31
  * @param args {@link ValidateSponsorshipPoliciesParameters} UserOperation you want to sponsor & entryPoint.
31
- * @returns valid sponsorship policies, see {@link ValidateSponsorshipPoliciesReturnType}
32
+ * @returns valid sponsorship policies, see {@link ValidateSponsorshipPolicies}
32
33
  *
33
34
  * @example
34
35
  * import { createClient } from "viem"
@@ -63,8 +64,8 @@ export const validateSponsorshipPolicies = async <
63
64
  TAccount extends Account | undefined = Account | undefined
64
65
  >(
65
66
  client: Client<TTransport, TChain, TAccount, PimlicoPaymasterRpcSchema>,
66
- args: ValidateSponsorshipPoliciesParameters
67
- ): Promise<ValidateSponsorshipPoliciesReturnType> => {
67
+ args: Prettify<ValidateSponsorshipPoliciesParameters>
68
+ ): Promise<Prettify<ValidateSponsorshipPolicies>[]> => {
68
69
  return await client.request({
69
70
  method: "pm_validateSponsorshipPolicies",
70
71
  params: [
@@ -23,8 +23,8 @@ import {
23
23
  } from "../clients/decorators/pimlico.js"
24
24
 
25
25
  import {
26
+ type ValidateSponsorshipPolicies,
26
27
  type ValidateSponsorshipPoliciesParameters,
27
- type ValidateSponsorshipPoliciesReturnType,
28
28
  validateSponsorshipPolicies
29
29
  } from "./pimlico/validateSponsorshipPolicies.js"
30
30
 
@@ -37,7 +37,7 @@ export type {
37
37
  PimlicoBundlerActions,
38
38
  PimlicoPaymasterClientActions,
39
39
  ValidateSponsorshipPoliciesParameters,
40
- ValidateSponsorshipPoliciesReturnType
40
+ ValidateSponsorshipPolicies
41
41
  }
42
42
 
43
43
  export {
@@ -1,5 +1,6 @@
1
1
  import type { Address, Chain, Client, Transport } from "viem"
2
2
  import { readContract } from "viem/actions"
3
+ import type { Prettify } from "../../types/index.js"
3
4
  import { getAction } from "../../utils/getAction.js"
4
5
 
5
6
  export type GetAccountNonceParams = {
@@ -39,8 +40,10 @@ export const getAccountNonce = async <
39
40
  TChain extends Chain | undefined = Chain | undefined
40
41
  >(
41
42
  client: Client<TTransport, TChain>,
42
- { sender, entryPoint, key = BigInt(0) }: GetAccountNonceParams
43
+ args: Prettify<GetAccountNonceParams>
43
44
  ): Promise<bigint> => {
45
+ const { sender, entryPoint, key = BigInt(0) } = args
46
+
44
47
  return await getAction(
45
48
  client,
46
49
  readContract
@@ -10,6 +10,7 @@ import {
10
10
  } from "viem"
11
11
 
12
12
  import { simulateContract } from "viem/actions"
13
+ import type { Prettify } from "../../types/index.js"
13
14
  import { getAction } from "../../utils/getAction.js"
14
15
 
15
16
  export type GetSenderAddressParams = { initCode: Hex; entryPoint: Address }
@@ -62,8 +63,10 @@ export const getSenderAddress = async <
62
63
  TChain extends Chain | undefined = Chain | undefined
63
64
  >(
64
65
  client: Client<TTransport, TChain>,
65
- { initCode, entryPoint }: GetSenderAddressParams
66
+ args: Prettify<GetSenderAddressParams>
66
67
  ): Promise<Address> => {
68
+ const { initCode, entryPoint } = args
69
+
67
70
  try {
68
71
  await getAction(
69
72
  client,
@@ -1,12 +1,14 @@
1
- import {
2
- type Abi,
3
- type Chain,
4
- type Client,
5
- type DeployContractParameters,
6
- type DeployContractReturnType,
7
- type Transport
1
+ import type {
2
+ Abi,
3
+ Chain,
4
+ Client,
5
+ DeployContractParameters,
6
+ EncodeDeployDataParameters,
7
+ Hash,
8
+ Transport
8
9
  } from "viem"
9
10
  import type { SmartAccount } from "../../accounts/types.js"
11
+ import type { Prettify } from "../../types/index.js"
10
12
  import { getAction } from "../../utils/getAction.js"
11
13
  import { parseAccount } from "../../utils/index.js"
12
14
  import { AccountOrClientNotFoundError } from "../../utils/signUserOperationHashWithECDSA.js"
@@ -31,7 +33,7 @@ export type DeployContractParametersWithPaymaster<
31
33
  *
32
34
  * @param client - Client to use
33
35
  * @param parameters - {@link DeployContractParameters}
34
- * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link DeployContractReturnType}
36
+ * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
35
37
  *
36
38
  * @example
37
39
  * import { createWalletClient, http } from 'viem'
@@ -55,14 +57,16 @@ export async function deployContract<
55
57
  TAccount extends SmartAccount | undefined
56
58
  >(
57
59
  client: Client<Transport, TChain, TAccount>,
58
- {
60
+ args: Prettify<DeployContractParametersWithPaymaster>
61
+ ): Promise<Hash> {
62
+ const {
59
63
  abi,
60
- args,
64
+ args: constructorArgs,
61
65
  bytecode,
62
66
  sponsorUserOperation,
63
67
  ...request
64
- }: DeployContractParametersWithPaymaster
65
- ): Promise<DeployContractReturnType> {
68
+ } = args
69
+
66
70
  const { account: account_ = client.account } = request
67
71
 
68
72
  if (!account_) {
@@ -84,9 +88,9 @@ export async function deployContract<
84
88
  maxPriorityFeePerGas: request.maxPriorityFeePerGas || 0n,
85
89
  callData: await account.encodeDeployCallData({
86
90
  abi,
87
- args,
88
- bytecode
89
- })
91
+ bytecode,
92
+ args: constructorArgs
93
+ } as EncodeDeployDataParameters)
90
94
  },
91
95
  account: account,
92
96
  sponsorUserOperation
@@ -4,6 +4,7 @@ import type { SmartAccount } from "../../accounts/types.js"
4
4
  import type {
5
5
  GetAccountParameter,
6
6
  PartialBy,
7
+ Prettify,
7
8
  UserOperation
8
9
  } from "../../types/index.js"
9
10
  import { getAction } from "../../utils/getAction.js"
@@ -47,8 +48,8 @@ export async function prepareUserOperationRequest<
47
48
  TAccount extends SmartAccount | undefined = SmartAccount | undefined
48
49
  >(
49
50
  client: Client<TTransport, TChain, TAccount>,
50
- args: PrepareUserOperationRequestParameters<TAccount>
51
- ): Promise<PrepareUserOperationRequestReturnType> {
51
+ args: Prettify<PrepareUserOperationRequestParameters<TAccount>>
52
+ ): Promise<Prettify<PrepareUserOperationRequestReturnType>> {
52
53
  const {
53
54
  account: account_ = client.account,
54
55
  userOperation: partialUserOperation,
@@ -1,11 +1,12 @@
1
1
  import type {
2
2
  Chain,
3
3
  Client,
4
+ Hash,
4
5
  SendTransactionParameters,
5
- SendTransactionReturnType,
6
6
  Transport
7
7
  } from "viem"
8
8
  import { type SmartAccount } from "../../accounts/types.js"
9
+ import type { Prettify } from "../../types/index.js"
9
10
  import { getAction } from "../../utils/getAction.js"
10
11
  import {
11
12
  AccountOrClientNotFoundError,
@@ -34,7 +35,7 @@ export type SendTransactionWithPaymasterParameters<
34
35
  *
35
36
  * @param client - Client to use
36
37
  * @param parameters - {@link SendTransactionParameters}
37
- * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
38
+ * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
38
39
  *
39
40
  * @example
40
41
  * import { createWalletClient, custom } from 'viem'
@@ -74,12 +75,10 @@ export async function sendTransaction<
74
75
  TChainOverride extends Chain | undefined
75
76
  >(
76
77
  client: Client<Transport, TChain, TAccount>,
77
- args: SendTransactionWithPaymasterParameters<
78
- TChain,
79
- TAccount,
80
- TChainOverride
78
+ args: Prettify<
79
+ SendTransactionWithPaymasterParameters<TChain, TAccount, TChainOverride>
81
80
  >
82
- ): Promise<SendTransactionReturnType> {
81
+ ): Promise<Hash> {
83
82
  const {
84
83
  account: account_ = client.account,
85
84
  data,
@@ -2,13 +2,13 @@ import type {
2
2
  Address,
3
3
  Chain,
4
4
  Client,
5
+ Hash,
5
6
  Hex,
6
7
  SendTransactionParameters,
7
- SendTransactionReturnType,
8
8
  Transport
9
9
  } from "viem"
10
10
  import { type SmartAccount } from "../../accounts/types.js"
11
- import type { GetAccountParameter } from "../../types/index.js"
11
+ import type { GetAccountParameter, Prettify } from "../../types/index.js"
12
12
  import { getAction } from "../../utils/getAction.js"
13
13
  import {
14
14
  AccountOrClientNotFoundError,
@@ -35,7 +35,7 @@ export type SendTransactionsWithPaymasterParameters<
35
35
  *
36
36
  * @param client - Client to use
37
37
  * @param parameters - {@link SendTransactionParameters}
38
- * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
38
+ * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash.
39
39
  *
40
40
  * @example
41
41
  * import { createWalletClient, custom } from 'viem'
@@ -80,8 +80,8 @@ export async function sendTransactions<
80
80
  TAccount extends SmartAccount | undefined
81
81
  >(
82
82
  client: Client<Transport, TChain, TAccount>,
83
- args: SendTransactionsWithPaymasterParameters<TAccount>
84
- ): Promise<SendTransactionReturnType> {
83
+ args: Prettify<SendTransactionsWithPaymasterParameters<TAccount>>
84
+ ): Promise<Hash> {
85
85
  const {
86
86
  account: account_ = client.account,
87
87
  transactions,
@@ -1,8 +1,9 @@
1
- import type { Chain, Client, Hex, Transport } from "viem"
1
+ import type { Chain, Client, Hash, Transport } from "viem"
2
2
  import type { SmartAccount } from "../../accounts/types.js"
3
3
  import type {
4
4
  GetAccountParameter,
5
5
  PartialBy,
6
+ Prettify,
6
7
  UserOperation
7
8
  } from "../../types/index.js"
8
9
  import { getAction } from "../../utils/getAction.js"
@@ -35,16 +36,14 @@ export type SendUserOperationParameters<
35
36
  } & GetAccountParameter<TAccount> &
36
37
  SponsorUserOperationMiddleware
37
38
 
38
- export type SendUserOperationReturnType = Hex
39
-
40
39
  export async function sendUserOperation<
41
40
  TTransport extends Transport = Transport,
42
41
  TChain extends Chain | undefined = Chain | undefined,
43
42
  TAccount extends SmartAccount | undefined = SmartAccount | undefined
44
43
  >(
45
44
  client: Client<TTransport, TChain, TAccount>,
46
- args: SendUserOperationParameters<TAccount>
47
- ): Promise<SendUserOperationReturnType> {
45
+ args: Prettify<SendUserOperationParameters<TAccount>>
46
+ ): Promise<Hash> {
48
47
  const { account: account_ = client.account } = args
49
48
  if (!account_) throw new AccountOrClientNotFoundError()
50
49
 
@@ -57,14 +56,8 @@ export async function sendUserOperation<
57
56
 
58
57
  userOperation.signature = await account.signUserOperation(userOperation)
59
58
 
60
- const userOpHash = await getAction(
61
- client,
62
- sendUserOperationBundler,
63
- "sendUserOperation"
64
- )({
59
+ return sendUserOperationBundler(client, {
65
60
  userOperation: userOperation,
66
61
  entryPoint: account.entryPoint
67
62
  })
68
-
69
- return userOpHash
70
63
  }
@@ -5,9 +5,9 @@ import {
5
5
  type ContractFunctionArgs,
6
6
  type ContractFunctionName,
7
7
  type EncodeFunctionDataParameters,
8
+ type Hash,
8
9
  type Transport,
9
10
  type WriteContractParameters,
10
- type WriteContractReturnType,
11
11
  encodeFunctionData
12
12
  } from "viem"
13
13
  import { type SmartAccount } from "../../accounts/types.js"
@@ -33,7 +33,7 @@ import {
33
33
  *
34
34
  * @param client - Client to use
35
35
  * @param parameters - {@link WriteContractParameters}
36
- * @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash). {@link WriteContractReturnType}
36
+ * @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash).
37
37
  *
38
38
  * @example
39
39
  * import { createWalletClient, custom, parseAbi } from 'viem'
@@ -124,7 +124,7 @@ export async function writeContract<
124
124
  TArgs,
125
125
  TChainOverride
126
126
  >
127
- ): Promise<WriteContractReturnType> {
127
+ ): Promise<Hash> {
128
128
  const data = encodeFunctionData<TAbi, TFunctionName>({
129
129
  abi,
130
130
  args,
@@ -17,7 +17,6 @@ import {
17
17
 
18
18
  import {
19
19
  type SendUserOperationParameters,
20
- type SendUserOperationReturnType,
21
20
  sendUserOperation
22
21
  } from "./smartAccount/sendUserOperation.js"
23
22
 
@@ -44,7 +43,6 @@ export {
44
43
  sendTransaction,
45
44
  sendUserOperation,
46
45
  type SendUserOperationParameters,
47
- type SendUserOperationReturnType,
48
46
  signMessage,
49
47
  signTypedData,
50
48
  type SendTransactionWithPaymasterParameters,
@@ -2,7 +2,6 @@ import type {
2
2
  Chain,
3
3
  Client,
4
4
  ClientConfig,
5
- ParseAccount,
6
5
  Transport,
7
6
  WalletClientConfig
8
7
  } from "viem"
@@ -38,20 +37,15 @@ export type SmartAccountClient<
38
37
  export type SmartAccountClientConfig<
39
38
  transport extends Transport = Transport,
40
39
  chain extends Chain | undefined = Chain | undefined,
41
- TAccount extends SmartAccount | undefined = SmartAccount | undefined
40
+ account extends SmartAccount | undefined = SmartAccount | undefined
42
41
  > = Prettify<
43
42
  Pick<
44
- ClientConfig<transport, chain, TAccount>,
45
- | "account"
46
- | "cacheTime"
47
- | "chain"
48
- | "key"
49
- | "name"
50
- | "pollingInterval"
51
- | "transport"
52
- >
53
- > &
54
- SponsorUserOperationMiddleware
43
+ ClientConfig<transport, chain, account>,
44
+ "cacheTime" | "chain" | "key" | "name" | "pollingInterval" | "transport"
45
+ > & {
46
+ account?: account
47
+ } & SponsorUserOperationMiddleware
48
+ >
55
49
 
56
50
  /**
57
51
  * Creates a EIP-4337 compliant Bundler Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
@@ -75,11 +69,11 @@ export type SmartAccountClientConfig<
75
69
 
76
70
  export function createSmartAccountClient<
77
71
  TTransport extends Transport,
78
- TChain extends Chain | undefined = Chain | undefined,
79
- TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined
72
+ TChain extends Chain | undefined = undefined,
73
+ TSmartAccount extends SmartAccount | undefined = undefined
80
74
  >(
81
75
  parameters: SmartAccountClientConfig<TTransport, TChain, TSmartAccount>
82
- ): SmartAccountClient<TTransport, TChain, ParseAccount<TSmartAccount>>
76
+ ): SmartAccountClient<TTransport, TChain, TSmartAccount>
83
77
 
84
78
  export function createSmartAccountClient(
85
79
  parameters: SmartAccountClientConfig
@@ -25,6 +25,7 @@ import {
25
25
  type WaitForUserOperationReceiptParameters,
26
26
  waitForUserOperationReceipt
27
27
  } from "../../actions/bundler/waitForUserOperationReceipt.js"
28
+ import type { Prettify } from "../../types/index.js"
28
29
  import type { BundlerClient } from "../createBundlerClient.js"
29
30
 
30
31
  export type BundlerActions = {
@@ -53,7 +54,9 @@ export type BundlerActions = {
53
54
  *
54
55
  * // Return '0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34'
55
56
  */
56
- sendUserOperation: (args: SendUserOperationParameters) => Promise<Hash>
57
+ sendUserOperation: (
58
+ args: Prettify<SendUserOperationParameters>
59
+ ) => Promise<Hash>
57
60
  /**
58
61
  *
59
62
  * Estimates preVerificationGas, verificationGasLimit and callGasLimit for user operation
@@ -80,8 +83,8 @@ export type BundlerActions = {
80
83
  * // Return {preVerificationGas: 43492n, verificationGasLimit: 59436n, callGasLimit: 9000n}
81
84
  */
82
85
  estimateUserOperationGas: (
83
- args: EstimateUserOperationGasParameters
84
- ) => Promise<EstimateUserOperationGasReturnType>
86
+ args: Prettify<EstimateUserOperationGasParameters>
87
+ ) => Promise<Prettify<EstimateUserOperationGasReturnType>>
85
88
  /**
86
89
  *
87
90
  * Returns the supported entrypoints by the bundler service
@@ -147,8 +150,8 @@ export type BundlerActions = {
147
150
  *
148
151
  */
149
152
  getUserOperationByHash: (
150
- args: GetUserOperationByHashParameters
151
- ) => Promise<GetUserOperationByHashReturnType>
153
+ args: Prettify<GetUserOperationByHashParameters>
154
+ ) => Promise<Prettify<GetUserOperationByHashReturnType> | null>
152
155
  /**
153
156
  *
154
157
  * Returns the user operation receipt from userOpHash
@@ -171,8 +174,8 @@ export type BundlerActions = {
171
174
  *
172
175
  */
173
176
  getUserOperationReceipt: (
174
- args: GetUserOperationReceiptParameters
175
- ) => Promise<GetUserOperationReceiptReturnType | null>
177
+ args: Prettify<GetUserOperationReceiptParameters>
178
+ ) => Promise<Prettify<GetUserOperationReceiptReturnType> | null>
176
179
 
177
180
  /**
178
181
  * Waits for the User Operation to be included on a [Block](https://viem.sh/docs/glossary/terms.html#block) (one confirmation), and then returns the [User Operation Receipt](https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationReceipt).
@@ -196,8 +199,8 @@ export type BundlerActions = {
196
199
  * })
197
200
  */
198
201
  waitForUserOperationReceipt: (
199
- args: WaitForUserOperationReceiptParameters
200
- ) => Promise<GetUserOperationReceiptReturnType>
202
+ args: Prettify<WaitForUserOperationReceiptParameters>
203
+ ) => Promise<Prettify<GetUserOperationReceiptReturnType>>
201
204
  }
202
205
 
203
206
  const bundlerActions = (client: Client): BundlerActions => ({