@charterlabs/rhinestone-sdk 0.0.2 → 0.0.4

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 (61) hide show
  1. package/README.md +6 -0
  2. package/dist/src/accounts/index.d.ts +10 -6
  3. package/dist/src/accounts/index.d.ts.map +1 -1
  4. package/dist/src/accounts/index.js +100 -4
  5. package/dist/src/accounts/kernel.d.ts +22 -0
  6. package/dist/src/accounts/kernel.d.ts.map +1 -0
  7. package/dist/src/accounts/kernel.js +252 -0
  8. package/dist/src/accounts/kernel.test.d.ts +2 -0
  9. package/dist/src/accounts/kernel.test.d.ts.map +1 -0
  10. package/dist/src/accounts/kernel.test.js +103 -0
  11. package/dist/src/accounts/nexus.d.ts +7 -2
  12. package/dist/src/accounts/nexus.d.ts.map +1 -1
  13. package/dist/src/accounts/nexus.js +59 -10
  14. package/dist/src/accounts/nexus.test.js +50 -4
  15. package/dist/src/accounts/safe.d.ts +7 -2
  16. package/dist/src/accounts/safe.d.ts.map +1 -1
  17. package/dist/src/accounts/safe.js +51 -2
  18. package/dist/src/accounts/safe.test.js +50 -4
  19. package/dist/src/accounts/utils.d.ts +5 -0
  20. package/dist/src/accounts/utils.d.ts.map +1 -1
  21. package/dist/src/actions/index.d.ts +12 -0
  22. package/dist/src/actions/index.d.ts.map +1 -0
  23. package/dist/src/actions/index.js +165 -0
  24. package/dist/src/actions/index.test.d.ts +2 -0
  25. package/dist/src/actions/index.test.d.ts.map +1 -0
  26. package/dist/src/actions/index.test.js +170 -0
  27. package/dist/src/execution/index.d.ts +5 -15
  28. package/dist/src/execution/index.d.ts.map +1 -1
  29. package/dist/src/execution/index.js +30 -149
  30. package/dist/src/execution/smart-session.d.ts.map +1 -1
  31. package/dist/src/execution/smart-session.js +7 -2
  32. package/dist/src/execution/smart-session.test.js +3 -0
  33. package/dist/src/execution/utils.d.ts +68 -0
  34. package/dist/src/execution/utils.d.ts.map +1 -0
  35. package/dist/src/execution/utils.js +355 -0
  36. package/dist/src/index.d.ts +20 -24
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/index.js +24 -0
  39. package/dist/src/modules/index.d.ts +2 -1
  40. package/dist/src/modules/index.d.ts.map +1 -1
  41. package/dist/src/modules/index.js +9 -1
  42. package/dist/src/modules/registry.d.ts +9 -0
  43. package/dist/src/modules/registry.d.ts.map +1 -0
  44. package/dist/src/modules/registry.js +60 -0
  45. package/dist/src/modules/validators/core.d.ts +4 -2
  46. package/dist/src/modules/validators/core.d.ts.map +1 -1
  47. package/dist/src/modules/validators/core.js +25 -1
  48. package/dist/src/orchestrator/client.d.ts.map +1 -1
  49. package/dist/src/orchestrator/registry.d.ts +1 -1
  50. package/dist/src/orchestrator/registry.d.ts.map +1 -1
  51. package/dist/src/orchestrator/registry.js +76 -1
  52. package/dist/src/orchestrator/types.d.ts +24 -3
  53. package/dist/src/orchestrator/types.d.ts.map +1 -1
  54. package/dist/src/orchestrator/utils.d.ts.map +1 -1
  55. package/dist/src/orchestrator/utils.js +3 -0
  56. package/dist/src/types.d.ts +12 -3
  57. package/dist/src/types.d.ts.map +1 -1
  58. package/dist/test/consts.d.ts +2 -1
  59. package/dist/test/consts.d.ts.map +1 -1
  60. package/dist/test/consts.js +3 -1
  61. package/package.json +1 -1
@@ -5,16 +5,13 @@ exports.waitForExecution = waitForExecution;
5
5
  exports.getMaxSpendableAmount = getMaxSpendableAmount;
6
6
  exports.getPortfolio = getPortfolio;
7
7
  const viem_1 = require("viem");
