@charterlabs/rhinestone-sdk 0.3.8 → 0.4.1
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 +89 -1
- package/dist/src/accounts/index.d.ts +6 -3
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +8 -2
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/providers.js +3 -3
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +4 -1
- package/dist/src/accounts/signing/common.d.ts +10 -5
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.d.ts +3 -1
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/startale.d.ts +3 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +108 -19
- package/dist/src/accounts/utils.d.ts +1 -1
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/auth/provider.d.ts +7 -0
- package/dist/src/auth/provider.d.ts.map +1 -0
- package/dist/src/auth/provider.js +41 -0
- package/dist/src/errors/index.d.ts +2 -2
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +2 -1
- package/dist/src/execution/error.d.ts +9 -1
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +12 -1
- package/dist/src/execution/index.d.ts +6 -4
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +18 -15
- package/dist/src/execution/utils.d.ts +31 -7
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +317 -46
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +13 -11
- package/dist/src/jwt-server/digest.d.ts +11 -0
- package/dist/src/jwt-server/digest.d.ts.map +1 -0
- package/dist/src/jwt-server/digest.js +22 -0
- package/dist/src/jwt-server/express.d.ts +16 -0
- package/dist/src/jwt-server/express.d.ts.map +1 -0
- package/dist/src/jwt-server/express.js +24 -0
- package/dist/src/jwt-server/handlers.d.ts +10 -0
- package/dist/src/jwt-server/handlers.d.ts.map +1 -0
- package/dist/src/jwt-server/handlers.js +41 -0
- package/dist/src/jwt-server/index.d.ts +8 -0
- package/dist/src/jwt-server/index.d.ts.map +1 -0
- package/dist/src/jwt-server/index.js +18 -0
- package/dist/src/jwt-server/jcs.d.ts +12 -0
- package/dist/src/jwt-server/jcs.d.ts.map +1 -0
- package/dist/src/jwt-server/jcs.js +60 -0
- package/dist/src/jwt-server/signer.d.ts +18 -0
- package/dist/src/jwt-server/signer.d.ts.map +1 -0
- package/dist/src/jwt-server/signer.js +71 -0
- package/dist/src/jwt-server/sponsorship.d.ts +19 -0
- package/dist/src/jwt-server/sponsorship.d.ts.map +1 -0
- package/dist/src/jwt-server/sponsorship.js +56 -0
- package/dist/src/jwt-server/web.d.ts +4 -0
- package/dist/src/jwt-server/web.d.ts.map +1 -0
- package/dist/src/jwt-server/web.js +27 -0
- package/dist/src/modules/validators/index.d.ts +2 -2
- package/dist/src/modules/validators/index.d.ts.map +1 -1
- package/dist/src/modules/validators/index.js +6 -1
- package/dist/src/modules/validators/policies/claim/permit2.d.ts +55 -0
- package/dist/src/modules/validators/policies/claim/permit2.d.ts.map +1 -0
- package/dist/src/modules/validators/policies/claim/permit2.js +239 -0
- package/dist/src/modules/validators/policies/claim/types.d.ts +12 -0
- package/dist/src/modules/validators/policies/claim/types.d.ts.map +1 -0
- package/dist/src/modules/validators/policies/claim/types.js +18 -0
- package/dist/src/modules/validators/smart-sessions.d.ts +30 -6
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +135 -12
- package/dist/src/orchestrator/client.d.ts +9 -4
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +29 -17
- package/dist/src/orchestrator/consts.d.ts +3 -2
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +4 -2
- package/dist/src/orchestrator/index.d.ts +4 -3
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +2 -2
- package/dist/src/orchestrator/registry.d.ts +2 -1
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +17 -1
- package/dist/src/orchestrator/types.d.ts +30 -2
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +99 -10
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +3 -9
- package/dist/src/utils/index.d.ts.map +1 -1
- package/package.json +18 -4
- package/dist/src/accounts/index.test.d.ts +0 -2
- package/dist/src/accounts/index.test.d.ts.map +0 -1
- package/dist/src/accounts/index.test.js +0 -33
- package/dist/src/accounts/json-rpc/index.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.test.js +0 -35
- package/dist/src/accounts/json-rpc/providers.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.test.js +0 -43
- package/dist/src/accounts/kernel.test.d.ts +0 -2
- package/dist/src/accounts/kernel.test.d.ts.map +0 -1
- package/dist/src/accounts/kernel.test.js +0 -132
- package/dist/src/accounts/nexus.test.d.ts +0 -2
- package/dist/src/accounts/nexus.test.d.ts.map +0 -1
- package/dist/src/accounts/nexus.test.js +0 -118
- package/dist/src/accounts/safe.test.d.ts +0 -2
- package/dist/src/accounts/safe.test.d.ts.map +0 -1
- package/dist/src/accounts/safe.test.js +0 -118
- package/dist/src/accounts/signing/passkeys.test.d.ts +0 -2
- package/dist/src/accounts/signing/passkeys.test.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.test.js +0 -88
- package/dist/src/accounts/startale.test.d.ts +0 -2
- package/dist/src/accounts/startale.test.d.ts.map +0 -1
- package/dist/src/accounts/startale.test.js +0 -92
- package/dist/src/accounts/utils.test.d.ts +0 -2
- package/dist/src/accounts/utils.test.d.ts.map +0 -1
- package/dist/src/accounts/utils.test.js +0 -49
- package/dist/src/actions/ecdsa.test.d.ts +0 -2
- package/dist/src/actions/ecdsa.test.d.ts.map +0 -1
- package/dist/src/actions/ecdsa.test.js +0 -99
- package/dist/src/actions/passkeys.test.d.ts +0 -2
- package/dist/src/actions/passkeys.test.d.ts.map +0 -1
- package/dist/src/actions/passkeys.test.js +0 -54
- package/dist/src/actions/recovery.test.d.ts +0 -2
- package/dist/src/actions/recovery.test.d.ts.map +0 -1
- package/dist/src/actions/recovery.test.js +0 -168
- package/dist/src/execution/utils.test.d.ts +0 -2
- package/dist/src/execution/utils.test.d.ts.map +0 -1
- package/dist/src/execution/utils.test.js +0 -49
- package/dist/src/modules/index.test.d.ts +0 -2
- package/dist/src/modules/index.test.d.ts.map +0 -1
- package/dist/src/modules/index.test.js +0 -81
- package/dist/src/modules/validators/core.test.d.ts +0 -2
- package/dist/src/modules/validators/core.test.d.ts.map +0 -1
- package/dist/src/modules/validators/core.test.js +0 -101
- package/dist/src/orchestrator/registry.test.d.ts +0 -2
- package/dist/src/orchestrator/registry.test.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.test.js +0 -154
- package/dist/test/consts.d.ts +0 -10
- package/dist/test/consts.d.ts.map +0 -1
- package/dist/test/consts.js +0 -22
- package/dist/test/utils/utils.d.ts +0 -5
- package/dist/test/utils/utils.d.ts.map +0 -1
- package/dist/test/utils/utils.js +0 -20
|
@@ -20,31 +20,68 @@ exports.getTokenRequests = getTokenRequests;
|
|
|
20
20
|
exports.resolveCallInputs = resolveCallInputs;
|
|
21
21
|
exports.getIntentAccount = getIntentAccount;
|
|
22
22
|
exports.getTargetExecutionSignature = getTargetExecutionSignature;
|
|
23
|
+
exports.hashErc7739TypedDataForSolady = hashErc7739TypedDataForSolady;
|
|
24
|
+
exports.resolveSessionForChain = resolveSessionForChain;
|
|
23
25
|
const viem_1 = require("viem");
|
|
24
26
|
const account_abstraction_1 = require("viem/account-abstraction");
|
|
25
27
|
const erc7739_1 = require("viem/experimental/erc7739");
|
|
26
28
|
const accounts_1 = require("../accounts");
|
|
29
|
+
const common_1 = require("../accounts/signing/common");
|
|
30
|
+
const startale_1 = require("../accounts/startale");
|
|
27
31
|
const utils_1 = require("../accounts/utils");
|
|
32
|
+
const provider_1 = require("../auth/provider");
|
|
28
33
|
const modules_1 = require("../modules");
|
|
29
34
|
const validators_1 = require("../modules/validators");
|
|
30
35
|
const core_1 = require("../modules/validators/core");
|
|
36
|
+
const permit2_1 = require("../modules/validators/policies/claim/permit2");
|
|
31
37
|
const orchestrator_1 = require("../orchestrator");
|
|
32
38
|
const registry_1 = require("../orchestrator/registry");
|
|
33
39
|
const types_1 = require("../orchestrator/types");
|
|
40
|
+
const utils_2 = require("../orchestrator/utils");
|
|
34
41
|
const compact_1 = require("./compact");
|
|
35
42
|
const error_1 = require("./error");
|
|
36
|
-
const
|
|
43
|
+
const permit2_2 = require("./permit2");
|
|
37
44
|
const singleChainOps_1 = require("./singleChainOps");
|
|
45
|
+
function isResolvedSessionSignerSet(signers) {
|
|
46
|
+
return (signers?.type === 'experimental_session' && 'verifyExecutions' in signers);
|
|
47
|
+
}
|
|
48
|
+
async function resolveSignersForChain(config, signers, chainId) {
|
|
49
|
+
if (signers?.type !== 'experimental_session') {
|
|
50
|
+
return signers;
|
|
51
|
+
}
|
|
52
|
+
const resolved = resolveSessionForChain(signers, chainId);
|
|
53
|
+
const enabled = await (0, validators_1.isSessionEnabled)((0, accounts_1.getAddress)(config), config.provider, resolved.session, config.useDevContracts);
|
|
54
|
+
const enableData = enabled ? undefined : resolved.enableData;
|
|
55
|
+
const hasExplicitActions = !!resolved.session.actions?.length;
|
|
56
|
+
const verifyExecutions = resolved.verifyExecutions ?? signers.verifyExecutions ?? hasExplicitActions;
|
|
57
|
+
return {
|
|
58
|
+
type: 'experimental_session',
|
|
59
|
+
session: resolved.session,
|
|
60
|
+
enableData,
|
|
61
|
+
verifyExecutions,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function resolveSessionForChain(signers, chainId) {
|
|
65
|
+
if ('sessions' in signers) {
|
|
66
|
+
const config = signers.sessions[chainId];
|
|
67
|
+
if (!config) {
|
|
68
|
+
throw new Error(`No session configured for chain ${chainId}`);
|
|
69
|
+
}
|
|
70
|
+
return config;
|
|
71
|
+
}
|
|
72
|
+
return { session: signers.session, enableData: signers.enableData };
|
|
73
|
+
}
|
|
38
74
|
async function prepareTransaction(config, transaction) {
|
|
39
|
-
const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, auxiliaryFunds, account, recipient, } = getTransactionParams(transaction);
|
|
75
|
+
const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, auxiliaryFunds, account, recipient, sourceCalls, } = getTransactionParams(transaction);
|
|
40
76
|
const accountAddress = (0, accounts_1.getAddress)(config);
|
|
41
77
|
const isUserOpSigner = signers?.type === 'guardians';
|
|
42
78
|
if (isUserOpSigner) {
|
|
43
79
|
throw new error_1.SignerNotSupportedError();
|
|
44
80
|
}
|
|
45
|
-
const
|
|
81
|
+
const prepared = await prepareTransactionAsIntent(config, sourceChains, targetChain, await resolveCallInputs(transaction.calls, config, targetChain, accountAddress), transaction.gasLimit, tokenRequests, recipient, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, auxiliaryFunds, account, signers, sourceCalls);
|
|
46
82
|
return {
|
|
47
|
-
intentRoute,
|
|
83
|
+
intentRoute: prepared.intentRoute,
|
|
84
|
+
intentInput: prepared.intentInput,
|
|
48
85
|
transaction,
|
|
49
86
|
};
|
|
50
87
|
}
|
|
@@ -93,6 +130,7 @@ async function signTransaction(config, preparedTransaction) {
|
|
|
93
130
|
const targetExecutionSignature = await getTargetExecutionSignature(config, intentRoute.intentOp, targetChain, signers);
|
|
94
131
|
return {
|
|
95
132
|
intentRoute,
|
|
133
|
+
intentInput: preparedTransaction.intentInput,
|
|
96
134
|
transaction: preparedTransaction.transaction,
|
|
97
135
|
originSignatures,
|
|
98
136
|
destinationSignature,
|
|
@@ -103,6 +141,16 @@ async function getTargetExecutionSignature(config, intentOp, targetChain, signer
|
|
|
103
141
|
if (signers?.type !== 'experimental_session') {
|
|
104
142
|
return undefined;
|
|
105
143
|
}
|
|
144
|
+
const settlementLayers = intentOp.elements.map((e) => e.mandate.qualifier.settlementContext.settlementLayer);
|
|
145
|
+
const hasIntentExecutorOps = settlementLayers.some((l) => l === 'INTENT_EXECUTOR' || l === 'SAME_CHAIN');
|
|
146
|
+
if (!hasIntentExecutorOps) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
const resolvedSigners = await resolveSignersForChain(config, signers, targetChain.id);
|
|
150
|
+
if (!isResolvedSessionSignerSet(resolvedSigners) ||
|
|
151
|
+
!resolvedSigners.verifyExecutions) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
106
154
|
const destination = getTargetExecutionMessage(config, intentOp);
|
|
107
155
|
const validator = getValidator(config, signers);
|
|
108
156
|
if (!validator) {
|
|
@@ -110,7 +158,7 @@ async function getTargetExecutionSignature(config, intentOp, targetChain, signer
|
|
|
110
158
|
}
|
|
111
159
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
112
160
|
const isRoot = validator.address === ownerValidator.address;
|
|
113
|
-
const signature = await getDestinationSignature(config,
|
|
161
|
+
const signature = await getDestinationSignature(config, resolvedSigners, validator, isRoot, targetChain, destination, [], true);
|
|
114
162
|
return signature;
|
|
115
163
|
}
|
|
116
164
|
async function signUserOperation(config, preparedUserOperation) {
|
|
@@ -151,10 +199,23 @@ async function signTypedData(config, parameters, chain, signers, options) {
|
|
|
151
199
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
152
200
|
const isRoot = validator.address === ownerValidator.address;
|
|
153
201
|
if (signers?.type === 'experimental_session') {
|
|
202
|
+
const resolved = resolveSessionForChain(signers, chain.id);
|
|
154
203
|
return await signTypedDataWithSession(config, chain, {
|
|
155
204
|
address: validator.address,
|
|
156
205
|
isRoot,
|
|
157
|
-
},
|
|
206
|
+
}, resolved.session, parameters);
|
|
207
|
+
}
|
|
208
|
+
const account = (0, accounts_1.getAccountProvider)(config);
|
|
209
|
+
if (account.type === 'startale' && (0, core_1.supportsEip712)(validator)) {
|
|
210
|
+
const isK1 = validator.address.toLowerCase() ===
|
|
211
|
+
startale_1.K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
|
|
212
|
+
if (isK1) {
|
|
213
|
+
const sig = await signErc7739TypedData(config, signers, validator, isRoot, parameters, chain);
|
|
214
|
+
if (!options?.skipErc6492) {
|
|
215
|
+
return await (0, accounts_1.toErc6492Signature)(config, sig, chain);
|
|
216
|
+
}
|
|
217
|
+
return sig;
|
|
218
|
+
}
|
|
158
219
|
}
|
|
159
220
|
const signature = await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, {
|
|
160
221
|
address: validator.address,
|
|
@@ -165,8 +226,9 @@ async function signTypedData(config, parameters, chain, signers, options) {
|
|
|
165
226
|
}
|
|
166
227
|
return signature;
|
|
167
228
|
}
|
|
168
|
-
async function signTypedDataWithSession(config, chain, validator,
|
|
229
|
+
async function signTypedDataWithSession(config, chain, validator, session, parameters) {
|
|
169
230
|
const { name, version, chainId, verifyingContract, salt } = (0, accounts_1.getEip712Domain)(config, chain);
|
|
231
|
+
const signers = (0, common_1.convertOwnerSetToSignerSet)(session.owners);
|
|
170
232
|
const signature = await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, validator, {
|
|
171
233
|
domain: parameters.domain,
|
|
172
234
|
primaryType: 'TypedDataSign',
|
|
@@ -197,7 +259,7 @@ async function signTypedDataWithSession(config, chain, validator, signers, param
|
|
|
197
259
|
message: parameters.message,
|
|
198
260
|
signature,
|
|
199
261
|
});
|
|
200
|
-
return (0, viem_1.encodePacked)(['bytes32', 'bytes'], [(0, validators_1.getPermissionId)(
|
|
262
|
+
return (0, viem_1.encodePacked)(['bytes32', 'bytes'], [(0, validators_1.getPermissionId)(session), erc7739Signature]);
|
|
201
263
|
});
|
|
202
264
|
return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
|
|
203
265
|
}
|
|
@@ -238,10 +300,10 @@ async function signAuthorizationsInternal(config, data) {
|
|
|
238
300
|
return authorizations;
|
|
239
301
|
}
|
|
240
302
|
async function submitTransaction(config, signedTransaction, authorizations, dryRun = false) {
|
|
241
|
-
const { intentRoute, transaction, originSignatures, destinationSignature, targetExecutionSignature, } = signedTransaction;
|
|
303
|
+
const { intentRoute, intentInput, transaction, originSignatures, destinationSignature, targetExecutionSignature, } = signedTransaction;
|
|
242
304
|
const { sourceChains, targetChain } = getTransactionParams(transaction);
|
|
243
305
|
const intentOp = intentRoute.intentOp;
|
|
244
|
-
return await submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun);
|
|
306
|
+
return await submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun, intentInput);
|
|
245
307
|
}
|
|
246
308
|
async function submitUserOperation(config, signedUserOperation) {
|
|
247
309
|
const chain = signedUserOperation.transaction.chain;
|
|
@@ -265,6 +327,7 @@ function getTransactionParams(transaction) {
|
|
|
265
327
|
const auxiliaryFunds = transaction.auxiliaryFunds;
|
|
266
328
|
const account = transaction.experimental_accountOverride;
|
|
267
329
|
const recipient = transaction.recipient;
|
|
330
|
+
const sourceCalls = transaction.sourceCalls;
|
|
268
331
|
const tokenRequests = getTokenRequests(targetChain, initialTokenRequests);
|
|
269
332
|
return {
|
|
270
333
|
sourceChains,
|
|
@@ -281,6 +344,7 @@ function getTransactionParams(transaction) {
|
|
|
281
344
|
auxiliaryFunds,
|
|
282
345
|
account,
|
|
283
346
|
recipient,
|
|
347
|
+
sourceCalls,
|
|
284
348
|
};
|
|
285
349
|
}
|
|
286
350
|
function getTokenRequests(targetChain, initialTokenRequests) {
|
|
@@ -334,7 +398,7 @@ function getIntentAccount(config, eip7702InitSignature, account) {
|
|
|
334
398
|
delegations,
|
|
335
399
|
};
|
|
336
400
|
}
|
|
337
|
-
async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipientInput, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, auxiliaryFunds, account, signers) {
|
|
401
|
+
async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipientInput, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, auxiliaryFunds, account, signers, sourceCalls) {
|
|
338
402
|
const calls = parseCalls(callInputs, targetChain.id);
|
|
339
403
|
const accountAccessList = createAccountAccessList(sourceChains, sourceAssets);
|
|
340
404
|
function getRecipient(recipient) {
|
|
@@ -352,11 +416,79 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
|
|
|
352
416
|
}
|
|
353
417
|
return getIntentAccount(recipient, eip7702InitSignature, account);
|
|
354
418
|
}
|
|
355
|
-
const intentAccount =
|
|
419
|
+
const intentAccount = {
|
|
420
|
+
...getIntentAccount(config, eip7702InitSignature, account),
|
|
421
|
+
...(signers?.type === 'experimental_session' && {
|
|
422
|
+
// Global fallback: target-chain sig for backward-compat with older orchestrators
|
|
423
|
+
mockSignature: (0, validators_1.buildMockSignature)(resolveSessionForChain(signers, targetChain.id).session, config.useDevContracts, sourceChains?.length ?? 1),
|
|
424
|
+
// Per-chain map: enables accurate per-chain session validation gas simulation
|
|
425
|
+
mockSignatures: Object.fromEntries([
|
|
426
|
+
...new Set([
|
|
427
|
+
...(sourceChains ?? []).map((c) => c.id),
|
|
428
|
+
targetChain.id,
|
|
429
|
+
]),
|
|
430
|
+
].map((chainId) => [
|
|
431
|
+
String(chainId),
|
|
432
|
+
(0, validators_1.buildMockSignature)(resolveSessionForChain(signers, chainId).session, config.useDevContracts, sourceChains?.length ?? 1, chainId),
|
|
433
|
+
])),
|
|
434
|
+
}),
|
|
435
|
+
};
|
|
356
436
|
const recipient = getRecipient(recipientInput);
|
|
357
437
|
const signatureMode = signers?.type === 'experimental_session'
|
|
358
438
|
? types_1.SIG_MODE_EMISSARY_EXECUTION_ERC1271
|
|
359
439
|
: types_1.SIG_MODE_ERC1271_EMISSARY;
|
|
440
|
+
// For session signers that need enabling, pass a dummy preclaimop per source chain
|
|
441
|
+
// so the orchestrator bakes it into the bundle before computing its HMAC. The filler
|
|
442
|
+
// executes the op via verifyExecution in ENABLE mode, enabling the session on-chain
|
|
443
|
+
// without a separate UserOp. Must be sent in the routing request — not injected
|
|
444
|
+
// post-facto — because the orchestrator HMAC covers preClaimOps.
|
|
445
|
+
const preClaimExecutions = {};
|
|
446
|
+
if (signers?.type === 'experimental_session' && sourceChains) {
|
|
447
|
+
const resolvedPerChain = await Promise.all(sourceChains.map(async (chain) => ({
|
|
448
|
+
chainId: chain.id,
|
|
449
|
+
resolved: await resolveSignersForChain(config, signers, chain.id),
|
|
450
|
+
})));
|
|
451
|
+
for (const { chainId, resolved } of resolvedPerChain) {
|
|
452
|
+
if (!isResolvedSessionSignerSet(resolved))
|
|
453
|
+
continue;
|
|
454
|
+
const { enableData, verifyExecutions } = resolved;
|
|
455
|
+
if (!verifyExecutions || !enableData)
|
|
456
|
+
continue;
|
|
457
|
+
preClaimExecutions[chainId] = [
|
|
458
|
+
{
|
|
459
|
+
to: validators_1.DUMMY_PRECLAIMOP_TARGET,
|
|
460
|
+
value: 0n,
|
|
461
|
+
data: validators_1.DUMMY_PRECLAIMOP_SELECTOR,
|
|
462
|
+
},
|
|
463
|
+
];
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
if (sourceCalls) {
|
|
467
|
+
const accountAddress = (0, accounts_1.getAddress)(config);
|
|
468
|
+
const allowedChainIds = new Set([
|
|
469
|
+
...(sourceChains ?? []).map((c) => c.id),
|
|
470
|
+
targetChain.id,
|
|
471
|
+
]);
|
|
472
|
+
for (const [chainIdStr, calls] of Object.entries(sourceCalls)) {
|
|
473
|
+
const chainId = Number(chainIdStr);
|
|
474
|
+
if (!allowedChainIds.has(chainId)) {
|
|
475
|
+
throw new error_1.InvalidSourceCallsError({ chainId });
|
|
476
|
+
}
|
|
477
|
+
const chain = sourceChains?.find((c) => c.id === chainId) ??
|
|
478
|
+
(targetChain.id === chainId ? targetChain : undefined);
|
|
479
|
+
if (!chain) {
|
|
480
|
+
throw new error_1.InvalidSourceCallsError({ chainId });
|
|
481
|
+
}
|
|
482
|
+
const resolved = await resolveCallInputs(calls, config, chain, accountAddress);
|
|
483
|
+
const userExecutions = parseCalls(resolved, chainId);
|
|
484
|
+
if (userExecutions.length === 0)
|
|
485
|
+
continue;
|
|
486
|
+
preClaimExecutions[chainId] = [
|
|
487
|
+
...(preClaimExecutions[chainId] ?? []),
|
|
488
|
+
...userExecutions,
|
|
489
|
+
];
|
|
490
|
+
}
|
|
491
|
+
}
|
|
360
492
|
const metaIntent = {
|
|
361
493
|
destinationChainId: targetChain.id,
|
|
362
494
|
tokenRequests: tokenRequests.map((tokenRequest) => ({
|
|
@@ -388,10 +520,12 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
|
|
|
388
520
|
signatureMode,
|
|
389
521
|
auxiliaryFunds,
|
|
390
522
|
},
|
|
523
|
+
...(Object.keys(preClaimExecutions).length > 0 && { preClaimExecutions }),
|
|
391
524
|
};
|
|
392
|
-
const
|
|
525
|
+
const serializedIntent = (0, utils_2.convertBigIntFields)(metaIntent);
|
|
526
|
+
const orchestrator = (0, orchestrator_1.getOrchestrator)(config._authProvider ?? (0, provider_1.createAuthProvider)(config), config.endpointUrl, config.headers);
|
|
393
527
|
const intentRoute = await orchestrator.getIntentRoute(metaIntent);
|
|
394
|
-
return intentRoute;
|
|
528
|
+
return { intentRoute, intentInput: serializedIntent };
|
|
395
529
|
}
|
|
396
530
|
async function signIntent(config, intentOp, targetChain, signers, targetExecution) {
|
|
397
531
|
const { origin, destination } = getIntentMessages(config, intentOp);
|
|
@@ -425,42 +559,43 @@ async function signIntent(config, intentOp, targetChain, signers, targetExecutio
|
|
|
425
559
|
const originSignatures = [];
|
|
426
560
|
for (const typedData of origin) {
|
|
427
561
|
const chain = (0, registry_1.getChainById)(typedData.domain?.chainId);
|
|
428
|
-
|
|
429
|
-
// Specifically, we need to remove the enable data in this case
|
|
430
|
-
const matchesTargetChain = chain.id === targetChain.id;
|
|
431
|
-
const originSigners = signers?.type === 'experimental_session'
|
|
432
|
-
? {
|
|
433
|
-
type: 'experimental_session',
|
|
434
|
-
session: signers.session,
|
|
435
|
-
verifyExecutions: matchesTargetChain
|
|
436
|
-
? signers.verifyExecutions
|
|
437
|
-
: undefined,
|
|
438
|
-
enableData: matchesTargetChain ? signers.enableData : undefined,
|
|
439
|
-
}
|
|
440
|
-
: signers;
|
|
562
|
+
const originSigners = await resolveSignersForChain(config, signers, chain.id);
|
|
441
563
|
const signature = await signIntentTypedData(config, originSigners, validator, isRoot, typedData, chain, targetExecution ?? false);
|
|
442
564
|
originSignatures.push(signature);
|
|
443
565
|
}
|
|
444
|
-
const
|
|
566
|
+
const destinationSigners = await resolveSignersForChain(config, signers, targetChain.id);
|
|
567
|
+
const destinationSignature = await getDestinationSignature(config, destinationSigners, validator, isRoot, targetChain, destination, originSignatures, targetExecution ?? false);
|
|
445
568
|
return {
|
|
446
569
|
originSignatures,
|
|
447
570
|
destinationSignature,
|
|
448
571
|
};
|
|
449
572
|
}
|
|
450
573
|
async function getDestinationSignature(config, signers, validator, isRoot, targetChain, destination, originSignatures, targetExecution) {
|
|
451
|
-
//
|
|
574
|
+
// Smart sessions require a separate destination signature because the
|
|
575
|
+
// session enable data differs per chain
|
|
452
576
|
if (signers?.type === 'experimental_session') {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
577
|
+
return await signDestinationSeparately(config, signers, validator, isRoot, targetChain, destination, targetExecution);
|
|
578
|
+
}
|
|
579
|
+
// ERC-7739 with K1 validator requires a separate destination signature because
|
|
580
|
+
// the account's eip712Domain() returns the target chain's chainId, which differs
|
|
581
|
+
// from the origin chain used for the last origin signature
|
|
582
|
+
const isK1Validator = validator.address.toLowerCase() ===
|
|
583
|
+
startale_1.K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
|
|
584
|
+
if (isK1Validator && (0, core_1.supportsEip712)(validator)) {
|
|
585
|
+
return await signDestinationSeparately(config, signers, validator, isRoot, targetChain, destination, targetExecution);
|
|
458
586
|
}
|
|
459
587
|
const lastOriginSignature = originSignatures.at(-1);
|
|
460
588
|
return typeof lastOriginSignature === 'object'
|
|
461
589
|
? lastOriginSignature.preClaimSig
|
|
462
590
|
: (lastOriginSignature ?? '0x');
|
|
463
591
|
}
|
|
592
|
+
async function signDestinationSeparately(config, signers, validator, isRoot, targetChain, destination, targetExecution) {
|
|
593
|
+
const destinationChain = (0, registry_1.getChainById)(targetChain.id);
|
|
594
|
+
const destinationSignatures = await signIntentTypedData(config, signers, validator, isRoot, destination, destinationChain, targetExecution);
|
|
595
|
+
return typeof destinationSignatures === 'object'
|
|
596
|
+
? destinationSignatures.preClaimSig
|
|
597
|
+
: (destinationSignatures ?? '0x');
|
|
598
|
+
}
|
|
464
599
|
function getIntentMessages(config, intentOp) {
|
|
465
600
|
const address = (0, accounts_1.getAddress)(config);
|
|
466
601
|
const intentExecutor = (0, modules_1.getIntentExecutor)(config);
|
|
@@ -474,7 +609,7 @@ function getIntentMessages(config, intentOp) {
|
|
|
474
609
|
origin.push(typedData);
|
|
475
610
|
}
|
|
476
611
|
else if (withPermit2) {
|
|
477
|
-
const typedData = (0,
|
|
612
|
+
const typedData = (0, permit2_2.getTypedData)(element, BigInt(intentOp.nonce), BigInt(intentOp.expires));
|
|
478
613
|
origin.push(typedData);
|
|
479
614
|
}
|
|
480
615
|
else {
|
|
@@ -500,28 +635,56 @@ function getTargetExecutionMessage(config, intentOp) {
|
|
|
500
635
|
};
|
|
501
636
|
return typedData;
|
|
502
637
|
}
|
|
638
|
+
/** Computes claim policy calldata when parameters are Permit2 typed data with claim policies. */
|
|
639
|
+
function resolveClaimPolicyData(signers, parameters) {
|
|
640
|
+
if (parameters.primaryType !== 'PermitBatchWitnessTransferFrom' ||
|
|
641
|
+
!signers.session.claimPolicies?.length) {
|
|
642
|
+
return undefined;
|
|
643
|
+
}
|
|
644
|
+
const msg = parameters.message;
|
|
645
|
+
if (!msg.permitted ||
|
|
646
|
+
!msg.mandate ||
|
|
647
|
+
typeof msg.spender !== 'string' ||
|
|
648
|
+
typeof msg.nonce !== 'bigint' ||
|
|
649
|
+
typeof msg.deadline !== 'bigint') {
|
|
650
|
+
return undefined;
|
|
651
|
+
}
|
|
652
|
+
return (0, permit2_1.buildPermit2ClaimPolicyCalldata)(signers.session.claimPolicies[0], parameters.message);
|
|
653
|
+
}
|
|
503
654
|
async function signIntentTypedData(config, signers, validator, isRoot, parameters, chain, targetExecution) {
|
|
504
655
|
if ((0, core_1.supportsEip712)(validator)) {
|
|
656
|
+
const isK1Validator = validator.address.toLowerCase() ===
|
|
657
|
+
startale_1.K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
|
|
658
|
+
if (isK1Validator) {
|
|
659
|
+
return await signErc7739TypedData(config, signers, validator, isRoot, parameters, chain);
|
|
660
|
+
}
|
|
505
661
|
return await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, {
|
|
506
662
|
address: validator.address,
|
|
507
663
|
isRoot,
|
|
508
664
|
}, parameters);
|
|
509
665
|
}
|
|
510
666
|
const hash = (0, viem_1.hashTypedData)(parameters);
|
|
511
|
-
if (signers
|
|
667
|
+
if (isResolvedSessionSignerSet(signers) && signers.verifyExecutions) {
|
|
512
668
|
if (targetExecution) {
|
|
513
|
-
|
|
669
|
+
const targetSigners = {
|
|
514
670
|
type: 'experimental_session',
|
|
515
671
|
session: signers.session,
|
|
516
672
|
verifyExecutions: true,
|
|
517
|
-
|
|
673
|
+
enableData: signers.enableData,
|
|
674
|
+
};
|
|
675
|
+
// signWithSession (called inside getEmissarySignature) already calls packSignature
|
|
676
|
+
// internally, so no transform is needed here
|
|
677
|
+
return await (0, accounts_1.getEmissarySignature)(config, targetSigners, chain, hash);
|
|
518
678
|
}
|
|
519
|
-
const
|
|
679
|
+
const claimPolicyData = resolveClaimPolicyData(signers, parameters);
|
|
680
|
+
const sessionSignersForEip1271 = {
|
|
520
681
|
type: 'experimental_session',
|
|
521
682
|
session: signers.session,
|
|
522
683
|
verifyExecutions: false,
|
|
523
684
|
enableData: signers.enableData,
|
|
524
|
-
|
|
685
|
+
claimPolicyData,
|
|
686
|
+
};
|
|
687
|
+
const eip1271Signature = await (0, accounts_1.getEip1271Signature)(config, sessionSignersForEip1271, chain, {
|
|
525
688
|
address: validator.address,
|
|
526
689
|
isRoot,
|
|
527
690
|
}, hash);
|
|
@@ -536,6 +699,13 @@ async function signIntentTypedData(config, signers, validator, isRoot, parameter
|
|
|
536
699
|
notarizedClaimSig: eip1271Signature,
|
|
537
700
|
};
|
|
538
701
|
}
|
|
702
|
+
if (isResolvedSessionSignerSet(signers)) {
|
|
703
|
+
const claimPolicyData = resolveClaimPolicyData(signers, parameters);
|
|
704
|
+
return await (0, accounts_1.getEip1271Signature)(config, claimPolicyData !== undefined ? { ...signers, claimPolicyData } : signers, chain, {
|
|
705
|
+
address: validator.address,
|
|
706
|
+
isRoot,
|
|
707
|
+
}, hash);
|
|
708
|
+
}
|
|
539
709
|
return await (0, accounts_1.getEip1271Signature)(config, signers, chain, {
|
|
540
710
|
address: validator.address,
|
|
541
711
|
isRoot,
|
|
@@ -595,8 +765,8 @@ async function submitUserOp(config, chain, userOp, signature) {
|
|
|
595
765
|
chain: chain.id,
|
|
596
766
|
};
|
|
597
767
|
}
|
|
598
|
-
async function submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun) {
|
|
599
|
-
return submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun);
|
|
768
|
+
async function submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun, intentInput) {
|
|
769
|
+
return submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun, intentInput);
|
|
600
770
|
}
|
|
601
771
|
function createSignedIntentOp(intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations) {
|
|
602
772
|
return {
|
|
@@ -616,13 +786,17 @@ function createSignedIntentOp(intentOp, originSignatures, destinationSignature,
|
|
|
616
786
|
: undefined,
|
|
617
787
|
};
|
|
618
788
|
}
|
|
619
|
-
async function submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun) {
|
|
789
|
+
async function submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun, intentInput) {
|
|
620
790
|
const signedIntentOp = createSignedIntentOp(intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations);
|
|
621
|
-
const
|
|
622
|
-
const
|
|
791
|
+
const isSponsored = !!intentInput?.options?.sponsorSettings;
|
|
792
|
+
const orchestrator = (0, orchestrator_1.getOrchestrator)(config._authProvider ?? (0, provider_1.createAuthProvider)(config), config.endpointUrl, config.headers);
|
|
793
|
+
const intentResults = await orchestrator.submitIntent(signedIntentOp, dryRun, intentInput ? { intentInput, isSponsored } : undefined);
|
|
794
|
+
// Some settlement paths (e.g. SAME_CHAIN) may not return a result.id — fall
|
|
795
|
+
// back to the nonce which the orchestrator also accepts as an intent identifier.
|
|
796
|
+
const intentId = intentResults.result.id ?? intentOp.nonce;
|
|
623
797
|
return {
|
|
624
798
|
type: 'intent',
|
|
625
|
-
id: BigInt(
|
|
799
|
+
id: BigInt(intentId),
|
|
626
800
|
sourceChains: sourceChains?.map((chain) => chain.id),
|
|
627
801
|
targetChain: targetChain.id,
|
|
628
802
|
};
|
|
@@ -783,3 +957,100 @@ function validateTokenSymbols(chain, tokenAddressOrSymbols) {
|
|
|
783
957
|
}
|
|
784
958
|
}
|
|
785
959
|
}
|
|
960
|
+
// Signs typed data using ERC-7739 nested EIP-712 for Startale accounts.
|
|
961
|
+
// Uses a Solady-compatible TypedDataSign hash and wraps the signature with
|
|
962
|
+
// the app domain separator and contents hash for on-chain verification.
|
|
963
|
+
async function signErc7739TypedData(config, signers, validator, isRoot, parameters, chain) {
|
|
964
|
+
const verifierDomain = (0, accounts_1.getEip712Domain)(config, chain);
|
|
965
|
+
const hash = hashErc7739TypedDataForSolady({
|
|
966
|
+
domain: parameters.domain,
|
|
967
|
+
types: parameters.types,
|
|
968
|
+
primaryType: parameters.primaryType,
|
|
969
|
+
message: parameters.message,
|
|
970
|
+
verifierDomain,
|
|
971
|
+
});
|
|
972
|
+
return await (0, accounts_1.getEip1271Signature)(config, signers, chain, {
|
|
973
|
+
address: validator.address,
|
|
974
|
+
isRoot,
|
|
975
|
+
}, hash, (signature) => (0, erc7739_1.wrapTypedDataSignature)({
|
|
976
|
+
domain: parameters.domain,
|
|
977
|
+
primaryType: parameters.primaryType,
|
|
978
|
+
types: parameters.types,
|
|
979
|
+
message: parameters.message,
|
|
980
|
+
signature,
|
|
981
|
+
}));
|
|
982
|
+
}
|
|
983
|
+
// Computes an ERC-7739 TypedDataSign hash compatible with Solady's ERC1271
|
|
984
|
+
// on-chain verification. Solady constructs the TypedDataSign type string by
|
|
985
|
+
// appending the contentsType directly after the TypedDataSign definition,
|
|
986
|
+
// which differs from viem's standard EIP-712 encodeType that re-sorts all
|
|
987
|
+
// referenced types alphabetically.
|
|
988
|
+
function hashErc7739TypedDataForSolady({ domain, types, primaryType, message, verifierDomain, }) {
|
|
989
|
+
// Standard EIP-712 encodeType for the original content type
|
|
990
|
+
function encodeTypeString(primary, allTypes) {
|
|
991
|
+
const deps = new Set();
|
|
992
|
+
function findDeps(t) {
|
|
993
|
+
const match = t.match(/^\w*/);
|
|
994
|
+
const typeName = match?.[0];
|
|
995
|
+
if (!typeName || deps.has(typeName) || !allTypes[typeName])
|
|
996
|
+
return;
|
|
997
|
+
deps.add(typeName);
|
|
998
|
+
for (const field of allTypes[typeName])
|
|
999
|
+
findDeps(field.type);
|
|
1000
|
+
}
|
|
1001
|
+
findDeps(primary);
|
|
1002
|
+
deps.delete(primary);
|
|
1003
|
+
const sorted = [primary, ...Array.from(deps).sort()];
|
|
1004
|
+
return sorted
|
|
1005
|
+
.map((t) => `${t}(${allTypes[t].map((f) => `${f.type} ${f.name}`).join(',')})`)
|
|
1006
|
+
.join('');
|
|
1007
|
+
}
|
|
1008
|
+
const contentsType = encodeTypeString(primaryType, types);
|
|
1009
|
+
const contentsName = primaryType;
|
|
1010
|
+
// Construct TypedDataSign type string matching Solady's on-chain encoding:
|
|
1011
|
+
// TypedDataSign(<contentsName> contents,...salt) + contentsType
|
|
1012
|
+
const typedDataSignTypeString = `TypedDataSign(${contentsName} contents,string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)${contentsType}`;
|
|
1013
|
+
const typedDataSignTypeHash = (0, viem_1.keccak256)((0, viem_1.toHex)(typedDataSignTypeString));
|
|
1014
|
+
// Hash the original content struct
|
|
1015
|
+
const contentsHash = (0, viem_1.hashStruct)({
|
|
1016
|
+
data: message,
|
|
1017
|
+
primaryType,
|
|
1018
|
+
types: types,
|
|
1019
|
+
});
|
|
1020
|
+
// Compute the TypedDataSign struct hash
|
|
1021
|
+
const structHash = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([
|
|
1022
|
+
{ type: 'bytes32' },
|
|
1023
|
+
{ type: 'bytes32' },
|
|
1024
|
+
{ type: 'bytes32' },
|
|
1025
|
+
{ type: 'bytes32' },
|
|
1026
|
+
{ type: 'uint256' },
|
|
1027
|
+
{ type: 'address' },
|
|
1028
|
+
{ type: 'bytes32' },
|
|
1029
|
+
], [
|
|
1030
|
+
typedDataSignTypeHash,
|
|
1031
|
+
contentsHash,
|
|
1032
|
+
(0, viem_1.keccak256)((0, viem_1.toHex)(verifierDomain.name)),
|
|
1033
|
+
(0, viem_1.keccak256)((0, viem_1.toHex)(verifierDomain.version)),
|
|
1034
|
+
BigInt(verifierDomain.chainId),
|
|
1035
|
+
verifierDomain.verifyingContract,
|
|
1036
|
+
verifierDomain.salt,
|
|
1037
|
+
]));
|
|
1038
|
+
// Compute the app domain separator
|
|
1039
|
+
const domainTypes = [];
|
|
1040
|
+
if (domain.name)
|
|
1041
|
+
domainTypes.push({ name: 'name', type: 'string' });
|
|
1042
|
+
if (domain.version)
|
|
1043
|
+
domainTypes.push({ name: 'version', type: 'string' });
|
|
1044
|
+
if (domain.chainId)
|
|
1045
|
+
domainTypes.push({ name: 'chainId', type: 'uint256' });
|
|
1046
|
+
if (domain.verifyingContract)
|
|
1047
|
+
domainTypes.push({ name: 'verifyingContract', type: 'address' });
|
|
1048
|
+
if (domain.salt)
|
|
1049
|
+
domainTypes.push({ name: 'salt', type: 'bytes32' });
|
|
1050
|
+
const appDomainSeparator = (0, viem_1.hashDomain)({
|
|
1051
|
+
domain,
|
|
1052
|
+
types: { EIP712Domain: domainTypes },
|
|
1053
|
+
});
|
|
1054
|
+
// Final hash: keccak256("\x19\x01" || appDomainSep || structHash)
|
|
1055
|
+
return (0, viem_1.keccak256)((0, viem_1.concat)(['0x1901', appDomainSeparator, structHash]));
|
|
1056
|
+
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData, TypedDataDefinition
|
|
1
|
+
import type { Account, Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData, TypedDataDefinition } from 'viem';
|
|
2
2
|
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
3
|
import { deployStandaloneWithEoa as deployStandaloneWithEoaInternal } from './accounts';
|
|
4
4
|
import { walletClientToAccount, wrapParaAccount } from './accounts/walletClient';
|
|
@@ -9,7 +9,7 @@ import { type IntentRoute, type PreparedTransactionData, type PreparedUserOperat
|
|
|
9
9
|
import { MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS } from './modules';
|
|
10
10
|
import { type SessionDetails } from './modules/validators/smart-sessions';
|
|
11
11
|
import { type ApprovalRequired, type AuxiliaryFunds, getAllSupportedChainsAndTokens, getSupportedTokens, getTokenAddress, getTokenDecimals, type IntentInput, type IntentOp, type IntentOpStatus, type Portfolio, type SettlementLayer, type SignedIntentOp, type SplitIntentsInput, type SplitIntentsResult, type TokenRequirements, type WrapRequired } from './orchestrator';
|
|
12
|
-
import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, MultiFactorValidatorConfig, OwnableValidatorConfig, OwnerSet, PaymasterConfig, Policy, ProviderConfig, Recovery, RhinestoneAccountConfig, RhinestoneConfig, RhinestoneSDKConfig, Session, SignerSet, TokenRequest, TokenSymbol, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types';
|
|
12
|
+
import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, ChainSessionConfig, MultiFactorValidatorConfig, OwnableValidatorConfig, OwnerSet, PaymasterConfig, Permit2ClaimPolicy, Policy, ProviderConfig, Recovery, RhinestoneAccountConfig, RhinestoneConfig, RhinestoneSDKConfig, Session, SignerSet, TokenRequest, TokenSymbol, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types';
|
|
13
13
|
interface RhinestoneAccount {
|
|
14
14
|
config: RhinestoneAccountConfig;
|
|
15
15
|
deploy: (chain: Chain, params?: {
|
|
@@ -62,7 +62,7 @@ interface RhinestoneAccount {
|
|
|
62
62
|
*/
|
|
63
63
|
declare function createRhinestoneAccount(config: RhinestoneConfig): Promise<RhinestoneAccount>;
|
|
64
64
|
declare class RhinestoneSDK {
|
|
65
|
-
private
|
|
65
|
+
private authProvider;
|
|
66
66
|
private endpointUrl?;
|
|
67
67
|
private provider?;
|
|
68
68
|
private bundler?;
|
|
@@ -77,7 +77,7 @@ declare class RhinestoneSDK {
|
|
|
77
77
|
splitIntents(input: SplitIntentsInput): Promise<SplitIntentsResult>;
|
|
78
78
|
}
|
|
79
79
|
export { RhinestoneSDK, createRhinestoneAccount, deployAccountsForOwners, walletClientToAccount, wrapParaAccount, OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, getSupportedTokens, getTokenAddress, getTokenDecimals, getAllSupportedChainsAndTokens, deployStandaloneWithEoaInternal as deployStandaloneWithEoa, checkERC20AllowanceDirect, getPermit2Address, signPermit2Batch, signPermit2Sequential, };
|
|
80
|
-
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, AuxiliaryFunds, IntentInput, IntentOp, IntentOpStatus, IntentRoute, SettlementLayer, SignedIntentOp, SplitIntentsInput, SplitIntentsResult, Portfolio, TokenRequirements, WrapRequired, ApprovalRequired, MultiChainPermit2Config, MultiChainPermit2Result, BatchPermit2Result, };
|
|
81
|
-
export { generateCredentialId, getCredentialIds,
|
|
80
|
+
export type { RhinestoneAccount, AccountType, RhinestoneAccountConfig, AccountProviderConfig, ProviderConfig, BundlerConfig, PaymasterConfig, Transaction, TokenSymbol, CallInput, Call, TokenRequest, OwnerSet, OwnableValidatorConfig, WebauthnValidatorConfig, MultiFactorValidatorConfig, SignerSet, ChainSessionConfig, Session, Recovery, Policy, Permit2ClaimPolicy, UniversalActionPolicyParamCondition, PreparedTransactionData, SignedTransactionData, TransactionResult, PreparedUserOperationData, SignedUserOperationData, UserOperationResult, AuxiliaryFunds, IntentInput, IntentOp, IntentOpStatus, IntentRoute, SettlementLayer, SignedIntentOp, SplitIntentsInput, SplitIntentsResult, Portfolio, TokenRequirements, WrapRequired, ApprovalRequired, MultiChainPermit2Config, MultiChainPermit2Result, BatchPermit2Result, };
|
|
81
|
+
export { addCredential, generateCredentialId, getCredentialIds, getCredentialInfo, getCredentials, getThreshold, hasCredential, hasCredentialById, removeCredential, setThreshold, WEBAUTHN_VALIDATOR_ABI, } from './modules/validators/webauthn-contract';
|
|
82
82
|
export { getOrchestrator } from './orchestrator';
|
|
83
83
|
//# 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,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,GAAG,EACH,eAAe,EACf,uBAAuB,EACvB,SAAS,EACT,mBAAmB,EACpB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EAGL,uBAAuB,IAAI,+BAA+B,EAS3D,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,yBAA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