permissionless 0.1.36 → 0.1.39

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 (35) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js +2 -2
  3. package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
  4. package/_cjs/accounts/safe/signerToSafeSmartAccount.js +18 -18
  5. package/_cjs/accounts/safe/signerToSafeSmartAccount.js.map +1 -1
  6. package/_cjs/actions/erc7579/supportsExecutionMode.js +2 -2
  7. package/_cjs/actions/erc7579/supportsExecutionMode.js.map +1 -1
  8. package/_cjs/actions/public/getSenderAddress.js +79 -55
  9. package/_cjs/actions/public/getSenderAddress.js.map +1 -1
  10. package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js +2 -2
  11. package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
  12. package/_esm/accounts/safe/signerToSafeSmartAccount.js +18 -18
  13. package/_esm/accounts/safe/signerToSafeSmartAccount.js.map +1 -1
  14. package/_esm/actions/erc7579/supportsExecutionMode.js +2 -2
  15. package/_esm/actions/erc7579/supportsExecutionMode.js.map +1 -1
  16. package/_esm/actions/public/getSenderAddress.js +83 -59
  17. package/_esm/actions/public/getSenderAddress.js.map +1 -1
  18. package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts +1 -1
  19. package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts.map +1 -1
  20. package/_types/accounts/safe/signerToSafeSmartAccount.d.ts +2 -1
  21. package/_types/accounts/safe/signerToSafeSmartAccount.d.ts.map +1 -1
  22. package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
  23. package/accounts/kernel/signerToEcdsaKernelSmartAccount.ts +3 -3
  24. package/accounts/safe/signerToSafeSmartAccount.ts +24 -24
  25. package/actions/erc7579/installModule.test.ts +111 -1
  26. package/actions/erc7579/isModuleInstalled.test.ts +1 -1
  27. package/actions/erc7579/supportsExecutionMode.ts +2 -2
  28. package/actions/erc7579/uninstallModule.test.ts +2 -2
  29. package/actions/public/getSenderAddress.test.ts +1 -1
  30. package/actions/public/getSenderAddress.ts +104 -70
  31. package/actions/smartAccount/signMessage.test.ts +89 -6
  32. package/actions/smartAccount/signTypedData.test.ts +84 -6
  33. package/actions/smartAccount/writeContract.test.ts +84 -6
  34. package/package.json +1 -1
  35. package/utils/encode7579CallData.test.ts +1 -1
@@ -9,14 +9,20 @@ import {
9
9
  } from "../../../permissionless-test/src/utils"
10
10
  import type { SmartAccount } from "../../accounts"
11
11
  import type { EntryPoint } from "../../types/entrypoint"
12
- import { ENTRYPOINT_ADDRESS_V06 } from "../../utils"
12
+ import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "../../utils"
13
13
  import { signMessage } from "./signMessage"
14
14
 