8
- const account_abstraction_1 = require("viem/account-abstraction");
9
8
  const chains_1 = require("viem/chains");
10
9
  const accounts_1 = require("../accounts");
11
10
  const utils_1 = require("../accounts/utils");
12
- const modules_1 = require("../modules");
13
- const validators_1 = require("../modules/validators");
14
11
  const orchestrator_1 = require("../orchestrator");
15
- const consts_1 = require("../orchestrator/consts");
16
12
  const registry_1 = require("../orchestrator/registry");
17
13
  const smart_session_1 = require("./smart-session");
14
+ const utils_2 = require("./utils");
18
15
  const POLLING_INTERVAL = 500;
19
16
  async function sendTransaction(config, transaction) {
20
17
  if ('chain' in transaction) {
@@ -34,7 +31,6 @@ async function sendTransactionInternal(config, sourceChain, targetChain, calls,
34
31
  }
35
32
  }
36
33
  const accountAddress = (0, accounts_1.getAddress)(config);
37
- const withSession = signers?.type === 'session' ? signers.session : null;
38
34
  // Across requires passing some value to repay the solvers
39
35
  const tokenRequests = initialTokenRequests.length === 0
40
36
  ? [
@@ -44,35 +40,38 @@ async function sendTransactionInternal(config, sourceChain, targetChain, calls,
44
40
  },
45
41
  ]
46
42
  : initialTokenRequests;
47
- if (withSession) {
43
+ if (signers) {
48
44
  if (!sourceChain) {
49
- throw new Error(`Specifying source chain is required when using smart sessions`);
45
+ throw new Error(`Specifying source chain is required when using smart sessions or guardians`);
46
+ }
47
+ const withSession = signers?.type === 'session' ? signers.session : null;
48
+ if (withSession) {
49
+ await (0, smart_session_1.enableSmartSession)(sourceChain, config, withSession);
50
50
  }
51
- await (0, smart_session_1.enableSmartSession)(sourceChain, config, withSession);
52
51
  // Smart sessions require a UserOp flow
53
- return await sendTransactionAsUserOp(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, withSession);
52
+ return await sendTransactionAsUserOp(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers);
54
53
  }
55
54
  else {
56
55
  return await sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress);
57
56
  }
58
57
  }
