@rhinestone/sdk 0.0.0-dev-20260204114155

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 (206) hide show
  1. package/README.md +83 -0
  2. package/dist/src/accounts/error.d.ts +114 -0
  3. package/dist/src/accounts/error.d.ts.map +1 -0
  4. package/dist/src/accounts/error.js +174 -0
  5. package/dist/src/accounts/index.d.ts +48 -0
  6. package/dist/src/accounts/index.d.ts.map +1 -0
  7. package/dist/src/accounts/index.js +643 -0
  8. package/dist/src/accounts/index.test.d.ts +2 -0
  9. package/dist/src/accounts/index.test.d.ts.map +1 -0
  10. package/dist/src/accounts/index.test.js +33 -0
  11. package/dist/src/accounts/json-rpc/index.d.ts +5 -0
  12. package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
  13. package/dist/src/accounts/json-rpc/index.js +20 -0
  14. package/dist/src/accounts/json-rpc/index.test.d.ts +2 -0
  15. package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
  16. package/dist/src/accounts/json-rpc/index.test.js +33 -0
  17. package/dist/src/accounts/json-rpc/providers.d.ts +5 -0
  18. package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
  19. package/dist/src/accounts/json-rpc/providers.js +22 -0
  20. package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
  21. package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
  22. package/dist/src/accounts/json-rpc/providers.test.js +43 -0
  23. package/dist/src/accounts/kernel.d.ts +27 -0
  24. package/dist/src/accounts/kernel.d.ts.map +1 -0
  25. package/dist/src/accounts/kernel.js +281 -0
  26. package/dist/src/accounts/kernel.test.d.ts +2 -0
  27. package/dist/src/accounts/kernel.test.d.ts.map +1 -0
  28. package/dist/src/accounts/kernel.test.js +132 -0
  29. package/dist/src/accounts/nexus.d.ts +33 -0
  30. package/dist/src/accounts/nexus.d.ts.map +1 -0
  31. package/dist/src/accounts/nexus.js +455 -0
  32. package/dist/src/accounts/nexus.test.d.ts +2 -0
  33. package/dist/src/accounts/nexus.test.d.ts.map +1 -0
  34. package/dist/src/accounts/nexus.test.js +118 -0
  35. package/dist/src/accounts/passport.d.ts +9 -0
  36. package/dist/src/accounts/passport.d.ts.map +1 -0
  37. package/dist/src/accounts/passport.js +82 -0
  38. package/dist/src/accounts/safe.d.ts +33 -0
  39. package/dist/src/accounts/safe.d.ts.map +1 -0
  40. package/dist/src/accounts/safe.js +349 -0
  41. package/dist/src/accounts/safe.test.d.ts +2 -0
  42. package/dist/src/accounts/safe.test.d.ts.map +1 -0
  43. package/dist/src/accounts/safe.test.js +118 -0
  44. package/dist/src/accounts/signing/common.d.ts +27 -0
  45. package/dist/src/accounts/signing/common.d.ts.map +1 -0
  46. package/dist/src/accounts/signing/common.js +190 -0
  47. package/dist/src/accounts/signing/message.d.ts +5 -0
  48. package/dist/src/accounts/signing/message.d.ts.map +1 -0
  49. package/dist/src/accounts/signing/message.js +47 -0
  50. package/dist/src/accounts/signing/passkeys.d.ts +36 -0
  51. package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
  52. package/dist/src/accounts/signing/passkeys.js +125 -0
  53. package/dist/src/accounts/signing/passkeys.test.d.ts +2 -0
  54. package/dist/src/accounts/signing/passkeys.test.d.ts.map +1 -0
  55. package/dist/src/accounts/signing/passkeys.test.js +88 -0
  56. package/dist/src/accounts/signing/typedData.d.ts +5 -0
  57. package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
  58. package/dist/src/accounts/signing/typedData.js +35 -0
  59. package/dist/src/accounts/startale.d.ts +25 -0
  60. package/dist/src/accounts/startale.d.ts.map +1 -0
  61. package/dist/src/accounts/startale.js +112 -0
  62. package/dist/src/accounts/startale.test.d.ts +2 -0
  63. package/dist/src/accounts/startale.test.d.ts.map +1 -0
  64. package/dist/src/accounts/startale.test.js +92 -0
  65. package/dist/src/accounts/utils.d.ts +33 -0
  66. package/dist/src/accounts/utils.d.ts.map +1 -0
  67. package/dist/src/accounts/utils.js +208 -0
  68. package/dist/src/accounts/utils.test.d.ts +2 -0
  69. package/dist/src/accounts/utils.test.d.ts.map +1 -0
  70. package/dist/src/accounts/utils.test.js +49 -0
  71. package/dist/src/accounts/walletClient.d.ts +34 -0
  72. package/dist/src/accounts/walletClient.d.ts.map +1 -0
  73. package/dist/src/accounts/walletClient.js +121 -0
  74. package/dist/src/actions/compact.d.ts +15 -0
  75. package/dist/src/actions/compact.d.ts.map +1 -0
  76. package/dist/src/actions/compact.js +213 -0
  77. package/dist/src/actions/deployment.d.ts +19 -0
  78. package/dist/src/actions/deployment.d.ts.map +1 -0
  79. package/dist/src/actions/deployment.js +78 -0
  80. package/dist/src/actions/ecdsa.d.ts +35 -0
  81. package/dist/src/actions/ecdsa.d.ts.map +1 -0
  82. package/dist/src/actions/ecdsa.js +114 -0
  83. package/dist/src/actions/ecdsa.test.d.ts +2 -0
  84. package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
  85. package/dist/src/actions/ecdsa.test.js +99 -0
  86. package/dist/src/actions/index.d.ts +17 -0
  87. package/dist/src/actions/index.d.ts.map +1 -0
  88. package/dist/src/actions/index.js +53 -0
  89. package/dist/src/actions/mfa.d.ts +37 -0
  90. package/dist/src/actions/mfa.d.ts.map +1 -0
  91. package/dist/src/actions/mfa.js +133 -0
  92. package/dist/src/actions/passkeys.d.ts +37 -0
  93. package/dist/src/actions/passkeys.d.ts.map +1 -0
  94. package/dist/src/actions/passkeys.js +129 -0
  95. package/dist/src/actions/passkeys.test.d.ts +2 -0
  96. package/dist/src/actions/passkeys.test.d.ts.map +1 -0
  97. package/dist/src/actions/passkeys.test.js +54 -0
  98. package/dist/src/actions/recovery.d.ts +33 -0
  99. package/dist/src/actions/recovery.d.ts.map +1 -0
  100. package/dist/src/actions/recovery.js +193 -0
  101. package/dist/src/actions/recovery.test.d.ts +2 -0
  102. package/dist/src/actions/recovery.test.d.ts.map +1 -0
  103. package/dist/src/actions/recovery.test.js +168 -0
  104. package/dist/src/actions/smart-sessions.d.ts +23 -0
  105. package/dist/src/actions/smart-sessions.d.ts.map +1 -0
  106. package/dist/src/actions/smart-sessions.js +52 -0
  107. package/dist/src/errors/index.d.ts +5 -0
  108. package/dist/src/errors/index.d.ts.map +1 -0
  109. package/dist/src/errors/index.js +54 -0
  110. package/dist/src/execution/compact.d.ts +148 -0
  111. package/dist/src/execution/compact.d.ts.map +1 -0
  112. package/dist/src/execution/compact.js +120 -0
  113. package/dist/src/execution/error.d.ts +55 -0
  114. package/dist/src/execution/error.d.ts.map +1 -0
  115. package/dist/src/execution/error.js +78 -0
  116. package/dist/src/execution/index.d.ts +41 -0
  117. package/dist/src/execution/index.d.ts.map +1 -0
  118. package/dist/src/execution/index.js +230 -0
  119. package/dist/src/execution/permit2.d.ts +143 -0
  120. package/dist/src/execution/permit2.d.ts.map +1 -0
  121. package/dist/src/execution/permit2.js +285 -0
  122. package/dist/src/execution/singleChainOps.d.ts +40 -0
  123. package/dist/src/execution/singleChainOps.d.ts.map +1 -0
  124. package/dist/src/execution/singleChainOps.js +46 -0
  125. package/dist/src/execution/types.d.ts +36 -0
  126. package/dist/src/execution/types.d.ts.map +1 -0
  127. package/dist/src/execution/types.js +2 -0
  128. package/dist/src/execution/utils.d.ts +87 -0
  129. package/dist/src/execution/utils.d.ts.map +1 -0
  130. package/dist/src/execution/utils.js +783 -0
  131. package/dist/src/index.d.ts +76 -0
  132. package/dist/src/index.d.ts.map +1 -0
  133. package/dist/src/index.js +319 -0
  134. package/dist/src/modules/abi/smart-session-emissary.d.ts +696 -0
  135. package/dist/src/modules/abi/smart-session-emissary.d.ts.map +1 -0
  136. package/dist/src/modules/abi/smart-session-emissary.js +565 -0
  137. package/dist/src/modules/abi/smart-sessions.d.ts +104 -0
  138. package/dist/src/modules/abi/smart-sessions.d.ts.map +1 -0
  139. package/dist/src/modules/abi/smart-sessions.js +131 -0
  140. package/dist/src/modules/chain-abstraction.d.ts +5 -0
  141. package/dist/src/modules/chain-abstraction.d.ts.map +1 -0
  142. package/dist/src/modules/chain-abstraction.js +7 -0
  143. package/dist/src/modules/common.d.ts +30 -0
  144. package/dist/src/modules/common.d.ts.map +1 -0
  145. package/dist/src/modules/common.js +42 -0
  146. package/dist/src/modules/index.d.ts +11 -0
  147. package/dist/src/modules/index.d.ts.map +1 -0
  148. package/dist/src/modules/index.js +97 -0
  149. package/dist/src/modules/index.test.d.ts +2 -0
  150. package/dist/src/modules/index.test.d.ts.map +1 -0
  151. package/dist/src/modules/index.test.js +81 -0
  152. package/dist/src/modules/legacy.d.ts +10 -0
  153. package/dist/src/modules/legacy.d.ts.map +1 -0
  154. package/dist/src/modules/legacy.js +65 -0
  155. package/dist/src/modules/read.d.ts +9 -0
  156. package/dist/src/modules/read.d.ts.map +1 -0
  157. package/dist/src/modules/read.js +125 -0
  158. package/dist/src/modules/validators/core.d.ts +31 -0
  159. package/dist/src/modules/validators/core.d.ts.map +1 -0
  160. package/dist/src/modules/validators/core.js +284 -0
  161. package/dist/src/modules/validators/core.test.d.ts +2 -0
  162. package/dist/src/modules/validators/core.test.d.ts.map +1 -0
  163. package/dist/src/modules/validators/core.test.js +101 -0
  164. package/dist/src/modules/validators/index.d.ts +4 -0
  165. package/dist/src/modules/validators/index.d.ts.map +1 -0
  166. package/dist/src/modules/validators/index.js +10 -0
  167. package/dist/src/modules/validators/smart-sessions.d.ts +185 -0
  168. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -0
  169. package/dist/src/modules/validators/smart-sessions.js +624 -0
  170. package/dist/src/orchestrator/client.d.ts +22 -0
  171. package/dist/src/orchestrator/client.d.ts.map +1 -0
  172. package/dist/src/orchestrator/client.js +360 -0
  173. package/dist/src/orchestrator/consts.d.ts +5 -0
  174. package/dist/src/orchestrator/consts.d.ts.map +1 -0
  175. package/dist/src/orchestrator/consts.js +9 -0
  176. package/dist/src/orchestrator/error.d.ts +242 -0
  177. package/dist/src/orchestrator/error.d.ts.map +1 -0
  178. package/dist/src/orchestrator/error.js +283 -0
  179. package/dist/src/orchestrator/index.d.ts +10 -0
  180. package/dist/src/orchestrator/index.d.ts.map +1 -0
  181. package/dist/src/orchestrator/index.js +58 -0
  182. package/dist/src/orchestrator/registry.d.ts +22 -0
  183. package/dist/src/orchestrator/registry.d.ts.map +1 -0
  184. package/dist/src/orchestrator/registry.js +116 -0
  185. package/dist/src/orchestrator/registry.test.d.ts +2 -0
  186. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  187. package/dist/src/orchestrator/registry.test.js +154 -0
  188. package/dist/src/orchestrator/types.d.ts +322 -0
  189. package/dist/src/orchestrator/types.d.ts.map +1 -0
  190. package/dist/src/orchestrator/types.js +31 -0
  191. package/dist/src/orchestrator/utils.d.ts +3 -0
  192. package/dist/src/orchestrator/utils.d.ts.map +1 -0
  193. package/dist/src/orchestrator/utils.js +24 -0
  194. package/dist/src/types.d.ts +296 -0
  195. package/dist/src/types.d.ts.map +1 -0
  196. package/dist/src/types.js +2 -0
  197. package/dist/src/utils/index.d.ts +26 -0
  198. package/dist/src/utils/index.d.ts.map +1 -0
  199. package/dist/src/utils/index.js +63 -0
  200. package/dist/test/consts.d.ts +10 -0
  201. package/dist/test/consts.d.ts.map +1 -0
  202. package/dist/test/consts.js +22 -0
  203. package/dist/test/utils/utils.d.ts +5 -0
  204. package/dist/test/utils/utils.d.ts.map +1 -0
  205. package/dist/test/utils/utils.js +20 -0
  206. package/package.json +161 -0
