@rhinestone/sdk 1.4.2 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +89 -1
  2. package/dist/src/accounts/error.d.ts +1 -1
  3. package/dist/src/accounts/error.js +1 -19
  4. package/dist/src/accounts/index.d.ts +5 -5
  5. package/dist/src/accounts/index.js +121 -157
  6. package/dist/src/accounts/json-rpc/index.d.ts +1 -1
  7. package/dist/src/accounts/json-rpc/index.js +8 -10
  8. package/dist/src/accounts/json-rpc/providers.d.ts +1 -1
  9. package/dist/src/accounts/json-rpc/providers.js +4 -7
  10. package/dist/src/accounts/kernel.d.ts +3 -3
  11. package/dist/src/accounts/kernel.js +66 -75
  12. package/dist/src/accounts/nexus.d.ts +3 -3
  13. package/dist/src/accounts/nexus.js +62 -73
  14. package/dist/src/accounts/passport.d.ts +3 -3
  15. package/dist/src/accounts/passport.js +9 -13
  16. package/dist/src/accounts/safe.d.ts +3 -3
  17. package/dist/src/accounts/safe.js +54 -63
  18. package/dist/src/accounts/signing/common.d.ts +10 -4
  19. package/dist/src/accounts/signing/common.d.ts.map +1 -1
  20. package/dist/src/accounts/signing/common.js +30 -36
  21. package/dist/src/accounts/signing/message.d.ts +2 -2
  22. package/dist/src/accounts/signing/message.js +10 -12
  23. package/dist/src/accounts/signing/passkeys.js +11 -17
  24. package/dist/src/accounts/signing/typedData.d.ts +1 -1
  25. package/dist/src/accounts/signing/typedData.js +6 -8
  26. package/dist/src/accounts/startale.d.ts +3 -3
  27. package/dist/src/accounts/startale.js +37 -47
  28. package/dist/src/accounts/utils.d.ts +2 -2
  29. package/dist/src/accounts/utils.js +22 -28
  30. package/dist/src/accounts/walletClient.js +4 -8
  31. package/dist/src/actions/compact.d.ts +1 -1
  32. package/dist/src/actions/compact.js +22 -35
  33. package/dist/src/actions/deployment.d.ts +1 -1
  34. package/dist/src/actions/deployment.js +11 -13
  35. package/dist/src/actions/ecdsa.d.ts +1 -1
  36. package/dist/src/actions/ecdsa.js +14 -20
  37. package/dist/src/actions/index.d.ts +2 -2
  38. package/dist/src/actions/index.js +6 -10
  39. package/dist/src/actions/mfa.d.ts +1 -1
  40. package/dist/src/actions/mfa.js +18 -24
  41. package/dist/src/actions/passkeys.d.ts +2 -2
  42. package/dist/src/actions/passkeys.js +14 -20
  43. package/dist/src/actions/recovery.d.ts +1 -1
  44. package/dist/src/actions/recovery.js +25 -29
  45. package/dist/src/actions/smart-sessions.d.ts +1 -1
  46. package/dist/src/actions/smart-sessions.js +8 -12
  47. package/dist/src/auth/provider.d.ts +7 -0
  48. package/dist/src/auth/provider.d.ts.map +1 -0
  49. package/dist/src/auth/provider.js +38 -0
  50. package/dist/src/errors/index.d.ts +3 -3
  51. package/dist/src/errors/index.js +10 -54
  52. package/dist/src/execution/compact.d.ts +3 -3
  53. package/dist/src/execution/compact.js +10 -18
  54. package/dist/src/execution/error.js +1 -11
  55. package/dist/src/execution/index.d.ts +9 -8
  56. package/dist/src/execution/index.d.ts.map +1 -1
  57. package/dist/src/execution/index.js +54 -67
  58. package/dist/src/execution/permit2.d.ts +5 -5
  59. package/dist/src/execution/permit2.js +8 -13
  60. package/dist/src/execution/singleChainOps.d.ts +2 -2
  61. package/dist/src/execution/singleChainOps.js +1 -3
  62. package/dist/src/execution/types.d.ts +1 -1
  63. package/dist/src/execution/types.js +1 -2
  64. package/dist/src/execution/utils.d.ts +10 -6
  65. package/dist/src/execution/utils.d.ts.map +1 -1
  66. package/dist/src/execution/utils.js +159 -162
  67. package/dist/src/index.d.ts +10 -10
  68. package/dist/src/index.d.ts.map +1 -1
  69. package/dist/src/index.js +57 -67
  70. package/dist/src/jwt-server/digest.d.ts +11 -0
  71. package/dist/src/jwt-server/digest.d.ts.map +1 -0
  72. package/dist/src/jwt-server/digest.js +19 -0
  73. package/dist/src/jwt-server/express.d.ts +16 -0
  74. package/dist/src/jwt-server/express.d.ts.map +1 -0
  75. package/dist/src/jwt-server/express.js +23 -0
  76. package/dist/src/jwt-server/handlers.d.ts +10 -0
  77. package/dist/src/jwt-server/handlers.d.ts.map +1 -0
  78. package/dist/src/jwt-server/handlers.js +37 -0
  79. package/dist/src/jwt-server/index.d.ts +8 -0
  80. package/dist/src/jwt-server/index.d.ts.map +1 -0
  81. package/dist/src/jwt-server/index.js +7 -0
  82. package/dist/src/jwt-server/jcs.d.ts +12 -0
  83. package/dist/src/jwt-server/jcs.d.ts.map +1 -0
  84. package/dist/src/jwt-server/jcs.js +57 -0
  85. package/dist/src/jwt-server/signer.d.ts +18 -0
  86. package/dist/src/jwt-server/signer.d.ts.map +1 -0
  87. package/dist/src/jwt-server/signer.js +68 -0
  88. package/dist/src/jwt-server/sponsorship.d.ts +19 -0
  89. package/dist/src/jwt-server/sponsorship.d.ts.map +1 -0
  90. package/dist/src/jwt-server/sponsorship.js +51 -0
  91. package/dist/src/jwt-server/web.d.ts +4 -0
  92. package/dist/src/jwt-server/web.d.ts.map +1 -0
  93. package/dist/src/jwt-server/web.js +23 -0
  94. package/dist/src/modules/abi/smart-session-emissary.js +1 -3
  95. package/dist/src/modules/abi/smart-sessions.js +1 -4
  96. package/dist/src/modules/chain-abstraction.js +1 -5
  97. package/dist/src/modules/common.d.ts +1 -1
  98. package/dist/src/modules/common.js +1 -13
  99. package/dist/src/modules/index.d.ts +5 -5
  100. package/dist/src/modules/index.js +35 -50
  101. package/dist/src/modules/legacy.d.ts +2 -2
  102. package/dist/src/modules/legacy.js +11 -14
  103. package/dist/src/modules/read.d.ts +1 -1
  104. package/dist/src/modules/read.js +11 -15
  105. package/dist/src/modules/validators/core.d.ts +2 -2
  106. package/dist/src/modules/validators/core.js +26 -44
  107. package/dist/src/modules/validators/index.d.ts +2 -2
  108. package/dist/src/modules/validators/index.js +3 -19
  109. package/dist/src/modules/validators/policies/claim/permit2.d.ts +1 -1
  110. package/dist/src/modules/validators/policies/claim/permit2.js +39 -44
  111. package/dist/src/modules/validators/policies/claim/types.js +11 -14
  112. package/dist/src/modules/validators/smart-sessions.d.ts +4 -4
  113. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  114. package/dist/src/modules/validators/smart-sessions.js +77 -97
  115. package/dist/src/orchestrator/client.d.ts +10 -5
  116. package/dist/src/orchestrator/client.d.ts.map +1 -1
  117. package/dist/src/orchestrator/client.js +73 -66
  118. package/dist/src/orchestrator/consts.d.ts +1 -1
  119. package/dist/src/orchestrator/consts.d.ts.map +1 -1
  120. package/dist/src/orchestrator/consts.js +2 -8
  121. package/dist/src/orchestrator/error.js +1 -33
  122. package/dist/src/orchestrator/index.d.ts +8 -7
  123. package/dist/src/orchestrator/index.d.ts.map +1 -1
  124. package/dist/src/orchestrator/index.js +8 -57
  125. package/dist/src/orchestrator/registry.d.ts +2 -2
  126. package/dist/src/orchestrator/registry.js +19 -33
  127. package/dist/src/orchestrator/types.d.ts +5 -1
  128. package/dist/src/orchestrator/types.d.ts.map +1 -1
  129. package/dist/src/orchestrator/types.js +1 -17
  130. package/dist/src/orchestrator/utils.js +1 -3
  131. package/dist/src/types.d.ts +29 -5
  132. package/dist/src/types.d.ts.map +1 -1
  133. package/dist/src/types.js +1 -2
  134. package/dist/src/utils/index.d.ts +2 -2
  135. package/dist/src/utils/index.js +9 -15
  136. package/package.json +29 -98
  137. package/dist/src/accounts/index.test.d.ts +0 -2
  138. package/dist/src/accounts/index.test.d.ts.map +0 -1
  139. package/dist/src/accounts/index.test.js +0 -33
  140. package/dist/src/accounts/json-rpc/index.test.d.ts +0 -2
  141. package/dist/src/accounts/json-rpc/index.test.d.ts.map +0 -1
  142. package/dist/src/accounts/json-rpc/index.test.js +0 -35
  143. package/dist/src/accounts/json-rpc/providers.test.d.ts +0 -2
  144. package/dist/src/accounts/json-rpc/providers.test.d.ts.map +0 -1
  145. package/dist/src/accounts/json-rpc/providers.test.js +0 -43
  146. package/dist/src/accounts/kernel.test.d.ts +0 -2
  147. package/dist/src/accounts/kernel.test.d.ts.map +0 -1
  148. package/dist/src/accounts/kernel.test.js +0 -132
  149. package/dist/src/accounts/nexus.test.d.ts +0 -2
  150. package/dist/src/accounts/nexus.test.d.ts.map +0 -1
  151. package/dist/src/accounts/nexus.test.js +0 -118
  152. package/dist/src/accounts/safe.test.d.ts +0 -2
  153. package/dist/src/accounts/safe.test.d.ts.map +0 -1
  154. package/dist/src/accounts/safe.test.js +0 -168
  155. package/dist/src/accounts/signing/passkeys.test.d.ts +0 -2
  156. package/dist/src/accounts/signing/passkeys.test.d.ts.map +0 -1
  157. package/dist/src/accounts/signing/passkeys.test.js +0 -88
  158. package/dist/src/accounts/startale.test.d.ts +0 -2
  159. package/dist/src/accounts/startale.test.d.ts.map +0 -1
  160. package/dist/src/accounts/startale.test.js +0 -189
  161. package/dist/src/accounts/utils.test.d.ts +0 -2
  162. package/dist/src/accounts/utils.test.d.ts.map +0 -1
  163. package/dist/src/accounts/utils.test.js +0 -49
  164. package/dist/src/actions/ecdsa.test.d.ts +0 -2
  165. package/dist/src/actions/ecdsa.test.d.ts.map +0 -1
  166. package/dist/src/actions/ecdsa.test.js +0 -99
  167. package/dist/src/actions/passkeys.test.d.ts +0 -2
  168. package/dist/src/actions/passkeys.test.d.ts.map +0 -1
  169. package/dist/src/actions/passkeys.test.js +0 -54
  170. package/dist/src/actions/recovery.test.d.ts +0 -2
  171. package/dist/src/actions/recovery.test.d.ts.map +0 -1
  172. package/dist/src/actions/recovery.test.js +0 -168
  173. package/dist/src/execution/signing.test.d.ts +0 -2
  174. package/dist/src/execution/signing.test.d.ts.map +0 -1
  175. package/dist/src/execution/signing.test.js +0 -465
  176. package/dist/src/execution/utils.test.d.ts +0 -2
  177. package/dist/src/execution/utils.test.d.ts.map +0 -1
  178. package/dist/src/execution/utils.test.js +0 -388
  179. package/dist/src/modules/index.test.d.ts +0 -2
  180. package/dist/src/modules/index.test.d.ts.map +0 -1
  181. package/dist/src/modules/index.test.js +0 -81
  182. package/dist/src/modules/validators/core.test.d.ts +0 -2
  183. package/dist/src/modules/validators/core.test.d.ts.map +0 -1
  184. package/dist/src/modules/validators/core.test.js +0 -101
  185. package/dist/src/modules/validators/policies/claim/permit2.test.d.ts +0 -2
  186. package/dist/src/modules/validators/policies/claim/permit2.test.d.ts.map +0 -1
  187. package/dist/src/modules/validators/policies/claim/permit2.test.js +0 -519
  188. package/dist/src/modules/validators/smart-sessions.test.d.ts +0 -2
  189. package/dist/src/modules/validators/smart-sessions.test.d.ts.map +0 -1
  190. package/dist/src/modules/validators/smart-sessions.test.js +0 -311
  191. package/dist/src/orchestrator/registry.test.d.ts +0 -2
  192. package/dist/src/orchestrator/registry.test.d.ts.map +0 -1
  193. package/dist/src/orchestrator/registry.test.js +0 -154
  194. package/dist/src/utils/index.test.d.ts +0 -2
  195. package/dist/src/utils/index.test.d.ts.map +0 -1
  196. package/dist/src/utils/index.test.js +0 -42
  197. package/dist/test/consts.d.ts +0 -10
  198. package/dist/test/consts.d.ts.map +0 -1
  199. package/dist/test/consts.js +0 -22
  200. package/dist/test/utils/utils.d.ts +0 -5
  201. package/dist/test/utils/utils.d.ts.map +0 -1
  202. package/dist/test/utils/utils.js +0 -20