15
15
  describe.each(getCoreSmartAccounts())(
16
16
  "signMessage $name",
17
- ({ getSmartAccountClient, isEip1271Compliant }) => {
18
- testWithRpc.skipIf(isEip1271Compliant)(
19
- "not isEip1271Compliant",
17
+ ({
18
+ getSmartAccountClient,
19
+ isEip1271Compliant,
20
+ supportsEntryPointV06,
21
+ supportsEntryPointV07,
22
+ name
23
+ }) => {
24
+ testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV06)(
25
+ "not isEip1271Compliant_v06",
20
26
  async ({ rpc }) => {
21
27
  const { anvilRpc, altoRpc, paymasterRpc } = rpc
22
28
 
@@ -47,8 +53,8 @@ describe.each(getCoreSmartAccounts())(
47
53
  }
48
54
  )
49
55
 
50
- testWithRpc.skipIf(!isEip1271Compliant)(
51
- "isEip1271Compliant",
56
+ testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV06)(
57
+ "isEip1271Compliant_v06",
52
58
  async ({ rpc }) => {
53
59
  const { anvilRpc, altoRpc, paymasterRpc } = rpc
54
60
 
@@ -85,5 +91,82 @@ describe.each(getCoreSmartAccounts())(
85
91
  expect(isVerified).toBeTruthy()
86
92
  }
87
93
  )
94
+
95
+ testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV07)(
96
+ "not isEip1271Compliant_v07",
97
+ async ({ rpc }) => {
98
+ const { anvilRpc, altoRpc, paymasterRpc } = rpc
99
+
100
+ const smartClient = await getSmartAccountClient({
101
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
102
+ privateKey: generatePrivateKey(),
103
+ altoRpc: altoRpc,
104
+ anvilRpc: anvilRpc,
105
+ paymasterClient: getPimlicoPaymasterClient({
106
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
107
+ paymasterRpc
108
+ })
109
+ })
110
+
111
+ await expect(async () =>
112
+ signMessage(
113
+ smartClient as Client<
114
+ Transport,
115
+ Chain,
116
+ SmartAccount<EntryPoint>
117
+ >,
118
+ {
119
+ message:
120
+ "slowly and steadily burning the private keys"
121
+ }
122
+ )
123
+ ).rejects.toThrow()
124
+ }
125
+ )
126
+
127
+ testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV07)(
128
+ "isEip1271Compliant_v07",
129
+ async ({ rpc }) => {
130
+ const { anvilRpc, altoRpc, paymasterRpc } = rpc
131
+
132
+ const smartClient = await getSmartAccountClient({
133
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
134
+ privateKey: generatePrivateKey(),
135
+ altoRpc: altoRpc,
136
+ anvilRpc: anvilRpc,
137
+ paymasterClient: getPimlicoPaymasterClient({
138
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
139
+ paymasterRpc
140
+ })
141
+ })
142
+
143
+ const signature = await signMessage(
144
+ smartClient as Client<
145
+ Transport,
146
+ Chain,
147
+ SmartAccount<EntryPoint>
148
+ >,
149
+ {
150
+ message: "slowly and steadily burning the private keys"
151
+ }
152
+ )
153
+
154
+ const publicClient = getPublicClient(anvilRpc)
155
+
156
+ if (name === "Safe 7579") {
157
+ // Due to 7579 launchpad, we can't verify the signature as of now.
158
+ // Awaiting for the fix
159
+ return
160
+ }
161
+
162
+ const isVerified = await publicClient.verifyMessage({
163
+ address: smartClient.account.address,
164
+ message: "slowly and steadily burning the private keys",
165
+ signature
166
+ })
167
+
168
+ expect(isVerified).toBeTruthy()
169
+ }
170
+ )
88
171
  }
89
172
  )
@@ -9,7 +9,7 @@ import {
9
9
  } from "../../../permissionless-test/src/utils"
10
10
  import type { SmartAccount } from "../../accounts"
11
11
  import type { EntryPoint } from "../../types/entrypoint"
12
- import { ENTRYPOINT_ADDRESS_V06 } from "../../utils"
12
+ import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "../../utils"
13
13
  import { signTypedData } from "./signTypedData"
14
14
 
15
15
  const typedData = {
@@ -48,9 +48,15 @@ const typedData = {
48
48
 
49
49
  describe.each(getCoreSmartAccounts())(
50
50
  "signTypedData $name",
51
- ({ getSmartAccountClient, isEip1271Compliant }) => {
52
- testWithRpc.skipIf(isEip1271Compliant)(
53
- "not isEip1271Compliant",
51
+ ({
52
+ getSmartAccountClient,
53
+ isEip1271Compliant,
54
+ supportsEntryPointV06,
55
+ supportsEntryPointV07,
56
+ name
57
+ }) => {
58
+ testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV06)(
59
+ "not isEip1271Compliant_v06",
54
60
  async ({ rpc }) => {
55
61
  const { anvilRpc, altoRpc, paymasterRpc } = rpc
56
62
 
@@ -78,8 +84,8 @@ describe.each(getCoreSmartAccounts())(
78
84
  }
79
85
  )
80
86
 
81
- testWithRpc.skipIf(!isEip1271Compliant)(
82
- "isEip1271Compliant",
87
+ testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV06)(
88
+ "isEip1271Compliant_v06",
83
89
  async ({ rpc }) => {
84
90
  const { anvilRpc, altoRpc, paymasterRpc } = rpc
85
91
 
@@ -114,5 +120,77 @@ describe.each(getCoreSmartAccounts())(
114
120
  expect(isVerified).toBeTruthy()
115
121
  }
116
122
  )
123
+
124
+ testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV07)(
125
+ "not isEip1271Compliant_v07",
126
+ async ({ rpc }) => {
127
+ const { anvilRpc, altoRpc, paymasterRpc } = rpc
128
+
129
+ const smartClient = await getSmartAccountClient({
130
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
131
+ privateKey: generatePrivateKey(),
132
+ altoRpc: altoRpc,
133
+ anvilRpc: anvilRpc,
134
+ paymasterClient: getPimlicoPaymasterClient({
135
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
136
+ paymasterRpc
137
+ })
138
+ })
139
+
140
+ await expect(async () =>
141
+ signTypedData(
142
+ smartClient as Client<
143
+ Transport,
144
+ Chain,
145
+ SmartAccount<EntryPoint>
146
+ >,
147
+ typedData
148
+ )
149
+ ).rejects.toThrow()
150
+ }
151
+ )
152
+
153
+ testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV07)(
154
+ "isEip1271Compliant_v07",
155
+ async ({ rpc }) => {
156
+ const { anvilRpc, altoRpc, paymasterRpc } = rpc
157
+
158
+ const smartClient = await getSmartAccountClient({
159
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
160
+ privateKey: generatePrivateKey(),
161
+ altoRpc: altoRpc,
162
+ anvilRpc: anvilRpc,
163
+ paymasterClient: getPimlicoPaymasterClient({
164
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
165
+ paymasterRpc
166
+ })
167
+ })
168
+
169
+ const signature = await signTypedData(
170
+ smartClient as Client<
171
+ Transport,
172
+ Chain,
173
+ SmartAccount<EntryPoint>
174
+ >,
175
+ typedData
176
+ )
177
+
178
+ const publicClient = getPublicClient(anvilRpc)
179
+
180
+ if (name === "Safe 7579") {
181
+ // Due to 7579 launchpad, we can't verify the signature as of now.
182
+ // Awaiting for the fix
183
+ return
184
+ }
185
+
186
+ const isVerified = await publicClient.verifyTypedData({
187
+ ...typedData,
188
+ address: smartClient.account.address,
189
+ signature
190
+ })
191
+
192
+ expect(isVerified).toBeTruthy()
193
+ }
194
+ )
117
195
  }
118
196
  )
@@ -9,7 +9,7 @@ import {
9
9
  } from "../../../permissionless-test/src/utils"
10
10
  import type { SmartAccount } from "../../accounts"
11
11
  import type { EntryPoint } from "../../types/entrypoint"
12
- import { ENTRYPOINT_ADDRESS_V06 } from "../../utils"
12
+ import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "../../utils"
13
13
  import { signTypedData } from "./signTypedData"
14
14
 
15
15
  const typedData = {
@@ -48,9 +48,15 @@ const typedData = {
48
48
 
49
49
  describe.each(getCoreSmartAccounts())(
50
50
  "signTypedData $name",
51
- ({ getSmartAccountClient, isEip1271Compliant }) => {
52
- testWithRpc.skipIf(isEip1271Compliant)(
53
- "not isEip1271Compliant",
51
+ ({
52
+ getSmartAccountClient,
53
+ isEip1271Compliant,
54
+ supportsEntryPointV06,
55
+ supportsEntryPointV07,
56
+ name
57
+ }) => {
58
+ testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV06)(
59
+ "not isEip1271Compliant_v06",
54
60
  async ({ rpc }) => {
55
61
  const { anvilRpc, altoRpc, paymasterRpc } = rpc
56
62
 
@@ -78,8 +84,8 @@ describe.each(getCoreSmartAccounts())(
78
84
  }
79
85
  )
80
86
 
81
- testWithRpc.skipIf(!isEip1271Compliant)(
82
- "isEip1271Compliant",
87
+ testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV06)(
88
+ "isEip1271Compliant_v06",
83
89
  async ({ rpc }) => {
84
90
  const { anvilRpc, altoRpc, paymasterRpc } = rpc
85
91
 
@@ -114,5 +120,77 @@ describe.each(getCoreSmartAccounts())(
114
120
  expect(isVerified).toBeTruthy()
115
121
  }
116
122
  )
123
+
124
+ testWithRpc.skipIf(isEip1271Compliant || !supportsEntryPointV07)(
125
+ "not isEip1271Compliant_v07",
126
+ async ({ rpc }) => {
127
+ const { anvilRpc, altoRpc, paymasterRpc } = rpc
128
+
129
+ const smartClient = await getSmartAccountClient({
130
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
131
+ privateKey: generatePrivateKey(),
132
+ altoRpc: altoRpc,
133
+ anvilRpc: anvilRpc,
134
+ paymasterClient: getPimlicoPaymasterClient({
135
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
136
+ paymasterRpc
137
+ })
138
+ })
139
+
140
+ await expect(async () =>
141
+ signTypedData(
142
+ smartClient as Client<
143
+ Transport,
144
+ Chain,
145
+ SmartAccount<EntryPoint>
146
+ >,
147
+ typedData
148
+ )
149
+ ).rejects.toThrow()
150
+ }
151
+ )
152
+
153
+ testWithRpc.skipIf(!isEip1271Compliant || !supportsEntryPointV07)(
154
+ "isEip1271Compliant_v07",
155
+ async ({ rpc }) => {
156
+ const { anvilRpc, altoRpc, paymasterRpc } = rpc
157
+
158
+ const smartClient = await getSmartAccountClient({
159
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
160
+ privateKey: generatePrivateKey(),
161
+ altoRpc: altoRpc,
162
+ anvilRpc: anvilRpc,
163
+ paymasterClient: getPimlicoPaymasterClient({
164
+ entryPoint: ENTRYPOINT_ADDRESS_V07,
165
+ paymasterRpc
166
+ })
167
+ })
168
+
169
+ const signature = await signTypedData(
170
+ smartClient as Client<
171
+ Transport,
172
+ Chain,
173
+ SmartAccount<EntryPoint>
174
+ >,
175
+ typedData
176
+ )
177
+
178
+ const publicClient = getPublicClient(anvilRpc)
179
+
180
+ if (name === "Safe 7579") {
181
+ // Due to 7579 launchpad, we can't verify the signature as of now.
182
+ // Awaiting for the fix
183
+ return
184
+ }
185
+
186
+ const isVerified = await publicClient.verifyTypedData({
187
+ ...typedData,
188
+ address: smartClient.account.address,
189
+ signature
190
+ })
191
+
192
+ expect(isVerified).toBeTruthy()
193
+ }
194
+ )
117
195
  }
118
196
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permissionless",
3
- "version": "0.1.36",
3
+ "version": "0.1.39",
4
4
  "author": "Pimlico",
5
5
  "homepage": "https://docs.pimlico.io/permissionless",
6
6
  "repository": "github:pimlicolabs/permissionless.js",
@@ -39,7 +39,7 @@ describe("encode7579CallData", () => {
39
39
  })
40
40
 
41
41
  expect(callData).toBe(
42
- "0xe9ae5c53ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000001234567890123456789012345678901234567890000000000000000000000000000000000000000000000000000000000000303900000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000014123456789012345678901234567890123456789000000000000000000000000000000000000000000000000012345678901234567890123456789012345678900000000000000000000000000000000000000000000000000000000000003039000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000141234567890123456789012345678901234567890000000000000000000000000"
42
+ "0xe9ae5c530100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000001234567890123456789012345678901234567890000000000000000000000000000000000000000000000000000000000000303900000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000014123456789012345678901234567890123456789000000000000000000000000000000000000000000000000012345678901234567890123456789012345678900000000000000000000000000000000000000000000000000000000000003039000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000141234567890123456789012345678901234567890000000000000000000000000"
43
43
  )
44
44
  })
45
45