@@ -0,0 +1,783 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareTransaction = prepareTransaction;
4
+ exports.getTransactionMessages = getTransactionMessages;
5
+ exports.signTransaction = signTransaction;
6
+ exports.signAuthorizations = signAuthorizations;
7
+ exports.signAuthorizationsInternal = signAuthorizationsInternal;
8
+ exports.signMessage = signMessage;
9
+ exports.signTypedData = signTypedData;
10
+ exports.submitTransaction = submitTransaction;
11
+ exports.prepareUserOperation = prepareUserOperation;
12
+ exports.signUserOperation = signUserOperation;
13
+ exports.submitUserOperation = submitUserOperation;
14
+ exports.getOrchestratorByChain = getOrchestratorByChain;
15
+ exports.signIntent = signIntent;
16
+ exports.prepareTransactionAsIntent = prepareTransactionAsIntent;
17
+ exports.submitIntentInternal = submitIntentInternal;
18
+ exports.getValidatorAccount = getValidatorAccount;
19
+ exports.parseCalls = parseCalls;
20
+ exports.getTokenRequests = getTokenRequests;
21
+ exports.resolveCallInputs = resolveCallInputs;
22
+ exports.getIntentAccount = getIntentAccount;
23
+ exports.getTargetExecutionSignature = getTargetExecutionSignature;
24
+ const viem_1 = require("viem");
25
+ const account_abstraction_1 = require("viem/account-abstraction");
26
+ const erc7739_1 = require("viem/experimental/erc7739");
27
+ const accounts_1 = require("../accounts");
28
+ const utils_1 = require("../accounts/utils");
29
+ const modules_1 = require("../modules");
30
+ const validators_1 = require("../modules/validators");
31
+ const core_1 = require("../modules/validators/core");
32
+ const orchestrator_1 = require("../orchestrator");
33
+ const consts_1 = require("../orchestrator/consts");
34
+ const registry_1 = require("../orchestrator/registry");
35
+ const types_1 = require("../orchestrator/types");
36
+ const compact_1 = require("./compact");
37
+ const error_1 = require("./error");
38
+ const permit2_1 = require("./permit2");
39
+ const singleChainOps_1 = require("./singleChainOps");
40
+ async function prepareTransaction(config, transaction) {
41
+ const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account, recipient, } = getTransactionParams(transaction);
42
+ const accountAddress = (0, accounts_1.getAddress)(config);
43
+ const isUserOpSigner = signers?.type === 'guardians';
44
+ if (isUserOpSigner) {
45
+ throw new error_1.SignerNotSupportedError();
46
+ }
47
+ const intentRoute = await prepareTransactionAsIntent(config, sourceChains, targetChain, await resolveCallInputs(transaction.calls, config, targetChain, accountAddress), transaction.gasLimit, tokenRequests, recipient, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account, signers);
48
+ return {
49
+ intentRoute,
50
+ transaction,
51
+ };
52
+ }
53
+ async function prepareUserOperation(config, transaction) {
54
+ const chain = transaction.chain;
55
+ const signers = transaction.signers;
56
+ const accountAddress = (0, accounts_1.getAddress)(config);
57
+ const data = await prepareTransactionAsUserOp(config, chain, await resolveCallInputs(transaction.calls, config, chain, accountAddress), signers, transaction.gasLimit);
58
+ return {
59
+ userOperation: data.userOp,
60
+ hash: data.hash,
61
+ transaction,
62
+ };
63
+ }
64
+ async function resolveCallInputs(inputs, config, chain, accountAddress) {
65
+ const resolved = [];
66
+ if (!inputs) {
67
+ return resolved;
68
+ }
69
+ for (const intent of inputs) {
70
+ if ('resolve' in intent) {
71
+ const result = await intent.resolve({ config, chain, accountAddress });
72
+ if (Array.isArray(result)) {
73
+ resolved.push(...result);
74
+ }
75
+ else if (result) {
76
+ resolved.push(result);
77
+ }
78
+ }
79
+ else {
80
+ resolved.push(intent);
81
+ }
82
+ }
83
+ return resolved;
84
+ }
85
+ function getTransactionMessages(config, preparedTransaction) {
86
+ return getIntentMessages(config, preparedTransaction.intentRoute.intentOp, false);
87
+ }
88
+ async function signTransaction(config, preparedTransaction) {
89
+ const { signers } = getTransactionParams(preparedTransaction.transaction);
90
+ const intentRoute = preparedTransaction.intentRoute;
91
+ const targetChain = 'targetChain' in preparedTransaction.transaction
92
+ ? preparedTransaction.transaction.targetChain
93
+ : preparedTransaction.transaction.chain;
94
+ const { originSignatures, destinationSignature } = await signIntent(config, intentRoute.intentOp, targetChain, signers, false);
95
+ const targetExecutionSignature = await getTargetExecutionSignature(config, intentRoute.intentOp, targetChain, signers);
96
+ return {
97
+ intentRoute,
98
+ transaction: preparedTransaction.transaction,
99
+ originSignatures,
100
+ destinationSignature,
101
+ targetExecutionSignature,
102
+ };
103
+ }
104
+ async function getTargetExecutionSignature(config, intentOp, targetChain, signers) {
105
+ if (signers?.type !== 'experimental_session') {
106
+ return undefined;
107
+ }
108
+ const targetExecutionIntentOp = {
109
+ ...intentOp,
110
+ nonce: intentOp.targetExecutionNonce,
111
+ };
112
+ const { destinationSignature: targetExecutionSignature } = await signIntent(config, targetExecutionIntentOp, targetChain, signers, true);
113
+ return targetExecutionSignature;
114
+ }
115
+ async function signUserOperation(config, preparedUserOperation) {
116
+ const chain = preparedUserOperation.transaction.chain;
117
+ const userOp = preparedUserOperation.userOperation;
118
+ const signers = preparedUserOperation.transaction.signers;
119
+ // Smart sessions require a UserOp flow
120
+ const signature = await signUserOp(config, chain, signers, userOp);
121
+ return {
122
+ userOperation: preparedUserOperation.userOperation,
123
+ hash: preparedUserOperation.hash,
124
+ transaction: preparedUserOperation.transaction,
125
+ signature,
126
+ };
127
+ }
128
+ async function signAuthorizations(config, preparedTransaction) {
129
+ return await signAuthorizationsInternal(config, preparedTransaction.intentRoute);
130
+ }
131
+ async function signMessage(config, message, chain, signers) {
132
+ const validator = getValidator(config, signers);
133
+ if (!validator) {
134
+ throw new Error('Validator not available');
135
+ }
136
+ const ownerValidator = (0, validators_1.getOwnerValidator)(config);
137
+ const isRoot = validator.address === ownerValidator.address;
138
+ const hash = (0, viem_1.hashMessage)(message);
139
+ const signature = await (0, accounts_1.getEip1271Signature)(config, signers, chain, {
140
+ address: validator.address,
141
+ isRoot,
142
+ }, hash);
143
+ return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
144
+ }
145
+ async function signTypedData(config, parameters, chain, signers, options) {
146
+ const validator = getValidator(config, signers);
147
+ if (!validator) {
148
+ throw new Error('Validator not available');
149
+ }
150
+ const ownerValidator = (0, validators_1.getOwnerValidator)(config);
151
+ const isRoot = validator.address === ownerValidator.address;
152
+ if (signers?.type === 'experimental_session') {
153
+ return await signTypedDataWithSession(config, chain, {
154
+ address: validator.address,
155
+ isRoot,
156
+ }, signers, parameters);
157
+ }
158
+ const signature = await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, {
159
+ address: validator.address,
160
+ isRoot,
161
+ }, parameters);
162
+ if (!options?.skipErc6492) {
163
+ return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
164
+ }
165
+ return signature;
166
+ }
167
+ async function signTypedDataWithSession(config, chain, validator, signers, parameters) {
168
+ const { name, version, chainId, verifyingContract, salt } = (0, accounts_1.getEip712Domain)(config, chain);
169
+ const signature = await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, validator, {
170
+ domain: parameters.domain,
171
+ primaryType: 'TypedDataSign',
172
+ types: {
173
+ ...parameters.types,
174
+ TypedDataSign: [
175
+ { name: 'contents', type: parameters.primaryType },
176
+ { name: 'name', type: 'string' },
177
+ { name: 'version', type: 'string' },
178
+ { name: 'chainId', type: 'uint256' },
179
+ { name: 'verifyingContract', type: 'address' },
180
+ { name: 'salt', type: 'bytes32' },
181
+ ],
182
+ },
183
+ message: {
184
+ contents: parameters.message,
185
+ name,
186
+ version,
187
+ chainId,
188
+ verifyingContract,
189
+ salt,
190
+ },
191
+ }, (signature) => {
192
+ const erc7739Signature = (0, erc7739_1.wrapTypedDataSignature)({
193
+ domain: parameters.domain,
194
+ primaryType: parameters.primaryType,
195
+ types: parameters.types,
196
+ message: parameters.message,
197
+ signature,
198
+ });
199
+ return (0, viem_1.encodePacked)(['bytes32', 'bytes'], [(0, validators_1.getPermissionId)(signers.session), erc7739Signature]);
200
+ });
201
+ return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
202
+ }
203
+ async function signAuthorizationsInternal(config, data) {
204
+ const eoa = config.eoa;
205
+ if (!eoa) {
206
+ throw new Error('EIP-7702 initialization is required for EOA accounts');
207
+ }
208
+ const accountAddress = (0, accounts_1.getAddress)(config);
209
+ const requiredDelegations = 'intentOp' in data
210
+ ? data.intentOp.signedMetadata.account.requiredDelegations || {}
211
+ : {};
212
+ const authorizations = [];
213
+ for (const chainId in requiredDelegations) {
214
+ const delegation = requiredDelegations[chainId];
215
+ const chain = (0, registry_1.getChainById)(Number(chainId));
216
+ const walletClient = (0, viem_1.createWalletClient)({
217
+ chain,
218
+ account: eoa,
219
+ transport: (0, utils_1.createTransport)(chain, config.provider),
220
+ }).extend(viem_1.publicActions);
221
+ const code = await walletClient.getCode({
222
+ address: accountAddress,
223
+ });
224
+ const isDelegated = code === (0, viem_1.concat)(['0xef0100', delegation.contract.toLowerCase()]);
225
+ if (isDelegated) {
226
+ continue;
227
+ }
228
+ const authorization = await walletClient.signAuthorization({
229
+ contractAddress: delegation.contract,
230
+ chainId: Number(chainId),
231
+ });
232
+ authorizations.push(authorization);
233
+ }
234
+ return authorizations;
235
+ }
236
+ async function submitTransaction(config, signedTransaction, authorizations, dryRun = false) {
237
+ const { intentRoute, transaction, originSignatures, destinationSignature, targetExecutionSignature, } = signedTransaction;
238
+ const { sourceChains, targetChain } = getTransactionParams(transaction);
239
+ const intentOp = intentRoute.intentOp;
240
+ return await submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun);
241
+ }
242
+ async function submitUserOperation(config, signedUserOperation) {
243
+ const chain = signedUserOperation.transaction.chain;
244
+ const userOp = signedUserOperation.userOperation;
245
+ const signature = signedUserOperation.signature;
246
+ // Smart sessions require a UserOp flow
247
+ return await submitUserOp(config, chain, userOp, signature);
248
+ }
249
+ function getTransactionParams(transaction) {
250
+ const sourceChains = 'chain' in transaction ? [transaction.chain] : transaction.sourceChains;
251
+ const targetChain = 'chain' in transaction ? transaction.chain : transaction.targetChain;
252
+ const initialTokenRequests = transaction.tokenRequests;
253
+ const signers = transaction.signers;
254
+ const eip7702InitSignature = transaction.eip7702InitSignature;
255
+ const sponsored = transaction.sponsored;
256
+ const gasLimit = transaction.gasLimit;
257
+ const settlementLayers = transaction.settlementLayers;
258
+ const sourceAssets = transaction.sourceAssets;
259
+ const feeAsset = transaction.feeAsset;
260
+ const lockFunds = transaction.lockFunds;
261
+ const account = transaction.experimental_accountOverride;
262
+ const recipient = transaction.recipient;
263
+ const tokenRequests = getTokenRequests(sourceChains || [], targetChain, initialTokenRequests, settlementLayers);
264
+ return {
265
+ sourceChains,
266
+ targetChain,
267
+ tokenRequests,
268
+ signers,
269
+ sponsored,
270
+ eip7702InitSignature,
271
+ gasLimit,
272
+ settlementLayers,
273
+ sourceAssets,
274
+ feeAsset,
275
+ lockFunds,
276
+ account,
277
+ recipient,
278
+ };
279
+ }
280
+ function getTokenRequests(sourceChains, targetChain, initialTokenRequests, settlementLayers) {
281
+ if (initialTokenRequests) {
282
+ validateTokenSymbols(targetChain, initialTokenRequests.map((tokenRequest) => tokenRequest.address));
283
+ }
284
+ // Across requires passing some value to repay the solvers
285
+ const defaultTokenRequest = {
286
+ address: viem_1.zeroAddress,
287
+ amount: 1n,
288
+ };
289
+ const isSameChain = (settlementLayers?.length === 1 && settlementLayers[0] === 'SAME_CHAIN') ||
290
+ (sourceChains &&
291
+ sourceChains.length === 1 &&
292
+ sourceChains[0].id === targetChain.id);
293
+ const tokenRequests = !initialTokenRequests || initialTokenRequests.length === 0
294
+ ? isSameChain
295
+ ? []
296
+ : [defaultTokenRequest]
297
+ : initialTokenRequests;
298
+ return tokenRequests;
299
+ }
300
+ async function prepareTransactionAsUserOp(config, chain, callInputs, signers, gasLimit) {
301
+ const publicClient = (0, viem_1.createPublicClient)({
302
+ chain,
303
+ transport: (0, utils_1.createTransport)(chain, config.provider),
304
+ });
305
+ const validatorAccount = await getValidatorAccount(config, signers, publicClient, chain);
306
+ if (!validatorAccount) {
307
+ throw new Error('No validator account found');
308
+ }
309
+ const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
310
+ const calls = parseCalls(callInputs, chain.id);
311
+ const userOp = await bundlerClient.prepareUserOperation({
312
+ account: validatorAccount,
313
+ calls,
314
+ callGasLimit: gasLimit,
315
+ });
316
+ return {
317
+ userOp,
318
+ hash: (0, account_abstraction_1.getUserOperationHash)({
319
+ userOperation: userOp,
320
+ chainId: chain.id,
321
+ entryPointAddress: account_abstraction_1.entryPoint07Address,
322
+ entryPointVersion: '0.7',
323
+ }),
324
+ };
325
+ }
326
+ function getAccountType(accountConfig) {
327
+ if (accountConfig?.type === 'eoa') {
328
+ return 'EOA';
329
+ }
330
+ else {
331
+ return 'ERC7579';
332
+ }
333
+ }
334
+ function getIntentAccount(config, eip7702InitSignature, account) {
335
+ const accountAddress = (0, accounts_1.getAddress)(config);
336
+ const accountType = getAccountType(config.account);
337
+ const { setupOps, delegations } = getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature);
338
+ return {
339
+ address: accountAddress,
340
+ accountType: accountType,
341
+ setupOps: account?.setupOps ?? setupOps,
342
+ delegations,
343
+ };
344
+ }
345
+ async function prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipientInput, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, account, signers) {
346
+ const calls = parseCalls(callInputs, targetChain.id);
347
+ const accountAccessList = createAccountAccessList(sourceChains, sourceAssets);
348
+ function getRecipient(recipient) {
349
+ if (typeof recipient === 'string') {
350
+ // Passed as an address, assume it's an EOA
351
+ return {
352
+ address: recipient,
353
+ accountType: 'EOA',
354
+ setupOps: [],
355
+ delegations: undefined,
356
+ };
357
+ }
358
+ if (!recipient) {
359
+ return undefined;
360
+ }
361
+ return getIntentAccount(recipient, eip7702InitSignature, account);
362
+ }
363
+ const intentAccount = getIntentAccount(config, eip7702InitSignature, account);
364
+ const recipient = getRecipient(recipientInput);
365
+ const signatureMode = signers?.type === 'experimental_session'
366
+ ? types_1.SIG_MODE_EMISSARY_EXECUTION_ERC1271
367
+ : types_1.SIG_MODE_ERC1271_EMISSARY;
368
+ const metaIntent = {
369
+ destinationChainId: targetChain.id,
370
+ tokenRequests: tokenRequests.map((tokenRequest) => ({
371
+ tokenAddress: (0, registry_1.resolveTokenAddress)(tokenRequest.address, targetChain.id),
372
+ amount: tokenRequest.amount,
373
+ })),
374
+ recipient,
375
+ account: intentAccount,
376
+ destinationExecutions: calls,
377
+ destinationGasUnits: gasLimit,
378
+ accountAccessList,
379
+ options: {
380
+ topupCompact: lockFunds ?? false,
381
+ feeToken: feeAsset,
382
+ sponsorSettings: sponsored
383
+ ? typeof sponsored === 'object'
384
+ ? {
385
+ gasSponsored: sponsored.gas,
386
+ bridgeFeesSponsored: sponsored.bridging,
387
+ swapFeesSponsored: sponsored.swaps,
388
+ }
389
+ : {
390
+ gasSponsored: sponsored,
391
+ bridgeFeesSponsored: sponsored,
392
+ swapFeesSponsored: sponsored,
393
+ }
394
+ : undefined,
395
+ settlementLayers,
396
+ signatureMode,
397
+ },
398
+ };
399
+ const orchestrator = getOrchestratorByChain(targetChain.id, config.apiKey, config.endpointUrl);
400
+ const intentRoute = await orchestrator.getIntentRoute(metaIntent);
401
+ return intentRoute;
402
+ }
403
+ async function signIntent(config, intentOp, targetChain, signers, targetExecution) {
404
+ const { origin, destination } = getIntentMessages(config, intentOp, targetExecution ?? false);
405
+ if (config.account?.type === 'eoa') {
406
+ const eoa = config.eoa;
407
+ if (!eoa) {
408
+ throw new accounts_1.EoaAccountMustHaveAccountError();
409
+ }
410
+ const originSignatures = [];
411
+ for (const typedData of origin) {
412
+ if (eoa.signTypedData) {
413
+ const signature = await eoa.signTypedData(typedData);
414
+ originSignatures.push(signature);
415
+ }
416
+ else {
417
+ throw new accounts_1.EoaSigningMethodNotConfiguredError('signTypedData');
418
+ }
419
+ }
420
+ const destinationSignature = originSignatures.at(-1);
421
+ return {
422
+ originSignatures,
423
+ destinationSignature,
424
+ };
425
+ }
426
+ const validator = getValidator(config, signers);
427
+ if (!validator) {
428
+ throw new Error('Validator not available');
429
+ }
430
+ const ownerValidator = (0, validators_1.getOwnerValidator)(config);
431
+ const isRoot = validator.address === ownerValidator.address;
432
+ const originSignatures = [];
433
+ for (const typedData of origin) {
434
+ const chain = (0, registry_1.getChainById)(typedData.domain?.chainId);
435
+ // For same chain transactions, we need to modify the origin signers
436
+ // Specifically, we need to remove the enable data in this case
437
+ const matchesTargetChain = chain.id === targetChain.id;
438
+ const originSigners = signers?.type === 'experimental_session'
439
+ ? {
440
+ type: 'experimental_session',
441
+ session: signers.session,
442
+ verifyExecutions: matchesTargetChain
443
+ ? signers.verifyExecutions
444
+ : undefined,
445
+ enableData: matchesTargetChain ? signers.enableData : undefined,
446
+ }
447
+ : signers;
448
+ const signature = await signIntentTypedData(config, originSigners, validator, isRoot, typedData, chain, targetExecution ?? false);
449
+ originSignatures.push(signature);
450
+ }
451
+ const destinationSignature = await getDestinationSignature(config, signers, validator, isRoot, targetChain, destination, originSignatures, targetExecution ?? false);
452
+ return {
453
+ originSignatures,
454
+ destinationSignature,
455
+ };
456
+ }
457
+ async function getDestinationSignature(config, signers, validator, isRoot, targetChain, destination, originSignatures, targetExecution) {
458
+ // For smart sessions, we need to provide a separate destination signature for the target chain
459
+ if (signers?.type === 'experimental_session') {
460
+ const destinationChain = (0, registry_1.getChainById)(targetChain.id);
461
+ const destinationSignatures = await signIntentTypedData(config, signers, validator, isRoot, destination, destinationChain, targetExecution);
462
+ return typeof destinationSignatures === 'object'
463
+ ? destinationSignatures.preClaimSig
464
+ : (destinationSignatures ?? '0x');
465
+ }
466
+ const lastOriginSignature = originSignatures.at(-1);
467
+ return typeof lastOriginSignature === 'object'
468
+ ? lastOriginSignature.preClaimSig
469
+ : (lastOriginSignature ?? '0x');
470
+ }
471
+ function getIntentMessages(config, intentOp, targetExecution) {
472
+ const address = (0, accounts_1.getAddress)(config);
473
+ const intentExecutor = (0, modules_1.getIntentExecutor)(config);
474
+ const withPermit2 = intentOp.elements.some((element) => element.mandate.qualifier.settlementContext.fundingMethod === 'PERMIT2');
475
+ const withIntentExecutorOps = targetExecution ||
476
+ intentOp.elements.some((element) => element.mandate.qualifier.settlementContext.settlementLayer ===
477
+ 'INTENT_EXECUTOR');
478
+ const origin = [];
479
+ for (const element of intentOp.elements) {
480
+ if (withIntentExecutorOps) {
481
+ const typedData = (0, singleChainOps_1.getTypedData)(address, intentExecutor.address, element, BigInt(intentOp.nonce));
482
+ origin.push(typedData);
483
+ }
484
+ else if (withPermit2) {
485
+ const typedData = (0, permit2_1.getTypedData)(element, BigInt(intentOp.nonce), BigInt(intentOp.expires));
486
+ origin.push(typedData);
487
+ }
488
+ else {
489
+ const typedData = (0, compact_1.getCompactTypedData)(intentOp);
490
+ origin.push(typedData);
491
+ }
492
+ }
493
+ const destination = origin.at(-1);
494
+ return {
495
+ origin,
496
+ destination,
497
+ };
498
+ }
499
+ async function signIntentTypedData(config, signers, validator, isRoot, parameters, chain, targetExecution) {
500
+ if ((0, core_1.supportsEip712)(validator)) {
501
+ return await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, {
502
+ address: validator.address,
503
+ isRoot,
504
+ }, parameters);
505
+ }
506
+ const hash = (0, viem_1.hashTypedData)(parameters);
507
+ if (signers?.type === 'experimental_session' && signers.verifyExecutions) {
508
+ if (targetExecution) {
509
+ return await (0, accounts_1.getEmissarySignature)(config, {
510
+ type: 'experimental_session',
511
+ session: signers.session,
512
+ verifyExecutions: true,
513
+ }, chain, hash);
514
+ }
515
+ const eip1271Signature = await (0, accounts_1.getEip1271Signature)(config, {
516
+ type: 'experimental_session',
517
+ session: signers.session,
518
+ verifyExecutions: false,
519
+ enableData: signers.enableData,
520
+ }, chain, {
521
+ address: validator.address,
522
+ isRoot,
523
+ }, hash);
524
+ const emissarySignature = await (0, accounts_1.getEmissarySignature)(config, {
525
+ type: 'experimental_session',
526
+ session: signers.session,
527
+ verifyExecutions: true,
528
+ enableData: signers.enableData,
529
+ }, chain, hash);
530
+ return {
531
+ preClaimSig: emissarySignature,
532
+ notarizedClaimSig: eip1271Signature,
533
+ };
534
+ }
535
+ return await (0, accounts_1.getEip1271Signature)(config, signers, chain, {
536
+ address: validator.address,
537
+ isRoot,
538
+ }, hash);
539
+ }
540
+ async function signUserOp(config, chain, signers, userOp) {
541
+ const validator = getValidator(config, signers);
542
+ if (!validator) {
543
+ throw new Error('Validator not available');
544
+ }
545
+ const publicClient = (0, viem_1.createPublicClient)({
546
+ chain,
547
+ transport: (0, utils_1.createTransport)(chain, config.provider),
548
+ });
549
+ const account = await getValidatorAccount(config, signers, publicClient, chain);
550
+ if (!account) {
551
+ throw new Error('No account found');
552
+ }
553
+ return await account.signUserOperation(userOp);
554
+ }
555
+ async function submitUserOp(config, chain, userOp, signature) {
556
+ const publicClient = (0, viem_1.createPublicClient)({
557
+ chain,
558
+ transport: (0, utils_1.createTransport)(chain, config.provider),
559
+ });
560
+ const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
561
+ const hash = await bundlerClient.request({
562
+ method: 'eth_sendUserOperation',
563
+ params: [
564
+ {
565
+ sender: userOp.sender,
566
+ nonce: (0, viem_1.toHex)(userOp.nonce),
567
+ factory: userOp.factory,
568
+ factoryData: userOp.factoryData,
569
+ callData: userOp.callData,
570
+ callGasLimit: (0, viem_1.toHex)(userOp.callGasLimit),
571
+ verificationGasLimit: (0, viem_1.toHex)(userOp.verificationGasLimit),
572
+ preVerificationGas: (0, viem_1.toHex)(userOp.preVerificationGas),
573
+ maxPriorityFeePerGas: (0, viem_1.toHex)(userOp.maxPriorityFeePerGas),
574
+ maxFeePerGas: (0, viem_1.toHex)(userOp.maxFeePerGas),
575
+ paymaster: userOp.paymaster,
576
+ paymasterVerificationGasLimit: userOp.paymasterVerificationGasLimit
577
+ ? (0, viem_1.toHex)(userOp.paymasterVerificationGasLimit)
578
+ : undefined,
579
+ paymasterPostOpGasLimit: userOp.paymasterPostOpGasLimit
580
+ ? (0, viem_1.toHex)(userOp.paymasterPostOpGasLimit)
581
+ : undefined,
582
+ paymasterData: userOp.paymasterData,
583
+ signature,
584
+ },
585
+ account_abstraction_1.entryPoint07Address,
586
+ ],
587
+ });
588
+ return {
589
+ type: 'userop',
590
+ hash,
591
+ chain: chain.id,
592
+ };
593
+ }
594
+ async function submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun) {
595
+ return submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun);
596
+ }
597
+ function getOrchestratorByChain(chainId, apiKey, orchestratorUrl) {
598
+ if (orchestratorUrl) {
599
+ return (0, orchestrator_1.getOrchestrator)(apiKey, orchestratorUrl);
600
+ }
601
+ const defaultOrchestratorUrl = (0, registry_1.isTestnet)(chainId)
602
+ ? consts_1.STAGING_ORCHESTRATOR_URL
603
+ : consts_1.PROD_ORCHESTRATOR_URL;
604
+ return (0, orchestrator_1.getOrchestrator)(apiKey, defaultOrchestratorUrl);
605
+ }
606
+ function createSignedIntentOp(intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations) {
607
+ return {
608
+ ...intentOp,
609
+ originSignatures,
610
+ destinationSignature,
611
+ targetExecutionSignature,
612
+ signedAuthorizations: authorizations.length > 0
613
+ ? authorizations.map((authorization) => ({
614
+ chainId: authorization.chainId,
615
+ address: authorization.address,
616
+ nonce: authorization.nonce,
617
+ yParity: authorization.yParity ?? 0,
618
+ r: authorization.r,
619
+ s: authorization.s,
620
+ }))
621
+ : undefined,
622
+ };
623
+ }
624
+ async function submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun) {
625
+ const signedIntentOp = createSignedIntentOp(intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations);
626
+ const orchestrator = getOrchestratorByChain(targetChain.id, config.apiKey, config.endpointUrl);
627
+ const intentResults = await orchestrator.submitIntent(signedIntentOp, dryRun);
628
+ return {
629
+ type: 'intent',
630
+ id: BigInt(intentResults.result.id),
631
+ sourceChains: sourceChains?.map((chain) => chain.id),
632
+ targetChain: targetChain.id,
633
+ };
634
+ }
635
+ async function getValidatorAccount(config, signers, publicClient, chain) {
636
+ if (!signers) {
637
+ return (0, accounts_1.getSmartAccount)(config, publicClient, chain);
638
+ }
639
+ // Owners
640
+ const withOwner = signers.type === 'owner' ? signers : null;
641
+ if (withOwner) {
642
+ return (0, accounts_1.getSmartAccount)(config, publicClient, chain);
643
+ }
644
+ const withGuardians = signers.type === 'guardians' ? signers : null;
645
+ return withGuardians
646
+ ? await (0, accounts_1.getGuardianSmartAccount)(config, publicClient, chain, {
647
+ type: 'ecdsa',
648
+ accounts: withGuardians.guardians,
649
+ })
650
+ : null;
651
+ }
652
+ function getValidator(config, signers) {
653
+ if (!signers) {
654
+ return (0, validators_1.getOwnerValidator)(config);
655
+ }
656
+ // Owners
657
+ const withOwner = signers.type === 'owner' ? signers : null;
658
+ if (withOwner) {
659
+ // ECDSA
660
+ if (withOwner.kind === 'ecdsa') {
661
+ // Use the configured owner validator (e.g., ENS) rather than forcing Ownable
662
+ return (0, validators_1.getOwnerValidator)(config);
663
+ }
664
+ // Passkeys (WebAuthn)
665
+ if (withOwner.kind === 'passkey') {
666
+ return (0, core_1.getWebAuthnValidator)(1, withOwner.accounts.map((account) => ({
667
+ pubKey: account.publicKey,
668
+ authenticatorId: account.id,
669
+ })));
670
+ }
671
+ // Multi-factor
672
+ if (withOwner.kind === 'multi-factor') {
673
+ return (0, core_1.getMultiFactorValidator)(1, withOwner.validators);
674
+ }
675
+ }
676
+ // Smart sessions
677
+ const withSession = signers.type === 'experimental_session';
678
+ if (withSession) {
679
+ return (0, validators_1.getSmartSessionValidator)(config);
680
+ }
681
+ // Guardians (social recovery)
682
+ const withGuardians = signers.type === 'guardians' ? signers : null;
683
+ if (withGuardians) {
684
+ return (0, core_1.getSocialRecoveryValidator)(withGuardians.guardians);
685
+ }
686
+ // Fallback
687
+ return undefined;
688
+ }
689
+ function parseCalls(calls, chainId) {
690
+ return calls.map((call) => ({
691
+ data: call.data ?? '0x',
692
+ value: call.value ?? 0n,
693
+ to: (0, registry_1.resolveTokenAddress)(call.to, chainId),
694
+ }));
695
+ }
696
+ function createAccountAccessList(sourceChains, sourceAssets) {
697
+ if (!sourceChains && !sourceAssets)
698
+ return undefined;
699
+ const chainIds = sourceChains?.map((chain) => chain.id);
700
+ if (!sourceAssets)
701
+ return { chainIds };
702
+ if (Array.isArray(sourceAssets)) {
703
+ const isExactConfig = sourceAssets.length > 0 && typeof sourceAssets[0] !== 'string';
704
+ if (isExactConfig) {
705
+ const resolvedConfigs = sourceAssets.map((config) => ({
706
+ chainId: config.chain.id,
707
+ tokenAddress: (0, registry_1.resolveTokenAddress)(config.address, config.chain.id),
708
+ amount: config.amount,
709
+ }));
710
+ return resolvedConfigs;
711
+ }
712
+ return chainIds
713
+ ? { chainIds, tokens: sourceAssets }
714
+ : { tokens: sourceAssets };
715
+ }
716
+ return { chainTokens: sourceAssets };
717
+ }
718
+ function getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature) {
719
+ const initCode = (0, accounts_1.getInitCode)(config);
720
+ if (config.account?.type === 'eoa') {
721
+ return {
722
+ setupOps: [],
723
+ };
724
+ }
725
+ else if ((0, accounts_1.is7702)(config)) {
726
+ // EIP-7702 initialization is only needed for EOA accounts
727
+ if (!eip7702InitSignature || eip7702InitSignature === '0x') {
728
+ throw new Error('EIP-7702 initialization signature is required for EOA accounts');
729
+ }
730
+ const { initData: eip7702InitData, contract: eip7702Contract } = (0, accounts_1.getEip7702InitCall)(config, eip7702InitSignature);
731
+ return {
732
+ setupOps: [
733
+ {
734
+ to: accountAddress,
735
+ data: eip7702InitData,
736
+ },
737
+ ],
738
+ delegations: {
739
+ 0: {
740
+ contract: eip7702Contract,
741
+ },
742
+ },
743
+ };
744
+ }
745
+ else if (initCode) {
746
+ const to = 'factory' in initCode ? initCode.factory : undefined;
747
+ const data = 'factory' in initCode ? initCode.factoryData : undefined;
748
+ if (!to || !data) {
749
+ throw new accounts_1.FactoryArgsNotAvailableError();
750
+ }
751
+ // Contract account with init code
752
+ return {
753
+ setupOps: [
754
+ {
755
+ to,
756
+ data,
757
+ },
758
+ ],
759
+ };
760
+ }
761
+ else {
762
+ // Already deployed contract account
763
+ return {
764
+ setupOps: [],
765
+ };
766
+ }
767
+ }
768
+ function validateTokenSymbols(chain, tokenAddressOrSymbols) {
769
+ function validateTokenSymbol(chain, addressOrSymbol) {
770
+ // Address
771
+ if ((0, viem_1.isAddress)(addressOrSymbol, { strict: false })) {
772
+ return true;
773
+ }
774
+ // Token symbol
775
+ const address = (0, registry_1.getTokenAddress)(addressOrSymbol, chain.id);
776
+ return (0, viem_1.isAddress)(address, { strict: false });
777
+ }
778
+ for (const addressOrSymbol of tokenAddressOrSymbols) {
779
+ if (!validateTokenSymbol(chain, addressOrSymbol)) {
780
+ throw new Error(`Invalid token symbol: ${addressOrSymbol}`);
781
+ }
782
+ }
783
+ }