@permissionless/wagmi 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 (37) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/_cjs/connectors/biconomySmartAccount.js +18 -0
  3. package/_cjs/connectors/biconomySmartAccount.js.map +1 -0
  4. package/_cjs/connectors/kernelSmartAccount.js +18 -0
  5. package/_cjs/connectors/kernelSmartAccount.js.map +1 -0
  6. package/_cjs/connectors/safeSmartAccount.js +18 -0
  7. package/_cjs/connectors/safeSmartAccount.js.map +1 -0
  8. package/_cjs/connectors/simpleSmartAccount.js +30 -0
  9. package/_cjs/connectors/simpleSmartAccount.js.map +1 -0
  10. package/_cjs/index.js +9 -1
  11. package/_cjs/index.js.map +1 -1
  12. package/_esm/connectors/biconomySmartAccount.js +14 -0
  13. package/_esm/connectors/biconomySmartAccount.js.map +1 -0
  14. package/_esm/connectors/kernelSmartAccount.js +14 -0
  15. package/_esm/connectors/kernelSmartAccount.js.map +1 -0
  16. package/_esm/connectors/safeSmartAccount.js +14 -0
  17. package/_esm/connectors/safeSmartAccount.js.map +1 -0
  18. package/_esm/connectors/simpleSmartAccount.js +26 -0
  19. package/_esm/connectors/simpleSmartAccount.js.map +1 -0
  20. package/_esm/index.js +5 -1
  21. package/_esm/index.js.map +1 -1
  22. package/_types/connectors/biconomySmartAccount.d.ts +317 -0
  23. package/_types/connectors/biconomySmartAccount.d.ts.map +1 -0
  24. package/_types/connectors/kernelSmartAccount.d.ts +317 -0
  25. package/_types/connectors/kernelSmartAccount.d.ts.map +1 -0
  26. package/_types/connectors/safeSmartAccount.d.ts +317 -0
  27. package/_types/connectors/safeSmartAccount.d.ts.map +1 -0
  28. package/_types/connectors/simpleSmartAccount.d.ts +635 -0
  29. package/_types/connectors/simpleSmartAccount.d.ts.map +1 -0
  30. package/_types/index.d.ts +5 -1
  31. package/_types/index.d.ts.map +1 -1
  32. package/connectors/biconomySmartAccount.ts +53 -0
  33. package/connectors/kernelSmartAccount.ts +53 -0
  34. package/connectors/safeSmartAccount.ts +50 -0
  35. package/connectors/simpleSmartAccount.ts +90 -0
  36. package/index.ts +30 -1
  37. package/package.json +10 -4