@@ -1,45 +1,23 @@
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.signIntent = signIntent;
15
- exports.prepareTransactionAsIntent = prepareTransactionAsIntent;
16
- exports.submitIntentInternal = submitIntentInternal;
17
- exports.getValidatorAccount = getValidatorAccount;
18
- exports.parseCalls = parseCalls;
19
- exports.getTokenRequests = getTokenRequests;
20
- exports.resolveCallInputs = resolveCallInputs;
21
- exports.getIntentAccount = getIntentAccount;
22
- exports.getTargetExecutionSignature = getTargetExecutionSignature;
23
- exports.hashErc7739TypedDataForSolady = hashErc7739TypedDataForSolady;
24
- exports.resolveSessionForChain = resolveSessionForChain;
25
- const viem_1 = require("viem");
26
- const account_abstraction_1 = require("viem/account-abstraction");
27
- const erc7739_1 = require("viem/experimental/erc7739");
28
- const accounts_1 = require("../accounts");
29
- const common_1 = require("../accounts/signing/common");
30
- const startale_1 = require("../accounts/startale");
31
- const utils_1 = require("../accounts/utils");
32
- const modules_1 = require("../modules");
33
- const validators_1 = require("../modules/validators");
34
- const core_1 = require("../modules/validators/core");
35
- const permit2_1 = require("../modules/validators/policies/claim/permit2");
36
- const orchestrator_1 = require("../orchestrator");
37
- const registry_1 = require("../orchestrator/registry");
38
- const types_1 = require("../orchestrator/types");
39
- const compact_1 = require("./compact");
40
- const error_1 = require("./error");
41
- const permit2_2 = require("./permit2");
42
- const singleChainOps_1 = require("./singleChainOps");
1
+ import { concat, createPublicClient, createWalletClient, encodeAbiParameters, encodePacked, hashDomain, hashMessage, hashStruct, hashTypedData, isAddress, keccak256, publicActions, toHex, } from 'viem';
2
+ import { entryPoint07Address, getUserOperationHash, } from 'viem/account-abstraction';
3
+ import { wrapTypedDataSignature } from 'viem/experimental/erc7739';
4
+ import { EoaAccountMustHaveAccountError, EoaSigningMethodNotConfiguredError, FactoryArgsNotAvailableError, getAccountProvider, getAddress, getEip712Domain, getEip1271Signature, getEip7702InitCall, getEmissarySignature, getGuardianSmartAccount, getInitCode, getSmartAccount, getTypedDataPackedSignature, is7702, toErc6492Signature, } from '../accounts/index.js';
5
+ import { convertOwnerSetToSignerSet } from '../accounts/signing/common.js';
6
+ import { K1_DEFAULT_VALIDATOR_ADDRESS } from '../accounts/startale.js';
7
+ import { createTransport, getBundlerClient, } from '../accounts/utils.js';
8
+ import { createAuthProvider } from '../auth/provider.js';
9
+ import { getIntentExecutor } from '../modules/index.js';
10
+ import { buildMockSignature, DUMMY_PRECLAIMOP_SELECTOR, DUMMY_PRECLAIMOP_TARGET, getOwnerValidator, getPermissionId, getSmartSessionValidator, isSessionEnabled, } from '../modules/validators/index.js';
11
+ import { getMultiFactorValidator, getSocialRecoveryValidator, getWebAuthnValidator, supportsEip712, } from '../modules/validators/core.js';
12
+ import { buildPermit2ClaimPolicyCalldata } from '../modules/validators/policies/claim/permit2.js';
13
+ import { getOrchestrator, } from '../orchestrator/index.js';
14
+ import { getChainById, getTokenAddress, resolveTokenAddress, } from '../orchestrator/registry.js';
15
+ import { SIG_MODE_EMISSARY_EXECUTION_ERC1271, SIG_MODE_ERC1271_EMISSARY, } from '../orchestrator/types.js';
16
+ import { convertBigIntFields } from '../orchestrator/utils.js';
17
+ import { getCompactTypedData } from './compact.js';
18
+ import { Eip7702InitSignatureRequiredError, SignerNotSupportedError, } from './error.js';
19
+ import { getTypedData as getPermit2TypedData } from './permit2.js';
20
+ import { getTypedData as getSingleChainOpsTypedData } from './singleChainOps.js';
43
21
  function isResolvedSessionSignerSet(signers) {
44
22
  return (signers?.type === 'experimental_session' && 'verifyExecutions' in signers);
45
23
  }
