permissionless 0.0.2 → 0.0.4

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 (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/_cjs/actions/bundler.js +6 -5
  3. package/_cjs/actions/bundler.js.map +1 -1
  4. package/_cjs/actions/index.js +3 -2
  5. package/_cjs/actions/index.js.map +1 -1
  6. package/_cjs/actions/pimlico.js +55 -0
  7. package/_cjs/actions/pimlico.js.map +1 -0
  8. package/_cjs/actions/utils.js +5 -1
  9. package/_cjs/actions/utils.js.map +1 -1
  10. package/_cjs/clients/bundler.js +17 -0
  11. package/_cjs/clients/bundler.js.map +1 -0
  12. package/_cjs/clients/index.js +6 -0
  13. package/_cjs/clients/index.js.map +1 -0
  14. package/_cjs/clients/pimlico.js +29 -0
  15. package/_cjs/clients/pimlico.js.map +1 -0
  16. package/_cjs/index.js +2 -0
  17. package/_cjs/index.js.map +1 -1
  18. package/_cjs/types/pimlico.js +3 -0
  19. package/_cjs/types/pimlico.js.map +1 -0
  20. package/_cjs/utils/index.js +38 -0
  21. package/_cjs/utils/index.js.map +1 -0
  22. package/_esm/actions/bundler.js +14 -147
  23. package/_esm/actions/bundler.js.map +1 -1
  24. package/_esm/actions/index.js +2 -2
  25. package/_esm/actions/index.js.map +1 -1
  26. package/_esm/actions/pimlico.js +124 -0
  27. package/_esm/actions/pimlico.js.map +1 -0
  28. package/_esm/actions/utils.js +4 -0
  29. package/_esm/actions/utils.js.map +1 -1
  30. package/_esm/clients/bundler.js +32 -0
  31. package/_esm/clients/bundler.js.map +1 -0
  32. package/_esm/clients/index.js +3 -0
  33. package/_esm/clients/index.js.map +1 -0
  34. package/_esm/clients/pimlico.js +62 -0
  35. package/_esm/clients/pimlico.js.map +1 -0
  36. package/_esm/index.js +2 -0
  37. package/_esm/index.js.map +1 -1
  38. package/_esm/types/pimlico.js +2 -0
  39. package/_esm/types/pimlico.js.map +1 -0
  40. package/_esm/utils/index.js +56 -0
  41. package/_esm/utils/index.js.map +1 -0
  42. package/_types/actions/bundler.d.ts +116 -27
  43. package/_types/actions/bundler.d.ts.map +1 -1
  44. package/_types/actions/index.d.ts +4 -2
  45. package/_types/actions/index.d.ts.map +1 -1
  46. package/_types/actions/pimlico.d.ts +178 -0
  47. package/_types/actions/pimlico.d.ts.map +1 -0
  48. package/_types/actions/utils.d.ts +4 -0
  49. package/_types/actions/utils.d.ts.map +1 -1
  50. package/_types/clients/bundler.d.ts +38 -0
  51. package/_types/clients/bundler.d.ts.map +1 -0
  52. package/_types/clients/index.d.ts +3 -0
  53. package/_types/clients/index.d.ts.map +1 -0
  54. package/_types/clients/pimlico.d.ts +73 -0
  55. package/_types/clients/pimlico.d.ts.map +1 -0
  56. package/_types/index.d.ts +2 -0
  57. package/_types/index.d.ts.map +1 -1
  58. package/_types/types/bundler.d.ts +4 -37
  59. package/_types/types/bundler.d.ts.map +1 -1
  60. package/_types/types/index.d.ts +1 -2
  61. package/_types/types/index.d.ts.map +1 -1
  62. package/_types/types/pimlico.d.ts +50 -0
  63. package/_types/types/pimlico.d.ts.map +1 -0
  64. package/_types/types/userOperation.d.ts +1 -0
  65. package/_types/types/userOperation.d.ts.map +1 -1
  66. package/_types/utils/index.d.ts +31 -0
  67. package/_types/utils/index.d.ts.map +1 -0
  68. package/actions/bundler.ts +87 -35
  69. package/actions/index.ts +25 -8
  70. package/actions/pimlico.ts +252 -0
  71. package/actions/utils.ts +5 -0
  72. package/clients/bundler.ts +38 -0
  73. package/clients/index.ts +3 -0
  74. package/clients/pimlico.ts +91 -0
  75. package/index.ts +2 -0
  76. package/package.json +23 -3
  77. package/tsconfig.build.tsbuildinfo +1 -1
  78. package/types/bundler.ts +4 -39
  79. package/types/index.ts +1 -2
  80. package/types/pimlico.ts +55 -0
  81. package/types/userOperation.ts +2 -0
  82. package/utils/index.ts +70 -0
@@ -0,0 +1,178 @@
1
+ import type { Address, Client, Hash, Hex } from "viem";
2
+ import type { PartialBy } from "viem/types/utils";
3
+ import type { PimlicoBundlerClient, PimlicoPaymasterClient } from "../clients/pimlico";
4
+ import type { PimlicoUserOperationStatus } from "../types/pimlico";
5
+ import type { UserOperation } from "../types/userOperation";
6
+ export type SponsorUserOperationParameters = {
7
+ userOperation: PartialBy<UserOperation, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterAndData">;
8
+ entryPoint: Address;
9
+ };
10
+ export type SponsorUserOperationReturnType = {
11
+ paymasterAndData: Hex;
12
+ preVerificationGas: bigint;
13
+ verificationGasLimit: bigint;
14
+ callGasLimit: bigint;
15
+ };
16
+ export type GetUserOperationGasPriceReturnType = {
17
+ slow: {
18
+ maxFeePerGas: bigint;
19
+ maxPriorityFeePerGas: bigint;
20
+ };
21
+ standard: {
22
+ maxFeePerGas: bigint;
23
+ maxPriorityFeePerGas: bigint;
24
+ };
25
+ fast: {
26
+ maxFeePerGas: bigint;
27
+ maxPriorityFeePerGas: bigint;
28
+ };
29
+ };
30
+ export type GetUserOperationStatusParameters = {
31
+ hash: Hash;
32
+ };
33
+ export type GetUserOperationStatusReturnType = PimlicoUserOperationStatus;
34
+ /**
35
+ * Returns the live gas prices that you can use to send a user operation.
36
+ *
37
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
38
+ *
39
+ * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
40
+ * @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas
41
+ *
42
+ *
43
+ * @example
44
+ * import { createClient } from "viem"
45
+ * import { getUserOperationGasPrice } from "permissionless/actions"
46
+ *
47
+ * const bundlerClient = createClient({
48
+ * chain: goerli,
49
+ * transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
50
+ * })
51
+ *
52
+ * await getUserOperationGasPrice(bundlerClient)
53
+ *
54
+ */
55
+ export declare const getUserOperationGasPrice: (client: PimlicoBundlerClient) => Promise<GetUserOperationGasPriceReturnType>;
56
+ /**
57
+ * Returns the status of the userOperation that is pending in the mempool.
58
+ *
59
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationStatus
60
+ *
61
+ * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
62
+ * @param hash {@link Hash} UserOpHash that you must have received from sendUserOperation.
63
+ * @returns status & transaction hash if included {@link GetUserOperationStatusReturnType}
64
+ *
65
+ *
66
+ * @example
67
+ * import { createClient } from "viem"
68
+ * import { getUserOperationStatus } from "permissionless/actions"
69
+ *
70
+ * const bundlerClient = createClient({
71
+ * chain: goerli,
72
+ * transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
73
+ * })
74
+ *
75
+ * await getUserOperationStatus(bundlerClient, { hash: userOpHash })
76
+ *
77
+ */
78
+ export declare const getUserOperationStatus: (client: PimlicoBundlerClient, { hash }: GetUserOperationStatusParameters) => Promise<GetUserOperationStatusReturnType>;
79
+ export type PimlicoBundlerActions = {
80
+ /**
81
+ * Returns the live gas prices that you can use to send a user operation.
82
+ *
83
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
84
+ *
85
+ * @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas {@link GetUserOperationGasPriceReturnType}
86
+ *
87
+ * @example
88
+ *
89
+ * import { createClient } from "viem"
90
+ * import { pimlicoBundlerActions } from "permissionless/actions"
91
+ *
92
+ * const bundlerClient = createClient({
93
+ * chain: goerli,
94
+ * transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
95
+ * }).extend(pimlicoBundlerActions)
96
+ *
97
+ * await bundlerClient.getUserOperationGasPrice()
98
+ */
99
+ getUserOperationGasPrice: () => Promise<GetUserOperationGasPriceReturnType>;
100
+ /**
101
+ * Returns the status of the userOperation that is pending in the mempool.
102
+ *
103
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationStatus
104
+ *
105
+ * @param hash {@link Hash} UserOpHash that you must have received from sendUserOperation.
106
+ * @returns status & transaction hash if included {@link GetUserOperationStatusReturnType}
107
+ *
108
+ * @example
109
+ * import { createClient } from "viem"
110
+ * import { pimlicoBundlerActions } from "permissionless/actions"
111
+ *
112
+ * const bundlerClient = createClient({
113
+ * chain: goerli,
114
+ * transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
115
+ * }).extend(pimlicoBundlerActions)
116
+ *
117
+ * await bundlerClient.getUserOperationStatus({ hash: userOpHash })
118
+ */
119
+ getUserOperationStatus: (args: GetUserOperationStatusParameters) => Promise<GetUserOperationStatusReturnType>;
120
+ };
121
+ export declare const pimlicoBundlerActions: (client: Client) => PimlicoBundlerActions;
122
+ /**
123
+ * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
124
+ *
125
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
126
+ *
127
+ * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
128
+ * @param args {@link sponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
129
+ * @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
130
+ *
131
+ *
132
+ * @example
133
+ * import { createClient } from "viem"
134
+ * import { sponsorUserOperation } from "permissionless/actions"
135
+ *
136
+ * const bundlerClient = createClient({
137
+ * chain: goerli,
138
+ * transport: http("https://api.pimlico.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE")
139
+ * })
140
+ *
141
+ * await sponsorUserOperation(bundlerClient, {
142
+ * userOperation: userOperationWithDummySignature,
143
+ * entryPoint: entryPoint
144
+ * }})
145
+ *
146
+ */
147
+ export declare const sponsorUserOperation: (client: PimlicoPaymasterClient, args: SponsorUserOperationParameters) => Promise<SponsorUserOperationReturnType>;
148
+ export type PimlicoPaymasterClientActions = {
149
+ /**
150
+ * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
151
+ *
152
+ * https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
153
+ *
154
+ * @param args {@link SponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
155
+ * @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
156
+ *
157
+ * @example
158
+ * import { createClient } from "viem"
159
+ * import { sponsorUserOperation } from "permissionless/actions"
160
+ *
161
+ * const bundlerClient = createClient({
162
+ * chain: goerli,
163
+ * transport: http("https://api.pimlico.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE")
164
+ * }).extend(pimlicoPaymasterActions)
165
+ *
166
+ * await bundlerClient.sponsorUserOperation(bundlerClient, {
167
+ * userOperation: userOperationWithDummySignature,
168
+ * entryPoint: entryPoint
169
+ * }})
170
+ *
171
+ */
172
+ sponsorUserOperation: (args: SponsorUserOperationParameters) => Promise<SponsorUserOperationReturnType>;
173
+ };
174
+ export declare const pimlicoPaymasterActions: (client: Client) => PimlicoPaymasterClientActions;
175
+ /**
176
+ * TODO: Add support for pimlicoActions after we support all the actions of v1 in v2 of the Pimlico API.
177
+ */
178
+ //# sourceMappingURL=pimlico.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../actions/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AACtF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAgC,MAAM,wBAAwB,CAAA;AAGzF,MAAM,MAAM,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,gCAAgC,CAAC,CAAA;CAChH,CAAA;AAED,eAAO,MAAM,qBAAqB,WAAY,MAAM,KAAG,qBAIrD,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,WACrB,sBAAsB,QACxB,8BAA8B,KACrC,QAAQ,8BAA8B,CAYxC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IACxC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,oBAAoB,EAAE,CAAC,IAAI,EAAE,8BAA8B,KAAK,OAAO,CAAC,8BAA8B,CAAC,CAAA;CAC1G,CAAA;AAED,eAAO,MAAM,uBAAuB,WAAY,MAAM,KAAG,6BAGvD,CAAA;AAEF;;GAEG"}
@@ -1,2 +1,6 @@
1
+ export declare const transactionReceiptStatus: {
2
+ readonly "0x0": "reverted";
3
+ readonly "0x1": "success";
4
+ };
1
5
  export declare function deepHexlify(obj: any): any;
2
6
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../actions/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAqBzC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../actions/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB;;;CAG3B,CAAA;AAGV,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAqBzC"}
@@ -0,0 +1,38 @@
1
+ import type { Account, Chain, Client, PublicClientConfig, Transport } from "viem";
2
+ import type { BundlerActions } from "../actions/bundler";
3
+ import type { BundlerRpcSchema } from "../types/bundler";
4
+ export type BundlerClient = Client<Transport, Chain | undefined, Account | undefined, BundlerRpcSchema, BundlerActions>;
5
+ /**
6
+ * 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).
7
+ *
8
+ * - Docs: https://docs.pimlico.io/permissionless/reference/clients/bundlerClient
9
+ *
10
+ * A Bundler Client is an interface to "erc 4337" [JSON-RPC API](https://eips.ethereum.org/EIPS/eip-4337#rpc-methods-eth-namespace) methods such as sending user operation, estimating gas for a user operation, get user operation receipt, etc through Bundler Actions.
11
+ *
12
+ * @param config - {@link PublicClientConfig}
13
+ * @returns A Bundler Client. {@link BundlerClient}
14
+ *
15
+ * @example
16
+ * import { createPublicClient, http } from 'viem'
17
+ * import { mainnet } from 'viem/chains'
18
+ *
19
+ * const bundlerClient = createBundlerClient({
20
+ * chain: mainnet,
21
+ * transport: http(BUNDLER_URL),
22
+ * })
23
+ */
24
+ export declare const createBundlerClient: <transport extends Transport, chain extends Chain | undefined = undefined>(parameters: {
25
+ name?: string | undefined;
26
+ pollingInterval?: number | undefined;
27
+ chain?: Chain | chain | undefined;
28
+ key?: string | undefined;
29
+ batch?: {
30
+ multicall?: boolean | {
31
+ batchSize?: number | undefined;
32
+ wait?: number | undefined;
33
+ } | undefined;
34
+ } | undefined;
35
+ cacheTime?: number | undefined;
36
+ transport: transport;
37
+ }) => BundlerClient;
38
+ //# sourceMappingURL=bundler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../clients/bundler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAGjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,GAAG,SAAS,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAA;AACvH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;MAE7B,aASF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { type BundlerClient, createBundlerClient } from "./bundler";
2
+ export { createBundlerClient, type BundlerClient };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../clients/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEnE,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,CAAA"}
@@ -0,0 +1,73 @@
1
+ import type { Account, Chain, Client, PublicClientConfig, Transport } from "viem";
2
+ import type { BundlerActions } from "../actions/bundler";
3
+ import { type PimlicoBundlerActions, type PimlicoPaymasterClientActions } from "../actions/pimlico";
4
+ import type { PimlicoBundlerRpcSchema, PimlicoPaymasterRpcSchema } from "../types/pimlico";
5
+ export type PimlicoBundlerClient = Client<Transport, Chain | undefined, Account | undefined, PimlicoBundlerRpcSchema, PimlicoBundlerActions & BundlerActions>;
6
+ export type PimlicoPaymasterClient = Client<Transport, Chain | undefined, Account | undefined, PimlicoPaymasterRpcSchema, PimlicoPaymasterClientActions>;
7
+ /**
8
+ * Creates a pimlico specific Bundler Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
9
+ *
10
+ * - Docs: https://docs.pimlico.io/permissionless/reference/clients/pimlicoBundlerClient
11
+ *
12
+ * A Pimlico Client is an interface to "pimlico endpoints" [JSON-RPC API](https://docs.pimlico.io/reference/bundler/endpoints) methods such as getting current blockchain gas prices, getting user operation status, etc through [Pimlico Bundler Actions](TODO://Add bundler action documentation link).
13
+ *
14
+ * @param config - {@link PublicClientConfig}
15
+ * @returns A Pimlico Bundler Client. {@link PimlicoBundlerClient}
16
+ *
17
+ * @example
18
+ * import { createPublicClient, http } from 'viem'
19
+ * import { mainnet } from 'viem/chains'
20
+ *
21
+ * const pimlicoBundlerClient = createPimlicoBundlerClient({
22
+ * chain: mainnet,
23
+ * transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE"),
24
+ * })
25
+ */
26
+ export declare const createPimlicoBundlerClient: <transport extends Transport, chain extends Chain | undefined = undefined>(parameters: {
27
+ name?: string | undefined;
28
+ pollingInterval?: number | undefined;
29
+ chain?: Chain | chain | undefined;
30
+ key?: string | undefined;
31
+ batch?: {
32
+ multicall?: boolean | {
33
+ batchSize?: number | undefined;
34
+ wait?: number | undefined;
35
+ } | undefined;
36
+ } | undefined;
37
+ cacheTime?: number | undefined;
38
+ transport: transport;
39
+ }) => PimlicoBundlerClient;
40
+ /**
41
+ * Creates a pimlico specific Paymaster Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
42
+ *
43
+ * - Docs: https://docs.pimlico.io/permissionless/reference/clients/pimlicoPaymasterClient
44
+ *
45
+ * A Pimlico Paymaster Client is an interface to "pimlico paymaster endpoints" [JSON-RPC API](https://docs.pimlico.io/reference/verifying-paymaster/endpoints) methods such as sponsoring user operation, etc through Pimlico Paymaster Actions.
46
+ *
47
+ * @param config - {@link PublicClientConfig}
48
+ * @returns A Pimlico Paymaster Client. {@link PimlicoPaymasterClient}
49
+ *
50
+ * @example
51
+ * import { createPublicClient, http } from 'viem'
52
+ * import { mainnet } from 'viem/chains'
53
+ *
54
+ * const pimlicoPaymasterClient = createPimlicoPaymasterClient({
55
+ * chain: mainnet,
56
+ * transport: http("https://api.pimlico.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE"),
57
+ * })
58
+ */
59
+ export declare const createPimlicoPaymasterClient: <transport extends Transport, chain extends Chain | undefined = undefined>(parameters: {
60
+ name?: string | undefined;
61
+ pollingInterval?: number | undefined;
62
+ chain?: Chain | chain | undefined;
63
+ key?: string | undefined;
64
+ batch?: {
65
+ multicall?: boolean | {
66
+ batchSize?: number | undefined;
67
+ wait?: number | undefined;
68
+ } | undefined;
69
+ } | undefined;
70
+ cacheTime?: number | undefined;
71
+ transport: transport;
72
+ }) => PimlicoPaymasterClient;
73
+ //# sourceMappingURL=pimlico.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../clients/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAGjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EACH,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAGrC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAE1F,MAAM,MAAM,oBAAoB,GAAG,MAAM,CACrC,SAAS,EACT,KAAK,GAAG,SAAS,EACjB,OAAO,GAAG,SAAS,EACnB,uBAAuB,EACvB,qBAAqB,GAAG,cAAc,CACzC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,CACvC,SAAS,EACT,KAAK,GAAG,SAAS,EACjB,OAAO,GAAG,SAAS,EACnB,yBAAyB,EACzB,6BAA6B,CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;MAEpC,oBASF,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;MAEtC,sBASF,CAAA"}
package/_types/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from "./actions";
2
+ export * from "./clients";
2
3
  export * from "./types";
4
+ export * from "./utils";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
@@ -1,8 +1,7 @@
1
- import type { Account, Address, Chain, Client, Hash, Hex, Transport } from "viem";
1
+ import type { Address, Hash, Hex } from "viem";
2
2
  import type { PartialBy } from "viem/types/utils";
3
3
  import type { UserOperationWithBigIntAsHex } from "./userOperation";
4
- export type BundlerClient = Client<Transport, Chain | undefined, Account | undefined, BundlerRpcSchema>;
5
- type BundlerRpcSchema = [
4
+ export type BundlerRpcSchema = [
6
5
  {
7
6
  Method: "eth_sendUserOperation";
8
7
  Parameters: [userOperation: UserOperationWithBigIntAsHex, entryPoint: Address];
@@ -47,38 +46,6 @@ type BundlerRpcSchema = [
47
46
  ReturnType: UserOperationReceiptWithBigIntAsHex;
48
47
  }
49
48
  ];
50
- export type UserOperationReceipt = {
51
- userOpHash: Hash;
52
- sender: Address;
53
- nonce: bigint;
54
- actualGasUsed: bigint;
55
- actualGasCost: bigint;
56
- success: boolean;
57
- receipt: {
58
- transactionHash: Hex;
59
- transactionIndex: bigint;
60
- blockHash: Hash;
61
- blockNumber: bigint;
62
- from: Address;
63
- to: Address | null;
64
- cumulativeGasUsed: bigint;
65
- status: bigint | null;
66
- gasUsed: bigint;
67
- contractAddress: Address | null;
68
- logsBloom: string;
69
- effectiveGasPrice: bigint;
70
- };
71
- logs: {
72
- data: Hex;
73
- blockNumber: bigint;
74
- blockHash: Hash;
75
- transactionHash: Hash;
76
- logIndex: bigint;
77
- transactionIndex: bigint;
78
- address: Address;
79
- topics: Hex[];
80
- }[];
81
- };
82
49
  type UserOperationReceiptWithBigIntAsHex = {
83
50
  userOpHash: Hash;
84
51
  sender: Address;
@@ -94,10 +61,10 @@ type UserOperationReceiptWithBigIntAsHex = {
94
61
  from: Address;
95
62
  to: Address | null;
96
63
  cumulativeGasUsed: Hex;
97
- status: Hex | null;
64
+ status: "0x0" | "0x1";
98
65
  gasUsed: Hex;
99
66
  contractAddress: Address | null;
100
- logsBloom: string;
67
+ logsBloom: Hex;
101
68
  effectiveGasPrice: Hex;
102
69
  };
103
70
  logs: {
@@ -1 +1 @@
1
- {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../types/bundler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAEnE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,OAAO,GAAG,SAAS,EAAE,gBAAgB,CAAC,CAAA;AAEvG,KAAK,gBAAgB,GAAG;IACpB;QACI,MAAM,EAAE,uBAAuB,CAAA;QAC/B,UAAU,EAAE,CAAC,aAAa,EAAE,4BAA4B,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QAC9E,UAAU,EAAE,IAAI,CAAA;KACnB;IACD;QACI,MAAM,EAAE,8BAA8B,CAAA;QACtC,UAAU,EAAE;YACR,aAAa,EAAE,SAAS,CACpB,4BAA4B,EAC5B,cAAc,GAAG,oBAAoB,GAAG,sBAAsB,CACjE;YACD,UAAU,EAAE,OAAO;SACtB,CAAA;QACD,UAAU,EAAE;YACR,kBAAkB,EAAE,GAAG,CAAA;YACvB,oBAAoB,EAAE,GAAG,CAAA;YACzB,YAAY,EAAE,GAAG,CAAA;SACpB,CAAA;KACJ;IACD;QACI,MAAM,EAAE,0BAA0B,CAAA;QAClC,UAAU,EAAE,EAAE,CAAA;QACd,UA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ACrC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACxB,UAAU,EAAE,mCAAmC,CAAA;KAClD;CACJ,CAAA;AAED,KAAK,mCAAmC,GAAG;IACvC,UAAU,EAAE,IAAI,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,GAAG,CAAA;IACV,aAAa,EAAE,GAAG,CAAA;IAClB,aAAa,EAAE,GAAG,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE;QACL,eAAe,EAAE,GAAG,CAAA;QACpB,gBAAgB,EAAE,GAAG,CAAA;QACrB,SAAS,EAAE,IAAI,CAAA;QACf,WAAW,EAAE,GAAG,CAAA;QAChB,IAAI,EAAE,OAAO,CAAA;QACb,EAAE,EAAE,OAAO,GAAG,IAAI,CAAA;QAClB,iBAAiB,EAAE,GAAG,CAAA;QACtB,MAAM,EAAE,KAAK,GAAG,KAAK,CAAA;QACrB,OAAO,EAAE,GAAG,CAAA;QACZ,eAAe,EAAE,OAAO,GAAG,IAAI,CAAA;QAC/B,SAAS,EAAE,GAAG,CAAA;QACd,iBAAiB,EAAE,GAAG,CAAA;KACzB,CAAA;IACD,IAAI,EAAE;QACF,IAAI,EAAE,GAAG,CAAA;QACT,WAAW,EAAE,GAAG,CAAA;QAChB,SAAS,EAAE,IAAI,CAAA;QACf,eAAe,EAAE,IAAI,CAAA;QACrB,QAAQ,EAAE,GAAG,CAAA;QACb,gBAAgB,EAAE,GAAG,CAAA;QACrB,OAAO,EAAE,OAAO,CAAA;QAChB,MAAM,EAAE,GAAG,EAAE,CAAA;KAChB,EAAE,CAAA;CACN,CAAA"}
@@ -1,4 +1,3 @@
1
- import type { UserOperationReceipt } from "./bundler";
2
1
  import type { UserOperation } from "./userOperation";
3
- export type { UserOperationReceipt, UserOperation };
2
+ export type { UserOperation };
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,YAAY,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,50 @@
1
+ import type { Address, Hash, Hex } from "viem";
2
+ import type { PartialBy } from "viem/types/utils";
3
+ import type { UserOperationWithBigIntAsHex } from "./userOperation";
4
+ type PimlicoUserOperationGasPriceWithBigIntAsHex = {
5
+ slow: {
6
+ maxFeePerGas: Hex;
7
+ maxPriorityFeePerGas: Hex;
8
+ };
9
+ standard: {
10
+ maxFeePerGas: Hex;
11
+ maxPriorityFeePerGas: Hex;
12
+ };
13
+ fast: {
14
+ maxFeePerGas: Hex;
15
+ maxPriorityFeePerGas: Hex;
16
+ };
17
+ };
18
+ export type PimlicoUserOperationStatus = {
19
+ status: "not_found" | "not_submitted" | "submitted" | "rejected" | "reverted" | "included" | "failed";
20
+ transactionHash: Hash | null;
21
+ };
22
+ export type PimlicoBundlerRpcSchema = [
23
+ {
24
+ Method: "pimlico_getUserOperationGasPrice";
25
+ Parameters: [];
26
+ ReturnType: PimlicoUserOperationGasPriceWithBigIntAsHex;
27
+ },
28
+ {
29
+ Method: "pimlico_getUserOperationStatus";
30
+ Parameters: [hash: Hash];
31
+ ReturnType: PimlicoUserOperationStatus;
32
+ }
33
+ ];
34
+ export type PimlicoPaymasterRpcSchema = [
35
+ {
36
+ Method: "pm_sponsorUserOperation";
37
+ Parameters: [
38
+ userOperation: PartialBy<UserOperationWithBigIntAsHex, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterAndData">,
39
+ entryPoint: Address
40
+ ];
41
+ ReturnType: {
42
+ paymasterAndData: Hex;
43
+ preVerificationGas: Hex;
44
+ verificationGasLimit: Hex;
45
+ callGasLimit: Hex;
46
+ };
47
+ }
48
+ ];
49
+ export {};
50
+ //# sourceMappingURL=pimlico.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../types/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAEnE,KAAK,2CAA2C,GAAG;IAC/C,IAAI,EAAE;QACF,YAAY,EAAE,GAAG,CAAA;QACjB,oBAAoB,EAAE,GAAG,CAAA;KAC5B,CAAA;IACD,QAAQ,EAAE;QACN,YAAY,EAAE,GAAG,CAAA;QACjB,oBAAoB,EAAE,GAAG,CAAA;KAC5B,CAAA;IACD,IAAI,EAAE;QACF,YAAY,EAAE,GAAG,CAAA;QACjB,oBAAoB,EAAE,GAAG,CAAA;KAC5B,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,MAAM,EAAE,WAAW,GAAG,eAAe,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAA;IACrG,eAAe,EAAE,IAAI,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IAClC;QACI,MAAM,EAAE,kCAAkC,CAAA;QAC1C,UAAU,EAAE,EAAE,CAAA;QACd,UAAU,EAAE,2CAA2C,CAAA;KAC1D;IACD;QACI,MAAM,EAAE,gCAAgC,CAAA;QACxC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACxB,UAAU,EAAE,0BAA0B,CAAA;KACzC;CACJ,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACpC;QACI,MAAM,EAAE,yBAAyB,CAAA;QACjC,UAAU,EAAE;YACR,aAAa,EAAE,SAAS,CACpB,4BAA4B,EAC5B,cAAc,GAAG,oBAAoB,GAAG,sBAAsB,GAAG,kBAAkB,CACtF;YACD,UAAU,EAAE,OAAO;SACtB,CAAA;QACD,UAAU,EAAE;YACR,gBAAgB,EAAE,GAAG,CAAA;YACrB,kBAAkB,EAAE,GAAG,CAAA;YACvB,oBAAoB,EAAE,GAAG,CAAA;YACzB,YAAY,EAAE,GAAG,CAAA;SACpB,CAAA;KACJ;CACJ,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import type { Address } from "abitype";
2
2
  import type { Hex } from "viem";
3
+ export type TStatus = "success" | "reverted";
3
4
  export type UserOperationWithBigIntAsHex = {
4
5
  sender: Address;
5
6
  nonce: Hex;
@@ -1 +1 @@
1
- {"version":3,"file":"userOperation.d.ts","sourceRoot":"","sources":["../../types/userOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAE/B,MAAM,MAAM,4BAA4B,GAAG;IACvC,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,EAAE,GAAG,CAAA;IACb,QAAQ,EAAE,GAAG,CAAA;IACb,YAAY,EAAE,GAAG,CAAA;IACjB,oBAAoB,EAAE,GAAG,CAAA;IACzB,kBAAkB,EAAE,GAAG,CAAA;IACvB,YAAY,EAAE,GAAG,CAAA;IACjB,oBAAoB,EAAE,GAAG,CAAA;IACzB,gBAAgB,EAAE,GAAG,CAAA;IACrB,SAAS,EAAE,GAAG,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,MAAM,C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C5B,gBAAgB,EAAE,GAAG,CAAA;IACrB,SAAS,EAAE,GAAG,CAAA;CACjB,CAAA"}
@@ -0,0 +1,31 @@
1
+ import type { Address, Hash } from "viem";
2
+ import type { UserOperation } from "../types";
3
+ export type GetUserOperationHashParams = {
4
+ userOperation: UserOperation;
5
+ entryPoint: Address;
6
+ chainId: number;
7
+ };
8
+ /**
9
+ *
10
+ * Returns user operation hash that is a unique identifier of the user operation.
11
+ *
12
+ * - Docs: https://docs.pimlico.io/permissionless/reference/utils/getUserOperationHash
13
+ *
14
+ * @param args: userOperation, entryPoint, chainId as {@link GetUserOperationHashParams}
15
+ * @returns userOperationHash as {@link Hash}
16
+ *
17
+ * @example
18
+ * import { getUserOperationHash } from "permissionless/utils"
19
+ *
20
+ * const userOperationHash = getUserOperationHash({
21
+ * userOperation,
22
+ * entryPoint,
23
+ * chainId
24
+ * })
25
+ *
26
+ * // Returns "0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34"
27
+ *
28
+ */
29
+ declare const getUserOperationHash: ({ userOperation, entryPoint, chainId }: GetUserOperationHashParams) => Hash;
30
+ export { getUserOperationHash };
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAO,MAAM,MAAM,CAAA;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAmC7C,MAAM,MAAM,0BAA0B,GAAG;IAAE,aAAa,EAAE,aAAa,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/G;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,oBAAoB,2CAA4C,0BAA0B,KAAG,IAOlG,CAAA;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}