@rhinestone/sdk 1.0.0-alpha.1 → 1.0.0-alpha.10

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.
Files changed (102) hide show
  1. package/dist/src/accounts/error.d.ts.map +1 -1
  2. package/dist/src/accounts/error.js +2 -0
  3. package/dist/src/accounts/index.d.ts +15 -8
  4. package/dist/src/accounts/index.d.ts.map +1 -1
  5. package/dist/src/accounts/index.js +204 -164
  6. package/dist/src/accounts/index.test.js +2 -2
  7. package/dist/src/accounts/kernel.d.ts +7 -9
  8. package/dist/src/accounts/kernel.d.ts.map +1 -1
  9. package/dist/src/accounts/kernel.js +0 -9
  10. package/dist/src/accounts/kernel.test.js +6 -6
  11. package/dist/src/accounts/nexus.d.ts +14 -13
  12. package/dist/src/accounts/nexus.d.ts.map +1 -1
  13. package/dist/src/accounts/nexus.js +91 -88
  14. package/dist/src/accounts/nexus.test.js +10 -10
  15. package/dist/src/accounts/safe.d.ts +4 -6
  16. package/dist/src/accounts/safe.d.ts.map +1 -1
  17. package/dist/src/accounts/safe.js +20 -30
  18. package/dist/src/accounts/safe.test.js +6 -6
  19. package/dist/src/accounts/startale.d.ts +20 -0
  20. package/dist/src/accounts/startale.d.ts.map +1 -0
  21. package/dist/src/accounts/startale.js +100 -0
  22. package/dist/src/accounts/startale.test.d.ts +2 -0
  23. package/dist/src/accounts/startale.test.d.ts.map +1 -0
  24. package/dist/src/accounts/startale.test.js +97 -0
  25. package/dist/src/accounts/utils.d.ts +4 -3
  26. package/dist/src/accounts/utils.d.ts.map +1 -1
  27. package/dist/src/accounts/utils.js +44 -0
  28. package/dist/src/actions/index.d.ts +17 -7
  29. package/dist/src/actions/index.d.ts.map +1 -1
  30. package/dist/src/actions/index.js +108 -15
  31. package/dist/src/actions/index.test.js +35 -17
  32. package/dist/src/actions/smart-session.d.ts +2 -2
  33. package/dist/src/actions/smart-session.d.ts.map +1 -1
  34. package/dist/src/execution/compact.d.ts +6 -3
  35. package/dist/src/execution/compact.d.ts.map +1 -1
  36. package/dist/src/execution/compact.js +44 -1
  37. package/dist/src/execution/error.d.ts +2 -9
  38. package/dist/src/execution/error.d.ts.map +1 -1
  39. package/dist/src/execution/error.js +4 -13
  40. package/dist/src/execution/index.d.ts +2 -3
  41. package/dist/src/execution/index.d.ts.map +1 -1
  42. package/dist/src/execution/index.js +34 -49
  43. package/dist/src/execution/smart-session.d.ts +1 -1
  44. package/dist/src/execution/smart-session.d.ts.map +1 -1
  45. package/dist/src/execution/smart-session.js +12 -17
  46. package/dist/src/execution/utils.d.ts +13 -11
  47. package/dist/src/execution/utils.d.ts.map +1 -1
  48. package/dist/src/execution/utils.js +141 -85
  49. package/dist/src/index.d.ts +14 -14
  50. package/dist/src/index.d.ts.map +1 -1
  51. package/dist/src/index.js +24 -20
  52. package/dist/src/modules/index.d.ts +3 -7
  53. package/dist/src/modules/index.d.ts.map +1 -1
  54. package/dist/src/modules/index.js +1 -10
  55. package/dist/src/modules/index.test.js +2 -2
  56. package/dist/src/modules/omni-account.d.ts +1 -4
  57. package/dist/src/modules/omni-account.d.ts.map +1 -1
  58. package/dist/src/modules/omni-account.js +2 -8
  59. package/dist/src/modules/read.d.ts +5 -6
  60. package/dist/src/modules/read.d.ts.map +1 -1
  61. package/dist/src/modules/read.js +6 -37
  62. package/dist/src/modules/validators/core.d.ts +6 -7
  63. package/dist/src/modules/validators/core.d.ts.map +1 -1
  64. package/dist/src/modules/validators/core.js +83 -8
  65. package/dist/src/modules/validators/core.test.js +4 -4
  66. package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
  67. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  68. package/dist/src/modules/validators/smart-sessions.js +7 -6
  69. package/dist/src/modules/validators/smart-sessions.test.js +4 -4
  70. package/dist/src/orchestrator/client.d.ts +1 -0
  71. package/dist/src/orchestrator/client.d.ts.map +1 -1
  72. package/dist/src/orchestrator/client.js +136 -94
  73. package/dist/src/orchestrator/consts.d.ts +3 -3
  74. package/dist/src/orchestrator/consts.d.ts.map +1 -1
  75. package/dist/src/orchestrator/consts.js +4 -4
  76. package/dist/src/orchestrator/index.d.ts +2 -2
  77. package/dist/src/orchestrator/index.d.ts.map +1 -1
  78. package/dist/src/orchestrator/index.js +1 -7
  79. package/dist/src/orchestrator/registry.d.ts +31 -12
  80. package/dist/src/orchestrator/registry.d.ts.map +1 -1
  81. package/dist/src/orchestrator/registry.js +57 -380
  82. package/dist/src/orchestrator/registry.json +365 -0
  83. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  84. package/dist/src/orchestrator/registry.test.js +137 -0
  85. package/dist/src/orchestrator/types.d.ts +69 -14
  86. package/dist/src/orchestrator/types.d.ts.map +1 -1
  87. package/dist/src/orchestrator/utils.d.ts.map +1 -1
  88. package/dist/src/orchestrator/utils.js +2 -2
  89. package/dist/src/types.d.ts +41 -21
  90. package/dist/src/types.d.ts.map +1 -1
  91. package/dist/test/consts.d.ts +2 -2
  92. package/dist/test/consts.d.ts.map +1 -1
  93. package/package.json +1 -1
  94. package/dist/src/actions/registry.d.ts +0 -7
  95. package/dist/src/actions/registry.d.ts.map +0 -1
  96. package/dist/src/actions/registry.js +0 -7
  97. package/dist/src/actions/registry.test.d.ts.map +0 -1
  98. package/dist/src/actions/registry.test.js +0 -25
  99. package/dist/src/modules/registry.d.ts +0 -13
  100. package/dist/src/modules/registry.d.ts.map +0 -1
  101. package/dist/src/modules/registry.js +0 -67
  102. /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 { sourceChain, targetChain, tokenRequests, signers } = getTransactionParams(transaction);