@@ -48,7 +26,7 @@ async function resolveSignersForChain(config, signers, chainId) {
48
26
  return signers;
49
27
  }
50
28
  const resolved = resolveSessionForChain(signers, chainId);
51
- const enabled = await (0, validators_1.isSessionEnabled)((0, accounts_1.getAddress)(config), config.provider, resolved.session, config.useDevContracts);
29
+ const enabled = await isSessionEnabled(getAddress(config), config.provider, resolved.session, config.useDevContracts);
52
30
  const enableData = enabled ? undefined : resolved.enableData;
53
31
  const hasExplicitActions = !!resolved.session.actions?.length;
54
32
  const verifyExecutions = resolved.verifyExecutions ?? signers.verifyExecutions ?? hasExplicitActions;
@@ -71,21 +49,22 @@ function resolveSessionForChain(signers, chainId) {
71
49
  }
72
50
  async function prepareTransaction(config, transaction) {
73
51
  const { sourceChains, targetChain, tokenRequests, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, auxiliaryFunds, account, recipient, } = getTransactionParams(transaction);
74
- const accountAddress = (0, accounts_1.getAddress)(config);
52
+ const accountAddress = getAddress(config);
75
53
  const isUserOpSigner = signers?.type === 'guardians';
76
54
  if (isUserOpSigner) {
77
- throw new error_1.SignerNotSupportedError();
55
+ throw new SignerNotSupportedError();
78
56
  }
79
- const intentRoute = await prepareTransactionAsIntent(config, sourceChains, targetChain, await resolveCallInputs(transaction.calls, config, targetChain, accountAddress), transaction.gasLimit, tokenRequests, recipient, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, auxiliaryFunds, account, signers);
57
+ const prepared = await prepareTransactionAsIntent(config, sourceChains, targetChain, await resolveCallInputs(transaction.calls, config, targetChain, accountAddress), transaction.gasLimit, tokenRequests, recipient, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, lockFunds, auxiliaryFunds, account, signers);
80
58
  return {
81
- intentRoute,
59
+ intentRoute: prepared.intentRoute,
60
+ intentInput: prepared.intentInput,
82
61
  transaction,
83
62
  };
84
63
  }
