permissionless 0.0.3 → 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 (49) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/_cjs/actions/bundler.js +3 -3
  3. package/_cjs/actions/bundler.js.map +1 -1
  4. package/_cjs/actions/index.js +1 -1
  5. package/_cjs/actions/index.js.map +1 -1
  6. package/_cjs/actions/pimlico.js.map +1 -1
  7. package/_cjs/clients/bundler.js.map +1 -1
  8. package/_cjs/clients/pimlico.js.map +1 -1
  9. package/_cjs/index.js +1 -0
  10. package/_cjs/index.js.map +1 -1
  11. package/_cjs/utils/index.js +38 -0
  12. package/_cjs/utils/index.js.map +1 -0
  13. package/_esm/actions/bundler.js +2 -2
  14. package/_esm/actions/bundler.js.map +1 -1
  15. package/_esm/actions/index.js +1 -1
  16. package/_esm/actions/index.js.map +1 -1
  17. package/_esm/actions/pimlico.js +3 -6
  18. package/_esm/actions/pimlico.js.map +1 -1
  19. package/_esm/clients/bundler.js +2 -3
  20. package/_esm/clients/bundler.js.map +1 -1
  21. package/_esm/clients/pimlico.js +3 -5
  22. package/_esm/clients/pimlico.js.map +1 -1
  23. package/_esm/index.js +1 -0
  24. package/_esm/index.js.map +1 -1
  25. package/_esm/utils/index.js +56 -0
  26. package/_esm/utils/index.js.map +1 -0
  27. package/_types/actions/bundler.d.ts +3 -3
  28. package/_types/actions/bundler.d.ts.map +1 -1
  29. package/_types/actions/index.d.ts +1 -1
  30. package/_types/actions/index.d.ts.map +1 -1
  31. package/_types/actions/pimlico.d.ts +6 -12
  32. package/_types/actions/pimlico.d.ts.map +1 -1
  33. package/_types/clients/bundler.d.ts +2 -3
  34. package/_types/clients/bundler.d.ts.map +1 -1
  35. package/_types/clients/pimlico.d.ts +3 -5
  36. package/_types/clients/pimlico.d.ts.map +1 -1
  37. package/_types/index.d.ts +1 -0
  38. package/_types/index.d.ts.map +1 -1
  39. package/_types/utils/index.d.ts +31 -0
  40. package/_types/utils/index.d.ts.map +1 -0
  41. package/actions/bundler.ts +3 -3
  42. package/actions/index.ts +2 -1
  43. package/actions/pimlico.ts +6 -12
  44. package/clients/bundler.ts +2 -3
  45. package/clients/pimlico.ts +3 -5
  46. package/index.ts +1 -0
  47. package/package.json +6 -1
  48. package/tsconfig.build.tsbuildinfo +1 -1
  49. package/utils/index.ts +70 -0
@@ -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"}
@@ -204,7 +204,7 @@ export const supportedEntryPoints = async (client: BundlerClient): Promise<Addre
204
204
  *
205
205
  */