59
- async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, withSession) {
58
+ async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers) {
59
+ const withSession = signers?.type === 'session' ? signers.session : null;
60
60
  const publicClient = (0, viem_1.createPublicClient)({
61
61
  chain: sourceChain,
62
62
  transport: (0, viem_1.http)(),
63
63
  });
64
- const sessionAccount = await (0, accounts_1.getSmartSessionSmartAccount)(config, publicClient, sourceChain, withSession);
64
+ const validatorAccount = await (0, utils_2.getValidatorAccount)(config, signers, publicClient, sourceChain);
65
+ if (!validatorAccount) {
66
+ throw new Error('No validator account found');
67
+ }
65
68
  const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
66
- const targetPublicClient = (0, viem_1.createPublicClient)({
67
- chain: targetChain,
68
- transport: (0, viem_1.http)(),
69
- });
70
- const targetSessionAccount = await (0, accounts_1.getSmartSessionSmartAccount)(config, targetPublicClient, targetChain, withSession);
71
- const targetBundlerClient = (0, utils_1.getBundlerClient)(config, targetPublicClient);
72
69
  if (sourceChain.id === targetChain.id) {
73
- await (0, smart_session_1.enableSmartSession)(targetChain, config, withSession);
70
+ if (withSession) {
71
+ await (0, smart_session_1.enableSmartSession)(targetChain, config, withSession);
72
+ }
74
73
  const hash = await bundlerClient.sendUserOperation({
75
- account: sessionAccount,
74
+ account: validatorAccount,
76
75
  calls,
77
76
  });
78
77
  return {
@@ -82,132 +81,20 @@ async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls,
82
81
  targetChain: targetChain.id,
83
82
  };
84
83
  }
85
- const accountAccessList = sourceChain
86
- ? {
87
- chainIds: [sourceChain.id],
88
- }
89
- : (0, registry_1.getDefaultAccountAccessList)();
90
- const metaIntent = {
91
- targetChainId: targetChain.id,
92
- tokenTransfers: tokenRequests.map((tokenRequest) => ({
93
- tokenAddress: tokenRequest.address,
94
- amount: tokenRequest.amount,
95
- })),
96
- targetAccount: accountAddress,
97
- targetGasUnits: gasLimit,
98
- userOp: (0, orchestrator_1.getEmptyUserOp)(),
99
- accountAccessList,
100
- };
101
- const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
102
- const orderPath = await orchestrator.getOrderPath(metaIntent, accountAddress);
84
+ const orderPath = await (0, utils_2.getUserOpOrderPath)(sourceChain, targetChain, tokenRequests, accountAddress, gasLimit, config.rhinestoneApiKey);
103
85
  // Deploy the account on the target chain
104
86
  await (0, accounts_1.deployTarget)(targetChain, config, true);
105
- await (0, smart_session_1.enableSmartSession)(targetChain, config, withSession);
106
- const userOp = await targetBundlerClient.prepareUserOperation({
107
- account: targetSessionAccount,
108
- calls: [...orderPath[0].injectedExecutions, ...calls],
109
- stateOverride: [
110
- ...tokenRequests.map((request) => {
111
- const rootBalanceSlot = (0, orchestrator_1.getTokenRootBalanceSlot)(targetChain, request.address);
112
- const balanceSlot = rootBalanceSlot
113
- ? (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: 'address' }, { type: 'uint256' }], [accountAddress, rootBalanceSlot]))
114
- : '0x';
115
- return {
116
- address: request.address,
117
- stateDiff: [
118
- {
119
- slot: balanceSlot,
120
- value: (0, viem_1.pad)((0, viem_1.toHex)(request.amount)),
121
- },
122
- ],
123
- };
124
- }),
125
- ],
126
- });
127
- userOp.signature = await targetSessionAccount.signUserOperation(userOp);
128
- const userOpHash = (0, account_abstraction_1.getUserOperationHash)({
129
- userOperation: userOp,
130
- chainId: targetChain.id,
131
- entryPointAddress: account_abstraction_1.entryPoint07Address,
132
- entryPointVersion: '0.7',
133
- });
134
- orderPath[0].orderBundle.segments[0].witness.userOpHash = userOpHash;
135
- const { hash, appDomainSeparator, contentsType, structHash } = await (0, smart_session_1.hashErc7739)(sourceChain, orderPath, accountAddress);
136
- const signature = await (0, accounts_1.sign)(withSession.owners, targetChain, hash);
137
- const sessionSignature = (0, smart_session_1.getSessionSignature)(signature, appDomainSeparator, structHash, contentsType, withSession);
138
- const smartSessionValidator = (0, validators_1.getSmartSessionValidator)(config);
139
- if (!smartSessionValidator) {
140
- throw new Error('Smart session validator not available');
87
+ if (withSession) {
88
+ await (0, smart_session_1.enableSmartSession)(targetChain, config, withSession);
141
89
  }
142
- const packedSig = (0, viem_1.encodePacked)(['address', 'bytes'], [smartSessionValidator.address, sessionSignature]);
143
- const signedOrderBundle = {
144
- ...orderPath[0].orderBundle,
145
- originSignatures: Array(orderPath[0].orderBundle.segments.length).fill(packedSig),
146
- targetSignature: packedSig,
147
- };
148
- const bundleResults = await orchestrator.postSignedOrderBundle([
149
- {
150
- signedOrderBundle,
151
- userOp,
152
- },
153
- ]);
154
- return {
155
- type: 'bundle',
156
- id: bundleResults[0].bundleId,
157
- sourceChain: sourceChain.id,
158
- targetChain: targetChain.id,
159
- };
90
+ const userOp = await (0, utils_2.getUserOp)(config, targetChain, signers, orderPath, calls, tokenRequests, accountAddress);
91
+ const signature = await (0, utils_2.signUserOp)(config, sourceChain, targetChain, accountAddress, signers, userOp, orderPath);
92
+ return await (0, utils_2.submitUserOp)(config, sourceChain, targetChain, userOp, orderPath, signature);
160
93
  }