@@ -0,0 +1,53 @@
1
+ import {
2
+ type SignerToBiconomySmartAccountParameters,
3
+ signerToBiconomySmartAccount
4
+ } from "permissionless/accounts"
5
+ import type { Prettify } from "permissionless/types"
6
+ import type { Address, Chain, Transport } from "viem"
7
+ import {
8
+ type SmartAccountParameters,
9
+ smartAccountConnectorHelper
10
+ } from "./simpleSmartAccount"
11
+
12
+ export type BiconomySmartAccountParameters<
13
+ TTransport extends Transport = Transport,
14
+ TChain extends Chain | undefined = Chain | undefined,
15
+ TSource extends string = "custom",
16
+ TAddress extends Address = Address
17
+ > = Prettify<
18
+ SmartAccountParameters<
19
+ Omit<
20
+ SignerToBiconomySmartAccountParameters<TSource, TAddress>,
21
+ "signer"
22
+ >,
23
+ TTransport,
24
+ TChain,
25
+ TSource,
26
+ TAddress
27
+ >
28
+ >
29
+
30
+ export async function biconomySmartAccount<
31
+ TTransport extends Transport = Transport,
32
+ TChain extends Chain | undefined = Chain | undefined,
33
+ TSource extends string = "custom",
34
+ TAddress extends Address = Address
35
+ >({
36
+ publicClient,
37
+ signer,
38
+ bundlerTransport,
39
+ sponsorUserOperation,
40
+ ...rest
41
+ }: Prettify<
42
+ BiconomySmartAccountParameters<TTransport, TChain, TSource, TAddress>
43
+ >) {
44
+ return smartAccountConnectorHelper({
45
+ account: await signerToBiconomySmartAccount(publicClient, {
46
+ ...rest,
47
+ signer
48
+ }),
49
+ publicClient,
50
+ bundlerTransport,
51
+ sponsorUserOperation
52
+ })
53
+ }
@@ -0,0 +1,53 @@
1
+ import {
2
+ type SignerToEcdsaKernelSmartAccountParameters,
3
+ signerToEcdsaKernelSmartAccount
4
+ } from "permissionless/accounts"
5
+ import type { Prettify } from "permissionless/types"
6
+ import type { Address, Chain, Transport } from "viem"
7
+ import {
8
+ type SmartAccountParameters,
9
+ smartAccountConnectorHelper
10
+ } from "./simpleSmartAccount"
11
+
12
+ export type KernelSmartAccountParameters<
13
+ TTransport extends Transport = Transport,
14
+ TChain extends Chain | undefined = Chain | undefined,
15
+ TSource extends string = "custom",
16
+ TAddress extends Address = Address
17
+ > = Prettify<
18
+ SmartAccountParameters<
19
+ Omit<
20
+ SignerToEcdsaKernelSmartAccountParameters<TSource, TAddress>,
21
+ "signer"
22
+ >,
23
+ TTransport,
24
+ TChain,
25
+ TSource,
26
+ TAddress
27
+ >
28
+ >
29
+
30
+ export async function kernelSmartAccount<
31
+ TTransport extends Transport = Transport,
32
+ TChain extends Chain | undefined = Chain | undefined,
33
+ TSource extends string = "custom",
34
+ TAddress extends Address = Address
35
+ >({
36
+ publicClient,
37
+ signer,
38
+ bundlerTransport,
39
+ sponsorUserOperation,
40
+ ...rest
41
+ }: Prettify<
42
+ KernelSmartAccountParameters<TTransport, TChain, TSource, TAddress>
43
+ >) {
44
+ return smartAccountConnectorHelper({
45
+ account: await signerToEcdsaKernelSmartAccount(publicClient, {
46
+ ...rest,
47
+ signer
48
+ }),
49
+ publicClient,
50
+ bundlerTransport,
51
+ sponsorUserOperation
52
+ })
53
+ }
@@ -0,0 +1,50 @@
1
+ import {
2
+ type SignerToSafeSmartAccountParameters,
3
+ signerToSafeSmartAccount
4
+ } from "permissionless/accounts"
5
+ import type { Prettify } from "permissionless/types"
6
+ import type { Address, Chain, Transport } from "viem"
7
+ import {
8
+ type SmartAccountParameters,
9
+ smartAccountConnectorHelper
10
+ } from "./simpleSmartAccount"
11
+
12
+ export type SafeSmartAccountParameters<
13
+ TTransport extends Transport = Transport,
14
+ TChain extends Chain | undefined = Chain | undefined,
15
+ TSource extends string = "custom",
16
+ TAddress extends Address = Address
17
+ > = Prettify<
18
+ SmartAccountParameters<
19
+ Omit<SignerToSafeSmartAccountParameters<TSource, TAddress>, "signer">,
20
+ TTransport,
21
+ TChain,
22
+ TSource,
23
+ TAddress
24
+ >
25
+ >
26
+
27
+ export async function safeSmartAccount<
28
+ TTransport extends Transport = Transport,
29
+ TChain extends Chain | undefined = Chain | undefined,
30
+ TSource extends string = "custom",
31
+ TAddress extends Address = Address
32
+ >({
33
+ publicClient,
34
+ signer,
35
+ bundlerTransport,
36
+ sponsorUserOperation,
37
+ ...rest
38
+ }: Prettify<
39
+ SafeSmartAccountParameters<TTransport, TChain, TSource, TAddress>
40
+ >) {
41
+ return smartAccountConnectorHelper({
42
+ account: await signerToSafeSmartAccount(publicClient, {
43
+ ...rest,
44
+ signer
45
+ }),
46
+ publicClient,
47
+ bundlerTransport,
48
+ sponsorUserOperation
49
+ })
50
+ }
@@ -0,0 +1,90 @@
1
+ import { createSmartAccountClient } from "permissionless"
2
+ import {
3
+ type SignerToSimpleSmartAccountParameters,
4
+ type SmartAccount,
5
+ type SmartAccountSigner,
6
+ signerToSimpleSmartAccount
7
+ } from "permissionless/accounts"
8
+ import { type SponsorUserOperationMiddleware } from "permissionless/actions/smartAccount"
9
+ import type { Prettify } from "permissionless/types"
10
+ import type { Address, Chain, PublicClient, Transport } from "viem"
11
+ import { smartAccount } from "./smartAccount"
12
+
13
+ export type SmartAccountParameters<
14
+ T,
15
+ TTransport extends Transport = Transport,
16
+ TChain extends Chain | undefined = Chain | undefined,
17
+ TSource extends string = "custom",
18
+ TAddress extends Address = Address
19
+ > = {
20
+ publicClient: PublicClient<TTransport, TChain>
21
+ signer: SmartAccountSigner<TSource, TAddress>
22
+ bundlerTransport: TTransport
23
+ } & SponsorUserOperationMiddleware &
24
+ T
25
+
26
+ export type SimpleSmartAccountParameters<
27
+ TTransport extends Transport = Transport,
28
+ TChain extends Chain | undefined = Chain | undefined,
29
+ TSource extends string = "custom",
30
+ TAddress extends Address = Address
31
+ > = Prettify<
32
+ SmartAccountParameters<
33
+ Omit<SignerToSimpleSmartAccountParameters<TSource, TAddress>, "signer">,
34
+ TTransport,
35
+ TChain,
36
+ TSource,
37
+ TAddress
38
+ >
39
+ >
40
+
41
+ export async function smartAccountConnectorHelper<
42
+ X,
43
+ TTransport extends Transport = Transport,
44
+ TChain extends Chain | undefined = Chain | undefined,
45
+ TSource extends string = "custom",
46
+ TAddress extends Address = Address,
47
+ Name extends string = string
48
+ >({
49
+ bundlerTransport,
50
+ sponsorUserOperation,
51
+ account
52
+ }: Omit<
53
+ SmartAccountParameters<X, TTransport, TChain, TSource, TAddress>,
54
+ "signer"
55
+ > & {
56
+ account: SmartAccount<Name, TTransport, TChain>
57
+ }) {
58
+ const smartAccountClient = createSmartAccountClient({
59
+ account,
60
+ transport: bundlerTransport,
61
+ sponsorUserOperation: sponsorUserOperation
62
+ })
63
+
64
+ return smartAccount({
65
+ smartAccountClient: smartAccountClient
66
+ })
67
+ }
68
+
69
+ export async function simpleSmartAccount<
70
+ TTransport extends Transport = Transport,
71
+ TChain extends Chain | undefined = Chain | undefined,
72
+ TSource extends string = "custom",
73
+ TAddress extends Address = Address
74
+ >({
75
+ publicClient,
76
+ signer,
77
+ bundlerTransport,
78
+ sponsorUserOperation,
79
+ ...rest
80
+ }: SimpleSmartAccountParameters<TTransport, TChain, TSource, TAddress>) {
81
+ return smartAccountConnectorHelper({
82
+ account: await signerToSimpleSmartAccount(publicClient, {
83
+ ...rest,
84
+ signer
85
+ }),
86
+ publicClient,
87
+ bundlerTransport,
88
+ sponsorUserOperation
89
+ })
90
+ }
package/index.ts CHANGED
@@ -1,3 +1,32 @@
1
+ import {
2
+ type SimpleSmartAccountParameters,
3
+ simpleSmartAccount
4
+ } from "./connectors/simpleSmartAccount"
1
5
  import { smartAccount } from "./connectors/smartAccount"