206
206
  export const chainId = async (client: BundlerClient) => {
207
- return BigInt(
207
+ return Number(
208
208
  await client.request({
209
209
  method: "eth_chainId",
210
210
  params: []
@@ -435,7 +435,7 @@ export type BundlerActions = {
435
435
  * const chainId = await bundlerClient.chainId()
436
436
  * // Return 5n for Goerli
437
437
  */
438
- chainId: () => Promise<bigint>
438
+ chainId: () => Promise<number>
439
439
  /**
440
440
  *
441
441
  * Returns the user operation from userOpHash
@@ -495,4 +495,4 @@ const bundlerActions = (client: Client): BundlerActions => ({
495
495
  getUserOperationReceipt(client as BundlerClient, args)
496
496
  })
497
497
 
498
- export default bundlerActions
498
+ export { bundlerActions }
package/actions/index.ts CHANGED
@@ -8,7 +8,8 @@ import type {
8
8
  SendUserOperationParameters
9
9
  } from "./bundler"
10
10
 
11
- import bundlerActions, {
11
+ import {
12
+ bundlerActions,
12
13
  chainId,
13
14
  estimateUserOperationGas,
14
15
  getUserOperationByHash,
@@ -44,8 +44,7 @@ export type GetUserOperationStatusReturnType = PimlicoUserOperationStatus
44
44
  /**
45
45
  * Returns the live gas prices that you can use to send a user operation.
46
46
  *
47
- * - Docs: [TODO://add link]
48
- * - Example: [TODO://add link]
47
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
49
48
  *
50
49
  * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
51
50
  * @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas
@@ -90,8 +89,7 @@ export const getUserOperationGasPrice = async (
90
89
  /**
91
90
  * Returns the status of the userOperation that is pending in the mempool.
92
91
  *
93
- * - Docs: [TODO://add link]
94
- * - Example: [TODO://add link]
92
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationStatus
95
93
  *
96
94
  * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
97
95
  * @param hash {@link Hash} UserOpHash that you must have received from sendUserOperation.
@@ -124,8 +122,7 @@ export type PimlicoBundlerActions = {
124
122
  /**
125
123
  * Returns the live gas prices that you can use to send a user operation.
126
124
  *
127
- * - Docs: [TODO://add link]
128
- * - Example: [TODO://add link]
125
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
129
126
  *
130
127
  * @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas {@link GetUserOperationGasPriceReturnType}
131
128
  *
@@ -145,8 +142,7 @@ export type PimlicoBundlerActions = {
145
142
  /**
146
143
  * Returns the status of the userOperation that is pending in the mempool.
147
144
  *
148
- * - Docs: [TODO://add link]
149
- * - Example: [TODO://add link]
145
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationStatus
150
146
  *
151
147
  * @param hash {@link Hash} UserOpHash that you must have received from sendUserOperation.
152
148
  * @returns status & transaction hash if included {@link GetUserOperationStatusReturnType}
@@ -174,8 +170,7 @@ export const pimlicoBundlerActions = (client: Client): PimlicoBundlerActions =>
174
170
  /**
175
171
  * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
176
172
  *
177
- * - Docs: [TODO://add link]
178
- * - Example: [TODO://add link]
173
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
179
174
  *
180
175
  * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
181
176
  * @param args {@link sponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
@@ -218,8 +213,7 @@ export type PimlicoPaymasterClientActions = {
218
213
  /**
219
214
  * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
220
215
  *
221
- * - Docs: [TODO://add link]
222
- * - Example: [TODO://add link]
216
+ * https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
223
217
  *
224
218
  * @param args {@link SponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
225
219
  * @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
@@ -8,10 +8,9 @@ export type BundlerClient = Client<Transport, Chain | undefined, Account | undef
8
8
  /**
9
9
  * 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).
10
10
  *
11
- * - Docs: [TODO://add link]
12
- * - Example: [TODO://add link]
11
+ * - Docs: https://docs.pimlico.io/permissionless/reference/clients/bundlerClient
13
12
  *
14
- * 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](TODO://Add bundler action documentation link).
13
+ * 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.
15
14
  *
16
15
  * @param config - {@link PublicClientConfig}
17
16
  * @returns A Bundler Client. {@link BundlerClient}
@@ -29,8 +29,7 @@ export type PimlicoPaymasterClient = Client<
29
29
  /**
30
30
  * 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).
31
31
  *
32
- * - Docs: [TODO://add link]
33
- * - Example: [TODO://add link]
32
+ * - Docs: https://docs.pimlico.io/permissionless/reference/clients/pimlicoBundlerClient
34
33
  *
35
34
  * 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).
36
35
  *
@@ -62,10 +61,9 @@ export const createPimlicoBundlerClient = <transport extends Transport, chain ex
62
61
  /**
63
62
  * 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).
64
63
  *
65
- * - Docs: [TODO://add link]
66
- * - Example: [TODO://add link]
64
+ * - Docs: https://docs.pimlico.io/permissionless/reference/clients/pimlicoPaymasterClient
67
65
  *
68
- * 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](TODO://Add bundler action documentation link).
66
+ * 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.
69
67
  *
70
68
  * @param config - {@link PublicClientConfig}
71
69
  * @returns A Pimlico Paymaster Client. {@link PimlicoPaymasterClient}
package/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./actions"
2
2
  export * from "./clients"
3
3
  export * from "./types"
4
+ export * from "./utils"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permissionless",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "author": "Pimlico",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
@@ -42,6 +42,11 @@
42
42
  "types": "./_types/clients/pimlico.d.ts",
43
43
  "import": "./_esm/clients/pimlico.js",
44
44
  "default": "./_cjs/clients/pimlico.js"
45
+ },
46
+ "./utils": {
47
+ "types": "./_types/utils/index.d.ts",
48
+ "import": "./_esm/utils/index.js",
49
+ "default": "./_cjs/utils/index.js"
45
50
  }
46
51
  },
47
52
  "peerDependencies": {