@rhinestone/sdk 0.11.3 → 0.12.0
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/README.md +6 -0
- package/dist/src/accounts/index.d.ts +2 -1
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +31 -0
- package/dist/src/actions/index.d.ts +17 -2
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +89 -46
- package/dist/src/actions/index.test.js +134 -21
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +5 -4
- package/dist/src/execution/utils.d.ts +1 -1
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +77 -24
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -2
- package/dist/src/modules/validators/core.d.ts +16 -1
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +2 -0
- package/dist/src/types.d.ts +10 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -203,6 +203,12 @@ const transactionResult = await rhinestoneAccount.sendTransaction({
|
|
|
203
203
|
})
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
+
## Migrating from Orchestrator SDK
|
|
207
|
+
|
|
208
|
+
To migrate from the [Orchestrator SDK](https://github.com/rhinestonewtf/orchestrator-sdk), replace all imports of `@rhinestone/orchestrator-sdk` with `@rhinestone/sdk/orchestrator`.
|
|
209
|
+
|
|
210
|
+
Let us know if you encounter any issues!
|
|
211
|
+
|
|
206
212
|
## Contributing
|
|
207
213
|
|
|
208
214
|
For feature or change requests, feel free to open a PR, start a discussion or get in touch with us.
|
|
@@ -16,6 +16,7 @@ declare function getDeployArgs(config: RhinestoneAccountConfig): {
|
|
|
16
16
|
initializationCallData: `0x${string}`;
|
|
17
17
|
};
|
|
18
18
|
declare function getModuleInstallationCalls(config: RhinestoneAccountConfig, module: Module): Call[];
|
|
19
|
+
declare function getModuleUninstallationCalls(config: RhinestoneAccountConfig, module: Module): Call[];
|
|
19
20
|
declare function getAddress(config: RhinestoneAccountConfig): `0x${string}`;
|
|
20
21
|
declare function getPackedSignature(config: RhinestoneAccountConfig, owners: OwnerSet, chain: Chain, validator: ValidatorConfig, hash: Hex, transformSignature?: (signature: Hex) => Hex): Promise<`0x${string}`>;
|
|
21
22
|
declare function isDeployed(chain: Chain, config: RhinestoneAccountConfig): Promise<boolean>;
|
|
@@ -27,5 +28,5 @@ declare function getSmartAccount(config: RhinestoneAccountConfig, client: Public
|
|
|
27
28
|
declare function getSmartSessionSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain, session: Session): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
28
29
|
declare function getGuardianSmartAccount(config: RhinestoneAccountConfig, client: PublicClient, chain: Chain, guardians: OwnerSet): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>>;
|
|
29
30
|
declare function sign(validators: OwnerSet, chain: Chain, hash: Hex): Promise<`0x${string}`>;
|
|
30
|
-
export { getModuleInstallationCalls, getDeployArgs, getBundleInitCode, getAddress, isDeployed, deploy, deploySource, deployTarget, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, sign, };
|
|
31
|
+
export { getModuleInstallationCalls, getModuleUninstallationCalls, getDeployArgs, getBundleInitCode, getAddress, isDeployed, deploy, deploySource, deployTarget, getSmartAccount, getSmartSessionSmartAccount, getGuardianSmartAccount, getPackedSignature, sign, };
|
|
31
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,
|
|
1
|
+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OAAO,iBASlB;AAUD,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,6BAUzD;AAgID,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,sJAmCb;AAED,iBAAe,2BAA2B,CACxC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,sJAuCjB;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,QAAQ,sJAwCpB;AAED,iBAAe,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,0BAYhE;AAsED,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAClB,IAAI,GACL,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getModuleInstallationCalls = getModuleInstallationCalls;
|
|
4
|
+
exports.getModuleUninstallationCalls = getModuleUninstallationCalls;
|
|
4
5
|
exports.getDeployArgs = getDeployArgs;
|
|
5
6
|
exports.getBundleInitCode = getBundleInitCode;
|
|
6
7
|
exports.getAddress = getAddress;
|
|
@@ -58,6 +59,36 @@ function getModuleInstallationCalls(config, module) {
|
|
|
58
59
|
data,
|
|
59
60
|
}));
|
|
60
61
|
}
|
|
62
|
+
function getModuleUninstallationCalls(config, module) {
|
|
63
|
+
const address = getAddress(config);
|
|
64
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
65
|
+
abi: [
|
|
66
|
+
{
|
|
67
|
+
type: 'function',
|
|
68
|
+
name: 'uninstallModule',
|
|
69
|
+
inputs: [
|
|
70
|
+
{
|
|
71
|
+
type: 'uint256',
|
|
72
|
+
name: 'moduleTypeId',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'address',
|
|
76
|
+
name: 'module',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'bytes',
|
|
80
|
+
name: 'deInitData',
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
outputs: [],
|
|
84
|
+
stateMutability: 'nonpayable',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
functionName: 'uninstallModule',
|
|
88
|
+
args: [module.type, module.address, module.deInitData],
|
|
89
|
+
});
|
|
90
|
+
return [{ to: address, data }];
|
|
91
|
+
}
|
|
61
92
|
function getAddress(config) {
|
|
62
93
|
if (is7702(config)) {
|
|
63
94
|
if (!config.eoa) {
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import { Address, Chain } from 'viem';
|
|
2
2
|
import { RhinestoneAccount } from '..';
|
|
3
|
+
import { WebauthnCredential } from '../modules/validators/core';
|
|
3
4
|
import { Call, OwnerSet, Recovery } from '../types';
|
|
4
5
|
declare function setUpRecovery({ rhinestoneAccount, guardians, threshold, }: {
|
|
5
6
|
rhinestoneAccount: RhinestoneAccount;
|
|
6
7
|
} & Recovery): Call[];
|
|
7
8
|
declare function recover(address: Address, newOwners: OwnerSet, chain: Chain): Promise<Call[]>;
|
|
9
|
+
declare function enableEcdsa({ rhinestoneAccount, owners, threshold, }: {
|
|
10
|
+
rhinestoneAccount: RhinestoneAccount;
|
|
11
|
+
owners: Address[];
|
|
12
|
+
threshold?: number;
|
|
13
|
+
}): Call[];
|
|
14
|
+
declare function enablePasskeys({ rhinestoneAccount, pubKey, authenticatorId, }: {
|
|
15
|
+
rhinestoneAccount: RhinestoneAccount;
|
|
16
|
+
} & WebauthnCredential): Call[];
|
|
17
|
+
declare function disableEcdsa({ rhinestoneAccount, }: {
|
|
18
|
+
rhinestoneAccount: RhinestoneAccount;
|
|
19
|
+
}): Call[];
|
|
20
|
+
declare function disablePasskeys({ rhinestoneAccount, }: {
|
|
21
|
+
rhinestoneAccount: RhinestoneAccount;
|
|
22
|
+
}): Call[];
|
|
8
23
|
declare function addOwner(owner: Address): Call;
|
|
9
24
|
declare function removeOwner(prevOwner: Address, ownerToRemove: Address): Call;
|
|
10
|
-
declare function
|
|
11
|
-
export { addOwner, removeOwner,
|
|
25
|
+
declare function changeThreshold(newThreshold: number): Call;
|
|
26
|
+
export { enableEcdsa, enablePasskeys, disableEcdsa, disablePasskeys, addOwner, removeOwner, changeThreshold, recover, setUpRecovery, };
|
|
12
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAIN,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAIN,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAA;AAKtC,OAAO,EAKL,kBAAkB,EACnB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,IAAI,EAA0B,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE3E,iBAAS,aAAa,CAAC,EACrB,iBAAiB,EACjB,SAAS,EACT,SAAa,GACd,EAAE;IACD,iBAAiB,EAAE,iBAAiB,CAAA;CACrC,GAAG,QAAQ,UAIX;AAED,iBAAe,OAAO,CACpB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,QAAQ,EACnB,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,IAAI,EAAE,CAAC,CASjB;AAED,iBAAS,WAAW,CAAC,EACnB,iBAAiB,EACjB,MAAM,EACN,SAAa,GACd,EAAE;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,MAAM,EAAE,OAAO,EAAE,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,UAOA;AAED,iBAAS,cAAc,CAAC,EACtB,iBAAiB,EACjB,MAAM,EACN,eAAe,GAChB,EAAE;IACD,iBAAiB,EAAE,iBAAiB,CAAA;CACrC,GAAG,kBAAkB,UAIrB;AAED,iBAAS,YAAY,CAAC,EACpB,iBAAiB,GAClB,EAAE;IACD,iBAAiB,EAAE,iBAAiB,CAAA;CACrC,UAOA;AAED,iBAAS,eAAe,CAAC,EACvB,iBAAiB,GAClB,EAAE;IACD,iBAAiB,EAAE,iBAAiB,CAAA;CACrC,UASA;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAiBtC;AAED,iBAAS,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI,CAoBrE;AAED,iBAAS,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAmBnD;AA+GD,OAAO,EACL,WAAW,EACX,cAAc,EACd,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,WAAW,EACX,eAAe,EACf,OAAO,EACP,aAAa,GACd,CAAA"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableEcdsa = enableEcdsa;
|
|
4
|
+
exports.enablePasskeys = enablePasskeys;
|
|
5
|
+
exports.disableEcdsa = disableEcdsa;
|
|
6
|
+
exports.disablePasskeys = disablePasskeys;
|
|
3
7
|
exports.addOwner = addOwner;
|
|
4
8
|
exports.removeOwner = removeOwner;
|
|
5
|
-
exports.
|
|
9
|
+
exports.changeThreshold = changeThreshold;
|
|
6
10
|
exports.recover = recover;
|
|
7
11
|
exports.setUpRecovery = setUpRecovery;
|
|
8
12
|
const viem_1 = require("viem");
|
|
@@ -23,6 +27,36 @@ async function recover(address, newOwners, chain) {
|
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
29
|
}
|
|
30
|
+
function enableEcdsa({ rhinestoneAccount, owners, threshold = 1, }) {
|
|
31
|
+
const module = (0, core_1.getOwnableValidator)({
|
|
32
|
+
threshold,
|
|
33
|
+
owners,
|
|
34
|
+
});
|
|
35
|
+
const calls = (0, accounts_1.getModuleInstallationCalls)(rhinestoneAccount.config, module);
|
|
36
|
+
return calls;
|
|
37
|
+
}
|
|
38
|
+
function enablePasskeys({ rhinestoneAccount, pubKey, authenticatorId, }) {
|
|
39
|
+
const module = (0, core_1.getWebAuthnValidator)({ pubKey, authenticatorId });
|
|
40
|
+
const calls = (0, accounts_1.getModuleInstallationCalls)(rhinestoneAccount.config, module);
|
|
41
|
+
return calls;
|
|
42
|
+
}
|
|
43
|
+
function disableEcdsa({ rhinestoneAccount, }) {
|
|
44
|
+
const module = (0, core_1.getOwnableValidator)({
|
|
45
|
+
threshold: 1,
|
|
46
|
+
owners: [],
|
|
47
|
+
});
|
|
48
|
+
const calls = (0, accounts_1.getModuleUninstallationCalls)(rhinestoneAccount.config, module);
|
|
49
|
+
return calls;
|
|
50
|
+
}
|
|
51
|
+
function disablePasskeys({ rhinestoneAccount, }) {
|
|
52
|
+
const module = (0, core_1.getWebAuthnValidator)({
|
|
53
|
+
// Mocked values
|
|
54
|
+
pubKey: '0x580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d1',
|
|
55
|
+
authenticatorId: '0x',
|
|
56
|
+
});
|
|
57
|
+
const calls = (0, accounts_1.getModuleUninstallationCalls)(rhinestoneAccount.config, module);
|
|
58
|
+
return calls;
|
|
59
|
+
}
|
|
26
60
|
function addOwner(owner) {
|
|
27
61
|
return {
|
|
28
62
|
to: core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
@@ -62,7 +96,7 @@ function removeOwner(prevOwner, ownerToRemove) {
|
|
|
62
96
|
}),
|
|
63
97
|
};
|
|
64
98
|
}
|
|
65
|
-
function
|
|
99
|
+
function changeThreshold(newThreshold) {
|
|
66
100
|
return {
|
|
67
101
|
to: core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
68
102
|
data: (0, viem_1.encodeFunctionData)({
|
|
@@ -78,7 +112,7 @@ function setThreshold(newThreshold) {
|
|
|
78
112
|
},
|
|
79
113
|
],
|
|
80
114
|
functionName: 'setThreshold',
|
|
81
|
-
args: [newThreshold],
|
|
115
|
+
args: [BigInt(newThreshold)],
|
|
82
116
|
}),
|
|
83
117
|
};
|
|
84
118
|
}
|
|
@@ -88,56 +122,65 @@ async function recoverEcdsaOwnership(address, newOwners, chain) {
|
|
|
88
122
|
transport: (0, viem_1.http)(),
|
|
89
123
|
});
|
|
90
124
|
// Read the existing config
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
const results = await publicClient.multicall({
|
|
126
|
+
contracts: [
|
|
127
|
+
{
|
|
128
|
+
address: core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
129
|
+
abi: [
|
|
130
|
+
{
|
|
131
|
+
inputs: [
|
|
132
|
+
{ internalType: 'address', name: 'account', type: 'address' },
|
|
133
|
+
],
|
|
134
|
+
name: 'getOwners',
|
|
135
|
+
outputs: [
|
|
136
|
+
{
|
|
137
|
+
internalType: 'address[]',
|
|
138
|
+
name: 'ownersArray',
|
|
139
|
+
type: 'address[]',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
stateMutability: 'view',
|
|
143
|
+
type: 'function',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
functionName: 'getOwners',
|
|
147
|
+
args: [address],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
address: core_1.OWNABLE_VALIDATOR_ADDRESS,
|
|
151
|
+
abi: [
|
|
152
|
+
{
|
|
153
|
+
inputs: [
|
|
154
|
+
{ internalType: 'address', name: 'account', type: 'address' },
|
|
155
|
+
],
|
|
156
|
+
name: 'threshold',
|
|
157
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
158
|
+
stateMutability: 'view',
|
|
159
|
+
type: 'function',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
functionName: 'threshold',
|
|
163
|
+
args: [address],
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
});
|
|
167
|
+
const existingOwnersResult = results[0];
|
|
168
|
+
const existingThresholdResult = results[1];
|
|
169
|
+
if (existingOwnersResult.error || existingThresholdResult.error) {
|
|
170
|
+
throw new Error('Failed to read existing owners or threshold');
|
|
171
|
+
}
|
|
172
|
+
const existingOwners = existingOwnersResult.result;
|
|
173
|
+
const existingThreshold = existingThresholdResult.result;
|
|
131
174
|
const normalizedExistingOwners = existingOwners.map((owner) => owner.toLowerCase());
|
|
132
175
|
const calls = [];
|
|
133
176
|
// Convert new owners config to addresses and threshold
|
|
134
177
|
const newOwnerAddresses = newOwners.accounts
|
|
135
178
|
.map((account) => account.address.toLowerCase())
|
|
136
179
|
.sort();
|
|
137
|
-
const newThreshold =
|
|
180
|
+
const newThreshold = newOwners.threshold ?? 1;
|
|
138
181
|
// Check if threshold needs to be updated
|
|
139
|
-
if (existingThreshold !== newThreshold) {
|
|
140
|
-
calls.push(
|
|
182
|
+
if (Number(existingThreshold) !== newThreshold) {
|
|
183
|
+
calls.push(changeThreshold(newThreshold));
|
|
141
184
|
}
|
|
142
185
|
const ownersToAdd = newOwnerAddresses.filter((owner) => !normalizedExistingOwners.includes(owner));
|
|
143
186
|
const ownersToRemove = normalizedExistingOwners.filter((owner) => !newOwnerAddresses.includes(owner));
|
|
@@ -8,6 +8,7 @@ const __1 = require("..");
|
|
|
8
8
|
const _1 = require(".");
|
|
9
9
|
const MOCK_OWNER_A = '0xd1aefebdceefc094f1805b241fa5e6db63a9181a';
|
|
10
10
|
const MOCK_OWNER_B = '0xeddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817';
|
|
11
|
+
const MOCK_OWNER_C = '0xb31e76f19defe76edc4b7eceeb4b0a2d6ddaca39';
|
|
11
12
|
const MOCK_ACCOUNT_ADDRESS = '0x1234567890123456789012345678901234567890';
|
|
12
13
|
// Mock viem
|
|
13
14
|
vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
@@ -19,6 +20,108 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
19
20
|
};
|
|
20
21
|
});
|
|
21
22
|
(0, vitest_1.describe)('Actions', () => {
|
|
23
|
+
(0, vitest_1.describe)('Install Ownable Validator', async () => {
|
|
24
|
+
const rhinestoneAccount = await (0, __1.createRhinestoneAccount)({
|
|
25
|
+
owners: {
|
|
26
|
+
type: 'ecdsa',
|
|
27
|
+
accounts: [consts_1.accountA],
|
|
28
|
+
},
|
|
29
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
30
|
+
});
|
|
31
|
+
(0, vitest_1.test)('1/1 Owners', () => {
|
|
32
|
+
(0, vitest_1.expect)((0, _1.enableEcdsa)({
|
|
33
|
+
rhinestoneAccount,
|
|
34
|
+
owners: [MOCK_OWNER_A],
|
|
35
|
+
})).toEqual([
|
|
36
|
+
{
|
|
37
|
+
to: '0x27d66c2e6b33579ee108206c4bc8f66bb655e69f',
|
|
38
|
+
data: '0x9517e29f00000000000000000000000000000000000000000000000000000000000000010000000000000000000000002483da3a338895199e5e538530213157e931bf0600000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a',
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
});
|
|
42
|
+
(0, vitest_1.test)('1/N Owners', () => {
|
|
43
|
+
(0, vitest_1.expect)((0, _1.enableEcdsa)({
|
|
44
|
+
rhinestoneAccount,
|
|
45
|
+
owners: [MOCK_OWNER_A, MOCK_OWNER_B],
|
|
46
|
+
})).toEqual([
|
|
47
|
+
{
|
|
48
|
+
to: '0x27d66c2e6b33579ee108206c4bc8f66bb655e69f',
|
|
49
|
+
data: '0x9517e29f00000000000000000000000000000000000000000000000000000000000000010000000000000000000000002483da3a338895199e5e538530213157e931bf06000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
|
|
50
|
+
},
|
|
51
|
+
]);
|
|
52
|
+
});
|
|
53
|
+
(0, vitest_1.test)('M/N Owners', () => {
|
|
54
|
+
(0, vitest_1.expect)((0, _1.enableEcdsa)({
|
|
55
|
+
rhinestoneAccount,
|
|
56
|
+
owners: [MOCK_OWNER_A, MOCK_OWNER_B, MOCK_OWNER_C],
|
|
57
|
+
threshold: 2,
|
|
58
|
+
})).toEqual([
|
|
59
|
+
{
|
|
60
|
+
to: '0x27d66c2e6b33579ee108206c4bc8f66bb655e69f',
|
|
61
|
+
data: '0x9517e29f00000000000000000000000000000000000000000000000000000000000000010000000000000000000000002483da3a338895199e5e538530213157e931bf06000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000b31e76f19defe76edc4b7eceeb4b0a2d6ddaca39000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
|
|
62
|
+
},
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
(0, vitest_1.describe)('Install WebAuthn Validator', async () => {
|
|
67
|
+
const rhinestoneAccount = await (0, __1.createRhinestoneAccount)({
|
|
68
|
+
owners: {
|
|
69
|
+
type: 'ecdsa',
|
|
70
|
+
accounts: [consts_1.accountA],
|
|
71
|
+
},
|
|
72
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
73
|
+
});
|
|
74
|
+
(0, vitest_1.test)('', () => {
|
|
75
|
+
(0, vitest_1.expect)((0, _1.enablePasskeys)({
|
|
76
|
+
rhinestoneAccount,
|
|
77
|
+
pubKey: consts_1.passkeyAccount.publicKey,
|
|
78
|
+
authenticatorId: consts_1.passkeyAccount.id,
|
|
79
|
+
})).toEqual([
|
|
80
|
+
{
|
|
81
|
+
to: '0x27d66c2e6b33579ee108206c4bc8f66bb655e69f',
|
|
82
|
+
data: '0x9517e29f00000000000000000000000000000000000000000000000000000000000000010000000000000000000000002f167e55d42584f65e2e30a748f41ee75a31141400000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000060580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d19c9a01073b202db2ed56e604ad11db557d8c3ad75181619597f21b830f2da82a',
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
(0, vitest_1.describe)('Uninstall Ownable Validator', async () => {
|
|
88
|
+
const rhinestoneAccount = await (0, __1.createRhinestoneAccount)({
|
|
89
|
+
owners: {
|
|
90
|
+
type: 'ecdsa',
|
|
91
|
+
accounts: [consts_1.accountA],
|
|
92
|
+
},
|
|
93
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
94
|
+
});
|
|
95
|
+
(0, vitest_1.test)('', () => {
|
|
96
|
+
(0, vitest_1.expect)((0, _1.disableEcdsa)({
|
|
97
|
+
rhinestoneAccount,
|
|
98
|
+
})).toEqual([
|
|
99
|
+
{
|
|
100
|
+
to: '0x27d66c2e6b33579ee108206c4bc8f66bb655e69f',
|
|
101
|
+
data: '0xa71763a800000000000000000000000000000000000000000000000000000000000000010000000000000000000000002483da3a338895199e5e538530213157e931bf0600000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000',
|
|
102
|
+
},
|
|
103
|
+
]);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
(0, vitest_1.describe)('Uninstall WebAuthn Validator', async () => {
|
|
107
|
+
const rhinestoneAccount = await (0, __1.createRhinestoneAccount)({
|
|
108
|
+
owners: {
|
|
109
|
+
type: 'ecdsa',
|
|
110
|
+
accounts: [consts_1.accountA],
|
|
111
|
+
},
|
|
112
|
+
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
113
|
+
});
|
|
114
|
+
(0, vitest_1.test)('', () => {
|
|
115
|
+
(0, vitest_1.expect)((0, _1.disablePasskeys)({
|
|
116
|
+
rhinestoneAccount,
|
|
117
|
+
})).toEqual([
|
|
118
|
+
{
|
|
119
|
+
to: '0x27d66c2e6b33579ee108206c4bc8f66bb655e69f',
|
|
120
|
+
data: '0xa71763a800000000000000000000000000000000000000000000000000000000000000010000000000000000000000002f167e55d42584f65e2e30a748f41ee75a31141400000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000',
|
|
121
|
+
},
|
|
122
|
+
]);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
22
125
|
(0, vitest_1.describe)('Add Owner', () => {
|
|
23
126
|
(0, vitest_1.test)('', () => {
|
|
24
127
|
(0, vitest_1.expect)((0, _1.addOwner)(MOCK_OWNER_A)).toEqual({
|
|
@@ -37,7 +140,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
37
140
|
});
|
|
38
141
|
(0, vitest_1.describe)('Set Threshold', () => {
|
|
39
142
|
(0, vitest_1.test)('', () => {
|
|
40
|
-
(0, vitest_1.expect)((0, _1.
|
|
143
|
+
(0, vitest_1.expect)((0, _1.changeThreshold)(1)).toEqual({
|
|
41
144
|
to: '0x2483DA3A338895199E5e538530213157e931Bf06',
|
|
42
145
|
data: '0x960bfe040000000000000000000000000000000000000000000000000000000000000001',
|
|
43
146
|
});
|
|
@@ -79,6 +182,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
79
182
|
(0, vitest_1.describe)('Recover', () => {
|
|
80
183
|
const mockPublicClient = {
|
|
81
184
|
readContract: vitest_1.vi.fn(),
|
|
185
|
+
multicall: vitest_1.vi.fn(),
|
|
82
186
|
};
|
|
83
187
|
(0, vitest_1.beforeEach)(() => {
|
|
84
188
|
const createPublicClientMock = viem_1.createPublicClient;
|
|
@@ -87,16 +191,17 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
87
191
|
});
|
|
88
192
|
(0, vitest_1.test)('1/1 Owners - Single owner to different single owner', async () => {
|
|
89
193
|
// Initial state
|
|
90
|
-
mockPublicClient.
|
|
91
|
-
|
|
92
|
-
|
|
194
|
+
mockPublicClient.multicall.mockResolvedValueOnce([
|
|
195
|
+
{ result: [consts_1.accountA.address.toLowerCase()], status: 'success' },
|
|
196
|
+
{ result: 1n, status: 'success' },
|
|
197
|
+
]);
|
|
93
198
|
const newOwners = {
|
|
94
199
|
type: 'ecdsa',
|
|
95
200
|
accounts: [consts_1.accountB],
|
|
96
201
|
threshold: 1,
|
|
97
202
|
};
|
|
98
203
|
const result = await (0, _1.recover)(MOCK_ACCOUNT_ADDRESS, newOwners, chains_1.base);
|
|
99
|
-
(0, vitest_1.expect)(mockPublicClient.
|
|
204
|
+
(0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
|
|
100
205
|
(0, vitest_1.expect)(result).toEqual([
|
|
101
206
|
{
|
|
102
207
|
to: '0x2483DA3A338895199E5e538530213157e931Bf06',
|
|
@@ -110,20 +215,24 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
110
215
|
});
|
|
111
216
|
(0, vitest_1.test)('1/N Owners - Single owner to multiple owners', async () => {
|
|
112
217
|
// Initial state
|
|
113
|
-
mockPublicClient.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
218
|
+
mockPublicClient.multicall.mockResolvedValueOnce([
|
|
219
|
+
{
|
|
220
|
+
result: [
|
|
221
|
+
consts_1.accountA.address.toLowerCase(),
|
|
222
|
+
consts_1.accountB.address.toLowerCase(),
|
|
223
|
+
consts_1.accountC.address.toLowerCase(),
|
|
224
|
+
],
|
|
225
|
+
status: 'success',
|
|
226
|
+
},
|
|
227
|
+
{ result: 1n, status: 'success' },
|
|
228
|
+
]);
|
|
120
229
|
const newOwners = {
|
|
121
230
|
type: 'ecdsa',
|
|
122
231
|
accounts: [consts_1.accountB, consts_1.accountC, consts_1.accountD],
|
|
123
232
|
threshold: 1,
|
|
124
233
|
};
|
|
125
234
|
const result = await (0, _1.recover)(MOCK_ACCOUNT_ADDRESS, newOwners, chains_1.base);
|
|
126
|
-
(0, vitest_1.expect)(mockPublicClient.
|
|
235
|
+
(0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
|
|
127
236
|
(0, vitest_1.expect)(result).toEqual([
|
|
128
237
|
{
|
|
129
238
|
to: '0x2483DA3A338895199E5e538530213157e931Bf06',
|
|
@@ -137,20 +246,24 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
|
|
|
137
246
|
});
|
|
138
247
|
(0, vitest_1.test)('M/N Owners - Multiple owners to different multiple owners', async () => {
|
|
139
248
|
// Initial state
|
|
140
|
-
mockPublicClient.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
249
|
+
mockPublicClient.multicall.mockResolvedValueOnce([
|
|
250
|
+
{
|
|
251
|
+
result: [
|
|
252
|
+
consts_1.accountA.address.toLowerCase(),
|
|
253
|
+
consts_1.accountB.address.toLowerCase(),
|
|
254
|
+
consts_1.accountC.address.toLowerCase(),
|
|
255
|
+
],
|
|
256
|
+
status: 'success',
|
|
257
|
+
},
|
|
258
|
+
{ result: 2n, status: 'success' },
|
|
259
|
+
]);
|
|
147
260
|
const newOwners = {
|
|
148
261
|
type: 'ecdsa',
|
|
149
262
|
accounts: [consts_1.accountB, consts_1.accountD],
|
|
150
263
|
threshold: 2,
|
|
151
264
|
};
|
|
152
265
|
const result = await (0, _1.recover)(MOCK_ACCOUNT_ADDRESS, newOwners, chains_1.base);
|
|
153
|
-
(0, vitest_1.expect)(mockPublicClient.
|
|
266
|
+
(0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
|
|
154
267
|
(0, vitest_1.expect)(result).toEqual([
|
|
155
268
|
{
|
|
156
269
|
to: '0x2483DA3A338895199E5e538530213157e931Bf06',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIX,MAAM,MAAM,CAAA;AAKb,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAYnD,OAAO,KAAK,EAEV,uBAAuB,EAGvB,WAAW,EACZ,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAe5D,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,8BAyBzB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIX,MAAM,MAAM,CAAA;AAKb,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAYnD,OAAO,KAAK,EAEV,uBAAuB,EAGvB,WAAW,EACZ,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAe5D,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,8BAyBzB;AA0LD,iBAAe,gBAAgB,CAC7B,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,iBAAiB,EACzB,uBAAuB,EAAE,OAAO;;;;;;;;;;;;kBAwCjC;AAED,iBAAe,qBAAqB,CAClC,MAAM,EAAE,uBAAuB,EAC/B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,OAAO,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,iBAAe,YAAY,CACzB,MAAM,EAAE,uBAAuB,EAC/B,UAAU,EAAE,OAAO,yDAMpB;AAED,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,GACb,CAAA;AACD,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -40,7 +40,8 @@ async function sendTransactionInternal(config, sourceChain, targetChain, calls,
|
|
|
40
40
|
},
|
|
41
41
|
]
|
|
42
42
|
: initialTokenRequests;
|
|
43
|
-
|
|
43
|
+
const asUserOp = signers?.type === 'guardians' || signers?.type === 'session';
|
|
44
|
+
if (asUserOp) {
|
|
44
45
|
if (!sourceChain) {
|
|
45
46
|
throw new Error(`Specifying source chain is required when using smart sessions or guardians`);
|
|
46
47
|
}
|
|
@@ -52,7 +53,7 @@ async function sendTransactionInternal(config, sourceChain, targetChain, calls,
|
|
|
52
53
|
return await sendTransactionAsUserOp(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers);
|
|
53
54
|
}
|
|
54
55
|
else {
|
|
55
|
-
return await sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress);
|
|
56
|
+
return await sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers) {
|
|
@@ -91,9 +92,9 @@ async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls,
|
|
|
91
92
|
const signature = await (0, utils_2.signUserOp)(config, sourceChain, targetChain, accountAddress, signers, userOp, orderPath);
|
|
92
93
|
return await (0, utils_2.submitUserOp)(config, sourceChain, targetChain, userOp, orderPath, signature);
|
|
93
94
|
}
|
|
94
|
-
async function sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress) {
|
|
95
|
+
async function sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers) {
|
|
95
96
|
const { orderPath, hash: orderBundleHash } = await (0, utils_2.prepareTransactionAsIntent)(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress);
|
|
96
|
-
const signature = await (0, utils_2.signIntent)(config, sourceChain, targetChain, orderBundleHash);
|
|
97
|
+
const signature = await (0, utils_2.signIntent)(config, sourceChain, targetChain, orderBundleHash, signers);
|
|
97
98
|
return await (0, utils_2.submitIntentInternal)(config, sourceChain, targetChain, orderPath, signature, true);
|
|
98
99
|
}
|
|
99
100
|
async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
@@ -29,7 +29,7 @@ declare function prepareTransaction(config: RhinestoneAccountConfig, transaction
|
|
|
29
29
|
declare function signTransaction(config: RhinestoneAccountConfig, preparedTransaction: PreparedTransactionData): Promise<SignedTransactionData>;
|
|
30
30
|
declare function submitTransaction(config: RhinestoneAccountConfig, signedTransaction: SignedTransactionData): Promise<TransactionResult>;
|
|
31
31
|
declare function prepareTransactionAsIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, calls: Call[], gasLimit: bigint | undefined, tokenRequests: TokenRequest[], accountAddress: Address): Promise<BundleData>;
|
|
32
|
-
declare function signIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, bundleHash: Hex): Promise<`0x${string}`>;
|
|
32
|
+
declare function signIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, bundleHash: Hex, signers?: SignerSet): Promise<`0x${string}`>;
|
|
33
33
|
declare function signUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, accountAddress: Address, signers: SignerSet | undefined, userOp: UserOperation, orderPath: OrderPath): Promise<`0x${string}`>;
|
|
34
34
|
declare function submitUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, userOp: UserOperation, orderPath: OrderPath, signature: Hex): Promise<TransactionResult>;
|
|
35
35
|
declare function getOrchestratorByChain(chainId: number, apiKey: string): import("../orchestrator").Orchestrator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAGL,GAAG,EAMJ,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,aAAa,EACd,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAA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EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CxB;AAED,iBAAe,oBAAoB,CACjC,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,KAAK,GAAG,SAAS,EAC9B,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,GAAG,EACd,MAAM,EAAE,OAAO,8BA6BhB;AAED,iBAAe,mBAAmB,CAChC,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,SAAS,GAAG,SAAS,EAC9B,YAAY,EAAE,GAAG,EACjB,KAAK,EAAE,KAAK,yKAsBb;AA0FD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,GACpB,CAAA;AACD,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
|
|
@@ -158,11 +158,20 @@ async function prepareTransactionAsIntent(config, sourceChain, targetChain, call
|
|
|
158
158
|
hash: orderBundleHash,
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
async function signIntent(config, sourceChain, targetChain, bundleHash) {
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
async function signIntent(config, sourceChain, targetChain, bundleHash, signers) {
|
|
162
|
+
const validator = getValidator(config, signers);
|
|
163
|
+
if (!validator) {
|
|
164
|
+
throw new Error('Validator not available');
|
|
165
|
+
}
|
|
166
|
+
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
167
|
+
const isRoot = validator.address === ownerValidator.address;
|
|
168
|
+
const owners = getOwners(config, signers);
|
|
169
|
+
if (!owners) {
|
|
170
|
+
throw new Error('No owners found');
|
|
171
|
+
}
|
|
172
|
+
const signature = await (0, accounts_1.getPackedSignature)(config, owners, sourceChain || targetChain, {
|
|
173
|
+
address: validator.address,
|
|
174
|
+
isRoot,
|
|
166
175
|
}, bundleHash);
|
|
167
176
|
return signature;
|
|
168
177
|
}
|
|
@@ -188,7 +197,7 @@ async function signUserOp(config, sourceChain, targetChain, accountAddress, sign
|
|
|
188
197
|
});
|
|
189
198
|
orderPath[0].orderBundle.segments[0].witness.userOpHash = userOpHash;
|
|
190
199
|
const { hash, appDomainSeparator, contentsType, structHash } = await (0, smart_session_1.hashErc7739)(sourceChain, orderPath, accountAddress);
|
|
191
|
-
const owners = getOwners(signers);
|
|
200
|
+
const owners = getOwners(config, signers);
|
|
192
201
|
if (!owners) {
|
|
193
202
|
throw new Error('No owners found');
|
|
194
203
|
}
|
|
@@ -326,30 +335,74 @@ async function getValidatorAccount(config, signers, publicClient, chain) {
|
|
|
326
335
|
}
|
|
327
336
|
function getValidator(config, signers) {
|
|
328
337
|
if (!signers) {
|
|
329
|
-
return
|
|
338
|
+
return (0, validators_1.getOwnerValidator)(config);
|
|
339
|
+
}
|
|
340
|
+
// Owners
|
|
341
|
+
const withOwner = signers.type === 'owner' ? signers : null;
|
|
342
|
+
if (withOwner) {
|
|
343
|
+
// ECDSA
|
|
344
|
+
if (withOwner.kind === 'ecdsa') {
|
|
345
|
+
return (0, core_1.getOwnableValidator)({
|
|
346
|
+
threshold: 1,
|
|
347
|
+
owners: withOwner.accounts.map((account) => account.address),
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
// Passkeys (WebAuthn)
|
|
351
|
+
if (withOwner.kind === 'passkey') {
|
|
352
|
+
const passkeyAccount = withOwner.account;
|
|
353
|
+
return (0, core_1.getWebAuthnValidator)({
|
|
354
|
+
pubKey: passkeyAccount.publicKey,
|
|
355
|
+
authenticatorId: passkeyAccount.id,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
330
358
|
}
|
|
359
|
+
// Smart sessions
|
|
331
360
|
const withSession = signers.type === 'session' ? signers.session : null;
|
|
361
|
+
if (withSession) {
|
|
362
|
+
return (0, validators_1.getSmartSessionValidator)(config);
|
|
363
|
+
}
|
|
364
|
+
// Guardians (social recovery)
|
|
332
365
|
const withGuardians = signers.type === 'guardians' ? signers : null;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
366
|
+
if (withGuardians) {
|
|
367
|
+
return (0, core_1.getSocialRecoveryValidator)(withGuardians.guardians);
|
|
368
|
+
}
|
|
369
|
+
// Fallback
|
|
370
|
+
return undefined;
|
|
338
371
|
}
|
|
339
|
-
function getOwners(signers) {
|
|
372
|
+
function getOwners(config, signers) {
|
|
340
373
|
if (!signers) {
|
|
341
|
-
return
|
|
374
|
+
return config.owners;
|
|
375
|
+
}
|
|
376
|
+
// Owners
|
|
377
|
+
const withOwner = signers.type === 'owner' ? signers : null;
|
|
378
|
+
if (withOwner) {
|
|
379
|
+
// ECDSA
|
|
380
|
+
if (withOwner.kind === 'ecdsa') {
|
|
381
|
+
return {
|
|
382
|
+
type: 'ecdsa',
|
|
383
|
+
accounts: withOwner.accounts,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
// Passkeys (WebAuthn)
|
|
387
|
+
if (withOwner.kind === 'passkey') {
|
|
388
|
+
return {
|
|
389
|
+
type: 'passkey',
|
|
390
|
+
account: withOwner.account,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
342
393
|
}
|
|
394
|
+
// Smart sessions
|
|
343
395
|
const withSession = signers.type === 'session' ? signers.session : null;
|
|
396
|
+
if (withSession) {
|
|
397
|
+
return withSession.owners;
|
|
398
|
+
}
|
|
399
|
+
// Guardians (social recovery)
|
|
344
400
|
const withGuardians = signers.type === 'guardians' ? signers : null;
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
:
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
accounts: withGuardians.guardians,
|
|
353
|
-
}
|
|
354
|
-
: undefined;
|
|
401
|
+
if (withGuardians) {
|
|
402
|
+
return {
|
|
403
|
+
type: 'ecdsa',
|
|
404
|
+
accounts: withGuardians.guardians,
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
return undefined;
|
|
355
408
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, Chain } from 'viem';
|
|
2
2
|
import { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
|
-
import { addOwner, recover, removeOwner,
|
|
3
|
+
import { addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, recover, removeOwner, setUpRecovery } from './actions';
|
|
4
4
|
import type { TransactionResult } from './execution';
|
|
5
5
|
import { BundleData, PreparedTransactionData, SignedTransactionData } from './execution/utils';
|
|
6
6
|
import type { BundleResult, BundleStatus, MetaIntent, MultiChainCompact, PostOrderBundleResult, SignedMultiChainCompact, UserTokenBalance } from './orchestrator';
|
|
@@ -24,6 +24,6 @@ interface RhinestoneAccount {
|
|
|
24
24
|
* @returns account
|
|
25
25
|
*/
|
|
26
26
|
declare function createRhinestoneAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
27
|
-
export { createRhinestoneAccount, addOwner, recover, removeOwner,
|
|
27
|
+
export { createRhinestoneAccount, addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, recover, removeOwner, setUpRecovery, };
|
|
28
28
|
export type { RhinestoneAccount, BundleStatus, Session, Call, Execution, MetaIntent, MultiChainCompact, PostOrderBundleResult, SignedMultiChainCompact, BundleData, PreparedTransactionData, SignedTransactionData, TransactionResult, };
|
|
29
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAA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AE,WAAW,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACzE,gBAAgB,EAAE,CAChB,MAAM,EAAE,iBAAiB,EACzB,uBAAuB,CAAC,EAAE,OAAO,KAC9B,OAAO,CAAC,YAAY,GAAG,oBAAoB,CAAC,CAAA;IACjD,UAAU,EAAE,MAAM,OAAO,CAAA;IACzB,YAAY,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAA;IACnE,qBAAqB,EAAE,CACrB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,OAAO,EACrB,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,MAAM,CAAC,CAAA;CACrB;AAED;;;;;GAKG;AACH,iBAAe,uBAAuB,CACpC,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAmF5B;AAED,OAAO,EACL,uBAAuB,EACvB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,eAAe,EACf,WAAW,EACX,cAAc,EACd,OAAO,EACP,WAAW,EACX,aAAa,GACd,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,GAClB,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setUpRecovery = exports.
|
|
3
|
+
exports.setUpRecovery = exports.removeOwner = exports.recover = exports.enablePasskeys = exports.enableEcdsa = exports.disablePasskeys = exports.disableEcdsa = exports.changeThreshold = exports.addOwner = void 0;
|
|
4
4
|
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
5
5
|
const accounts_1 = require("./accounts");
|
|
6
6
|
const actions_1 = require("./actions");
|
|
7
7
|
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
8
|
+
Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
|
|
9
|
+
Object.defineProperty(exports, "disableEcdsa", { enumerable: true, get: function () { return actions_1.disableEcdsa; } });
|
|
10
|
+
Object.defineProperty(exports, "disablePasskeys", { enumerable: true, get: function () { return actions_1.disablePasskeys; } });
|
|
11
|
+
Object.defineProperty(exports, "enableEcdsa", { enumerable: true, get: function () { return actions_1.enableEcdsa; } });
|
|
12
|
+
Object.defineProperty(exports, "enablePasskeys", { enumerable: true, get: function () { return actions_1.enablePasskeys; } });
|
|
8
13
|
Object.defineProperty(exports, "recover", { enumerable: true, get: function () { return actions_1.recover; } });
|
|
9
14
|
Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function () { return actions_1.removeOwner; } });
|
|
10
|
-
Object.defineProperty(exports, "setThreshold", { enumerable: true, get: function () { return actions_1.setThreshold; } });
|
|
11
15
|
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
12
16
|
const execution_1 = require("./execution");
|
|
13
17
|
const utils_1 = require("./execution/utils");
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { Account, type Address, type Hex } from 'viem';
|
|
2
2
|
import type { OwnerSet, RhinestoneAccountConfig } from '../../types';
|
|
3
3
|
import { type Module } from '../common';
|
|
4
|
+
interface PublicKey {
|
|
5
|
+
prefix?: number | undefined;
|
|
6
|
+
x: bigint;
|
|
7
|
+
y: bigint;
|
|
8
|
+
}
|
|
9
|
+
interface WebauthnCredential {
|
|
10
|
+
pubKey: PublicKey | Hex | Uint8Array;
|
|
11
|
+
authenticatorId: string;
|
|
12
|
+
}
|
|
4
13
|
declare const OWNABLE_VALIDATOR_ADDRESS: Address;
|
|
5
14
|
declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
|
|
6
15
|
declare function getMockSignature(ownerSet: OwnerSet): Hex;
|
|
7
16
|
declare function getValidator(owners: OwnerSet): Module;
|
|
17
|
+
declare function getOwnableValidator({ threshold, owners, }: {
|
|
18
|
+
threshold: number;
|
|
19
|
+
owners: Address[];
|
|
20
|
+
}): Module;
|
|
21
|
+
declare function getWebAuthnValidator(webAuthnCredential: WebauthnCredential): Module;
|
|
8
22
|
declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
|
|
9
|
-
export { OWNABLE_VALIDATOR_ADDRESS, getOwnerValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
23
|
+
export { OWNABLE_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getSocialRecoveryValidator, getValidator, getMockSignature, };
|
|
24
|
+
export type { WebauthnCredential };
|
|
10
25
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,OAAO,EAIZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,OAAO,EAIZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAEjE,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,SAAS,GAAG,GAAG,GAAG,UAAU,CAAA;IACpC,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,QAAA,MAAM,yBAAyB,EAAE,OACa,CAAA;AAW9C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,UAEzD;AAED,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAUjD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,QAAQ,UAarC;AAED,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,OAAO,EAAE,CAAA;CAClB,GAAG,MAAM,CAiBT;AAED,iBAAS,oBAAoB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,MAAM,CAwD5E;AAED,iBAAS,0BAA0B,CACjC,SAAS,EAAE,OAAO,EAAE,EACpB,SAAS,SAAI,GACZ,MAAM,CAsBR;AAeD,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
4
4
|
exports.getOwnerValidator = getOwnerValidator;
|
|
5
|
+
exports.getOwnableValidator = getOwnableValidator;
|
|
6
|
+
exports.getWebAuthnValidator = getWebAuthnValidator;
|
|
5
7
|
exports.getSocialRecoveryValidator = getSocialRecoveryValidator;
|
|
6
8
|
exports.getValidator = getValidator;
|
|
7
9
|
exports.getMockSignature = getMockSignature;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -95,6 +95,15 @@ interface TokenRequest {
|
|
|
95
95
|
address: Address;
|
|
96
96
|
amount: bigint;
|
|
97
97
|
}
|
|
98
|
+
type OwnerSignerSet = {
|
|
99
|
+
type: 'owner';
|
|
100
|
+
kind: 'ecdsa';
|
|
101
|
+
accounts: Account[];
|
|
102
|
+
} | {
|
|
103
|
+
type: 'owner';
|
|
104
|
+
kind: 'passkey';
|
|
105
|
+
account: WebAuthnAccount;
|
|
106
|
+
};
|
|
98
107
|
interface SessionSignerSet {
|
|
99
108
|
type: 'session';
|
|
100
109
|
session: Session;
|
|
@@ -103,7 +112,7 @@ interface GuardiansSignerSet {
|
|
|
103
112
|
type: 'guardians';
|
|
104
113
|
guardians: Account[];
|
|
105
114
|
}
|
|
106
|
-
type SignerSet = SessionSignerSet | GuardiansSignerSet;
|
|
115
|
+
type SignerSet = OwnerSignerSet | SessionSignerSet | GuardiansSignerSet;
|
|
107
116
|
interface BaseTransaction {
|
|
108
117
|
calls: Call[];
|
|
109
118
|
tokenRequests: TokenRequest[];
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CAClC;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,eAAe,CAAA;CACzB;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,SAAS,CAA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