permissionless 0.2.13 → 0.2.15

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 +13 -0
  2. package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  3. package/_cjs/accounts/index.js +3 -1
  4. package/_cjs/accounts/index.js.map +1 -1
  5. package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
  6. package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
  7. package/_cjs/accounts/nexus/toNexusSmartAccount.js +198 -0
  8. package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -0
  9. package/_cjs/accounts/safe/toSafeSmartAccount.js +1 -9
  10. package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
  11. package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  12. package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
  13. package/_cjs/accounts/trust/toTrustSmartAccount.js.map +1 -1
  14. package/_cjs/actions/erc7579/isModuleInstalled.js +8 -13
  15. package/_cjs/actions/erc7579/isModuleInstalled.js.map +1 -1
  16. package/_cjs/utils/encodeInstallModule.js +9 -6
  17. package/_cjs/utils/encodeInstallModule.js.map +1 -1
  18. package/_cjs/utils/encodeUninstallModule.js +9 -6
  19. package/_cjs/utils/encodeUninstallModule.js.map +1 -1
  20. package/_cjs/utils/toOwner.js.map +1 -1
  21. package/_esm/accounts/biconomy/toBiconomySmartAccount.js +2 -7
  22. package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  23. package/_esm/accounts/index.js +2 -1
  24. package/_esm/accounts/index.js.map +1 -1
  25. package/_esm/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
  26. package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
  27. package/_esm/accounts/nexus/toNexusSmartAccount.js +201 -0
  28. package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -0
  29. package/_esm/accounts/safe/toSafeSmartAccount.js +1 -9
  30. package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
  31. package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  32. package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
  33. package/_esm/accounts/trust/toTrustSmartAccount.js.map +1 -1
  34. package/_esm/actions/erc7579/isModuleInstalled.js +8 -13
  35. package/_esm/actions/erc7579/isModuleInstalled.js.map +1 -1
  36. package/_esm/utils/encodeInstallModule.js +9 -6
  37. package/_esm/utils/encodeInstallModule.js.map +1 -1
  38. package/_esm/utils/encodeUninstallModule.js +9 -6
  39. package/_esm/utils/encodeUninstallModule.js.map +1 -1
  40. package/_esm/utils/toOwner.js.map +1 -1
  41. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts +5 -9
  42. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
  43. package/_types/accounts/index.d.ts +2 -1
  44. package/_types/accounts/index.d.ts.map +1 -1
  45. package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts +3 -2
  46. package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts.map +1 -1
  47. package/_types/accounts/light/toLightSmartAccount.d.ts +3 -2
  48. package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
  49. package/_types/accounts/nexus/toNexusSmartAccount.d.ts +27 -0
  50. package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -0
  51. package/_types/accounts/safe/toSafeSmartAccount.d.ts +3 -2
  52. package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
  53. package/_types/accounts/simple/toSimpleSmartAccount.d.ts +3 -2
  54. package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
  55. package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts +3 -2
  56. package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts.map +1 -1
  57. package/_types/accounts/trust/toTrustSmartAccount.d.ts +3 -2
  58. package/_types/accounts/trust/toTrustSmartAccount.d.ts.map +1 -1
  59. package/_types/actions/erc7579/isModuleInstalled.d.ts.map +1 -1
  60. package/_types/utils/encodeInstallModule.d.ts.map +1 -1
  61. package/_types/utils/encodeUninstallModule.d.ts.map +1 -1
  62. package/_types/utils/toOwner.d.ts +6 -3
  63. package/_types/utils/toOwner.d.ts.map +1 -1
  64. package/accounts/biconomy/toBiconomySmartAccount.ts +4 -11
  65. package/accounts/index.ts +11 -0
  66. package/accounts/kernel/toEcdsaKernelSmartAccount.ts +2 -3
  67. package/accounts/light/toLightSmartAccount.ts +2 -3
  68. package/accounts/nexus/toNexusSmartAccount.ts +330 -0
  69. package/accounts/safe/toSafeSmartAccount.ts +3 -14
  70. package/accounts/simple/toSimpleSmartAccount.ts +2 -3
  71. package/accounts/thirdweb/toThirdwebSmartAccount.ts +2 -3
  72. package/accounts/trust/toTrustSmartAccount.ts +2 -3
  73. package/actions/erc7579/installModule.test.ts +4 -4
  74. package/actions/erc7579/installModules.test.ts +4 -4
  75. package/actions/erc7579/isModuleInstalled.test.ts +2 -2
  76. package/actions/erc7579/isModuleInstalled.ts +8 -13
  77. package/actions/erc7579/uninstallModule.test.ts +2 -2
  78. package/actions/erc7579/uninstallModules.test.ts +2 -2
  79. package/package.json +1 -1
  80. package/utils/encodeInstallModule.ts +9 -6
  81. package/utils/encodeUninstallModule.ts +9 -6
  82. package/utils/toOwner.ts +7 -12
