@rhinestone/sdk 1.0.0-alpha.1 → 1.0.0-alpha.11
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/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +2 -0
- package/dist/src/accounts/index.d.ts +15 -8
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +204 -164
- package/dist/src/accounts/index.test.js +2 -2
- package/dist/src/accounts/kernel.d.ts +7 -9
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +0 -9
- package/dist/src/accounts/kernel.test.js +6 -6
- package/dist/src/accounts/nexus.d.ts +14 -13
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +91 -88
- package/dist/src/accounts/nexus.test.js +10 -10
- package/dist/src/accounts/safe.d.ts +4 -6
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +20 -30
- package/dist/src/accounts/safe.test.js +6 -6
- package/dist/src/accounts/startale.d.ts +20 -0
- package/dist/src/accounts/startale.d.ts.map +1 -0
- package/dist/src/accounts/startale.js +100 -0
- package/dist/src/accounts/startale.test.d.ts +2 -0
- package/dist/src/accounts/startale.test.d.ts.map +1 -0
- package/dist/src/accounts/startale.test.js +97 -0
- package/dist/src/accounts/utils.d.ts +4 -3
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +44 -0
- package/dist/src/actions/index.d.ts +17 -7
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +108 -15
- package/dist/src/actions/index.test.js +35 -17
- package/dist/src/actions/smart-session.d.ts +2 -2
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/execution/compact.d.ts +6 -3
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +44 -1
- package/dist/src/execution/error.d.ts +2 -9
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +4 -13
- package/dist/src/execution/index.d.ts +2 -3
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +34 -49
- package/dist/src/execution/smart-session.d.ts +1 -1
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +12 -17
- package/dist/src/execution/utils.d.ts +13 -11
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +150 -84
- package/dist/src/index.d.ts +14 -14
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +24 -20
- package/dist/src/modules/index.d.ts +3 -7
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -10
- package/dist/src/modules/index.test.js +2 -2
- package/dist/src/modules/omni-account.d.ts +1 -4
- package/dist/src/modules/omni-account.d.ts.map +1 -1
- package/dist/src/modules/omni-account.js +2 -8
- package/dist/src/modules/read.d.ts +5 -6
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +6 -37
- package/dist/src/modules/validators/core.d.ts +6 -7
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +83 -8
- package/dist/src/modules/validators/core.test.js +4 -4
- package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +7 -6
- package/dist/src/modules/validators/smart-sessions.test.js +4 -4
- package/dist/src/orchestrator/client.d.ts +1 -0
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +136 -94
- package/dist/src/orchestrator/consts.d.ts +3 -3
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +4 -4
- package/dist/src/orchestrator/index.d.ts +2 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -7
- package/dist/src/orchestrator/registry.d.ts +31 -12
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +57 -380
- package/dist/src/orchestrator/registry.json +365 -0
- package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
- package/dist/src/orchestrator/registry.test.js +137 -0
- package/dist/src/orchestrator/types.d.ts +81 -14
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +2 -2
- package/dist/src/types.d.ts +42 -21
- package/dist/src/types.d.ts.map +1 -1
- package/dist/test/consts.d.ts +2 -2
- package/dist/test/consts.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/actions/registry.d.ts +0 -7
- package/dist/src/actions/registry.d.ts.map +0 -1
- package/dist/src/actions/registry.js +0 -7
- package/dist/src/actions/registry.test.d.ts.map +0 -1
- package/dist/src/actions/registry.test.js +0 -25
- package/dist/src/modules/registry.d.ts +0 -13
- package/dist/src/modules/registry.d.ts.map +0 -1
- package/dist/src/modules/registry.js +0 -67
- /package/dist/src/{actions → orchestrator}/registry.test.d.ts +0 -0
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prepareTransaction = prepareTransaction;
|
|
4
4
|
exports.signTransaction = signTransaction;
|
|
5
|
+
exports.signAuthorizations = signAuthorizations;
|
|
6
|
+
exports.signAuthorizationsInternal = signAuthorizationsInternal;
|
|
5
7
|
exports.submitTransaction = submitTransaction;
|
|
6
8
|
exports.getOrchestratorByChain = getOrchestratorByChain;
|
|
7
9
|
exports.signIntent = signIntent;
|
|
8
10
|
exports.prepareTransactionAsIntent = prepareTransactionAsIntent;
|
|
9
11
|
exports.submitIntentInternal = submitIntentInternal;
|
|
10
12
|
exports.getValidatorAccount = getValidatorAccount;
|
|
13
|
+
exports.parseCalls = parseCalls;
|
|
11
14
|
const viem_1 = require("viem");
|
|
12
15
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
13
16
|
const accounts_1 = require("../accounts");
|
|
@@ -19,22 +22,19 @@ const consts_1 = require("../orchestrator/consts");
|
|
|
19
22
|
const registry_1 = require("../orchestrator/registry");
|
|
20
23
|
const error_1 = require("./error");
|
|
21
24
|
async function prepareTransaction(config, transaction) {
|
|
22
|
-
const {
|
|
25
|
+
const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, } = getTransactionParams(transaction);
|
|
23
26
|
const accountAddress = (0, accounts_1.getAddress)(config);
|
|
24
27
|
let data;
|
|
25
28
|
const asUserOp = signers?.type === 'guardians' || signers?.type === 'session';
|
|
26
29
|
if (asUserOp) {
|
|
27
|
-
if (
|
|
28
|
-
throw new error_1.
|
|
29
|
-
}
|
|
30
|
-
if (sourceChain.id !== targetChain.id) {
|
|
31
|
-
throw new error_1.SourceTargetChainMismatchError();
|
|
30
|
+
if (sourceChains && sourceChains.length > 0) {
|
|
31
|
+
throw new error_1.SourceChainsNotAvailableForUserOpFlowError();
|
|
32
32
|
}
|
|
33
33
|
// Smart sessions require a UserOp flow
|
|
34
|
-
data = await prepareTransactionAsUserOp(config,
|
|
34
|
+
data = await prepareTransactionAsUserOp(config, targetChain, transaction.calls, signers);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
data = await prepareTransactionAsIntent(config,
|
|
37
|
+
data = await prepareTransactionAsIntent(config, sourceChains, targetChain, transaction.calls, transaction.gasLimit, tokenRequests, accountAddress, sponsored ?? false, eip7702InitSignature);
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
40
|
data,
|
|
@@ -42,12 +42,12 @@ async function prepareTransaction(config, transaction) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
async function signTransaction(config, preparedTransaction) {
|
|
45
|
-
const {
|
|
45
|
+
const { targetChain, signers } = getTransactionParams(preparedTransaction.transaction);
|
|
46
46
|
const data = preparedTransaction.data;
|
|
47
47
|
const asUserOp = data.type === 'userop';
|
|
48
48
|
let signature;
|
|
49
49
|
if (asUserOp) {
|
|
50
|
-
const chain =
|
|
50
|
+
const chain = targetChain;
|
|
51
51
|
const userOp = data.userOp;
|
|
52
52
|
if (!userOp) {
|
|
53
53
|
throw new error_1.UserOperationRequiredForSmartSessionsError();
|
|
@@ -56,7 +56,7 @@ async function signTransaction(config, preparedTransaction) {
|
|
|
56
56
|
signature = await signUserOp(config, chain, signers, userOp);
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
|
-
signature = await signIntent(config,
|
|
59
|
+
signature = await signIntent(config, targetChain, data.hash, signers);
|
|
60
60
|
}
|
|
61
61
|
return {
|
|
62
62
|
data,
|
|
@@ -64,12 +64,52 @@ async function signTransaction(config, preparedTransaction) {
|
|
|
64
64
|
signature,
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
async function
|
|
67
|
+
async function signAuthorizations(config, preparedTransaction) {
|
|
68
|
+
return await signAuthorizationsInternal(config, preparedTransaction.data);
|
|
69
|
+
}
|
|
70
|
+
async function signAuthorizationsInternal(config, data) {
|
|
71
|
+
const eoa = config.eoa;
|
|
72
|
+
if (!eoa) {
|
|
73
|
+
throw new Error('EIP-7702 initialization is required for EOA accounts');
|
|
74
|
+
}
|
|
75
|
+
const accountAddress = (0, accounts_1.getAddress)(config);
|
|
76
|
+
const requiredDelegations = data.type === 'intent'
|
|
77
|
+
? data.intentRoute.intentOp.signedMetadata.account.requiredDelegations ||
|
|
78
|
+
{}
|
|
79
|
+
: {};
|
|
80
|
+
const authorizations = [];
|
|
81
|
+
for (const chainId in requiredDelegations) {
|
|
82
|
+
const delegation = requiredDelegations[chainId];
|
|
83
|
+
const chain = (0, registry_1.getChainById)(Number(chainId));
|
|
84
|
+
if (!chain) {
|
|
85
|
+
throw new Error(`Chain not supported: ${chainId}`);
|
|
86
|
+
}
|
|
87
|
+
const walletClient = (0, viem_1.createWalletClient)({
|
|
88
|
+
chain,
|
|
89
|
+
account: eoa,
|
|
90
|
+
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
91
|
+
}).extend(viem_1.publicActions);
|
|
92
|
+
const code = await walletClient.getCode({
|
|
93
|
+
address: accountAddress,
|
|
94
|
+
});
|
|
95
|
+
const isDelegated = code === (0, viem_1.concat)(['0xef0100', delegation.contract.toLowerCase()]);
|
|
96
|
+
if (isDelegated) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const authorization = await walletClient.signAuthorization({
|
|
100
|
+
contractAddress: delegation.contract,
|
|
101
|
+
chainId: Number(chainId),
|
|
102
|
+
});
|
|
103
|
+
authorizations.push(authorization);
|
|
104
|
+
}
|
|
105
|
+
return authorizations;
|
|
106
|
+
}
|
|
107
|
+
async function submitTransaction(config, signedTransaction, authorizations) {
|
|
68
108
|
const { data, transaction, signature } = signedTransaction;
|
|
69
|
-
const {
|
|
109
|
+
const { sourceChains, targetChain } = getTransactionParams(transaction);
|
|
70
110
|
const asUserOp = data.type === 'userop';
|
|
71
111
|
if (asUserOp) {
|
|
72
|
-
const chain =
|
|
112
|
+
const chain = targetChain;
|
|
73
113
|
const userOp = data.userOp;
|
|
74
114
|
if (!userOp) {
|
|
75
115
|
throw new error_1.UserOperationRequiredForSmartSessionsError();
|
|
@@ -82,16 +122,18 @@ async function submitTransaction(config, signedTransaction) {
|
|
|
82
122
|
if (!intentOp) {
|
|
83
123
|
throw new error_1.OrderPathRequiredForIntentsError();
|
|
84
124
|
}
|
|
85
|
-
return await submitIntent(config,
|
|
125
|
+
return await submitIntent(config, sourceChains, targetChain, intentOp, signature, authorizations);
|
|
86
126
|
}
|
|
87
127
|
}
|
|
88
128
|
function getTransactionParams(transaction) {
|
|
89
|
-
const
|
|
129
|
+
const sourceChains = 'chain' in transaction ? [transaction.chain] : transaction.sourceChains;
|
|
90
130
|
const targetChain = 'chain' in transaction ? transaction.chain : transaction.targetChain;
|
|
91
131
|
const initialTokenRequests = transaction.tokenRequests;
|
|
92
132
|
const signers = transaction.signers;
|
|
133
|
+
const eip7702InitSignature = transaction.eip7702InitSignature;
|
|
134
|
+
const sponsored = transaction.sponsored;
|
|
93
135
|
// Across requires passing some value to repay the solvers
|
|
94
|
-
const tokenRequests = initialTokenRequests.length === 0
|
|
136
|
+
const tokenRequests = !initialTokenRequests || initialTokenRequests.length === 0
|
|
95
137
|
? [
|
|
96
138
|
{
|
|
97
139
|
address: viem_1.zeroAddress,
|
|
@@ -100,22 +142,25 @@ function getTransactionParams(transaction) {
|
|
|
100
142
|
]
|
|
101
143
|
: initialTokenRequests;
|
|
102
144
|
return {
|
|
103
|
-
|
|
145
|
+
sourceChains,
|
|
104
146
|
targetChain,
|
|
105
147
|
tokenRequests,
|
|
106
148
|
signers,
|
|
149
|
+
sponsored,
|
|
150
|
+
eip7702InitSignature,
|
|
107
151
|
};
|
|
108
152
|
}
|
|
109
|
-
async function prepareTransactionAsUserOp(config, chain,
|
|
153
|
+
async function prepareTransactionAsUserOp(config, chain, callInputs, signers) {
|
|
110
154
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
111
155
|
chain,
|
|
112
|
-
transport: (0,
|
|
156
|
+
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
113
157
|
});
|
|
114
158
|
const validatorAccount = await getValidatorAccount(config, signers, publicClient, chain);
|
|
115
159
|
if (!validatorAccount) {
|
|
116
160
|
throw new Error('No validator account found');
|
|
117
161
|
}
|
|
118
162
|
const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
|
|
163
|
+
const calls = parseCalls(callInputs, chain.id);
|
|
119
164
|
const userOp = await bundlerClient.prepareUserOperation({
|
|
120
165
|
account: validatorAccount,
|
|
121
166
|
calls,
|
|
@@ -131,28 +176,36 @@ async function prepareTransactionAsUserOp(config, chain, calls, signers) {
|
|
|
131
176
|
}),
|
|
132
177
|
};
|
|
133
178
|
}
|
|
134
|
-
async function prepareTransactionAsIntent(config,
|
|
135
|
-
const
|
|
179
|
+
async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, accountAddress, isSponsored, eip7702InitSignature) {
|
|
180
|
+
const calls = parseCalls(callInputs, targetChain.id);
|
|
181
|
+
const accountAccessList = sourceChains && sourceChains.length > 0
|
|
136
182
|
? {
|
|
137
|
-
chainIds:
|
|
183
|
+
chainIds: sourceChains.map((chain) => chain.id),
|
|
138
184
|
}
|
|
139
185
|
: undefined;
|
|
186
|
+
const { setupOps, delegations } = await getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature);
|
|
140
187
|
const metaIntent = {
|
|
141
188
|
destinationChainId: targetChain.id,
|
|
142
189
|
tokenTransfers: tokenRequests.map((tokenRequest) => ({
|
|
143
|
-
tokenAddress: tokenRequest.address,
|
|
190
|
+
tokenAddress: (0, registry_1.resolveTokenAddress)(tokenRequest.address, targetChain.id),
|
|
144
191
|
amount: tokenRequest.amount,
|
|
145
192
|
})),
|
|
146
|
-
account:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
193
|
+
account: {
|
|
194
|
+
address: accountAddress,
|
|
195
|
+
accountType: 'ERC7579',
|
|
196
|
+
setupOps,
|
|
197
|
+
delegations,
|
|
198
|
+
},
|
|
199
|
+
destinationExecutions: calls,
|
|
152
200
|
destinationGasUnits: gasLimit,
|
|
153
201
|
accountAccessList,
|
|
154
|
-
|
|
155
|
-
|
|
202
|
+
options: {
|
|
203
|
+
topupCompact: false,
|
|
204
|
+
sponsorSettings: {
|
|
205
|
+
gasSponsored: isSponsored,
|
|
206
|
+
bridgeFeesSponsored: isSponsored,
|
|
207
|
+
swapFeesSponsored: isSponsored,
|
|
208
|
+
},
|
|
156
209
|
},
|
|
157
210
|
};
|
|
158
211
|
const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
|
|
@@ -164,18 +217,14 @@ async function prepareTransactionAsIntent(config, sourceChain, targetChain, call
|
|
|
164
217
|
hash: intentHash,
|
|
165
218
|
};
|
|
166
219
|
}
|
|
167
|
-
async function signIntent(config,
|
|
220
|
+
async function signIntent(config, targetChain, intentHash, signers) {
|
|
168
221
|
const validator = getValidator(config, signers);
|
|
169
222
|
if (!validator) {
|
|
170
223
|
throw new Error('Validator not available');
|
|
171
224
|
}
|
|
172
225
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
173
226
|
const isRoot = validator.address === ownerValidator.address;
|
|
174
|
-
const
|
|
175
|
-
if (!owners) {
|
|
176
|
-
throw new Error('No owners found');
|
|
177
|
-
}
|
|
178
|
-
const signature = await (0, accounts_1.getPackedSignature)(config, owners, sourceChain || targetChain, {
|
|
227
|
+
const signature = await (0, accounts_1.getPackedSignature)(config, signers, targetChain, {
|
|
179
228
|
address: validator.address,
|
|
180
229
|
isRoot,
|
|
181
230
|
}, intentHash);
|
|
@@ -188,7 +237,7 @@ async function signUserOp(config, chain, signers, userOp) {
|
|
|
188
237
|
}
|
|
189
238
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
190
239
|
chain,
|
|
191
|
-
transport: (0,
|
|
240
|
+
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
192
241
|
});
|
|
193
242
|
const account = await getValidatorAccount(config, signers, publicClient, chain);
|
|
194
243
|
if (!account) {
|
|
@@ -199,7 +248,7 @@ async function signUserOp(config, chain, signers, userOp) {
|
|
|
199
248
|
async function submitUserOp(config, chain, userOp, signature) {
|
|
200
249
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
201
250
|
chain,
|
|
202
|
-
transport: (0,
|
|
251
|
+
transport: (0, utils_1.createTransport)(chain, config.provider),
|
|
203
252
|
});
|
|
204
253
|
const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
|
|
205
254
|
const hash = await bundlerClient.request({
|
|
@@ -232,34 +281,40 @@ async function submitUserOp(config, chain, userOp, signature) {
|
|
|
232
281
|
return {
|
|
233
282
|
type: 'userop',
|
|
234
283
|
hash,
|
|
235
|
-
|
|
236
|
-
targetChain: chain.id,
|
|
284
|
+
chain: chain.id,
|
|
237
285
|
};
|
|
238
286
|
}
|
|
239
|
-
async function submitIntent(config,
|
|
240
|
-
return submitIntentInternal(config,
|
|
287
|
+
async function submitIntent(config, sourceChains, targetChain, intentOp, signature, authorizations) {
|
|
288
|
+
return submitIntentInternal(config, sourceChains, targetChain, intentOp, signature, authorizations);
|
|
241
289
|
}
|
|
242
290
|
function getOrchestratorByChain(chainId, apiKey) {
|
|
243
291
|
const orchestratorUrl = (0, registry_1.isTestnet)(chainId)
|
|
244
|
-
? consts_1.
|
|
292
|
+
? consts_1.STAGING_ORCHESTRATOR_URL
|
|
245
293
|
: consts_1.PROD_ORCHESTRATOR_URL;
|
|
246
294
|
return (0, orchestrator_1.getOrchestrator)(apiKey, orchestratorUrl);
|
|
247
295
|
}
|
|
248
|
-
async function submitIntentInternal(config,
|
|
296
|
+
async function submitIntentInternal(config, sourceChains, targetChain, intentOp, signature, authorizations) {
|
|
249
297
|
const signedIntentOp = {
|
|
250
298
|
...intentOp,
|
|
251
299
|
originSignatures: Array(intentOp.elements.length).fill(signature),
|
|
252
300
|
destinationSignature: signature,
|
|
301
|
+
signedAuthorizations: authorizations.length > 0
|
|
302
|
+
? authorizations.map((authorization) => ({
|
|
303
|
+
chainId: authorization.chainId,
|
|
304
|
+
address: authorization.address,
|
|
305
|
+
nonce: authorization.nonce,
|
|
306
|
+
yParity: authorization.yParity ?? 0,
|
|
307
|
+
r: authorization.r,
|
|
308
|
+
s: authorization.s,
|
|
309
|
+
}))
|
|
310
|
+
: undefined,
|
|
253
311
|
};
|
|
254
|
-
if (deploy) {
|
|
255
|
-
await (0, accounts_1.deployTarget)(targetChain, config, false);
|
|
256
|
-
}
|
|
257
312
|
const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
|
|
258
313
|
const intentResults = await orchestrator.submitIntent(signedIntentOp);
|
|
259
314
|
return {
|
|
260
315
|
type: 'intent',
|
|
261
316
|
id: BigInt(intentResults.result.id),
|
|
262
|
-
|
|
317
|
+
sourceChains: sourceChains?.map((chain) => chain.id),
|
|
263
318
|
targetChain: targetChain.id,
|
|
264
319
|
};
|
|
265
320
|
}
|
|
@@ -292,10 +347,7 @@ function getValidator(config, signers) {
|
|
|
292
347
|
if (withOwner) {
|
|
293
348
|
// ECDSA
|
|
294
349
|
if (withOwner.kind === 'ecdsa') {
|
|
295
|
-
return (0, core_1.getOwnableValidator)(
|
|
296
|
-
threshold: 1,
|
|
297
|
-
owners: withOwner.accounts.map((account) => account.address),
|
|
298
|
-
});
|
|
350
|
+
return (0, core_1.getOwnableValidator)(1, withOwner.accounts.map((account) => account.address));
|
|
299
351
|
}
|
|
300
352
|
// Passkeys (WebAuthn)
|
|
301
353
|
if (withOwner.kind === 'passkey') {
|
|
@@ -305,6 +357,10 @@ function getValidator(config, signers) {
|
|
|
305
357
|
authenticatorId: passkeyAccount.id,
|
|
306
358
|
});
|
|
307
359
|
}
|
|
360
|
+
// Multi-factor
|
|
361
|
+
if (withOwner.kind === 'multi-factor') {
|
|
362
|
+
return (0, core_1.getMultiFactorValidator)(1, withOwner.validators);
|
|
363
|
+
}
|
|
308
364
|
}
|
|
309
365
|
// Smart sessions
|
|
310
366
|
const withSession = signers.type === 'session' ? signers.session : null;
|
|
@@ -319,40 +375,50 @@ function getValidator(config, signers) {
|
|
|
319
375
|
// Fallback
|
|
320
376
|
return undefined;
|
|
321
377
|
}
|
|
322
|
-
function
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
// Passkeys (WebAuthn)
|
|
337
|
-
if (withOwner.kind === 'passkey') {
|
|
338
|
-
return {
|
|
339
|
-
type: 'passkey',
|
|
340
|
-
account: withOwner.account,
|
|
341
|
-
};
|
|
378
|
+
function parseCalls(calls, chainId) {
|
|
379
|
+
return calls.map((call) => ({
|
|
380
|
+
data: call.data ?? '0x',
|
|
381
|
+
value: call.value ?? 0n,
|
|
382
|
+
to: (0, registry_1.resolveTokenAddress)(call.to, chainId),
|
|
383
|
+
}));
|
|
384
|
+
}
|
|
385
|
+
async function getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature) {
|
|
386
|
+
const initCode = (0, accounts_1.getInitCode)(config);
|
|
387
|
+
if (config.eoa) {
|
|
388
|
+
// EIP-7702 initialization is only needed for EOA accounts
|
|
389
|
+
if (!eip7702InitSignature || eip7702InitSignature === '0x') {
|
|
390
|
+
throw new Error('EIP-7702 initialization signature is required for EOA accounts');
|
|
342
391
|
}
|
|
392
|
+
const { initData: eip7702InitData, contract: eip7702Contract } = await (0, accounts_1.getEip7702InitCall)(config, eip7702InitSignature);
|
|
393
|
+
return {
|
|
394
|
+
setupOps: [
|
|
395
|
+
{
|
|
396
|
+
to: accountAddress,
|
|
397
|
+
data: eip7702InitData,
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
delegations: {
|
|
401
|
+
0: {
|
|
402
|
+
contract: eip7702Contract,
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
};
|
|
343
406
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
407
|
+
else if (initCode) {
|
|
408
|
+
// Contract account with init code
|
|
409
|
+
return {
|
|
410
|
+
setupOps: [
|
|
411
|
+
{
|
|
412
|
+
to: initCode.factory,
|
|
413
|
+
data: initCode.factoryData,
|
|
414
|
+
},
|
|
415
|
+
],
|
|
416
|
+
};
|
|
348
417
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (withGuardians) {
|
|
418
|
+
else {
|
|
419
|
+
// Already deployed contract account
|
|
352
420
|
return {
|
|
353
|
-
|
|
354
|
-
accounts: withGuardians.guardians,
|
|
421
|
+
setupOps: [],
|
|
355
422
|
};
|
|
356
423
|
}
|
|
357
|
-
return undefined;
|
|
358
424
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import type { Address, Chain, Hex } from 'viem';
|
|
2
|
-
import { UserOperationReceipt } from 'viem/account-abstraction';
|
|
1
|
+
import type { Address, Chain, Hex, SignedAuthorizationList } from 'viem';
|
|
2
|
+
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
3
|
import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './accounts';
|
|
4
|
-
import {
|
|
4
|
+
import { createTransport } from './accounts/utils';
|
|
5
|
+
import { addOwner, changeMultiFactorThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, removeSubValidator, setSubValidator, setUpRecovery } from './actions';
|
|
5
6
|
import type { TransactionResult } from './execution';
|
|
6
|
-
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError,
|
|
7
|
-
import { SessionDetails } from './execution/smart-session';
|
|
8
|
-
import { IntentData, PreparedTransactionData, SignedTransactionData } from './execution/utils';
|
|
9
|
-
import { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SettlementSystem, SignedIntentOp } from './orchestrator';
|
|
10
|
-
import {
|
|
11
|
-
import type { Call, Execution, RhinestoneAccountConfig, Session, Transaction } from './types';
|
|
7
|
+
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError } from './execution';
|
|
8
|
+
import { type SessionDetails } from './execution/smart-session';
|
|
9
|
+
import { type IntentData, type PreparedTransactionData, type SignedTransactionData } from './execution/utils';
|
|
10
|
+
import { AuthenticationRequiredError, InsufficientBalanceError, type IntentCost, type IntentInput, IntentNotFoundError, type IntentOp, type IntentOpStatus, type IntentResult, type IntentRoute, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, type Portfolio, type SettlementSystem, type SignedIntentOp, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './orchestrator';
|
|
11
|
+
import type { Call, RhinestoneAccountConfig, Session, Transaction } from './types';
|
|
12
12
|
interface RhinestoneAccount {
|
|
13
13
|
config: RhinestoneAccountConfig;
|
|
14
14
|
deploy: (chain: Chain, session?: Session) => Promise<void>;
|
|
15
|
+
signEip7702InitData: () => Promise<Hex>;
|
|
15
16
|
prepareTransaction: (transaction: Transaction) => Promise<PreparedTransactionData>;
|
|
16
17
|
signTransaction: (preparedTransaction: PreparedTransactionData) => Promise<SignedTransactionData>;
|
|
17
|
-
|
|
18
|
+
signAuthorizations: (preparedTransaction: PreparedTransactionData) => Promise<SignedAuthorizationList>;
|
|
19
|
+
submitTransaction: (signedTransaction: SignedTransactionData, authorizations?: SignedAuthorizationList) => Promise<TransactionResult>;
|
|
18
20
|
sendTransaction: (transaction: Transaction) => Promise<TransactionResult>;
|
|
19
21
|
waitForExecution: (result: TransactionResult, acceptsPreconfirmations?: boolean) => Promise<IntentOpStatus | UserOperationReceipt>;
|
|
20
22
|
getAddress: () => Address;
|
|
21
23
|
getPortfolio: (onTestnets?: boolean) => Promise<Portfolio>;
|
|
22
24
|
getMaxSpendableAmount: (chain: Chain, tokenAddress: Address, gasUnits: bigint) => Promise<bigint>;
|
|
23
25
|
getSessionDetails: (sessions: Session[], sessionIndex: number, signature?: Hex) => Promise<SessionDetails>;
|
|
24
|
-
areAttestersTrusted: (chain: Chain) => Promise<boolean>;
|
|
25
26
|
getOwners: (chain: Chain) => Promise<{
|
|
26
27
|
accounts: Address[];
|
|
27
28
|
threshold: number;
|
|
28
29
|
} | null>;
|
|
29
30
|
getValidators: (chain: Chain) => Promise<Address[]>;
|
|
30
|
-
depositEther: (chain: Chain, value: bigint) => Promise<TransactionResult>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Initialize a Rhinestone account
|
|
@@ -36,6 +36,6 @@ interface RhinestoneAccount {
|
|
|
36
36
|
* @returns account
|
|
37
37
|
*/
|
|
38
38
|
declare function createRhinestoneAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
39
|
-
export { createRhinestoneAccount, addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, recover, removeOwner,
|
|
40
|
-
export type { RhinestoneAccount, Session, Call,
|
|
39
|
+
export { createRhinestoneAccount, createTransport, addOwner, changeMultiFactorThreshold, changeThreshold, disableEcdsa, disableMultiFactor, disablePasskeys, enableEcdsa, enableMultiFactor, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, removeSubValidator, setSubValidator, setUpRecovery, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, isExecutionError, IntentFailedError, ExecutionError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
|
|
40
|
+
export type { RhinestoneAccount, Session, Call, IntentData, PreparedTransactionData, SignedTransactionData, TransactionResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, Portfolio, };
|
|
41
41
|
//# 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,GAAG,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"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"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.
|
|
3
|
+
exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainsNotAvailableForUserOpFlowError = exports.ExecutionError = exports.IntentFailedError = exports.isExecutionError = exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = exports.isAccountError = exports.setUpRecovery = exports.setSubValidator = exports.removeSubValidator = exports.removeOwner = exports.recover = exports.encodeSmartSessionSignature = exports.enablePasskeys = exports.enableMultiFactor = exports.enableEcdsa = exports.disablePasskeys = exports.disableMultiFactor = exports.disableEcdsa = exports.changeThreshold = exports.changeMultiFactorThreshold = exports.addOwner = exports.createTransport = void 0;
|
|
4
4
|
exports.createRhinestoneAccount = createRhinestoneAccount;
|
|
5
5
|
const accounts_1 = require("./accounts");
|
|
6
6
|
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
@@ -12,29 +12,34 @@ Object.defineProperty(exports, "isAccountError", { enumerable: true, get: functi
|
|
|
12
12
|
Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.SigningNotSupportedForAccountError; } });
|
|
13
13
|
Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return accounts_1.SignMessageNotSupportedByAccountError; } });
|
|
14
14
|
Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
|
|
15
|
+
const utils_1 = require("./accounts/utils");
|
|
16
|
+
Object.defineProperty(exports, "createTransport", { enumerable: true, get: function () { return utils_1.createTransport; } });
|
|
15
17
|
const actions_1 = require("./actions");
|
|
16
18
|
Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
|
|
19
|
+
Object.defineProperty(exports, "changeMultiFactorThreshold", { enumerable: true, get: function () { return actions_1.changeMultiFactorThreshold; } });
|
|
17
20
|
Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
|
|
18
21
|
Object.defineProperty(exports, "disableEcdsa", { enumerable: true, get: function () { return actions_1.disableEcdsa; } });
|
|
22
|
+
Object.defineProperty(exports, "disableMultiFactor", { enumerable: true, get: function () { return actions_1.disableMultiFactor; } });
|
|
19
23
|
Object.defineProperty(exports, "disablePasskeys", { enumerable: true, get: function () { return actions_1.disablePasskeys; } });
|
|
20
24
|
Object.defineProperty(exports, "enableEcdsa", { enumerable: true, get: function () { return actions_1.enableEcdsa; } });
|
|
25
|
+
Object.defineProperty(exports, "enableMultiFactor", { enumerable: true, get: function () { return actions_1.enableMultiFactor; } });
|
|
21
26
|
Object.defineProperty(exports, "enablePasskeys", { enumerable: true, get: function () { return actions_1.enablePasskeys; } });
|
|
22
27
|
Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return actions_1.encodeSmartSessionSignature; } });
|
|
23
28
|
Object.defineProperty(exports, "recover", { enumerable: true, get: function () { return actions_1.recover; } });
|
|
24
29
|
Object.defineProperty(exports, "removeOwner", { enumerable: true, get: function () { return actions_1.removeOwner; } });
|
|
30
|
+
Object.defineProperty(exports, "removeSubValidator", { enumerable: true, get: function () { return actions_1.removeSubValidator; } });
|
|
31
|
+
Object.defineProperty(exports, "setSubValidator", { enumerable: true, get: function () { return actions_1.setSubValidator; } });
|
|
25
32
|
Object.defineProperty(exports, "setUpRecovery", { enumerable: true, get: function () { return actions_1.setUpRecovery; } });
|
|
26
|
-
Object.defineProperty(exports, "trustAttester", { enumerable: true, get: function () { return actions_1.trustAttester; } });
|
|
27
33
|
const execution_1 = require("./execution");
|
|
28
34
|
Object.defineProperty(exports, "ExecutionError", { enumerable: true, get: function () { return execution_1.ExecutionError; } });
|
|
29
35
|
Object.defineProperty(exports, "IntentFailedError", { enumerable: true, get: function () { return execution_1.IntentFailedError; } });
|
|
30
36
|
Object.defineProperty(exports, "isExecutionError", { enumerable: true, get: function () { return execution_1.isExecutionError; } });
|
|
31
37
|
Object.defineProperty(exports, "OrderPathRequiredForIntentsError", { enumerable: true, get: function () { return execution_1.OrderPathRequiredForIntentsError; } });
|
|
32
38
|
Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true, get: function () { return execution_1.SessionChainRequiredError; } });
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
-
Object.defineProperty(exports, "SourceTargetChainMismatchError", { enumerable: true, get: function () { return execution_1.SourceTargetChainMismatchError; } });
|
|
39
|
+
Object.defineProperty(exports, "SourceChainsNotAvailableForUserOpFlowError", { enumerable: true, get: function () { return execution_1.SourceChainsNotAvailableForUserOpFlowError; } });
|
|
35
40
|
Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.UserOperationRequiredForSmartSessionsError; } });
|
|
36
41
|
const smart_session_1 = require("./execution/smart-session");
|
|
37
|
-
const
|
|
42
|
+
const utils_2 = require("./execution/utils");
|
|
38
43
|
const modules_1 = require("./modules");
|
|
39
44
|
const orchestrator_1 = require("./orchestrator");
|
|
40
45
|
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
|
|
@@ -60,14 +65,20 @@ async function createRhinestoneAccount(config) {
|
|
|
60
65
|
function deploy(chain, session) {
|
|
61
66
|
return (0, accounts_1.deploy)(config, chain, session);
|
|
62
67
|
}
|
|
68
|
+
function signEip7702InitData() {
|
|
69
|
+
return (0, accounts_1.signEip7702InitData)(config);
|
|
70
|
+
}
|
|
63
71
|
function prepareTransaction(transaction) {
|
|
64
|
-
return (0,
|
|
72
|
+
return (0, utils_2.prepareTransaction)(config, transaction);
|
|
65
73
|
}
|
|
66
74
|
function signTransaction(preparedTransaction) {
|
|
67
|
-
return (0,
|
|
75
|
+
return (0, utils_2.signTransaction)(config, preparedTransaction);
|
|
76
|
+
}
|
|
77
|
+
function signAuthorizations(preparedTransaction) {
|
|
78
|
+
return (0, utils_2.signAuthorizations)(config, preparedTransaction);
|
|
68
79
|
}
|
|
69
|
-
function submitTransaction(signedTransaction) {
|
|
70
|
-
return (0,
|
|
80
|
+
function submitTransaction(signedTransaction, authorizations) {
|
|
81
|
+
return (0, utils_2.submitTransaction)(config, signedTransaction, authorizations ?? []);
|
|
71
82
|
}
|
|
72
83
|
/**
|
|
73
84
|
* Sign and send a transaction
|
|
@@ -114,27 +125,22 @@ async function createRhinestoneAccount(config) {
|
|
|
114
125
|
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
115
126
|
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
116
127
|
}
|
|
117
|
-
function areAttestersTrusted(chain) {
|
|
118
|
-
const account = getAddress();
|
|
119
|
-
return (0, modules_1.areAttestersTrusted)(account, chain);
|
|
120
|
-
}
|
|
121
128
|
function getOwners(chain) {
|
|
122
129
|
const account = getAddress();
|
|
123
|
-
return (0, modules_1.getOwners)(account, chain);
|
|
130
|
+
return (0, modules_1.getOwners)(account, chain, config.provider);
|
|
124
131
|
}
|
|
125
132
|
function getValidators(chain) {
|
|
126
133
|
const accountType = config.account?.type || 'nexus';
|
|
127
134
|
const account = getAddress();
|
|
128
|
-
return (0, modules_1.getValidators)(accountType, account, chain);
|
|
129
|
-
}
|
|
130
|
-
async function depositEther(chain, value) {
|
|
131
|
-
return (0, execution_1.depositEther)(config, chain, value);
|
|
135
|
+
return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
|
|
132
136
|
}
|
|
133
137
|
return {
|
|
134
138
|
config,
|
|
135
139
|
deploy,
|
|
140
|
+
signEip7702InitData,
|
|
136
141
|
prepareTransaction,
|
|
137
142
|
signTransaction,
|
|
143
|
+
signAuthorizations,
|
|
138
144
|
submitTransaction,
|
|
139
145
|
sendTransaction,
|
|
140
146
|
waitForExecution,
|
|
@@ -142,9 +148,7 @@ async function createRhinestoneAccount(config) {
|
|
|
142
148
|
getPortfolio,
|
|
143
149
|
getMaxSpendableAmount,
|
|
144
150
|
getSessionDetails,
|
|
145
|
-
areAttestersTrusted,
|
|
146
151
|
getOwners,
|
|
147
152
|
getValidators,
|
|
148
|
-
depositEther,
|
|
149
153
|
};
|
|
150
154
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Chain, type Hex } from 'viem';
|
|
2
2
|
import type { RhinestoneAccountConfig } from '../types';
|
|
3
3
|
import { type Module } from './common';
|
|
4
4
|
import { HOOK_ADDRESS } from './omni-account';
|
|
5
|
-
import {
|
|
6
|
-
import { getTrustAttesterCall, getTrustedAttesters } from './registry';
|
|
5
|
+
import { getOwners, getValidators } from './read';
|
|
7
6
|
import { getOwnerValidator } from './validators';
|
|
8
7
|
interface WebAuthnData {
|
|
9
8
|
authenticatorData: Hex;
|
|
@@ -24,12 +23,9 @@ interface ModeleSetup {
|
|
|
24
23
|
executors: Module[];
|
|
25
24
|
fallbacks: Module[];
|
|
26
25
|
hooks: Module[];
|
|
27
|
-
registry: Address;
|
|
28
|
-
attesters: Address[];
|
|
29
|
-
threshold: number;
|
|
30
26
|
}
|
|
31
27
|
declare function getSetup(config: RhinestoneAccountConfig): ModeleSetup;
|
|
32
28
|
declare function getWebauthnValidatorSignature({ webauthn, signature, usePrecompiled, }: WebauthnValidatorSignature): `0x${string}`;
|
|
33
29
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
34
|
-
export { HOOK_ADDRESS, getSetup,
|
|
30
|
+
export { HOOK_ADDRESS, getSetup, getOwnerValidator, getWebauthnValidatorSignature, getOwners, getValidators, isRip7212SupportedNetwork, };
|
|
35
31
|
//# sourceMappingURL=index.d.ts.map
|