permissionless 0.2.12 → 0.2.14

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 (57) 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/nexus/toNexusSmartAccount.js +198 -0
  6. package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -0
  7. package/_cjs/accounts/safe/toSafeSmartAccount.js +1 -9
  8. package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
  9. package/_cjs/actions/erc7579/isModuleInstalled.js +8 -13
  10. package/_cjs/actions/erc7579/isModuleInstalled.js.map +1 -1
  11. package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +5 -3
  12. package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
  13. package/_cjs/utils/encodeInstallModule.js +9 -6
  14. package/_cjs/utils/encodeInstallModule.js.map +1 -1
  15. package/_cjs/utils/encodeUninstallModule.js +9 -6
  16. package/_cjs/utils/encodeUninstallModule.js.map +1 -1
  17. package/_esm/accounts/biconomy/toBiconomySmartAccount.js +2 -7
  18. package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  19. package/_esm/accounts/index.js +2 -1
  20. package/_esm/accounts/index.js.map +1 -1
  21. package/_esm/accounts/nexus/toNexusSmartAccount.js +201 -0
  22. package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -0
  23. package/_esm/accounts/safe/toSafeSmartAccount.js +1 -9
  24. package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
  25. package/_esm/actions/erc7579/isModuleInstalled.js +8 -13
  26. package/_esm/actions/erc7579/isModuleInstalled.js.map +1 -1
  27. package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +5 -3
  28. package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
  29. package/_esm/utils/encodeInstallModule.js +9 -6
  30. package/_esm/utils/encodeInstallModule.js.map +1 -1
  31. package/_esm/utils/encodeUninstallModule.js +9 -6
  32. package/_esm/utils/encodeUninstallModule.js.map +1 -1
  33. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts +2 -7
  34. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
  35. package/_types/accounts/index.d.ts +2 -1
  36. package/_types/accounts/index.d.ts.map +1 -1
  37. package/_types/accounts/nexus/toNexusSmartAccount.d.ts +26 -0
  38. package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -0
  39. package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
  40. package/_types/actions/erc7579/isModuleInstalled.d.ts.map +1 -1
  41. package/_types/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.d.ts.map +1 -1
  42. package/_types/utils/encodeInstallModule.d.ts.map +1 -1
  43. package/_types/utils/encodeUninstallModule.d.ts.map +1 -1
  44. package/accounts/biconomy/toBiconomySmartAccount.ts +2 -8
  45. package/accounts/index.ts +11 -0
  46. package/accounts/nexus/toNexusSmartAccount.ts +331 -0
  47. package/accounts/safe/toSafeSmartAccount.ts +1 -12
  48. package/actions/erc7579/installModule.test.ts +4 -4
  49. package/actions/erc7579/installModules.test.ts +4 -4
  50. package/actions/erc7579/isModuleInstalled.test.ts +2 -2
  51. package/actions/erc7579/isModuleInstalled.ts +8 -13
  52. package/actions/erc7579/uninstallModule.test.ts +2 -2
  53. package/actions/erc7579/uninstallModules.test.ts +2 -2
  54. package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +6 -5
  55. package/package.json +1 -1
  56. package/utils/encodeInstallModule.ts +9 -6
  57. package/utils/encodeUninstallModule.ts +9 -6
@@ -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(
@@ -138,15 +138,16 @@ export const prepareUserOperationForErc20Paymaster =
138
138
  }
139
139
 
140
140
  ////////////////////////////////////////////////////////////////////////////////
141
-
142
141
  // Call prepareUserOperation
143
142
  ////////////////////////////////////////////////////////////////////////////////
144
143
 
145
144
  const allowanceSlot = _allowanceSlot ?? quotes[0].allowanceSlot
146
145
  const balanceSlot = _balanceSlot ?? quotes[0].balanceSlot
147
146
 
148
- const hasSlot =
149
- allowanceSlot !== undefined && balanceSlot !== undefined
147
+ const hasAllowanceSlot = allowanceSlot !== undefined
148
+ const hasBalanceSlot = balanceSlot !== undefined
149
+
150
+ const hasSlot = hasAllowanceSlot && hasBalanceSlot
150
151
 
151
152
  if (!hasSlot && balanceOverride) {
152
153
  throw new Error(
@@ -155,7 +156,7 @@ export const prepareUserOperationForErc20Paymaster =
155
156
  }
156
157
 
157
158
  const balanceStateOverride =
158
- balanceOverride && balanceSlot
159
+ balanceOverride && hasBalanceSlot
159
160
  ? erc20BalanceOverride({
160
161
  token,
161
162
  owner: account.address,
@@ -164,7 +165,7 @@ export const prepareUserOperationForErc20Paymaster =
164
165
  : undefined
165
166
 
166
167
  const allowanceStateOverride =
167
- balanceOverride && allowanceSlot
168
+ balanceOverride && hasAllowanceSlot
168
169
  ? erc20AllowanceOverride({
169
170
  token,
170
171
  owner: account.address,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permissionless",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
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",