161
94
  async function sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress) {
162
- const accountAccessList = sourceChain
163
- ? {
164
- chainIds: [sourceChain.id],
165
- }
166
- : (0, registry_1.getDefaultAccountAccessList)();
167
- const metaIntent = {
168
- targetChainId: targetChain.id,
169
- tokenTransfers: tokenRequests.map((tokenRequest) => ({
170
- tokenAddress: tokenRequest.address,
171
- amount: tokenRequest.amount,
172
- })),
173
- targetAccount: accountAddress,
174
- targetExecutions: calls.map((call) => ({
175
- value: call.value ?? 0n,
176
- to: call.to,
177
- data: call.data ?? '0x',
178
- })),
179
- targetGasUnits: gasLimit,
180
- accountAccessList,
181
- };
182
- const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
183
- const orderPath = await orchestrator.getOrderPath(metaIntent, accountAddress);
184
- orderPath[0].orderBundle.segments[0].witness.execs = [
185
- ...orderPath[0].injectedExecutions,
186
- ...metaIntent.targetExecutions,
187
- ];
188
- const orderBundleHash = (0, orchestrator_1.getOrderBundleHash)(orderPath[0].orderBundle);
189
- const bundleSignature = await (0, accounts_1.sign)(config.owners, sourceChain || targetChain, orderBundleHash);
190
- const validatorModule = (0, modules_1.getOwnerValidator)(config);
191
- const packedSig = (0, viem_1.encodePacked)(['address', 'bytes'], [validatorModule.address, bundleSignature]);
192
- const signedOrderBundle = {
193
- ...orderPath[0].orderBundle,
194
- originSignatures: Array(orderPath[0].orderBundle.segments.length).fill(packedSig),
195
- targetSignature: packedSig,
196
- };
197
- await (0, accounts_1.deployTarget)(targetChain, config, false);
198
- const initCode = (0, accounts_1.getBundleInitCode)(config);
199
- const bundleResults = await orchestrator.postSignedOrderBundle([
200
- {
201
- signedOrderBundle,
202
- initCode,
203
- },
204
- ]);
205
- return {
206
- type: 'bundle',
207
- id: bundleResults[0].bundleId,
208
- sourceChain: sourceChain?.id,
209
- targetChain: targetChain.id,
210
- };
95
+ const { orderPath, hash: orderBundleHash } = await (0, utils_2.prepareTransactionAsIntent)(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress);
96
+ const signature = await (0, utils_2.signIntent)(config, sourceChain, targetChain, orderBundleHash);
97
+ return await (0, utils_2.submitIntentInternal)(config, sourceChain, targetChain, orderPath, signature, true);
211
98
  }
