@charterlabs/rhinestone-sdk 0.2.8 → 0.3.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/dist/src/accounts/error.d.ts +4 -1
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +9 -1
- package/dist/src/accounts/index.d.ts +11 -4
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +32 -10
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/index.js +4 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.js +33 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +2 -1
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/providers.js +8 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.test.js +43 -0
- package/dist/src/accounts/kernel.d.ts +9 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +15 -1
- package/dist/src/accounts/nexus.d.ts +11 -4
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +19 -3
- package/dist/src/accounts/passport.d.ts +4 -4
- package/dist/src/accounts/passport.d.ts.map +1 -1
- package/dist/src/accounts/safe.d.ts +9 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +17 -1
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +26 -5
- package/dist/src/accounts/signing/message.js +1 -1
- package/dist/src/accounts/startale.d.ts +9 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +17 -1
- package/dist/src/accounts/walletClient.d.ts +27 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -1
- package/dist/src/accounts/walletClient.js +77 -0
- package/dist/src/actions/index.d.ts +1 -10
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.d.ts +2 -11
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +0 -10
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +3 -1
- package/dist/src/execution/error.d.ts +8 -1
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +10 -1
- package/dist/src/execution/index.d.ts +9 -4
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +32 -12
- package/dist/src/execution/singleChainOps.d.ts +28 -0
- package/dist/src/execution/singleChainOps.d.ts.map +1 -0
- package/dist/src/execution/{multiChainOps.js → singleChainOps.js} +7 -14
- package/dist/src/execution/smart-session.d.ts +5 -7
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/smart-session.js +113 -228
- package/dist/src/execution/utils.d.ts +4 -4
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +125 -29
- package/dist/src/index.d.ts +13 -15
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -6
- package/dist/src/modules/common.d.ts +3 -1
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +10 -0
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +15 -1
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +39 -2
- package/dist/src/modules/validators/smart-sessions.d.ts +6 -6
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +23 -12
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +13 -1
- package/dist/src/orchestrator/error.d.ts +27 -1
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +10 -1
- package/dist/src/orchestrator/index.d.ts +6 -6
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +4 -3
- package/dist/src/orchestrator/registry.d.ts +6 -2
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +30 -70
- package/dist/src/orchestrator/registry.test.js +24 -24
- package/dist/src/orchestrator/types.d.ts +31 -21
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +3 -5
- package/dist/src/types.d.ts +43 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +12 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +16 -0
- package/package.json +5 -5
- package/dist/src/execution/multiChainOps.d.ts +0 -40
- package/dist/src/execution/multiChainOps.d.ts.map +0 -1
- package/dist/src/execution/smart-session.test.d.ts +0 -2
- package/dist/src/execution/smart-session.test.d.ts.map +0 -1
- package/dist/src/execution/smart-session.test.js +0 -34
|
@@ -20,6 +20,7 @@ exports.getTokenRequests = getTokenRequests;
|
|
|
20
20
|
exports.resolveCallInputs = resolveCallInputs;
|
|
21
21
|
const viem_1 = require("viem");
|
|
22
22
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
23
|
+
const erc7739_1 = require("viem/experimental/erc7739");
|
|
23
24
|
const accounts_1 = require("../accounts");
|
|
24
25
|
const utils_1 = require("../accounts/utils");
|
|
25
26
|
const modules_1 = require("../modules");
|
|
@@ -30,16 +31,16 @@ const consts_1 = require("../orchestrator/consts");
|
|
|
30
31
|
const registry_1 = require("../orchestrator/registry");
|
|
31
32
|
const compact_1 = require("./compact");
|
|
32
33
|
const error_1 = require("./error");
|
|
33
|
-
const multiChainOps_1 = require("./multiChainOps");
|
|
34
34
|
const permit2_1 = require("./permit2");
|
|
35
|
+
const singleChainOps_1 = require("./singleChainOps");
|
|
35
36
|
async function prepareTransaction(config, transaction) {
|
|
36
|
-
const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account, } = getTransactionParams(transaction);
|
|
37
|
+
const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account, recipient, } = getTransactionParams(transaction);
|
|
37
38
|
const accountAddress = (0, accounts_1.getAddress)(config);
|
|
38
39
|
const isUserOpSigner = signers?.type === 'guardians' || signers?.type === 'session';
|
|
39
40
|
if (isUserOpSigner) {
|
|
40
41
|
throw new error_1.SignerNotSupportedError();
|
|
41
42
|
}
|
|
42
|
-
const intentRoute = await prepareTransactionAsIntent(config, sourceChains, targetChain, await resolveCallInputs(transaction.calls, config, targetChain, accountAddress), transaction.gasLimit, tokenRequests, accountAddress, sponsored ?? false, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account);
|
|
43
|
+
const intentRoute = await prepareTransactionAsIntent(config, sourceChains, targetChain, await resolveCallInputs(transaction.calls, config, targetChain, accountAddress), transaction.gasLimit, tokenRequests, recipient, accountAddress, sponsored ?? false, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account);
|
|
43
44
|
return {
|
|
44
45
|
intentRoute,
|
|
45
46
|
transaction,
|
|
@@ -58,6 +59,9 @@ async function prepareUserOperation(config, transaction) {
|
|
|
58
59
|
}
|
|
59
60
|
async function resolveCallInputs(inputs, config, chain, accountAddress) {
|
|
60
61
|
const resolved = [];
|
|
62
|
+
if (!inputs) {
|
|
63
|
+
return resolved;
|
|
64
|
+
}
|
|
61
65
|
for (const intent of inputs) {
|
|
62
66
|
if ('resolve' in intent) {
|
|
63
67
|
const result = await intent.resolve({ config, chain, accountAddress });
|
|
@@ -122,12 +126,54 @@ async function signTypedData(config, parameters, chain, signers) {
|
|
|
122
126
|
}
|
|
123
127
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
124
128
|
const isRoot = validator.address === ownerValidator.address;
|
|
129
|
+
if (signers?.type === 'session') {
|
|
130
|
+
return await signTypedDataWithSession(config, chain, {
|
|
131
|
+
address: validator.address,
|
|
132
|
+
isRoot,
|
|
133
|
+
}, signers, parameters);
|
|
134
|
+
}
|
|
125
135
|
const signature = await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, {
|
|
126
136
|
address: validator.address,
|
|
127
137
|
isRoot,
|
|
128
138
|
}, parameters);
|
|
129
139
|
return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
|
|
130
140
|
}
|
|
141
|
+
async function signTypedDataWithSession(config, chain, validator, signers, parameters) {
|
|
142
|
+
const { name, version, chainId, verifyingContract, salt } = (0, accounts_1.getEip712Domain)(config, chain);
|
|
143
|
+
const signature = await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, validator, {
|
|
144
|
+
domain: parameters.domain,
|
|
145
|
+
primaryType: 'TypedDataSign',
|
|
146
|
+
types: {
|
|
147
|
+
...parameters.types,
|
|
148
|
+
TypedDataSign: [
|
|
149
|
+
{ name: 'contents', type: parameters.primaryType },
|
|
150
|
+
{ name: 'name', type: 'string' },
|
|
151
|
+
{ name: 'version', type: 'string' },
|
|
152
|
+
{ name: 'chainId', type: 'uint256' },
|
|
153
|
+
{ name: 'verifyingContract', type: 'address' },
|
|
154
|
+
{ name: 'salt', type: 'bytes32' },
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
message: {
|
|
158
|
+
contents: parameters.message,
|
|
159
|
+
name,
|
|
160
|
+
version,
|
|
161
|
+
chainId,
|
|
162
|
+
verifyingContract,
|
|
163
|
+
salt,
|
|
164
|
+
},
|
|
165
|
+
}, (signature) => {
|
|
166
|
+
const erc7739Signature = (0, erc7739_1.wrapTypedDataSignature)({
|
|
167
|
+
domain: parameters.domain,
|
|
168
|
+
primaryType: parameters.primaryType,
|
|
169
|
+
types: parameters.types,
|
|
170
|
+
message: parameters.message,
|
|
171
|
+
signature,
|
|
172
|
+
});
|
|
173
|
+
return (0, viem_1.encodePacked)(['bytes32', 'bytes'], [(0, validators_1.getPermissionId)(signers.session), erc7739Signature]);
|
|
174
|
+
});
|
|
175
|
+
return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
|
|
176
|
+
}
|
|
131
177
|
async function signAuthorizationsInternal(config, data) {
|
|
132
178
|
const eoa = config.eoa;
|
|
133
179
|
if (!eoa) {
|
|
@@ -190,6 +236,7 @@ function getTransactionParams(transaction) {
|
|
|
190
236
|
const feeAsset = transaction.feeAsset;
|
|
191
237
|
const lockFunds = transaction.lockFunds;
|
|
192
238
|
const account = transaction.experimental_accountOverride;
|
|
239
|
+
const recipient = transaction.recipient;
|
|
193
240
|
const tokenRequests = getTokenRequests(sourceChains || [], targetChain, initialTokenRequests, settlementLayers);
|
|
194
241
|
return {
|
|
195
242
|
sourceChains,
|
|
@@ -204,6 +251,7 @@ function getTransactionParams(transaction) {
|
|
|
204
251
|
feeAsset,
|
|
205
252
|
lockFunds,
|
|
206
253
|
account,
|
|
254
|
+
recipient,
|
|
207
255
|
};
|
|
208
256
|
}
|
|
209
257
|
function getTokenRequests(sourceChains, targetChain, initialTokenRequests, settlementLayers) {
|
|
@@ -250,25 +298,62 @@ async function prepareTransactionAsUserOp(config, chain, callInputs, signers, ga
|
|
|
250
298
|
}),
|
|
251
299
|
};
|
|
252
300
|
}
|
|
253
|
-
async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, accountAddress, isSponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account) {
|
|
301
|
+
async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipientInput, accountAddress, isSponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account) {
|
|
302
|
+
if (config.account?.type === 'eoa') {
|
|
303
|
+
if (callInputs.length > 0) {
|
|
304
|
+
throw new error_1.CallsNotSupportedError();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
254
307
|
const calls = parseCalls(callInputs, targetChain.id);
|
|
255
308
|
const accountAccessList = createAccountAccessList(sourceChains, sourceAssets);
|
|
256
|
-
const { setupOps, delegations } =
|
|
257
|
-
|
|
258
|
-
if (
|
|
309
|
+
const { setupOps, delegations } = getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature);
|
|
310
|
+
function getAccountType(accountConfig) {
|
|
311
|
+
if (accountConfig?.type === 'eoa') {
|
|
259
312
|
return 'EOA';
|
|
260
313
|
}
|
|
261
314
|
else {
|
|
262
315
|
return 'ERC7579';
|
|
263
316
|
}
|
|
264
|
-
}
|
|
265
|
-
|
|
317
|
+
}
|
|
318
|
+
function getRecipient(recipient) {
|
|
319
|
+
if (typeof recipient === 'string') {
|
|
320
|
+
// Passed as an address, assume it's an EOA
|
|
321
|
+
return {
|
|
322
|
+
address: recipient,
|
|
323
|
+
accountType: 'EOA',
|
|
324
|
+
setupOps: [],
|
|
325
|
+
delegations: undefined,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const recipientAddress = recipient ? (0, accounts_1.getAddress)(recipient) : undefined;
|
|
329
|
+
const recipientAccountType = recipient
|
|
330
|
+
? getAccountType(recipient.account)
|
|
331
|
+
: undefined;
|
|
332
|
+
const { setupOps: recipientSetupOps, delegations: recipientDelegations } = recipient && recipientAddress
|
|
333
|
+
? getSetupOperationsAndDelegations(recipient, recipientAddress, eip7702InitSignature)
|
|
334
|
+
: {
|
|
335
|
+
setupOps: [],
|
|
336
|
+
delegations: {},
|
|
337
|
+
};
|
|
338
|
+
if (!recipientAddress || !recipientAccountType) {
|
|
339
|
+
return undefined;
|
|
340
|
+
}
|
|
341
|
+
return {
|
|
342
|
+
address: recipientAddress,
|
|
343
|
+
accountType: recipientAccountType,
|
|
344
|
+
setupOps: recipientSetupOps,
|
|
345
|
+
delegations: recipientDelegations,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
const accountType = getAccountType(config.account);
|
|
349
|
+
const recipient = getRecipient(recipientInput);
|
|
266
350
|
const metaIntent = {
|
|
267
351
|
destinationChainId: targetChain.id,
|
|
268
|
-
|
|
352
|
+
tokenRequests: tokenRequests.map((tokenRequest) => ({
|
|
269
353
|
tokenAddress: (0, registry_1.resolveTokenAddress)(tokenRequest.address, targetChain.id),
|
|
270
354
|
amount: tokenRequest.amount,
|
|
271
355
|
})),
|
|
356
|
+
recipient,
|
|
272
357
|
account: {
|
|
273
358
|
address: accountAddress,
|
|
274
359
|
accountType: accountType,
|
|
@@ -320,9 +405,10 @@ async function signIntent(config, targetChain, intentOp, signers) {
|
|
|
320
405
|
throw new accounts_1.EoaSigningMethodNotConfiguredError('signTypedData, sign, or signMessage');
|
|
321
406
|
}
|
|
322
407
|
}
|
|
408
|
+
const destinationSignature = originSignatures.at(-1);
|
|
323
409
|
return {
|
|
324
410
|
originSignatures,
|
|
325
|
-
destinationSignature
|
|
411
|
+
destinationSignature,
|
|
326
412
|
};
|
|
327
413
|
}
|
|
328
414
|
const validator = getValidator(config, signers);
|
|
@@ -332,20 +418,20 @@ async function signIntent(config, targetChain, intentOp, signers) {
|
|
|
332
418
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
333
419
|
const isRoot = validator.address === ownerValidator.address;
|
|
334
420
|
const signatures = await getIntentSignature(config, intentOp, signers, targetChain, validator, isRoot);
|
|
335
|
-
return
|
|
421
|
+
return {
|
|
422
|
+
originSignatures: signatures.originSignatures,
|
|
423
|
+
destinationSignature: signatures.destinationSignature,
|
|
424
|
+
};
|
|
336
425
|
}
|
|
337
426
|
async function getIntentSignature(config, intentOp, signers, targetChain, validator, isRoot) {
|
|
338
|
-
const
|
|
339
|
-
const
|
|
427
|
+
const withPermit2 = intentOp.elements.some((element) => element.mandate.qualifier.settlementContext?.fundingMethod === 'PERMIT2');
|
|
428
|
+
const withIntentExecutorOps = intentOp.elements.some((element) => element.mandate.qualifier.settlementContext.settlementLayer ===
|
|
340
429
|
'INTENT_EXECUTOR');
|
|
341
|
-
if (
|
|
342
|
-
const signature = await
|
|
343
|
-
return
|
|
344
|
-
originSignatures: Array(intentOp.elements.length).fill(signature),
|
|
345
|
-
destinationSignature: signature,
|
|
346
|
-
};
|
|
430
|
+
if (withIntentExecutorOps) {
|
|
431
|
+
const signature = await getSingleChainOpsSignature(config, intentOp, signers, targetChain, validator, isRoot);
|
|
432
|
+
return signature;
|
|
347
433
|
}
|
|
348
|
-
if (
|
|
434
|
+
if (withPermit2) {
|
|
349
435
|
return await getPermit2Signatures(config, intentOp, signers, targetChain, validator, isRoot);
|
|
350
436
|
}
|
|
351
437
|
const signature = await getCompactSignature(config, intentOp, signers, targetChain, validator, isRoot);
|
|
@@ -354,12 +440,20 @@ async function getIntentSignature(config, intentOp, signers, targetChain, valida
|
|
|
354
440
|
destinationSignature: signature,
|
|
355
441
|
};
|
|
356
442
|
}
|
|
357
|
-
async function
|
|
443
|
+
async function getSingleChainOpsSignature(config, intentOp, signers, targetChain, validator, isRoot) {
|
|
358
444
|
const address = (0, accounts_1.getAddress)(config);
|
|
359
445
|
const intentExecutor = (0, modules_1.getIntentExecutor)(config);
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
446
|
+
const originSignatures = [];
|
|
447
|
+
for (const element of intentOp.elements) {
|
|
448
|
+
const typedData = (0, singleChainOps_1.getTypedData)(address, intentExecutor.address, element, BigInt(intentOp.nonce));
|
|
449
|
+
const signature = await signIntentTypedData(config, signers, targetChain, validator, isRoot, typedData);
|
|
450
|
+
originSignatures.push(signature);
|
|
451
|
+
}
|
|
452
|
+
const destinationSignature = originSignatures.at(-1);
|
|
453
|
+
return {
|
|
454
|
+
originSignatures,
|
|
455
|
+
destinationSignature,
|
|
456
|
+
};
|
|
363
457
|
}
|
|
364
458
|
async function getPermit2Signatures(config, intentOp, signers, targetChain, validator, isRoot) {
|
|
365
459
|
const originSignatures = [];
|
|
@@ -368,9 +462,10 @@ async function getPermit2Signatures(config, intentOp, signers, targetChain, vali
|
|
|
368
462
|
const signature = await signIntentTypedData(config, signers, targetChain, validator, isRoot, typedData);
|
|
369
463
|
originSignatures.push(signature);
|
|
370
464
|
}
|
|
465
|
+
const destinationSignature = originSignatures.at(-1);
|
|
371
466
|
return {
|
|
372
467
|
originSignatures,
|
|
373
|
-
destinationSignature
|
|
468
|
+
destinationSignature,
|
|
374
469
|
};
|
|
375
470
|
}
|
|
376
471
|
async function getCompactSignature(config, intentOp, signers, targetChain, validator, isRoot) {
|
|
@@ -513,7 +608,8 @@ function getValidator(config, signers) {
|
|
|
513
608
|
if (withOwner) {
|
|
514
609
|
// ECDSA
|
|
515
610
|
if (withOwner.kind === 'ecdsa') {
|
|
516
|
-
|
|
611
|
+
// Use the configured owner validator (e.g., ENS) rather than forcing Ownable
|
|
612
|
+
return (0, validators_1.getOwnerValidator)(config);
|
|
517
613
|
}
|
|
518
614
|
// Passkeys (WebAuthn)
|
|
519
615
|
if (withOwner.kind === 'passkey') {
|
|
@@ -561,7 +657,7 @@ function createAccountAccessList(sourceChains, sourceAssets) {
|
|
|
561
657
|
}
|
|
562
658
|
return { chainTokens: sourceAssets };
|
|
563
659
|
}
|
|
564
|
-
|
|
660
|
+
function getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature) {
|
|
565
661
|
const initCode = (0, accounts_1.getInitCode)(config);
|
|
566
662
|
if (config.account?.type === 'eoa') {
|
|
567
663
|
return {
|
|
@@ -573,7 +669,7 @@ async function getSetupOperationsAndDelegations(config, accountAddress, eip7702I
|
|
|
573
669
|
if (!eip7702InitSignature || eip7702InitSignature === '0x') {
|
|
574
670
|
throw new Error('EIP-7702 initialization signature is required for EOA accounts');
|
|
575
671
|
}
|
|
576
|
-
const { initData: eip7702InitData, contract: eip7702Contract } =
|
|
672
|
+
const { initData: eip7702InitData, contract: eip7702Contract } = (0, accounts_1.getEip7702InitCall)(config, eip7702InitSignature);
|
|
577
673
|
return {
|
|
578
674
|
setupOps: [
|
|
579
675
|
{
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData, Account } from 'viem';
|
|
2
2
|
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
3
|
import { deployStandaloneWithEoa as deployStandaloneWithEoaInternal } from './accounts';
|
|
4
|
-
import { walletClientToAccount } from './accounts/walletClient';
|
|
4
|
+
import { walletClientToAccount, wrapParaAccount } from './accounts/walletClient';
|
|
5
5
|
import { type TransactionResult, type TransactionStatus, type UserOperationResult } from './execution';
|
|
6
6
|
import { type BatchPermit2Result, checkERC20AllowanceDirect, getPermit2Address, type MultiChainPermit2Config, type MultiChainPermit2Result, signPermit2Batch, signPermit2Sequential } from './execution/permit2';
|
|
7
7
|
import { type SessionDetails } from './execution/smart-session';
|
|
8
8
|
import { type IntentRoute, type PreparedTransactionData, type PreparedUserOperationData, type SignedTransactionData, type SignedUserOperationData } from './execution/utils';
|
|
9
|
-
import { getSupportedTokens, getTokenAddress, type IntentCost, type IntentInput, type IntentOp, type IntentOpStatus, type Portfolio, type SettlementLayer, type SignedIntentOp } from './orchestrator';
|
|
10
|
-
import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, MultiFactorValidatorConfig, OwnableValidatorConfig, OwnerSet, PaymasterConfig, Policy, ProviderConfig, Recovery, RhinestoneAccountConfig, Session, SignerSet, TokenRequest, TokenSymbol, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types';
|
|
9
|
+
import { type ApprovalRequired, getAllSupportedChainsAndTokens, getSupportedTokens, getTokenAddress, type IntentCost, type IntentInput, type IntentOp, type IntentOpStatus, type Portfolio, type SettlementLayer, type SignedIntentOp, type TokenRequirements, type WrapRequired } from './orchestrator';
|
|
10
|
+
import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, MultiFactorValidatorConfig, OwnableValidatorConfig, OwnerSet, PaymasterConfig, Policy, ProviderConfig, Recovery, RhinestoneAccountConfig, RhinestoneSDKConfig, Session, SignerSet, TokenRequest, TokenSymbol, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types';
|
|
11
11
|
interface RhinestoneAccount {
|
|
12
12
|
config: RhinestoneAccountConfig;
|
|
13
13
|
deploy: (chain: Chain, params?: {
|
|
@@ -23,7 +23,7 @@ interface RhinestoneAccount {
|
|
|
23
23
|
signAuthorizations: (preparedTransaction: PreparedTransactionData) => Promise<SignedAuthorizationList>;
|
|
24
24
|
signMessage: (message: SignableMessage, chain: Chain, signers: SignerSet | undefined) => Promise<Hex>;
|
|
25
25
|
signTypedData: <typedData extends TypedData | Record<string, unknown> = TypedData, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(parameters: HashTypedDataParameters<typedData, primaryType>, chain: Chain, signers: SignerSet | undefined) => Promise<Hex>;
|
|
26
|
-
submitTransaction: (signedTransaction: SignedTransactionData, authorizations?: SignedAuthorizationList) => Promise<TransactionResult>;
|
|
26
|
+
submitTransaction: (signedTransaction: SignedTransactionData, authorizations?: SignedAuthorizationList, dryRun?: boolean) => Promise<TransactionResult>;
|
|
27
27
|
sendTransaction: (transaction: Transaction) => Promise<TransactionResult>;
|
|
28
28
|
prepareUserOperation: (transaction: UserOperationTransaction) => Promise<PreparedUserOperationData>;
|
|
29
29
|
signUserOperation: (preparedUserOperation: PreparedUserOperationData) => Promise<SignedUserOperationData>;
|
|
@@ -33,8 +33,8 @@ interface RhinestoneAccount {
|
|
|
33
33
|
waitForExecution(result: UserOperationResult, acceptsPreconfirmations?: boolean): Promise<UserOperationReceipt>;
|
|
34
34
|
getAddress: () => Address;
|
|
35
35
|
getPortfolio: (onTestnets?: boolean) => Promise<Portfolio>;
|
|
36
|
-
getMaxSpendableAmount: (chain: Chain, tokenAddress: Address, gasUnits: bigint, sponsored?: boolean) => Promise<bigint>;
|
|
37
|
-
getSessionDetails: (sessions: Session[], sessionIndex: number, signature?: Hex) => Promise<SessionDetails>;
|
|
36
|
+
getMaxSpendableAmount: (chain: Chain, tokenAddress: Address | TokenSymbol, gasUnits: bigint, sponsored?: boolean) => Promise<bigint>;
|
|
37
|
+
getSessionDetails: (sessions: Session[], sessionIndex: number, initialNonces?: bigint[], signature?: Hex) => Promise<SessionDetails>;
|
|
38
38
|
getOwners: (chain: Chain) => Promise<{
|
|
39
39
|
accounts: Address[];
|
|
40
40
|
threshold: number;
|
|
@@ -48,17 +48,15 @@ declare class RhinestoneSDK {
|
|
|
48
48
|
private provider?;
|
|
49
49
|
private bundler?;
|
|
50
50
|
private paymaster?;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
endpointUrl?: string;
|
|
54
|
-
provider?: ProviderConfig;
|
|
55
|
-
bundler?: BundlerConfig;
|
|
56
|
-
paymaster?: PaymasterConfig;
|
|
57
|
-
});
|
|
51
|
+
private useDevContracts?;
|
|
52
|
+
constructor(options?: RhinestoneSDKConfig);
|
|
58
53
|
createAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
|
|
54
|
+
getIntentStatus(intentId: bigint): Promise<TransactionStatus & {
|
|
55
|
+
status: IntentOpStatus["status"];
|
|
56
|
+
}>;
|
|
59
57
|
}
|
|
60
|
-
export { RhinestoneSDK, walletClientToAccount, getSupportedTokens, getTokenAddress, deployStandaloneWithEoaInternal as deployStandaloneWithEoa, checkERC20AllowanceDirect, getPermit2Address, signPermit2Batch, signPermit2Sequential, };
|
|
61
|
-
export type { RhinestoneAccount, AccountType, RhinestoneAccountConfig, AccountProviderConfig, ProviderConfig, BundlerConfig, PaymasterConfig, Transaction, TokenSymbol, CallInput, Call, TokenRequest, OwnerSet, OwnableValidatorConfig, WebauthnValidatorConfig, MultiFactorValidatorConfig, SignerSet, Session, Recovery, Policy, UniversalActionPolicyParamCondition, PreparedTransactionData, SignedTransactionData, TransactionResult, PreparedUserOperationData, SignedUserOperationData, UserOperationResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentRoute, SettlementLayer, SignedIntentOp, Portfolio, MultiChainPermit2Config, MultiChainPermit2Result, BatchPermit2Result, };
|
|
58
|
+
export { RhinestoneSDK, walletClientToAccount, wrapParaAccount, getSupportedTokens, getTokenAddress, getAllSupportedChainsAndTokens, deployStandaloneWithEoaInternal as deployStandaloneWithEoa, checkERC20AllowanceDirect, getPermit2Address, signPermit2Batch, signPermit2Sequential, };
|
|
59
|
+
export type { RhinestoneAccount, AccountType, RhinestoneAccountConfig, AccountProviderConfig, ProviderConfig, BundlerConfig, PaymasterConfig, Transaction, TokenSymbol, CallInput, Call, TokenRequest, OwnerSet, OwnableValidatorConfig, WebauthnValidatorConfig, MultiFactorValidatorConfig, SignerSet, Session, Recovery, Policy, UniversalActionPolicyParamCondition, PreparedTransactionData, SignedTransactionData, TransactionResult, PreparedUserOperationData, SignedUserOperationData, UserOperationResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentRoute, SettlementLayer, SignedIntentOp, Portfolio, TokenRequirements, WrapRequired, ApprovalRequired, MultiChainPermit2Config, MultiChainPermit2Result, BatchPermit2Result, };
|
|
62
60
|
export { generateCredentialId, getCredentialIds, hasCredentialById, hasCredential, addCredential, removeCredential, setThreshold, getCredentialInfo, getThreshold, getCredentials, WEBAUTHN_VALIDATOR_ABI, } from './modules/validators/webauthn-contract';
|
|
63
61
|
export { getOrchestrator } from './orchestrator';
|
|
64
62
|
//# 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,EACV,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,eAAe,EACf,uBAAuB,EACvB,SAAS,EACT,OAAO,EACR,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,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EAE9B,+BAA+B,IAAI,uBAAuB,EAE1D,yBAAyB,EACzB,iBAAiB,EAEjB,gBAAgB,EAChB,qBAAqB,GACtB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,eAAe,EACf,WAAW,EACX,WAAW,EACX,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,mCAAmC,EACnC,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,WAAW,EACX,eAAe,EACf,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAEhB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,GACnB,CAAA;AAGD,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACvB,MAAM,wCAAwC,CAAA;AAG/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOrchestrator = exports.WEBAUTHN_VALIDATOR_ABI = exports.getCredentials = exports.getThreshold = exports.getCredentialInfo = exports.setThreshold = exports.removeCredential = exports.addCredential = exports.hasCredential = exports.hasCredentialById = exports.getCredentialIds = exports.generateCredentialId = exports.signPermit2Sequential = exports.signPermit2Batch = exports.getPermit2Address = exports.checkERC20AllowanceDirect = exports.deployStandaloneWithEoa = exports.getTokenAddress = exports.getSupportedTokens = exports.walletClientToAccount = exports.RhinestoneSDK = void 0;
|
|
3
|
+
exports.getOrchestrator = exports.WEBAUTHN_VALIDATOR_ABI = exports.getCredentials = exports.getThreshold = exports.getCredentialInfo = exports.setThreshold = exports.removeCredential = exports.addCredential = exports.hasCredential = exports.hasCredentialById = exports.getCredentialIds = exports.generateCredentialId = exports.signPermit2Sequential = exports.signPermit2Batch = exports.getPermit2Address = exports.checkERC20AllowanceDirect = exports.deployStandaloneWithEoa = exports.getAllSupportedChainsAndTokens = exports.getTokenAddress = exports.getSupportedTokens = exports.wrapParaAccount = exports.walletClientToAccount = exports.RhinestoneSDK = void 0;
|
|
4
4
|
const accounts_1 = require("./accounts");
|
|
5
5
|
Object.defineProperty(exports, "deployStandaloneWithEoa", { enumerable: true, get: function () { return accounts_1.deployStandaloneWithEoa; } });
|
|
6
6
|
const walletClient_1 = require("./accounts/walletClient");
|
|
7
7
|
Object.defineProperty(exports, "walletClientToAccount", { enumerable: true, get: function () { return walletClient_1.walletClientToAccount; } });
|
|
8
|
+
Object.defineProperty(exports, "wrapParaAccount", { enumerable: true, get: function () { return walletClient_1.wrapParaAccount; } });
|
|
8
9
|
const execution_1 = require("./execution");
|
|
9
10
|
const permit2_1 = require("./execution/permit2");
|
|
10
11
|
Object.defineProperty(exports, "checkERC20AllowanceDirect", { enumerable: true, get: function () { return permit2_1.checkERC20AllowanceDirect; } });
|
|
@@ -15,6 +16,7 @@ const smart_session_1 = require("./execution/smart-session");
|
|
|
15
16
|
const utils_1 = require("./execution/utils");
|
|
16
17
|
const modules_1 = require("./modules");
|
|
17
18
|
const orchestrator_1 = require("./orchestrator");
|
|
19
|
+
Object.defineProperty(exports, "getAllSupportedChainsAndTokens", { enumerable: true, get: function () { return orchestrator_1.getAllSupportedChainsAndTokens; } });
|
|
18
20
|
Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
|
|
19
21
|
Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
|
|
20
22
|
/**
|
|
@@ -186,12 +188,12 @@ async function createRhinestoneAccount(config) {
|
|
|
186
188
|
/**
|
|
187
189
|
* Get the maximum spendable token amount on the target chain
|
|
188
190
|
* @param chain Target chain
|
|
189
|
-
* @param
|
|
191
|
+
* @param token Token address (on the target chain)
|
|
190
192
|
* @param gasUnits Gas cost estimate for the transaction execution
|
|
191
193
|
* @returns Maximum spendable amount in absolute units
|
|
192
194
|
*/
|
|
193
|
-
function getMaxSpendableAmount(chain,
|
|
194
|
-
return (0, execution_1.getMaxSpendableAmount)(config, chain,
|
|
195
|
+
function getMaxSpendableAmount(chain, token, gasUnits, sponsored = false) {
|
|
196
|
+
return (0, execution_1.getMaxSpendableAmount)(config, chain, token, gasUnits, sponsored);
|
|
195
197
|
}
|
|
196
198
|
/**
|
|
197
199
|
* Get account owners (ECDSA)
|
|
@@ -212,8 +214,8 @@ async function createRhinestoneAccount(config) {
|
|
|
212
214
|
const account = getAddress();
|
|
213
215
|
return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
|
|
214
216
|
}
|
|
215
|
-
function getSessionDetails(sessions, sessionIndex, signature) {
|
|
216
|
-
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, signature);
|
|
217
|
+
function getSessionDetails(sessions, sessionIndex, initialNonces, signature) {
|
|
218
|
+
return (0, smart_session_1.getSessionDetails)(config, sessions, sessionIndex, initialNonces, signature);
|
|
217
219
|
}
|
|
218
220
|
/**
|
|
219
221
|
* Check ERC20 allowance for the account owner and token (using Permit2 as spender)
|
|
@@ -261,12 +263,14 @@ class RhinestoneSDK {
|
|
|
261
263
|
provider;
|
|
262
264
|
bundler;
|
|
263
265
|
paymaster;
|
|
266
|
+
useDevContracts;
|
|
264
267
|
constructor(options) {
|
|
265
268
|
this.apiKey = options?.apiKey;
|
|
266
269
|
this.endpointUrl = options?.endpointUrl;
|
|
267
270
|
this.provider = options?.provider;
|
|
268
271
|
this.bundler = options?.bundler;
|
|
269
272
|
this.paymaster = options?.paymaster;
|
|
273
|
+
this.useDevContracts = options?.useDevContracts;
|
|
270
274
|
}
|
|
271
275
|
createAccount(config) {
|
|
272
276
|
const rhinestoneConfig = {
|
|
@@ -276,9 +280,13 @@ class RhinestoneSDK {
|
|
|
276
280
|
provider: this.provider,
|
|
277
281
|
bundler: this.bundler,
|
|
278
282
|
paymaster: this.paymaster,
|
|
283
|
+
useDevContracts: this.useDevContracts,
|
|
279
284
|
};
|
|
280
285
|
return createRhinestoneAccount(rhinestoneConfig);
|
|
281
286
|
}
|
|
287
|
+
getIntentStatus(intentId) {
|
|
288
|
+
return (0, execution_1.getIntentStatus)(this.apiKey, this.endpointUrl, intentId);
|
|
289
|
+
}
|
|
282
290
|
}
|
|
283
291
|
exports.RhinestoneSDK = RhinestoneSDK;
|
|
284
292
|
// WebAuthn Validator contract helpers (keep Charter API stable)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Address, Hex } from 'viem';
|
|
2
|
+
import type { ModuleInput } from '../types';
|
|
2
3
|
type ModuleTypeId = typeof MODULE_TYPE_ID_VALIDATOR | typeof MODULE_TYPE_ID_EXECUTOR | typeof MODULE_TYPE_ID_FALLBACK | typeof MODULE_TYPE_ID_HOOK;
|
|
3
4
|
type ModuleType = typeof MODULE_TYPE_VALIDATOR | typeof MODULE_TYPE_EXECUTOR | typeof MODULE_TYPE_FALLBACK | typeof MODULE_TYPE_HOOK;
|
|
4
5
|
interface Module {
|
|
@@ -17,6 +18,7 @@ declare const MODULE_TYPE_EXECUTOR = "executor";
|
|
|
17
18
|
declare const MODULE_TYPE_FALLBACK = "fallback";
|
|
18
19
|
declare const MODULE_TYPE_HOOK = "hook";
|
|
19
20
|
declare function toModuleTypeId(type: ModuleType): ModuleTypeId;
|
|
20
|
-
|
|
21
|
+
declare function getModule(module: ModuleInput): Module;
|
|
22
|
+
export { MODULE_TYPE_ID_VALIDATOR, MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, MODULE_TYPE_ID_HOOK, MODULE_TYPE_VALIDATOR, MODULE_TYPE_EXECUTOR, MODULE_TYPE_FALLBACK, MODULE_TYPE_HOOK, toModuleTypeId, getModule, };
|
|
21
23
|
export type { Module, ModuleType, ModuleTypeId };
|
|
22
24
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../modules/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../modules/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,KAAK,YAAY,GACb,OAAO,wBAAwB,GAC/B,OAAO,uBAAuB,GAC9B,OAAO,uBAAuB,GAC9B,OAAO,mBAAmB,CAAA;AAE9B,KAAK,UAAU,GACX,OAAO,qBAAqB,GAC5B,OAAO,oBAAoB,GAC3B,OAAO,oBAAoB,GAC3B,OAAO,gBAAgB,CAAA;AAE3B,UAAU,MAAM;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE,GAAG,CAAA;IACf,iBAAiB,EAAE,GAAG,CAAA;IACtB,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,QAAA,MAAM,wBAAwB,KAAK,CAAA;AACnC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAClC,QAAA,MAAM,uBAAuB,KAAK,CAAA;AAClC,QAAA,MAAM,mBAAmB,KAAK,CAAA;AAE9B,QAAA,MAAM,qBAAqB,cAAc,CAAA;AACzC,QAAA,MAAM,oBAAoB,aAAa,CAAA;AACvC,QAAA,MAAM,oBAAoB,aAAa,CAAA;AACvC,QAAA,MAAM,gBAAgB,SAAS,CAAA;AAE/B,iBAAS,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAWtD;AAED,iBAAS,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAQ9C;AAED,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,CAAA;AACD,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MODULE_TYPE_HOOK = exports.MODULE_TYPE_FALLBACK = exports.MODULE_TYPE_EXECUTOR = exports.MODULE_TYPE_VALIDATOR = exports.MODULE_TYPE_ID_HOOK = exports.MODULE_TYPE_ID_FALLBACK = exports.MODULE_TYPE_ID_EXECUTOR = exports.MODULE_TYPE_ID_VALIDATOR = void 0;
|
|
4
4
|
exports.toModuleTypeId = toModuleTypeId;
|
|
5
|
+
exports.getModule = getModule;
|
|
5
6
|
const MODULE_TYPE_ID_VALIDATOR = 1n;
|
|
6
7
|
exports.MODULE_TYPE_ID_VALIDATOR = MODULE_TYPE_ID_VALIDATOR;
|
|
7
8
|
const MODULE_TYPE_ID_EXECUTOR = 2n;
|
|
@@ -30,3 +31,12 @@ function toModuleTypeId(type) {
|
|
|
30
31
|
return MODULE_TYPE_ID_HOOK;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
34
|
+
function getModule(module) {
|
|
35
|
+
return {
|
|
36
|
+
type: toModuleTypeId(module.type),
|
|
37
|
+
address: module.address,
|
|
38
|
+
initData: module.initData ?? '0x',
|
|
39
|
+
deInitData: module.deInitData ?? '0x',
|
|
40
|
+
additionalContext: module.additionalContext ?? '0x',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAuB,MAAM,MAAM,CAAA;AAWpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEzE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,KAAK,EAAuB,MAAM,MAAM,CAAA;AAWpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEzE,OAAO,EAQL,KAAK,MAAM,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,YAAY,EAGb,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAA4B,MAAM,cAAc,CAAA;AAM1E,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,iBAAS,QAAQ,CAAC,MAAM,EAAE,uBAAuB,GAAG,WAAW,CAwE9D;AAED,iBAAS,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAY3D;AAED,iBAAS,yBAAyB,CAAC,KAAK,EAAE,KAAK,WAW9C;AAED,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,yBAAyB,GAC1B,CAAA"}
|
|
@@ -47,6 +47,20 @@ function getSetup(config) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
const hooks = [];
|
|
50
|
+
if (config.modules) {
|
|
51
|
+
validators.push(...config.modules
|
|
52
|
+
.filter((m) => m.type === common_1.MODULE_TYPE_VALIDATOR)
|
|
53
|
+
.map((m) => (0, common_1.getModule)(m)));
|
|
54
|
+
executors.push(...config.modules
|
|
55
|
+
.filter((m) => m.type === common_1.MODULE_TYPE_EXECUTOR)
|
|
56
|
+
.map((m) => (0, common_1.getModule)(m)));
|
|
57
|
+
fallbacks.push(...config.modules
|
|
58
|
+
.filter((m) => m.type === common_1.MODULE_TYPE_FALLBACK)
|
|
59
|
+
.map((m) => (0, common_1.getModule)(m)));
|
|
60
|
+
hooks.push(...config.modules
|
|
61
|
+
.filter((m) => m.type === common_1.MODULE_TYPE_HOOK)
|
|
62
|
+
.map((m) => (0, common_1.getModule)(m)));
|
|
63
|
+
}
|
|
50
64
|
return {
|
|
51
65
|
validators,
|
|
52
66
|
executors,
|
|
@@ -55,7 +69,7 @@ function getSetup(config) {
|
|
|
55
69
|
};
|
|
56
70
|
}
|
|
57
71
|
function getIntentExecutor(config) {
|
|
58
|
-
const intentExecutorAddress = config.
|
|
72
|
+
const intentExecutorAddress = config.useDevContracts === true
|
|
59
73
|
? omni_account_1.INTENT_EXECUTOR_ADDRESS_DEV
|
|
60
74
|
: omni_account_1.INTENT_EXECUTOR_ADDRESS;
|
|
61
75
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Account, type Address, type Hex } from 'viem';
|
|
2
|
-
import type { OwnableValidatorConfig, OwnerSet, RhinestoneAccountConfig, WebauthnValidatorConfig } from '../../types';
|
|
2
|
+
import type { ENSValidatorConfig, OwnableValidatorConfig, OwnerSet, RhinestoneAccountConfig, WebauthnValidatorConfig } from '../../types';
|
|
3
3
|
import { type Module } from '../common';
|
|
4
4
|
interface PublicKey {
|
|
5
5
|
prefix?: number | undefined;
|
|
@@ -11,6 +11,7 @@ interface WebauthnCredential {
|
|
|
11
11
|
authenticatorId: string;
|
|
12
12
|
}
|
|
13
13
|
declare const OWNABLE_VALIDATOR_ADDRESS: Address;
|
|
14
|
+
declare const ENS_VALIDATOR_ADDRESS: Address;
|
|
14
15
|
declare const WEBAUTHN_VALIDATOR_ADDRESS: Address;
|
|
15
16
|
declare const MULTI_FACTOR_VALIDATOR_ADDRESS: Address;
|
|
16
17
|
declare const WEBAUTHN_V0_VALIDATOR_ADDRESS: Address;
|
|
@@ -18,10 +19,11 @@ declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
|
|
|
18
19
|
declare function getMockSignature(ownerSet: OwnerSet): Hex;
|
|
19
20
|
declare function getValidator(owners: OwnerSet): Module;
|
|
20
21
|
declare function getOwnableValidator(threshold: number, owners: Address[], address?: Address): Module;
|
|
22
|
+
declare function getENSValidator(threshold: number, owners: Address[], ownerExpirations: number[], address?: Address): Module;
|
|
21
23
|
declare function getWebAuthnValidator(threshold: number, webAuthnCredentials: WebauthnCredential[], address?: Address): Module;
|
|
22
|
-
declare function getMultiFactorValidator(threshold: number, validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[]): Module;
|
|
24
|
+
declare function getMultiFactorValidator(threshold: number, validators: (OwnableValidatorConfig | ENSValidatorConfig | WebauthnValidatorConfig | null)[]): Module;
|
|
23
25
|
declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
|
|
24
26
|
declare function supportsEip712(validator: Module): boolean;
|
|
25
|
-
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, WEBAUTHN_V0_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, supportsEip712, };
|
|
27
|
+
export { OWNABLE_VALIDATOR_ADDRESS, ENS_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, WEBAUTHN_V0_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getENSValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, supportsEip712, };
|
|
26
28
|
export type { WebauthnCredential };
|
|
27
29
|
//# 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,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,KAAK,GAAG,EAKT,MAAM,MAAM,CAAA;AAGb,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,aAAa,CAAA;AAEpB,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;AAC9C,QAAA,MAAM,qBAAqB,EAAE,OACiB,CAAA;AAC9C,QAAA,MAAM,0BAA0B,EAAE,OACY,CAAA;AAG9C,QAAA,MAAM,8BAA8B,EAAE,OACQ,CAAA;AAO9C,QAAA,MAAM,6BAA6B,EAAE,OACS,CAAA;AAO9C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,UAKzD;AAED,iBAAS,gBAAgB,CAAC,QAAQ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