25
+ const { sourceChains, targetChain, tokenRequests, signers, 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 (!sourceChain) {
28
- throw new error_1.SourceChainRequiredForSmartSessionsError();
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, sourceChain, transaction.calls, signers);
34
+ data = await prepareTransactionAsUserOp(config, targetChain, transaction.calls, signers);
35
35
  }
36
36
  else {
37
- data = await prepareTransactionAsIntent(config, sourceChain, targetChain, transaction.calls, transaction.gasLimit, tokenRequests, accountAddress);
37
+ data = await prepareTransactionAsIntent(config, sourceChains, targetChain, transaction.calls, transaction.gasLimit, tokenRequests, accountAddress, 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 { sourceChain, targetChain, signers } = getTransactionParams(preparedTransaction.transaction);
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 = sourceChain ?? targetChain;
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, sourceChain, targetChain, data.hash);
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 submitTransaction(config, signedTransaction) {
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 { sourceChain, targetChain } = getTransactionParams(transaction);
109
+ const { sourceChains, targetChain } = getTransactionParams(transaction);
70
110
  const asUserOp = data.type === 'userop';
71
111
  if (asUserOp) {
72
- const chain = sourceChain ?? targetChain;
112
+ const chain = targetChain;
73
113
  const userOp = data.userOp;
74
114
  if (!userOp) {
75
115
  throw new error_1.UserOperationRequiredForSmartSessionsError();
@@ -82,16 +122,17 @@ async function submitTransaction(config, signedTransaction) {
82
122
  if (!intentOp) {
83
123
  throw new error_1.OrderPathRequiredForIntentsError();
84
124
  }
85
- return await submitIntent(config, sourceChain, targetChain, intentOp, signature);
125
+ return await submitIntent(config, sourceChains, targetChain, intentOp, signature, authorizations);
86
126
  }
87
127
  }
88
128
  function getTransactionParams(transaction) {
89
- const sourceChain = 'chain' in transaction ? transaction.chain : transaction.sourceChain;
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;
93
134
  // Across requires passing some value to repay the solvers
94
- const tokenRequests = initialTokenRequests.length === 0
135
+ const tokenRequests = !initialTokenRequests || initialTokenRequests.length === 0
95
136
  ? [
96
137
  {
97
138
  address: viem_1.zeroAddress,
@@ -100,22 +141,24 @@ function getTransactionParams(transaction) {
100
141
  ]
101
142
  : initialTokenRequests;
102
143
  return {
103
- sourceChain,
144
+ sourceChains,
104
145
  targetChain,
105
146
  tokenRequests,
106
147
  signers,
148
+ eip7702InitSignature,
107
149
  };
108
150
  }
109
- async function prepareTransactionAsUserOp(config, chain, calls, signers) {
151
+ async function prepareTransactionAsUserOp(config, chain, callInputs, signers) {
110
152
  const publicClient = (0, viem_1.createPublicClient)({
111
153
  chain,
112
- transport: (0, viem_1.http)(),
154
+ transport: (0, utils_1.createTransport)(chain, config.provider),
113
155
  });
114
156
  const validatorAccount = await getValidatorAccount(config, signers, publicClient, chain);
115
157
  if (!validatorAccount) {
116
158
  throw new Error('No validator account found');
117
159
  }
118
160
  const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
161
+ const calls = parseCalls(callInputs, chain.id);
119
162
  const userOp = await bundlerClient.prepareUserOperation({
120
163
  account: validatorAccount,
121
164
  calls,
@@ -131,29 +174,29 @@ async function prepareTransactionAsUserOp(config, chain, calls, signers) {
131
174
  }),
132
175
  };
133
176
  }
134
- async function prepareTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress) {
135
- const accountAccessList = sourceChain
177
+ async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, accountAddress, eip7702InitSignature) {
178
+ const calls = parseCalls(callInputs, targetChain.id);
179
+ const accountAccessList = sourceChains && sourceChains.length > 0
136
180
  ? {
137
- chainIds: [sourceChain.id],
181
+ chainIds: sourceChains.map((chain) => chain.id),
138
182
  }
139
183
  : undefined;
184
+ const { setupOps, delegations } = await getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature);
140
185
  const metaIntent = {
141
186
  destinationChainId: targetChain.id,
142
187
  tokenTransfers: tokenRequests.map((tokenRequest) => ({
143
- tokenAddress: tokenRequest.address,
188
+ tokenAddress: (0, registry_1.resolveTokenAddress)(tokenRequest.address, targetChain.id),
144
189
  amount: tokenRequest.amount,
145
190
  })),
146
- account: accountAddress,
147
- destinationExecutions: calls.map((call) => ({
148
- value: call.value ?? 0n,
149
- to: call.to,
150
- data: call.data ?? '0x',
151
- })),
152
- destinationGasUnits: gasLimit,
153
- accountAccessList,
154
- smartAccount: {
191
+ account: {
192
+ address: accountAddress,
155
193
  accountType: 'ERC7579',
194
+ setupOps,
195
+ delegations,
156
196
  },
197
+ destinationExecutions: calls,
198
+ destinationGasUnits: gasLimit,
199
+ accountAccessList,
157
200
  };
158
201
  const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
159
202
  const intentRoute = await orchestrator.getIntentRoute(metaIntent);
@@ -164,18 +207,14 @@ async function prepareTransactionAsIntent(config, sourceChain, targetChain, call
164
207
  hash: intentHash,
165
208
  };
166
209
  }
167
- async function signIntent(config, sourceChain, targetChain, intentHash, signers) {
210
+ async function signIntent(config, targetChain, intentHash, signers) {
168
211
  const validator = getValidator(config, signers);
169
212
  if (!validator) {
170
213
  throw new Error('Validator not available');
171
214
  }
172
215
  const ownerValidator = (0, validators_1.getOwnerValidator)(config);
173
216
  const isRoot = validator.address === ownerValidator.address;
174
- const owners = getOwners(config, signers);
175
- if (!owners) {
176
- throw new Error('No owners found');
177
- }
178
- const signature = await (0, accounts_1.getPackedSignature)(config, owners, sourceChain || targetChain, {
217
+ const signature = await (0, accounts_1.getPackedSignature)(config, signers, targetChain, {
179
218
  address: validator.address,
180
219
  isRoot,
181
220
  }, intentHash);
@@ -188,7 +227,7 @@ async function signUserOp(config, chain, signers, userOp) {
188
227
  }
189
228
  const publicClient = (0, viem_1.createPublicClient)({
190
229
  chain,
191
- transport: (0, viem_1.http)(),
230
+ transport: (0, utils_1.createTransport)(chain, config.provider),
192
231
  });
193
232
  const account = await getValidatorAccount(config, signers, publicClient, chain);
194
233
  if (!account) {
@@ -199,7 +238,7 @@ async function signUserOp(config, chain, signers, userOp) {
199
238
  async function submitUserOp(config, chain, userOp, signature) {
200
239
  const publicClient = (0, viem_1.createPublicClient)({
201
240
  chain,
202
- transport: (0, viem_1.http)(),
241
+ transport: (0, utils_1.createTransport)(chain, config.provider),
203
242
  });
204
243
  const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
205
244
  const hash = await bundlerClient.request({
@@ -232,34 +271,40 @@ async function submitUserOp(config, chain, userOp, signature) {
232
271
  return {
233
272
  type: 'userop',
234
273
  hash,
235
- sourceChain: chain.id,
236
- targetChain: chain.id,
274
+ chain: chain.id,
237
275
  };
238
276
  }
239
- async function submitIntent(config, sourceChain, targetChain, intentOp, signature) {
240
- return submitIntentInternal(config, sourceChain, targetChain, intentOp, signature, false);
277
+ async function submitIntent(config, sourceChains, targetChain, intentOp, signature, authorizations) {
278
+ return submitIntentInternal(config, sourceChains, targetChain, intentOp, signature, authorizations);
241
279
  }
242
280
  function getOrchestratorByChain(chainId, apiKey) {
243
281
  const orchestratorUrl = (0, registry_1.isTestnet)(chainId)
244
- ? consts_1.DEV_ORCHESTRATOR_URL
282
+ ? consts_1.STAGING_ORCHESTRATOR_URL
245
283
  : consts_1.PROD_ORCHESTRATOR_URL;
246
284
  return (0, orchestrator_1.getOrchestrator)(apiKey, orchestratorUrl);
247
285
  }
248
- async function submitIntentInternal(config, sourceChain, targetChain, intentOp, signature, deploy) {
286
+ async function submitIntentInternal(config, sourceChains, targetChain, intentOp, signature, authorizations) {
249
287
  const signedIntentOp = {
250
288
  ...intentOp,
251
289
  originSignatures: Array(intentOp.elements.length).fill(signature),
252
290
  destinationSignature: signature,
291
+ signedAuthorizations: authorizations.length > 0
292
+ ? authorizations.map((authorization) => ({
293
+ chainId: authorization.chainId,
294
+ address: authorization.address,
295
+ nonce: authorization.nonce,
296
+ yParity: authorization.yParity ?? 0,
297
+ r: authorization.r,
298
+ s: authorization.s,
299
+ }))
300
+ : undefined,
253
301
  };
254
- if (deploy) {
255
- await (0, accounts_1.deployTarget)(targetChain, config, false);
256
- }
257
302
  const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
258
303
  const intentResults = await orchestrator.submitIntent(signedIntentOp);
259
304
  return {
260
305
  type: 'intent',
261
306
  id: BigInt(intentResults.result.id),
262
- sourceChain: sourceChain?.id,
307
+ sourceChains: sourceChains?.map((chain) => chain.id),
263
308
  targetChain: targetChain.id,
264
309
  };
265
310
  }
@@ -292,10 +337,7 @@ function getValidator(config, signers) {
292
337
  if (withOwner) {
293
338
  // ECDSA
294
339
  if (withOwner.kind === 'ecdsa') {
295
- return (0, core_1.getOwnableValidator)({
296
- threshold: 1,
297
- owners: withOwner.accounts.map((account) => account.address),
298
- });
340
+ return (0, core_1.getOwnableValidator)(1, withOwner.accounts.map((account) => account.address));
299
341
  }
300
342
  // Passkeys (WebAuthn)
301
343
  if (withOwner.kind === 'passkey') {
@@ -305,6 +347,10 @@ function getValidator(config, signers) {
305
347
  authenticatorId: passkeyAccount.id,
306
348
  });
307
349
  }
350
+ // Multi-factor
351
+ if (withOwner.kind === 'multi-factor') {
352
+ return (0, core_1.getMultiFactorValidator)(1, withOwner.validators);
353
+ }
308
354
  }
309
355
  // Smart sessions
310
356
  const withSession = signers.type === 'session' ? signers.session : null;
@@ -319,40 +365,50 @@ function getValidator(config, signers) {
319
365
  // Fallback
320
366
  return undefined;
321
367
  }
322
- function getOwners(config, signers) {
323
- if (!signers) {
324
- return config.owners;
325
- }
326
- // Owners
327
- const withOwner = signers.type === 'owner' ? signers : null;
328
- if (withOwner) {
329
- // ECDSA
330
- if (withOwner.kind === 'ecdsa') {
331
- return {
332
- type: 'ecdsa',
333
- accounts: withOwner.accounts,
334
- };
335
- }
336
- // Passkeys (WebAuthn)
337
- if (withOwner.kind === 'passkey') {
338
- return {
339
- type: 'passkey',
340
- account: withOwner.account,
341
- };
368
+ function parseCalls(calls, chainId) {
369
+ return calls.map((call) => ({
370
+ data: call.data ?? '0x',
371
+ value: call.value ?? 0n,
372
+ to: (0, registry_1.resolveTokenAddress)(call.to, chainId),
373
+ }));
374
+ }
375
+ async function getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature) {
376
+ const initCode = (0, accounts_1.getInitCode)(config);
377
+ if (config.eoa) {
378
+ // EIP-7702 initialization is only needed for EOA accounts
379
+ if (!eip7702InitSignature || eip7702InitSignature === '0x') {
380
+ throw new Error('EIP-7702 initialization signature is required for EOA accounts');
342
381
  }
382
+ const { initData: eip7702InitData, contract: eip7702Contract } = await (0, accounts_1.getEip7702InitCall)(config, eip7702InitSignature);
383
+ return {
384
+ setupOps: [
385
+ {
386
+ to: accountAddress,
387
+ data: eip7702InitData,
388
+ },
389
+ ],
390
+ delegations: {
391
+ 0: {
392
+ contract: eip7702Contract,
393
+ },
394
+ },
395
+ };
343
396
  }
344
- // Smart sessions
345
- const withSession = signers.type === 'session' ? signers.session : null;
346
- if (withSession) {
347
- return withSession.owners;
397
+ else if (initCode) {
398
+ // Contract account with init code
399
+ return {
400
+ setupOps: [
401
+ {
402
+ to: initCode.factory,
403
+ data: initCode.factoryData,
404
+ },
405
+ ],
406
+ };
348
407
  }
349
- // Guardians (social recovery)
350
- const withGuardians = signers.type === 'guardians' ? signers : null;
351
- if (withGuardians) {
408
+ else {
409
+ // Already deployed contract account
352
410
  return {
353
- type: 'ecdsa',
354
- accounts: withGuardians.guardians,
411
+ setupOps: [],
355
412
  };
356
413
  }
357
- return undefined;
358
414
  }
@@ -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 { addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, setUpRecovery, trustAttester } from './actions';
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, SourceChainRequiredForSmartSessionsError, SourceTargetChainMismatchError, UserOperationRequiredForSmartSessionsError } from './execution';
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 { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundError, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './orchestrator';
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
- submitTransaction: (signedTransaction: SignedTransactionData) => Promise<TransactionResult>;
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, setUpRecovery, encodeSmartSessionSignature, trustAttester, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, isExecutionError, IntentFailedError, ExecutionError, SourceChainRequiredForSmartSessionsError, SourceTargetChainMismatchError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
40
- export type { RhinestoneAccount, Session, Call, Execution, IntentData, PreparedTransactionData, SignedTransactionData, TransactionResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, Portfolio, };
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
@@ -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;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EACL,YAAY,EAEZ,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAE5B,cAAc,EACd,kCAAkC,EAClC,qCAAqC,EACrC,4BAA4B,EAC7B,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,eAAe,EACf,WAAW,EACX,cAAc,EACd,2BAA2B,EAC3B,OAAO,EACP,WAAW,EACX,aAAa,EACb,aAAa,EACd,MAAM,WAAW,CAAA;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAEL,cAAc,EAGd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,wCAAwC,EACxC,8BAA8B,EAE9B,0CAA0C,EAE3C,MAAM,aAAa,CAAA;AACpB,OAAO,EAEL,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,UAAU,EACV,uBAAuB,EAEvB,qBAAqB,EAGtB,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,cAAc,EACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM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AAuB,EACvB,qBAAqB,GACtB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,CAAA"}
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.SourceTargetChainMismatchError = exports.SourceChainRequiredForSmartSessionsError = 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.trustAttester = exports.encodeSmartSessionSignature = exports.setUpRecovery = exports.removeOwner = exports.recover = exports.enablePasskeys = exports.enableEcdsa = exports.disablePasskeys = exports.disableEcdsa = exports.changeThreshold = exports.addOwner = void 0;
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, "SourceChainRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.SourceChainRequiredForSmartSessionsError; } });
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 utils_1 = require("./execution/utils");
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, utils_1.prepareTransaction)(config, transaction);
72
+ return (0, utils_2.prepareTransaction)(config, transaction);
65
73
  }
66
74
  function signTransaction(preparedTransaction) {
67
- return (0, utils_1.signTransaction)(config, preparedTransaction);
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, utils_1.submitTransaction)(config, signedTransaction);
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 Address, type Chain, type Hex } from 'viem';
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 { areAttestersTrusted, getOwners, getValidators } from './read';
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, getTrustAttesterCall, getTrustedAttesters, getOwnerValidator, getWebauthnValidatorSignature, areAttestersTrusted, getOwners, getValidators, isRip7212SupportedNetwork, };
30
+ export { HOOK_ADDRESS, getSetup, getOwnerValidator, getWebauthnValidatorSignature, getOwners, getValidators, isRip7212SupportedNetwork, };
35
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,KAAK,EAEV,KAAK,GAAG,EAET,MAAM,MAAM,CAAA;AAYb,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAEvD,OAAO,EAGL,KAAK,MAAM,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,YAAY,EAGb,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtE,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,iBAAiB,EAA4B,MAAM,cAAc,CAAA;AAM1E,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B;AAED,UAAU,0BAA0B;IAClC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