85
64
  async function prepareUserOperation(config, transaction) {
86
65
  const chain = transaction.chain;
87
66
  const signers = transaction.signers;
88
- const accountAddress = (0, accounts_1.getAddress)(config);
67
+ const accountAddress = getAddress(config);
89
68
  const data = await prepareTransactionAsUserOp(config, chain, await resolveCallInputs(transaction.calls, config, chain, accountAddress), signers, transaction.gasLimit);
90
69
  return {
91
70
  userOperation: data.userOp,
@@ -127,6 +106,7 @@ async function signTransaction(config, preparedTransaction) {
127
106
  const targetExecutionSignature = await getTargetExecutionSignature(config, intentRoute.intentOp, targetChain, signers);
128
107
  return {
129
108
  intentRoute,
109
+ intentInput: preparedTransaction.intentInput,
130
110
  transaction: preparedTransaction.transaction,
131
111
  originSignatures,
132
112
  destinationSignature,
@@ -152,7 +132,7 @@ async function getTargetExecutionSignature(config, intentOp, targetChain, signer
152
132
  if (!validator) {
153
133
  throw new Error('Validator not available');
154
134
  }
155
- const ownerValidator = (0, validators_1.getOwnerValidator)(config);
135
+ const ownerValidator = getOwnerValidator(config);
156
136
  const isRoot = validator.address === ownerValidator.address;
157
137
  const signature = await getDestinationSignature(config, resolvedSigners, validator, isRoot, targetChain, destination, [], true);
158
138
  return signature;
@@ -178,21 +158,21 @@ async function signMessage(config, message, chain, signers) {
178
158
  if (!validator) {
179
159
  throw new Error('Validator not available');
180
160
  }
181
- const ownerValidator = (0, validators_1.getOwnerValidator)(config);
161
+ const ownerValidator = getOwnerValidator(config);
182
162
  const isRoot = validator.address === ownerValidator.address;
183
- const hash = (0, viem_1.hashMessage)(message);
184
- const signature = await (0, accounts_1.getEip1271Signature)(config, signers, chain, {
163
+ const hash = hashMessage(message);
164
+ const signature = await getEip1271Signature(config, signers, chain, {
185
165
  address: validator.address,
186
166
  isRoot,
187
167
  }, hash);
188
- return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
168
+ return await toErc6492Signature(config, signature, chain);
189
169
  }
190
170
  async function signTypedData(config, parameters, chain, signers, options) {
191
171
  const validator = getValidator(config, signers);
192
172
  if (!validator) {
193
173
  throw new Error('Validator not available');
194
174
  }
195
- const ownerValidator = (0, validators_1.getOwnerValidator)(config);
175
+ const ownerValidator = getOwnerValidator(config);
196
176
  const isRoot = validator.address === ownerValidator.address;
197
177
  if (signers?.type === 'experimental_session') {
198
178
  const resolved = resolveSessionForChain(signers, chain.id);
@@ -201,31 +181,31 @@ async function signTypedData(config, parameters, chain, signers, options) {
201
181
  isRoot,
202
182
  }, resolved.session, parameters);
203
183
  }
204
- const account = (0, accounts_1.getAccountProvider)(config);
205
- if (account.type === 'startale' && (0, core_1.supportsEip712)(validator)) {
184
+ const account = getAccountProvider(config);
185
+ if (account.type === 'startale' && supportsEip712(validator)) {
206
186
  const isK1 = validator.address.toLowerCase() ===
207
- startale_1.K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
187
+ K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
208
188
  if (isK1) {
209
189
  const sig = await signErc7739TypedData(config, signers, validator, isRoot, parameters, chain);
210
190
  if (!options?.skipErc6492) {
211
- return await (0, accounts_1.toErc6492Signature)(config, sig, chain);
191
+ return await toErc6492Signature(config, sig, chain);
212
192
  }
213
193
  return sig;
214
194
  }
215
195
  }
216
- const signature = await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, {
196
+ const signature = await getTypedDataPackedSignature(config, signers, chain, {
217
197
  address: validator.address,
218
198
  isRoot,
219
199
  }, parameters);
220
200
  if (!options?.skipErc6492) {
221
- return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
201
+ return await toErc6492Signature(config, signature, chain);
222
202
  }
223
203
  return signature;
224
204
  }
225
205
  async function signTypedDataWithSession(config, chain, validator, session, parameters) {
226
- const { name, version, chainId, verifyingContract, salt } = (0, accounts_1.getEip712Domain)(config, chain);
227
- const signers = (0, common_1.convertOwnerSetToSignerSet)(session.owners);
228
- const signature = await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, validator, {
206
+ const { name, version, chainId, verifyingContract, salt } = getEip712Domain(config, chain);
207
+ const signers = convertOwnerSetToSignerSet(session.owners);
208
+ const signature = await getTypedDataPackedSignature(config, signers, chain, validator, {
229
209
  domain: parameters.domain,
230
210
  primaryType: 'TypedDataSign',
231
211
  types: {
@@ -248,39 +228,39 @@ async function signTypedDataWithSession(config, chain, validator, session, param
248
228
  salt,
249
229
  },
250
230
  }, (signature) => {
251
- const erc7739Signature = (0, erc7739_1.wrapTypedDataSignature)({
231
+ const erc7739Signature = wrapTypedDataSignature({
252
232
  domain: parameters.domain,
253
233
  primaryType: parameters.primaryType,
254
234
  types: parameters.types,
255
235
  message: parameters.message,
256
236
  signature,
257
237
  });
258
- return (0, viem_1.encodePacked)(['bytes32', 'bytes'], [(0, validators_1.getPermissionId)(session), erc7739Signature]);
238
+ return encodePacked(['bytes32', 'bytes'], [getPermissionId(session), erc7739Signature]);
259
239
  });
260
- return await (0, accounts_1.toErc6492Signature)(config, signature, chain);
240
+ return await toErc6492Signature(config, signature, chain);
261
241
  }
262
242
  async function signAuthorizationsInternal(config, data) {
263
243
  const eoa = config.eoa;
264
244
  if (!eoa) {
265
245
  throw new Error('EIP-7702 initialization is required for EOA accounts');
266
246
  }
267
- const accountAddress = (0, accounts_1.getAddress)(config);
247
+ const accountAddress = getAddress(config);
268
248
  const requiredDelegations = 'intentOp' in data
269
249
  ? data.intentOp.signedMetadata.account.requiredDelegations || {}
270
250
  : {};
271
251
  const authorizations = [];
272
252
  for (const chainId in requiredDelegations) {
273
253
  const delegation = requiredDelegations[chainId];
274
- const chain = (0, registry_1.getChainById)(Number(chainId));
275
- const walletClient = (0, viem_1.createWalletClient)({
254
+ const chain = getChainById(Number(chainId));
255
+ const walletClient = createWalletClient({
276
256
  chain,
277
257
  account: eoa,
278
- transport: (0, utils_1.createTransport)(chain, config.provider),
279
- }).extend(viem_1.publicActions);
258
+ transport: createTransport(chain, config.provider),
259
+ }).extend(publicActions);
280
260
  const code = await walletClient.getCode({
281
261
  address: accountAddress,
282
262
  });
283
- const isDelegated = code === (0, viem_1.concat)(['0xef0100', delegation.contract.toLowerCase()]);
263
+ const isDelegated = code === concat(['0xef0100', delegation.contract.toLowerCase()]);
284
264
  if (isDelegated) {
285
265
  continue;
286
266
  }
@@ -293,10 +273,10 @@ async function signAuthorizationsInternal(config, data) {
293
273
  return authorizations;
294
274
  }
295
275
  async function submitTransaction(config, signedTransaction, authorizations, dryRun = false) {
296
- const { intentRoute, transaction, originSignatures, destinationSignature, targetExecutionSignature, } = signedTransaction;
276
+ const { intentRoute, intentInput, transaction, originSignatures, destinationSignature, targetExecutionSignature, } = signedTransaction;
297
277
  const { sourceChains, targetChain } = getTransactionParams(transaction);
298
278
  const intentOp = intentRoute.intentOp;
299
- return await submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun);
279
+ return await submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun, intentInput);
300
280
  }
301
281
  async function submitUserOperation(config, signedUserOperation) {
302
282
  const chain = signedUserOperation.transaction.chain;
@@ -345,15 +325,15 @@ function getTokenRequests(targetChain, initialTokenRequests) {
345
325
  return initialTokenRequests ?? [];
346
326
  }
347
327
  async function prepareTransactionAsUserOp(config, chain, callInputs, signers, gasLimit) {
348
- const publicClient = (0, viem_1.createPublicClient)({
328
+ const publicClient = createPublicClient({
349
329
  chain,
350
- transport: (0, utils_1.createTransport)(chain, config.provider),
330
+ transport: createTransport(chain, config.provider),
351
331
  });
352
332
  const validatorAccount = await getValidatorAccount(config, signers, publicClient, chain);
353
333
  if (!validatorAccount) {
354
334
  throw new Error('No validator account found');
355
335
  }
356
- const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
336
+ const bundlerClient = getBundlerClient(config, publicClient);
357
337
  const calls = parseCalls(callInputs, chain.id);
358
338
  const userOp = await bundlerClient.prepareUserOperation({
359
339
  account: validatorAccount,
@@ -362,10 +342,10 @@ async function prepareTransactionAsUserOp(config, chain, callInputs, signers, ga
362
342
  });
363
343
  return {
364
344
  userOp,
365
- hash: (0, account_abstraction_1.getUserOperationHash)({
345
+ hash: getUserOperationHash({
366
346
  userOperation: userOp,
367
347
  chainId: chain.id,
368
- entryPointAddress: account_abstraction_1.entryPoint07Address,
348
+ entryPointAddress: entryPoint07Address,
369
349
  entryPointVersion: '0.7',
370
350
  }),
371
351
  };
@@ -379,7 +359,7 @@ function getAccountType(accountConfig) {
379
359
  }
380
360
  }
381
361
  function getIntentAccount(config, eip7702InitSignature, account) {
382
- const accountAddress = (0, accounts_1.getAddress)(config);
362
+ const accountAddress = getAddress(config);
383
363
  const accountType = getAccountType(config.account);
384
364
  const { setupOps, delegations } = getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature);
385
365
  return {
@@ -410,13 +390,24 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
410
390
  const intentAccount = {
411
391
  ...getIntentAccount(config, eip7702InitSignature, account),
412
392
  ...(signers?.type === 'experimental_session' && {
413
- mockSignature: (0, validators_1.buildMockSignature)(resolveSessionForChain(signers, targetChain.id).session, config.useDevContracts, sourceChains?.length),
393
+ // Global fallback: target-chain sig for backward-compat with older orchestrators
394
+ mockSignature: buildMockSignature(resolveSessionForChain(signers, targetChain.id).session, config.useDevContracts, sourceChains?.length ?? 1),
395
+ // Per-chain map: enables accurate per-chain session validation gas simulation
396
+ mockSignatures: Object.fromEntries([
397
+ ...new Set([
398
+ ...(sourceChains ?? []).map((c) => c.id),
399
+ targetChain.id,
400
+ ]),
401
+ ].map((chainId) => [
402
+ String(chainId),
403
+ buildMockSignature(resolveSessionForChain(signers, chainId).session, config.useDevContracts, sourceChains?.length ?? 1, chainId),
404
+ ])),
414
405
  }),
415
406
  };
416
407
  const recipient = getRecipient(recipientInput);
417
408
  const signatureMode = signers?.type === 'experimental_session'
418
- ? types_1.SIG_MODE_EMISSARY_EXECUTION_ERC1271
419
- : types_1.SIG_MODE_ERC1271_EMISSARY;
409
+ ? SIG_MODE_EMISSARY_EXECUTION_ERC1271
410
+ : SIG_MODE_ERC1271_EMISSARY;
420
411
  // For session signers that need enabling, pass a dummy preclaimop per source chain
421
412
  // so the orchestrator bakes it into the bundle before computing its HMAC. The filler
422
413
  // executes the op via verifyExecution in ENABLE mode, enabling the session on-chain
@@ -436,9 +427,9 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
436
427
  continue;
437
428
  preClaimExecutions[chainId] = [
438
429
  {
439
- to: validators_1.DUMMY_PRECLAIMOP_TARGET,
430
+ to: DUMMY_PRECLAIMOP_TARGET,
440
431
  value: 0n,
441
- data: validators_1.DUMMY_PRECLAIMOP_SELECTOR,
432
+ data: DUMMY_PRECLAIMOP_SELECTOR,
442
433
  },
443
434
  ];
444
435
  }
@@ -446,7 +437,7 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
446
437
  const metaIntent = {
447
438
  destinationChainId: targetChain.id,
448
439
  tokenRequests: tokenRequests.map((tokenRequest) => ({
449
- tokenAddress: (0, registry_1.resolveTokenAddress)(tokenRequest.address, targetChain.id),
440
+ tokenAddress: resolveTokenAddress(tokenRequest.address, targetChain.id),
450
441
  amount: tokenRequest.amount,
451
442
  })),
452
443
  recipient,
@@ -476,16 +467,17 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
476
467
  },
477
468
  ...(Object.keys(preClaimExecutions).length > 0 && { preClaimExecutions }),
478
469
  };
479
- const orchestrator = (0, orchestrator_1.getOrchestrator)(config.apiKey, config.endpointUrl, config.headers);
470
+ const serializedIntent = convertBigIntFields(metaIntent);
471
+ const orchestrator = getOrchestrator(config._authProvider ?? createAuthProvider(config), config.endpointUrl, config.headers);
480
472
  const intentRoute = await orchestrator.getIntentRoute(metaIntent);
481
- return intentRoute;
473
+ return { intentRoute, intentInput: serializedIntent };
482
474
  }
483
475
  async function signIntent(config, intentOp, targetChain, signers, targetExecution) {
484
476
  const { origin, destination } = getIntentMessages(config, intentOp);
485
477
  if (config.account?.type === 'eoa') {
486
478
  const eoa = config.eoa;
487
479
  if (!eoa) {
488
- throw new accounts_1.EoaAccountMustHaveAccountError();
480
+ throw new EoaAccountMustHaveAccountError();
489
481
  }
490
482
  const originSignatures = [];
491
483
  for (const typedData of origin) {
@@ -494,7 +486,7 @@ async function signIntent(config, intentOp, targetChain, signers, targetExecutio
494
486
  originSignatures.push(signature);
495
487
  }
496
488
  else {
497
- throw new accounts_1.EoaSigningMethodNotConfiguredError('signTypedData');
489
+ throw new EoaSigningMethodNotConfiguredError('signTypedData');
498
490
  }
499
491
  }
500
492
  const destinationSignature = originSignatures.at(-1);
@@ -507,11 +499,11 @@ async function signIntent(config, intentOp, targetChain, signers, targetExecutio
507
499
  if (!validator) {
508
500
  throw new Error('Validator not available');
509
501
  }
510
- const ownerValidator = (0, validators_1.getOwnerValidator)(config);
502
+ const ownerValidator = getOwnerValidator(config);
511
503
  const isRoot = validator.address === ownerValidator.address;
512
504
  const originSignatures = [];
513
505
  for (const typedData of origin) {
514
- const chain = (0, registry_1.getChainById)(typedData.domain?.chainId);
506
+ const chain = getChainById(typedData.domain?.chainId);
515
507
  const originSigners = await resolveSignersForChain(config, signers, chain.id);
516
508
  const signature = await signIntentTypedData(config, originSigners, validator, isRoot, typedData, chain, targetExecution ?? false);
517
509
  originSignatures.push(signature);
@@ -533,8 +525,8 @@ async function getDestinationSignature(config, signers, validator, isRoot, targe
533
525
  // the account's eip712Domain() returns the target chain's chainId, which differs
534
526
  // from the origin chain used for the last origin signature
535
527
  const isK1Validator = validator.address.toLowerCase() ===
536
- startale_1.K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
537
- if (isK1Validator && (0, core_1.supportsEip712)(validator)) {
528
+ K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
529
+ if (isK1Validator && supportsEip712(validator)) {
538
530
  return await signDestinationSeparately(config, signers, validator, isRoot, targetChain, destination, targetExecution);
539
531
  }
540
532
  const lastOriginSignature = originSignatures.at(-1);
@@ -543,30 +535,30 @@ async function getDestinationSignature(config, signers, validator, isRoot, targe
543
535
  : (lastOriginSignature ?? '0x');
544
536
  }
545
537
  async function signDestinationSeparately(config, signers, validator, isRoot, targetChain, destination, targetExecution) {
546
- const destinationChain = (0, registry_1.getChainById)(targetChain.id);
538
+ const destinationChain = getChainById(targetChain.id);
547
539
  const destinationSignatures = await signIntentTypedData(config, signers, validator, isRoot, destination, destinationChain, targetExecution);
548
540
  return typeof destinationSignatures === 'object'
549
541
  ? destinationSignatures.preClaimSig
550
542
  : (destinationSignatures ?? '0x');
551
543
  }
552
544
  function getIntentMessages(config, intentOp) {
553
- const address = (0, accounts_1.getAddress)(config);
554
- const intentExecutor = (0, modules_1.getIntentExecutor)(config);
545
+ const address = getAddress(config);
546
+ const intentExecutor = getIntentExecutor(config);
555
547
  const withPermit2 = intentOp.elements.some((element) => element.mandate.qualifier.settlementContext.fundingMethod === 'PERMIT2');
556
548
  const withIntentExecutorOps = intentOp.elements.some((element) => element.mandate.qualifier.settlementContext.settlementLayer ===
557
549
  'INTENT_EXECUTOR');
558
550
  const origin = [];
559
551
  for (const element of intentOp.elements) {
560
552
  if (withIntentExecutorOps) {
561
- const typedData = (0, singleChainOps_1.getTypedData)(address, intentExecutor.address, element, BigInt(intentOp.nonce));
553
+ const typedData = getSingleChainOpsTypedData(address, intentExecutor.address, element, BigInt(intentOp.nonce));
562
554
  origin.push(typedData);
563
555
  }
564
556
  else if (withPermit2) {
565
- const typedData = (0, permit2_2.getTypedData)(element, BigInt(intentOp.nonce), BigInt(intentOp.expires));
557
+ const typedData = getPermit2TypedData(element, BigInt(intentOp.nonce), BigInt(intentOp.expires));
566
558
  origin.push(typedData);
567
559
  }
568
560
  else {
569
- const typedData = (0, compact_1.getCompactTypedData)(intentOp);
561
+ const typedData = getCompactTypedData(intentOp);
570
562
  origin.push(typedData);
571
563
  }
572
564
  }
@@ -577,10 +569,10 @@ function getIntentMessages(config, intentOp) {
577
569
  };
578
570
  }
579
571
  function getTargetExecutionMessage(config, intentOp) {
580
- const address = (0, accounts_1.getAddress)(config);
581
- const intentExecutor = (0, modules_1.getIntentExecutor)(config);
572
+ const address = getAddress(config);
573
+ const intentExecutor = getIntentExecutor(config);
582
574
  const lastElement = intentOp.elements.at(-1);
583
- const typedData = (0, singleChainOps_1.getTypedData)(address, intentExecutor.address, lastElement, BigInt(intentOp.targetExecutionNonce));
575
+ const typedData = getSingleChainOpsTypedData(address, intentExecutor.address, lastElement, BigInt(intentOp.targetExecutionNonce));
584
576
  typedData.message.gasRefund = typedData.message.gasRefund ?? {
585
577
  token: '0x0000000000000000000000000000000000000000',
586
578
  exchangeRate: 0n,
@@ -602,21 +594,21 @@ function resolveClaimPolicyData(signers, parameters) {
602
594
  typeof msg.deadline !== 'bigint') {
603
595
  return undefined;
604
596
  }
605
- return (0, permit2_1.buildPermit2ClaimPolicyCalldata)(signers.session.claimPolicies[0], parameters.message);
597
+ return buildPermit2ClaimPolicyCalldata(signers.session.claimPolicies[0], parameters.message);
606
598
  }
607
599
  async function signIntentTypedData(config, signers, validator, isRoot, parameters, chain, targetExecution) {
608
- if ((0, core_1.supportsEip712)(validator)) {
600
+ if (supportsEip712(validator)) {
609
601
  const isK1Validator = validator.address.toLowerCase() ===
610
- startale_1.K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
602
+ K1_DEFAULT_VALIDATOR_ADDRESS.toLowerCase();
611
603
  if (isK1Validator) {
612
604
  return await signErc7739TypedData(config, signers, validator, isRoot, parameters, chain);
613
605
  }
614
- return await (0, accounts_1.getTypedDataPackedSignature)(config, signers, chain, {
606
+ return await getTypedDataPackedSignature(config, signers, chain, {
615
607
  address: validator.address,
616
608
  isRoot,
617
609
  }, parameters);
618
610
  }
619
- const hash = (0, viem_1.hashTypedData)(parameters);
611
+ const hash = hashTypedData(parameters);
620
612
  if (isResolvedSessionSignerSet(signers) && signers.verifyExecutions) {
621
613
  if (targetExecution) {
622
614
  const targetSigners = {
@@ -627,7 +619,7 @@ async function signIntentTypedData(config, signers, validator, isRoot, parameter
627
619
  };
628
620
  // signWithSession (called inside getEmissarySignature) already calls packSignature
629
621
  // internally, so no transform is needed here
630
- return await (0, accounts_1.getEmissarySignature)(config, targetSigners, chain, hash);
622
+ return await getEmissarySignature(config, targetSigners, chain, hash);
631
623
  }
632
624
  const claimPolicyData = resolveClaimPolicyData(signers, parameters);
633
625
  const sessionSignersForEip1271 = {
@@ -637,11 +629,11 @@ async function signIntentTypedData(config, signers, validator, isRoot, parameter
637
629
  enableData: signers.enableData,
638
630
  claimPolicyData,
639
631
  };
640
- const eip1271Signature = await (0, accounts_1.getEip1271Signature)(config, sessionSignersForEip1271, chain, {
632
+ const eip1271Signature = await getEip1271Signature(config, sessionSignersForEip1271, chain, {
641
633
  address: validator.address,
642
634
  isRoot,
643
635
  }, hash);
644
- const emissarySignature = await (0, accounts_1.getEmissarySignature)(config, {
636
+ const emissarySignature = await getEmissarySignature(config, {
645
637
  type: 'experimental_session',
646
638
  session: signers.session,
647
639
  verifyExecutions: true,
@@ -654,12 +646,12 @@ async function signIntentTypedData(config, signers, validator, isRoot, parameter
654
646
  }
655
647
  if (isResolvedSessionSignerSet(signers)) {
656
648
  const claimPolicyData = resolveClaimPolicyData(signers, parameters);
657
- return await (0, accounts_1.getEip1271Signature)(config, claimPolicyData !== undefined ? { ...signers, claimPolicyData } : signers, chain, {
649
+ return await getEip1271Signature(config, claimPolicyData !== undefined ? { ...signers, claimPolicyData } : signers, chain, {
658
650
  address: validator.address,
659
651
  isRoot,
660
652
  }, hash);
661
653
  }
662
- return await (0, accounts_1.getEip1271Signature)(config, signers, chain, {
654
+ return await getEip1271Signature(config, signers, chain, {
663
655
  address: validator.address,
664
656
  isRoot,
665
657
  }, hash);
@@ -669,9 +661,9 @@ async function signUserOp(config, chain, signers, userOp) {
669
661
  if (!validator) {
670
662
  throw new Error('Validator not available');
671
663
  }
672
- const publicClient = (0, viem_1.createPublicClient)({
664
+ const publicClient = createPublicClient({
673
665
  chain,
674
- transport: (0, utils_1.createTransport)(chain, config.provider),
666
+ transport: createTransport(chain, config.provider),
675
667
  });
676
668
  const account = await getValidatorAccount(config, signers, publicClient, chain);
677
669
  if (!account) {
@@ -680,36 +672,36 @@ async function signUserOp(config, chain, signers, userOp) {
680
672
  return await account.signUserOperation(userOp);
681
673
  }
682
674
  async function submitUserOp(config, chain, userOp, signature) {
683
- const publicClient = (0, viem_1.createPublicClient)({
675
+ const publicClient = createPublicClient({
684
676
  chain,
685
- transport: (0, utils_1.createTransport)(chain, config.provider),
677
+ transport: createTransport(chain, config.provider),
686
678
  });
687
- const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
679
+ const bundlerClient = getBundlerClient(config, publicClient);
688
680
  const hash = await bundlerClient.request({
689
681
  method: 'eth_sendUserOperation',
690
682
  params: [
691
683
  {
692
684
  sender: userOp.sender,
693
- nonce: (0, viem_1.toHex)(userOp.nonce),
685
+ nonce: toHex(userOp.nonce),
694
686
  factory: userOp.factory,
695
687
  factoryData: userOp.factoryData,
696
688
  callData: userOp.callData,
697
- callGasLimit: (0, viem_1.toHex)(userOp.callGasLimit),
698
- verificationGasLimit: (0, viem_1.toHex)(userOp.verificationGasLimit),
699
- preVerificationGas: (0, viem_1.toHex)(userOp.preVerificationGas),
700
- maxPriorityFeePerGas: (0, viem_1.toHex)(userOp.maxPriorityFeePerGas),
701
- maxFeePerGas: (0, viem_1.toHex)(userOp.maxFeePerGas),
689
+ callGasLimit: toHex(userOp.callGasLimit),
690
+ verificationGasLimit: toHex(userOp.verificationGasLimit),
691
+ preVerificationGas: toHex(userOp.preVerificationGas),
692
+ maxPriorityFeePerGas: toHex(userOp.maxPriorityFeePerGas),
693
+ maxFeePerGas: toHex(userOp.maxFeePerGas),
702
694
  paymaster: userOp.paymaster,
703
695
  paymasterVerificationGasLimit: userOp.paymasterVerificationGasLimit
704
- ? (0, viem_1.toHex)(userOp.paymasterVerificationGasLimit)
696
+ ? toHex(userOp.paymasterVerificationGasLimit)
705
697
  : undefined,
706
698
  paymasterPostOpGasLimit: userOp.paymasterPostOpGasLimit
707
- ? (0, viem_1.toHex)(userOp.paymasterPostOpGasLimit)
699
+ ? toHex(userOp.paymasterPostOpGasLimit)
708
700
  : undefined,
709
701
  paymasterData: userOp.paymasterData,
710
702
  signature,
711
703
  },
712
- account_abstraction_1.entryPoint07Address,
704
+ entryPoint07Address,
713
705
  ],
714
706
  });
715
707
  return {
@@ -718,8 +710,8 @@ async function submitUserOp(config, chain, userOp, signature) {
718
710
  chain: chain.id,
719
711
  };
720
712
  }
721
- async function submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun) {
722
- return submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun);
713
+ async function submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun, intentInput) {
714
+ return submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun, intentInput);
723
715
  }
724
716
  function createSignedIntentOp(intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations) {
725
717
  return {
@@ -739,29 +731,33 @@ function createSignedIntentOp(intentOp, originSignatures, destinationSignature,
739
731
  : undefined,
740
732
  };
741
733
  }
742
- async function submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun) {
734
+ async function submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations, dryRun, intentInput) {
743
735
  const signedIntentOp = createSignedIntentOp(intentOp, originSignatures, destinationSignature, targetExecutionSignature, authorizations);
744
- const orchestrator = (0, orchestrator_1.getOrchestrator)(config.apiKey, config.endpointUrl, config.headers);
745
- const intentResults = await orchestrator.submitIntent(signedIntentOp, dryRun);
736
+ const isSponsored = !!intentInput?.options?.sponsorSettings;
737
+ const orchestrator = getOrchestrator(config._authProvider ?? createAuthProvider(config), config.endpointUrl, config.headers);
738
+ const intentResults = await orchestrator.submitIntent(signedIntentOp, dryRun, intentInput ? { intentInput, isSponsored } : undefined);
739
+ // Some settlement paths (e.g. SAME_CHAIN) may not return a result.id — fall
740
+ // back to the nonce which the orchestrator also accepts as an intent identifier.
741
+ const intentId = intentResults.result.id ?? intentOp.nonce;
746
742
  return {
747
743
  type: 'intent',
748
- id: BigInt(intentResults.result.id),
744
+ id: BigInt(intentId),
749
745
  sourceChains: sourceChains?.map((chain) => chain.id),
750
746
  targetChain: targetChain.id,
751
747
  };
752
748
  }
753
749
  async function getValidatorAccount(config, signers, publicClient, chain) {
754
750
  if (!signers) {
755
- return (0, accounts_1.getSmartAccount)(config, publicClient, chain);
751
+ return getSmartAccount(config, publicClient, chain);
756
752
  }
757
753
  // Owners
758
754
  const withOwner = signers.type === 'owner' ? signers : null;
759
755
  if (withOwner) {
760
- return (0, accounts_1.getSmartAccount)(config, publicClient, chain);
756
+ return getSmartAccount(config, publicClient, chain);
761
757
  }
762
758
  const withGuardians = signers.type === 'guardians' ? signers : null;
763
759
  return withGuardians
764
- ? await (0, accounts_1.getGuardianSmartAccount)(config, publicClient, chain, {
760
+ ? await getGuardianSmartAccount(config, publicClient, chain, {
765
761
  type: 'ecdsa',
766
762
  accounts: withGuardians.guardians,
767
763
  })
@@ -769,7 +765,7 @@ async function getValidatorAccount(config, signers, publicClient, chain) {
769
765
  }
770
766
  function getValidator(config, signers) {
771
767
  if (!signers) {
772
- return (0, validators_1.getOwnerValidator)(config);
768
+ return getOwnerValidator(config);
773
769
  }
774
770
  // Owners
775
771
  const withOwner = signers.type === 'owner' ? signers : null;
@@ -777,29 +773,29 @@ function getValidator(config, signers) {
777
773
  // ECDSA
778
774
  if (withOwner.kind === 'ecdsa') {
779
775
  // Use the configured owner validator (e.g., ENS) rather than forcing Ownable
780
- return (0, validators_1.getOwnerValidator)(config);
776
+ return getOwnerValidator(config);
781
777
  }
782
778
  // Passkeys (WebAuthn)
783
779
  if (withOwner.kind === 'passkey') {
784
- return (0, core_1.getWebAuthnValidator)(1, withOwner.accounts.map((account) => ({
780
+ return getWebAuthnValidator(1, withOwner.accounts.map((account) => ({
785
781
  pubKey: account.publicKey,
786
782
  authenticatorId: account.id,
787
783
  })));
788
784
  }
789
785
  // Multi-factor
790
786
  if (withOwner.kind === 'multi-factor') {
791
- return (0, core_1.getMultiFactorValidator)(1, withOwner.validators);
787
+ return getMultiFactorValidator(1, withOwner.validators);
792
788
  }
793
789
  }
794
790
  // Smart sessions
795
791
  const withSession = signers.type === 'experimental_session';
796
792
  if (withSession) {
797
- return (0, validators_1.getSmartSessionValidator)(config);
793
+ return getSmartSessionValidator(config);
798
794
  }
799
795
  // Guardians (social recovery)
800
796
  const withGuardians = signers.type === 'guardians' ? signers : null;
801
797
  if (withGuardians) {
802
- return (0, core_1.getSocialRecoveryValidator)(withGuardians.guardians);
798
+ return getSocialRecoveryValidator(withGuardians.guardians);
803
799
  }
804
800
  // Fallback
805
801
  return undefined;
@@ -808,7 +804,7 @@ function parseCalls(calls, chainId) {
808
804
  return calls.map((call) => ({
809
805
  data: call.data ?? '0x',
810
806
  value: call.value ?? 0n,
811
- to: (0, registry_1.resolveTokenAddress)(call.to, chainId),
807
+ to: resolveTokenAddress(call.to, chainId),
812
808
  }));
813
809
  }
814
810
  function createAccountAccessList(sourceChains, sourceAssets) {
@@ -822,7 +818,7 @@ function createAccountAccessList(sourceChains, sourceAssets) {
822
818
  if (isExactConfig) {
823
819
  const resolvedConfigs = sourceAssets.map((config) => ({
824
820
  chainId: config.chain.id,
825
- tokenAddress: (0, registry_1.resolveTokenAddress)(config.address, config.chain.id),
821
+ tokenAddress: resolveTokenAddress(config.address, config.chain.id),
826
822
  amount: config.amount,
827
823
  }));
828
824
  return resolvedConfigs;
@@ -834,18 +830,18 @@ function createAccountAccessList(sourceChains, sourceAssets) {
834
830
  return { chainTokens: sourceAssets };
835
831
  }
836
832
  function getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSignature) {
837
- const initCode = (0, accounts_1.getInitCode)(config);
833
+ const initCode = getInitCode(config);
838
834
  if (config.account?.type === 'eoa') {
839
835
  return {
840
836
  setupOps: [],
841
837
  };
842
838
  }
843
- else if ((0, accounts_1.is7702)(config)) {
839
+ else if (is7702(config)) {
844
840
  // EIP-7702 initialization is only needed for EOA accounts
845
841
  if (!eip7702InitSignature || eip7702InitSignature === '0x') {
846
- throw new error_1.Eip7702InitSignatureRequiredError();
842
+ throw new Eip7702InitSignatureRequiredError();
847
843
  }
848
- const { initData: eip7702InitData, contract: eip7702Contract } = (0, accounts_1.getEip7702InitCall)(config, eip7702InitSignature);
844
+ const { initData: eip7702InitData, contract: eip7702Contract } = getEip7702InitCall(config, eip7702InitSignature);
849
845
  return {
850
846
  setupOps: [
851
847
  {
@@ -871,7 +867,7 @@ function getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSig
871
867
  setupOps: [],
872
868
  };
873
869
  }
874
- throw new accounts_1.FactoryArgsNotAvailableError();
870
+ throw new FactoryArgsNotAvailableError();
875
871
  }
876
872
  // Contract account with init code
877
873
  return {
@@ -893,12 +889,12 @@ function getSetupOperationsAndDelegations(config, accountAddress, eip7702InitSig
893
889
  function validateTokenSymbols(chain, tokenAddressOrSymbols) {
894
890
  function validateTokenSymbol(chain, addressOrSymbol) {
895
891
  // Address
896
- if ((0, viem_1.isAddress)(addressOrSymbol, { strict: false })) {
892
+ if (isAddress(addressOrSymbol, { strict: false })) {
897
893
  return true;
898
894
  }
899
895
  // Token symbol
900
- const address = (0, registry_1.getTokenAddress)(addressOrSymbol, chain.id);
901
- return (0, viem_1.isAddress)(address, { strict: false });
896
+ const address = getTokenAddress(addressOrSymbol, chain.id);
897
+ return isAddress(address, { strict: false });
902
898
  }
903
899
  for (const addressOrSymbol of tokenAddressOrSymbols) {
904
900
  if (!validateTokenSymbol(chain, addressOrSymbol)) {
@@ -910,7 +906,7 @@ function validateTokenSymbols(chain, tokenAddressOrSymbols) {
910
906
  // Uses a Solady-compatible TypedDataSign hash and wraps the signature with
911
907
  // the app domain separator and contents hash for on-chain verification.
912
908
  async function signErc7739TypedData(config, signers, validator, isRoot, parameters, chain) {
913
- const verifierDomain = (0, accounts_1.getEip712Domain)(config, chain);
909
+ const verifierDomain = getEip712Domain(config, chain);
914
910
  const hash = hashErc7739TypedDataForSolady({
915
911
  domain: parameters.domain,
916
912
  types: parameters.types,
@@ -918,10 +914,10 @@ async function signErc7739TypedData(config, signers, validator, isRoot, paramete
918
914
  message: parameters.message,
919
915
  verifierDomain,
920
916
  });
921
- return await (0, accounts_1.getEip1271Signature)(config, signers, chain, {
917
+ return await getEip1271Signature(config, signers, chain, {
922
918
  address: validator.address,
923
919
  isRoot,
924
- }, hash, (signature) => (0, erc7739_1.wrapTypedDataSignature)({
920
+ }, hash, (signature) => wrapTypedDataSignature({
925
921
  domain: parameters.domain,
926
922
  primaryType: parameters.primaryType,
927
923
  types: parameters.types,
@@ -959,15 +955,15 @@ function hashErc7739TypedDataForSolady({ domain, types, primaryType, message, ve
959
955
  // Construct TypedDataSign type string matching Solady's on-chain encoding:
960
956
  // TypedDataSign(<contentsName> contents,...salt) + contentsType
961
957
  const typedDataSignTypeString = `TypedDataSign(${contentsName} contents,string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)${contentsType}`;
962
- const typedDataSignTypeHash = (0, viem_1.keccak256)((0, viem_1.toHex)(typedDataSignTypeString));
958
+ const typedDataSignTypeHash = keccak256(toHex(typedDataSignTypeString));
963
959
  // Hash the original content struct
964
- const contentsHash = (0, viem_1.hashStruct)({
960
+ const contentsHash = hashStruct({
965
961
  data: message,
966
962
  primaryType,
967
963
  types: types,
968
964
  });
969
965
  // Compute the TypedDataSign struct hash
970
- const structHash = (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([
966
+ const structHash = keccak256(encodeAbiParameters([
971
967
  { type: 'bytes32' },
972
968
  { type: 'bytes32' },
973
969
  { type: 'bytes32' },
@@ -978,8 +974,8 @@ function hashErc7739TypedDataForSolady({ domain, types, primaryType, message, ve
978
974
  ], [
979
975
  typedDataSignTypeHash,
980
976
  contentsHash,
981
- (0, viem_1.keccak256)((0, viem_1.toHex)(verifierDomain.name)),
982
- (0, viem_1.keccak256)((0, viem_1.toHex)(verifierDomain.version)),
977
+ keccak256(toHex(verifierDomain.name)),
978
+ keccak256(toHex(verifierDomain.version)),
983
979
  BigInt(verifierDomain.chainId),
984
980
  verifierDomain.verifyingContract,
985
981
  verifierDomain.salt,
@@ -996,10 +992,11 @@ function hashErc7739TypedDataForSolady({ domain, types, primaryType, message, ve
996
992
  domainTypes.push({ name: 'verifyingContract', type: 'address' });
997
993
  if (domain.salt)
998
994
  domainTypes.push({ name: 'salt', type: 'bytes32' });
999
- const appDomainSeparator = (0, viem_1.hashDomain)({
995
+ const appDomainSeparator = hashDomain({
1000
996
  domain,
1001
997
  types: { EIP712Domain: domainTypes },
1002
998
  });
1003
999
  // Final hash: keccak256("\x19\x01" || appDomainSep || structHash)
1004
- return (0, viem_1.keccak256)((0, viem_1.concat)(['0x1901', appDomainSeparator, structHash]));
1000
+ return keccak256(concat(['0x1901', appDomainSeparator, structHash]));
1005
1001
  }
1002
+ export { prepareTransaction, getTransactionMessages, signTransaction, signAuthorizations, signAuthorizationsInternal, signMessage, signTypedData, submitTransaction, prepareUserOperation, signUserOperation, submitUserOperation, signIntent, prepareTransactionAsIntent, submitIntentInternal, getValidatorAccount, parseCalls, getTokenRequests, resolveCallInputs, getIntentAccount, getTargetExecutionSignature, hashErc7739TypedDataForSolady, resolveSessionForChain, };