@@ -35,7 +35,7 @@ describe.each(getCoreSmartAccounts())(
35
35
  const opHash = await installModule(smartClient, {
36
36
  account: smartClient.account,
37
37
  type: "executor",
38
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
38
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
39
39
  initData: name.startsWith("Kernel 7579")
40
40
  ? encodePacked(
41
41
  ["address", "bytes"],
@@ -74,7 +74,7 @@ describe.each(getCoreSmartAccounts())(
74
74
 
75
75
  const isModuleInstalled = await smartClient.isModuleInstalled({
76
76
  type: "executor",
77
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
77
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
78
78
  context: "0x"
79
79
  })
80
80
 
@@ -127,7 +127,7 @@ describe.each(getCoreSmartAccounts())(
127
127
  const opHash = await installModule(smartClient, {
128
128
  account: smartClient.account,
129
129
  type: "executor",
130
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
130
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
131
131
  context: name.startsWith("Kernel 7579")
132
132
  ? encodePacked(
133
133
  ["address", "bytes"],
@@ -165,7 +165,7 @@ describe.each(getCoreSmartAccounts())(
165
165
 
166
166
  const isModuleInstalled = await smartClient.isModuleInstalled({
167
167
  type: "executor",
168
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
168
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
169
169
  context: "0x"
170
170
  })
171
171
 
@@ -45,7 +45,7 @@ describe.each(getCoreSmartAccounts())(
45
45
  {
46
46
  type: "executor",
47
47
  address:
48
- "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
48
+ "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
49
49
  context: name.startsWith("Kernel 7579")
50
50
  ? encodePacked(
51
51
  ["address", "bytes"],
@@ -88,7 +88,7 @@ describe.each(getCoreSmartAccounts())(
88
88
 
89
89
  const isModuleInstalled = await smartClient.isModuleInstalled({
90
90
  type: "executor",
91
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
91
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
92
92
  context: "0x"
93
93
  })
94
94
 
@@ -144,7 +144,7 @@ describe.each(getCoreSmartAccounts())(
144
144
  {
145
145
  type: "executor",
146
146
  address:
147
- "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
147
+ "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
148
148
  context: name.startsWith("Kernel 7579")
149
149
  ? encodePacked(
150
150
  ["address", "bytes"],
@@ -187,7 +187,7 @@ describe.each(getCoreSmartAccounts())(
187
187
 
188
188
  const isModuleInstalled = await smartClient.isModuleInstalled({
189
189
  type: "executor",
190
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
190
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
191
191
  context: "0x"
192
192
  })
193
193
 
@@ -35,7 +35,7 @@ describe.each(getCoreSmartAccounts())(
35
35
  const opHash = await smartClient.installModule({
36
36
  account: smartClient.account as any,
37
37
  type: "executor",
38
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
38
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
39
39
  context: name.startsWith("Kernel 7579")
40
40
  ? encodePacked(
41
41
  ["address", "bytes"],
@@ -60,7 +60,7 @@ describe.each(getCoreSmartAccounts())(
60
60
  {
61
61
  account: smartClient.account,
62
62
  type: "executor",
63
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
63
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
64
64
  context: "0x"
65
65
  }
66
66
  )
@@ -58,28 +58,23 @@ export async function isModuleInstalled<
58
58
 
59
59
  const abi = [
60
60
  {
61
- name: "isModuleInstalled",
62
61
  type: "function",
63
- stateMutability: "view",
62
+ name: "isModuleInstalled",
64
63
  inputs: [
65
64
  {
65
+ name: "moduleType",
66
66
  type: "uint256",
67
- name: "moduleTypeId"
68
- },
69
- {
70
- type: "address",
71
- name: "module"
67
+ internalType: "uint256"
72
68
  },
69
+ { name: "module", type: "address", internalType: "address" },
73
70
  {
71
+ name: "additionalContext",
74
72
  type: "bytes",
75
- name: "additionalContext"
73
+ internalType: "bytes"
76
74
  }
77
75
  ],
78
- outputs: [
79
- {
80
- type: "bool"
81
- }
82
- ]
76
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
77
+ stateMutability: "view"
83
78
  }
84
79
  ] as const
85
80
 
@@ -34,7 +34,7 @@ describe.each(getCoreSmartAccounts())(
34
34
 
35
35
  const opHash = await smartClient.installModule({
36
36
  type: "executor",
37
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
37
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
38
38
  context: name.startsWith("Kernel 7579")
39
39
  ? encodePacked(
40
40
  ["address", "bytes"],
@@ -59,7 +59,7 @@ describe.each(getCoreSmartAccounts())(
59
59
  {
60
60
  account: smartClient.account,
61
61
  type: "executor",
62
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
62
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
63
63
  context: name.startsWith("Kernel 7579")
64
64
  ? "0x"
65
65
  : encodeAbiParameters(
@@ -34,7 +34,7 @@ describe.each(getCoreSmartAccounts())(
34
34
 
35
35
  const opHash = await smartClient.installModule({
36
36
  type: "executor",
37
- address: "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
37
+ address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
38
38
  context: name.startsWith("Kernel 7579")
39
39
  ? encodePacked(
40
40
  ["address", "bytes"],
@@ -62,7 +62,7 @@ describe.each(getCoreSmartAccounts())(
62
62
  {
63
63
  type: "executor",
64
64
  address:
65
- "0xc98B026383885F41d9a995f85FC480E9bb8bB891",
65
+ "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
66
66
  context: name.startsWith("Kernel 7579")
67
67
  ? "0x"
68
68
  : encodeAbiParameters(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permissionless",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "author": "Pimlico",
5
5
  "homepage": "https://docs.pimlico.io/permissionless",
6
6
  "repository": "github:pimlicolabs/permissionless.js",
@@ -54,24 +54,27 @@ export function encodeInstallModule<
54
54
  data: encodeFunctionData({
55
55
  abi: [
56
56
  {
57
- name: "installModule",
58
57
  type: "function",
59
- stateMutability: "nonpayable",
58
+ name: "installModule",
60
59
  inputs: [
61
60
  {
61
+ name: "moduleType",
62
62
  type: "uint256",
63
- name: "moduleTypeId"
63
+ internalType: "uint256"
64
64
  },
65
65
  {
66
+ name: "module",
66
67
  type: "address",
67
- name: "module"
68
+ internalType: "address"
68
69
  },
69
70
  {
71
+ name: "initData",
70
72
  type: "bytes",
71
- name: "initData"
73
+ internalType: "bytes"
72
74
  }
73
75
  ],
74
- outputs: []
76
+ outputs: [],
77
+ stateMutability: "nonpayable"
75
78
  }
76
79
  ],
77
80
  functionName: "installModule",
@@ -54,24 +54,27 @@ export function encodeUninstallModule<
54
54
  data: encodeFunctionData({
55
55
  abi: [
56
56
  {
57
- name: "uninstallModule",
58
57
  type: "function",
59
- stateMutability: "nonpayable",
58
+ name: "uninstallModule",
60
59
  inputs: [
61
60
  {
61
+ name: "moduleType",
62
62
  type: "uint256",
63
- name: "moduleTypeId"
63
+ internalType: "uint256"
64
64
  },
65
65
  {
66
+ name: "module",
66
67
  type: "address",
67
- name: "module"
68
+ internalType: "address"
68
69
  },
69
70
  {
71
+ name: "deInitData",
70
72
  type: "bytes",
71
- name: "deInitData"
73
+ internalType: "bytes"
72
74
  }
73
75
  ],
74
- outputs: []
76
+ outputs: [],
77
+ stateMutability: "nonpayable"
75
78
  }
76
79
  ],
77
80
  functionName: "uninstallModule",
package/utils/toOwner.ts CHANGED
@@ -2,9 +2,6 @@ import {
2
2
  type Account,
3
3
  type Address,
4
4
  type Chain,
5
- type EIP1193Provider,
6
- type EIP1193RequestFn,
7
- type EIP1474Methods,
8
5
  type LocalAccount,
9
6
  type OneOf,
10
7
  type Transport,
@@ -17,12 +14,14 @@ import { toAccount } from "viem/accounts"
17
14
  import { signTypedData } from "viem/actions"
18
15
  import { getAction } from "viem/utils"
19
16
 
20
- export async function toOwner({
17
+ export type EthereumProvider = { request(...args: any): Promise<any> }
18
+
19
+ export async function toOwner<provider extends EthereumProvider>({
21
20
  owner,
22
21
  address
23
22
  }: {
24
23
  owner: OneOf<
25
- | EIP1193Provider
24
+ | provider
26
25
  | WalletClient<Transport, Chain | undefined, Account>
27
26
  | LocalAccount
28
27
  >
@@ -39,15 +38,11 @@ export async function toOwner({
39
38
  if ("request" in owner) {
40
39
  if (!address) {
41
40
  try {
42
- ;[address] = await (
43
- owner.request as EIP1193RequestFn<EIP1474Methods>
44
- )({
41
+ ;[address] = await (owner as EthereumProvider).request({
45
42
  method: "eth_requestAccounts"
46
43
  })
47
44
  } catch {
48
- ;[address] = await (
49
- owner.request as EIP1193RequestFn<EIP1474Methods>
50
- )({
45
+ ;[address] = await (owner as EthereumProvider).request({
51
46
  method: "eth_accounts"
52
47
  })
53
48
  }
@@ -58,7 +53,7 @@ export async function toOwner({
58
53
  }
59
54
  walletClient = createWalletClient({
60
55
  account: address,
61
- transport: custom(owner as EIP1193Provider)
56
+ transport: custom(owner as EthereumProvider)
62
57
  })
63
58
  }
64
59