2
6
 
3
- export { smartAccount }
7
+ import {
8
+ type SafeSmartAccountParameters,
9
+ safeSmartAccount
10
+ } from "./connectors/safeSmartAccount"
11
+
12
+ import {
13
+ type BiconomySmartAccountParameters,
14
+ biconomySmartAccount
15
+ } from "./connectors/biconomySmartAccount"
16
+
17
+ import {
18
+ type KernelSmartAccountParameters,
19
+ kernelSmartAccount
20
+ } from "./connectors/kernelSmartAccount"
21
+
22
+ export {
23
+ smartAccount,
24
+ simpleSmartAccount,
25
+ type SimpleSmartAccountParameters,
26
+ safeSmartAccount,
27
+ type SafeSmartAccountParameters,
28
+ biconomySmartAccount,
29
+ type BiconomySmartAccountParameters,
30
+ kernelSmartAccount,
31
+ type KernelSmartAccountParameters
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@permissionless/wagmi",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "author": "Pimlico",
5
5
  "homepage": "https://docs.pimlico.io/permissionless/wagmi",
6
6
  "repository": "github:pimlicolabs/permissionless.js",
@@ -11,7 +11,13 @@
11
11
  "type": "module",
12
12
  "sideEffects": false,
13
13
  "description": "A utility library for working with ERC-4337",
14
- "keywords": ["ethereum", "erc-4337", "eip-4337", "paymaster", "bundler"],
14
+ "keywords": [
15
+ "ethereum",
16
+ "erc-4337",
17
+ "eip-4337",
18
+ "paymaster",
19
+ "bundler"
20
+ ],
15
21
  "license": "MIT",
16
22
  "exports": {
17
23
  ".": {
@@ -21,8 +27,8 @@
21
27
  }
22
28
  },
23
29
  "peerDependencies": {
24
- "wagmi": "^0.0.0-canary-20240123224806",
30
+ "wagmi": "^2.5.1",
25
31
  "viem": "^2.0.0",
26
- "permissionless": "^0.0.30"
32
+ "permissionless": "^0.0.36"
27
33
  }
28
34
  }