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.
- package/CHANGELOG.md +13 -0
- package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_cjs/accounts/index.js +3 -1
- package/_cjs/accounts/index.js.map +1 -1
- package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
- package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_cjs/accounts/nexus/toNexusSmartAccount.js +198 -0
- package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -0
- package/_cjs/accounts/safe/toSafeSmartAccount.js +1 -9
- package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_cjs/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_cjs/actions/erc7579/isModuleInstalled.js +8 -13
- package/_cjs/actions/erc7579/isModuleInstalled.js.map +1 -1
- package/_cjs/utils/encodeInstallModule.js +9 -6
- package/_cjs/utils/encodeInstallModule.js.map +1 -1
- package/_cjs/utils/encodeUninstallModule.js +9 -6
- package/_cjs/utils/encodeUninstallModule.js.map +1 -1
- package/_cjs/utils/toOwner.js.map +1 -1
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js +2 -7
- package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
- package/_esm/accounts/index.js +2 -1
- package/_esm/accounts/index.js.map +1 -1
- package/_esm/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
- package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
- package/_esm/accounts/nexus/toNexusSmartAccount.js +201 -0
- package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -0
- package/_esm/accounts/safe/toSafeSmartAccount.js +1 -9
- package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
- package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
- package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
- package/_esm/accounts/trust/toTrustSmartAccount.js.map +1 -1
- package/_esm/actions/erc7579/isModuleInstalled.js +8 -13
- package/_esm/actions/erc7579/isModuleInstalled.js.map +1 -1
- package/_esm/utils/encodeInstallModule.js +9 -6
- package/_esm/utils/encodeInstallModule.js.map +1 -1
- package/_esm/utils/encodeUninstallModule.js +9 -6
- package/_esm/utils/encodeUninstallModule.js.map +1 -1
- package/_esm/utils/toOwner.js.map +1 -1
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts +5 -9
- package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
- package/_types/accounts/index.d.ts +2 -1
- package/_types/accounts/index.d.ts.map +1 -1
- package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts +3 -2
- package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts.map +1 -1
- package/_types/accounts/light/toLightSmartAccount.d.ts +3 -2
- package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts +27 -0
- package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -0
- package/_types/accounts/safe/toSafeSmartAccount.d.ts +3 -2
- package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts +3 -2
- package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts +3 -2
- package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts.map +1 -1
- package/_types/accounts/trust/toTrustSmartAccount.d.ts +3 -2
- package/_types/accounts/trust/toTrustSmartAccount.d.ts.map +1 -1
- package/_types/actions/erc7579/isModuleInstalled.d.ts.map +1 -1
- package/_types/utils/encodeInstallModule.d.ts.map +1 -1
- package/_types/utils/encodeUninstallModule.d.ts.map +1 -1
- package/_types/utils/toOwner.d.ts +6 -3
- package/_types/utils/toOwner.d.ts.map +1 -1
- package/accounts/biconomy/toBiconomySmartAccount.ts +4 -11
- package/accounts/index.ts +11 -0
- package/accounts/kernel/toEcdsaKernelSmartAccount.ts +2 -3
- package/accounts/light/toLightSmartAccount.ts +2 -3
- package/accounts/nexus/toNexusSmartAccount.ts +330 -0
- package/accounts/safe/toSafeSmartAccount.ts +3 -14
- package/accounts/simple/toSimpleSmartAccount.ts +2 -3
- package/accounts/thirdweb/toThirdwebSmartAccount.ts +2 -3
- package/accounts/trust/toTrustSmartAccount.ts +2 -3
- package/actions/erc7579/installModule.test.ts +4 -4
- package/actions/erc7579/installModules.test.ts +4 -4
- package/actions/erc7579/isModuleInstalled.test.ts +2 -2
- package/actions/erc7579/isModuleInstalled.ts +8 -13
- package/actions/erc7579/uninstallModule.test.ts +2 -2
- package/actions/erc7579/uninstallModules.test.ts +2 -2
- package/package.json +1 -1
- package/utils/encodeInstallModule.ts +9 -6
- package/utils/encodeUninstallModule.ts +9 -6
- 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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
-
"
|
|
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: "
|
|
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
|
-
"
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
-
|
|
62
|
+
name: "isModuleInstalled",
|
|
64
63
|
inputs: [
|
|
65
64
|
{
|
|
65
|
+
name: "moduleType",
|
|
66
66
|
type: "uint256",
|
|
67
|
-
|
|
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
|
-
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
-
"
|
|
65
|
+
"0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
|
|
66
66
|
context: name.startsWith("Kernel 7579")
|
|
67
67
|
? "0x"
|
|
68
68
|
: encodeAbiParameters(
|
package/package.json
CHANGED
|
@@ -54,24 +54,27 @@ export function encodeInstallModule<
|
|
|
54
54
|
data: encodeFunctionData({
|
|
55
55
|
abi: [
|
|
56
56
|
{
|
|
57
|
-
name: "installModule",
|
|
58
57
|
type: "function",
|
|
59
|
-
|
|
58
|
+
name: "installModule",
|
|
60
59
|
inputs: [
|
|
61
60
|
{
|
|
61
|
+
name: "moduleType",
|
|
62
62
|
type: "uint256",
|
|
63
|
-
|
|
63
|
+
internalType: "uint256"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
+
name: "module",
|
|
66
67
|
type: "address",
|
|
67
|
-
|
|
68
|
+
internalType: "address"
|
|
68
69
|
},
|
|
69
70
|
{
|
|
71
|
+
name: "initData",
|
|
70
72
|
type: "bytes",
|
|
71
|
-
|
|
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
|
-
|
|
58
|
+
name: "uninstallModule",
|
|
60
59
|
inputs: [
|
|
61
60
|
{
|
|
61
|
+
name: "moduleType",
|
|
62
62
|
type: "uint256",
|
|
63
|
-
|
|
63
|
+
internalType: "uint256"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
+
name: "module",
|
|
66
67
|
type: "address",
|
|
67
|
-
|
|
68
|
+
internalType: "address"
|
|
68
69
|
},
|
|
69
70
|
{
|
|
71
|
+
name: "deInitData",
|
|
70
72
|
type: "bytes",
|
|
71
|
-
|
|
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
|
|
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
|
-
|
|
|
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
|
|
56
|
+
transport: custom(owner as EthereumProvider)
|
|
62
57
|
})
|
|
63
58
|
}
|
|
64
59
|
|