212
99
  async function waitForExecution(config, result, acceptsPreconfirmations) {
213
100
  const validStatuses = new Set([
@@ -222,7 +109,7 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
222
109
  case 'bundle': {
223
110
  let bundleResult = null;
224
111
  while (bundleResult === null || !validStatuses.has(bundleResult.status)) {
225
- const orchestrator = getOrchestratorByChain(result.targetChain, config.rhinestoneApiKey);
112
+ const orchestrator = (0, utils_2.getOrchestratorByChain)(result.targetChain, config.rhinestoneApiKey);
226
113
  bundleResult = await orchestrator.getBundleStatus(result.id);
227
114
  await new Promise((resolve) => setTimeout(resolve, POLLING_INTERVAL));
228
115
  }
@@ -247,18 +134,12 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
247
134
  }
248
135
  async function getMaxSpendableAmount(config, chain, tokenAddress, gasUnits) {
249
136
  const address = (0, accounts_1.getAddress)(config);
250
- const orchestrator = getOrchestratorByChain(chain.id, config.rhinestoneApiKey);
137
+ const orchestrator = (0, utils_2.getOrchestratorByChain)(chain.id, config.rhinestoneApiKey);
251
138
  return orchestrator.getMaxTokenAmount(address, chain.id, tokenAddress, gasUnits);
252
139
  }
253
140
  async function getPortfolio(config, onTestnets) {
254
141
  const address = (0, accounts_1.getAddress)(config);
255
142
  const chainId = onTestnets ? chains_1.sepolia.id : chains_1.mainnet.id;
256
- const orchestrator = getOrchestratorByChain(chainId, config.rhinestoneApiKey);
143
+ const orchestrator = (0, utils_2.getOrchestratorByChain)(chainId, config.rhinestoneApiKey);
257
144
  return orchestrator.getPortfolio(address, (0, registry_1.getDefaultAccountAccessList)());
258
145
  }
259
- function getOrchestratorByChain(chainId, apiKey) {
260
- const orchestratorUrl = (0, registry_1.isTestnet)(chainId)
261
- ? consts_1.DEV_ORCHESTRATOR_URL
262
- : consts_1.PROD_ORCHESTRATOR_URL;
263
- return (0, orchestrator_1.getOrchestrator)(apiKey, orchestratorUrl);
264
- }
@@ -1 +1 @@
1
- {"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAWb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEhE,iBAAe,kBAAkB,CAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,OAAO,iBAyBjB;AAED,iBAAe,WAAW,CACxB,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,OAAO;;;;;GAiExB;AAED,iBAAS,mBAAmB,CAC1B,SAAS,EAAE,GAAG,EACd,kBAAkB,EAAE,GAAG,EACvB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,OAAO,iBAkBrB;AAED,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
1
+ {"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIV,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAYb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAEhE,iBAAe,kBAAkB,CAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,OAAO,iBAiCjB;AAED,iBAAe,WAAW,CACxB,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,OAAO;;;;;GAiExB;AAED,iBAAS,mBAAmB,CAC1B,SAAS,EAAE,GAAG,EACd,kBAAkB,EAAE,GAAG,EACvB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,OAAO,iBAkBrB;AAED,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
@@ -6,6 +6,7 @@ exports.getSessionSignature = getSessionSignature;
6
6
  const viem_1 = require("viem");
7
7
  const accounts_1 = require("../accounts");
8
8
  const utils_1 = require("../accounts/utils");
9
+ const modules_1 = require("../modules");
9
10
  const validators_1 = require("../modules/validators");
10
11
  const utils_2 = require("../orchestrator/utils");
11
12
  async function enableSmartSession(chain, config, session) {
@@ -18,12 +19,16 @@ async function enableSmartSession(chain, config, session) {
18
19
  if (isEnabled) {
19
20
  return;
20
21
  }
22
+ const enableSessionCall = await (0, validators_1.getEnableSessionCall)(chain, session);
23
+ const trustedAttesters = await (0, modules_1.getTrustedAttesters)(publicClient, address);
24
+ const trustAttesterCall = trustedAttesters.length === 0 ? (0, modules_1.getTrustAttesterCall)(config) : undefined;
21
25
  const smartAccount = await (0, accounts_1.getSmartAccount)(config, publicClient, chain);
22
26
  const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
23
- const enableSessionCall = await (0, validators_1.getEnableSessionCall)(chain, session);
24
27
  const opHash = await bundlerClient.sendUserOperation({
25
28
  account: smartAccount,
26
- calls: [enableSessionCall],
29
+ calls: trustAttesterCall
30
+ ? [trustAttesterCall, enableSessionCall]
31
+ : [enableSessionCall],
27
32
  });
28
33
  await bundlerClient.waitForUserOperationReceipt({
29
34
  hash: opHash,
@@ -85,6 +85,9 @@ const hash = (0, viem_1.keccak256)('0xabcd');
85
85
  },
86
86
  },
87
87
  ],
88
+ tokenPrices: {},
89
+ gasPrices: {},
90
+ opGasParams: {},
88
91
  },
89
92
  injectedExecutions: [
90
93
  {
@@ -0,0 +1,68 @@
1
+ import { Address, Chain, Hex } from 'viem';
2
+ import { UserOperation } from 'viem/account-abstraction';
3
+ import { OrderPath } from '../orchestrator/types';
4
+ import { Call, RhinestoneAccountConfig, SignerSet, TokenRequest, Transaction } from '../types';
5
+ type TransactionResult = {
6
+ type: 'userop';
7
+ hash: Hex;
8
+ sourceChain: number;
9
+ targetChain: number;
10
+ } | {
11
+ type: 'bundle';
12
+ id: bigint;
13
+ sourceChain?: number;
14
+ targetChain: number;
15
+ };
16
+ interface BundleData {
17
+ hash: Hex;
18
+ orderPath: OrderPath;
19
+ userOp?: UserOperation;
20
+ }
21
+ interface PreparedTransactionData {
22
+ bundleData: BundleData;
23
+ transaction: Transaction;
24
+ }
25
+ interface SignedTransactionData extends PreparedTransactionData {
26
+ signature: Hex;
27
+ }
28
+ declare function prepareTransaction(config: RhinestoneAccountConfig, transaction: Transaction): Promise<PreparedTransactionData>;
29
+ declare function signTransaction(config: RhinestoneAccountConfig, preparedTransaction: PreparedTransactionData): Promise<SignedTransactionData>;
30
+ declare function submitTransaction(config: RhinestoneAccountConfig, signedTransaction: SignedTransactionData): Promise<TransactionResult>;
31
+ declare function prepareTransactionAsIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, calls: Call[], gasLimit: bigint | undefined, tokenRequests: TokenRequest[], accountAddress: Address): Promise<BundleData>;
32
+ declare function signIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, bundleHash: Hex): Promise<`0x${string}`>;
33
+ declare function signUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, accountAddress: Address, signers: SignerSet | undefined, userOp: UserOperation, orderPath: OrderPath): Promise<`0x${string}`>;
34
+ declare function submitUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, userOp: UserOperation, orderPath: OrderPath, signature: Hex): Promise<TransactionResult>;
35
+ declare function getOrchestratorByChain(chainId: number, apiKey: string): import("../orchestrator").Orchestrator;
36
+ declare function getUserOpOrderPath(sourceChain: Chain, targetChain: Chain, tokenRequests: TokenRequest[], accountAddress: Address, gasLimit: bigint | undefined, rhinestoneApiKey: string): Promise<OrderPath>;
37
+ declare function getUserOp(config: RhinestoneAccountConfig, targetChain: Chain, signers: SignerSet | undefined, orderPath: OrderPath, calls: Call[], tokenRequests: TokenRequest[], accountAddress: Address): Promise<{
38
+ readonly account: import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>;
39
+ readonly stateOverride: {
40
+ address: `0x${string}`;
41
+ stateDiff: {
42
+ slot: `0x${string}`;
43
+ value: `0x${string}`;
44
+ }[];
45
+ }[];
46
+ callData: Hex;
47
+ paymasterAndData: undefined;
48
+ sender: UserOperation["sender"];
49
+ authorization: UserOperation["authorization"];
50
+ factory: UserOperation["factory"];
51
+ factoryData: UserOperation["factoryData"];
52
+ nonce: UserOperation["nonce"];
53
+ maxFeePerGas: UserOperation["maxFeePerGas"];
54
+ maxPriorityFeePerGas: UserOperation["maxPriorityFeePerGas"];
55
+ callGasLimit: UserOperation["callGasLimit"];
56
+ preVerificationGas: UserOperation["preVerificationGas"];
57
+ verificationGasLimit: UserOperation["verificationGasLimit"];
58
+ paymasterPostOpGasLimit: UserOperation["paymasterPostOpGasLimit"];
59
+ paymasterVerificationGasLimit: UserOperation["paymasterVerificationGasLimit"];
60
+ paymaster: UserOperation["paymaster"];
61
+ paymasterData: UserOperation["paymasterData"];
62
+ signature: UserOperation["signature"];
63
+ }>;
64
+ declare function submitIntentInternal(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, orderPath: OrderPath, signature: Hex, deploy: boolean): Promise<TransactionResult>;
65
+ declare function getValidatorAccount(config: RhinestoneAccountConfig, signers: SignerSet | undefined, publicClient: any, chain: Chain): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | null | undefined>;
66
+ export { prepareTransaction, signTransaction, submitTransaction, getOrchestratorByChain, getUserOpOrderPath, getUserOp, signIntent, signUserOp, submitUserOp, prepareTransactionAsIntent, submitIntentInternal, getValidatorAccount, };
67
+ export type { BundleData, TransactionResult, PreparedTransactionData, SignedTransactionData, };
68
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAGL,GAAG,EAMJ,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,aAAa,EACd,MAAM,0BAA0B,CAAA;AA6BjC,OAAO,EAEL,SAAS,EAGV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,IAAI,EAEJ,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAA;AAGjB,KAAK,iBAAiB,GAClB;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,GAAG,CAAA;IACT,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACpB,GACD;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,CAAC,EAAE,MAAM,CAAA;IACp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