@rhinestone/sdk 1.0.0-alpha.2 → 1.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/src/accounts/index.d.ts +8 -6
  2. package/dist/src/accounts/index.d.ts.map +1 -1
  3. package/dist/src/accounts/index.js +32 -151
  4. package/dist/src/accounts/kernel.d.ts +7 -9
  5. package/dist/src/accounts/kernel.d.ts.map +1 -1
  6. package/dist/src/accounts/kernel.js +0 -9
  7. package/dist/src/accounts/nexus.d.ts +5 -10
  8. package/dist/src/accounts/nexus.d.ts.map +1 -1
  9. package/dist/src/accounts/nexus.js +0 -70
  10. package/dist/src/accounts/safe.d.ts +4 -6
  11. package/dist/src/accounts/safe.d.ts.map +1 -1
  12. package/dist/src/accounts/safe.js +0 -9
  13. package/dist/src/accounts/utils.d.ts +4 -3
  14. package/dist/src/accounts/utils.d.ts.map +1 -1
  15. package/dist/src/accounts/utils.js +44 -0
  16. package/dist/src/actions/index.d.ts +5 -5
  17. package/dist/src/actions/index.d.ts.map +1 -1
  18. package/dist/src/actions/index.js +8 -4
  19. package/dist/src/actions/index.test.js +18 -0
  20. package/dist/src/actions/registry.d.ts +1 -1
  21. package/dist/src/actions/registry.d.ts.map +1 -1
  22. package/dist/src/actions/registry.test.js +1 -2
  23. package/dist/src/actions/smart-session.d.ts +2 -2
  24. package/dist/src/actions/smart-session.d.ts.map +1 -1
  25. package/dist/src/execution/compact.d.ts +2 -2
  26. package/dist/src/execution/compact.d.ts.map +1 -1
  27. package/dist/src/execution/compact.js +3 -1
  28. package/dist/src/execution/index.d.ts.map +1 -1
  29. package/dist/src/execution/index.js +17 -17
  30. package/dist/src/execution/smart-session.d.ts +1 -1
  31. package/dist/src/execution/smart-session.d.ts.map +1 -1
  32. package/dist/src/execution/smart-session.js +10 -10
  33. package/dist/src/execution/utils.d.ts +8 -7
  34. package/dist/src/execution/utils.d.ts.map +1 -1
  35. package/dist/src/execution/utils.js +38 -21
  36. package/dist/src/index.d.ts +8 -8
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/index.js +10 -8
  39. package/dist/src/modules/read.d.ts +5 -5
  40. package/dist/src/modules/read.d.ts.map +1 -1
  41. package/dist/src/modules/read.js +7 -6
  42. package/dist/src/modules/registry.d.ts +2 -2
  43. package/dist/src/modules/registry.d.ts.map +1 -1
  44. package/dist/src/modules/validators/core.d.ts +1 -1
  45. package/dist/src/modules/validators/core.d.ts.map +1 -1
  46. package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
  47. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  48. package/dist/src/modules/validators/smart-sessions.js +7 -6
  49. package/dist/src/orchestrator/client.d.ts.map +1 -1
  50. package/dist/src/orchestrator/client.js +69 -39
  51. package/dist/src/orchestrator/index.d.ts +2 -2
  52. package/dist/src/orchestrator/index.d.ts.map +1 -1
  53. package/dist/src/orchestrator/index.js +1 -7
  54. package/dist/src/orchestrator/registry.d.ts +31 -12
  55. package/dist/src/orchestrator/registry.d.ts.map +1 -1
  56. package/dist/src/orchestrator/registry.js +56 -379
  57. package/dist/src/orchestrator/registry.json +356 -0
  58. package/dist/src/orchestrator/registry.test.d.ts +2 -0
  59. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  60. package/dist/src/orchestrator/registry.test.js +137 -0
  61. package/dist/src/orchestrator/types.d.ts +9 -6
  62. package/dist/src/orchestrator/types.d.ts.map +1 -1
  63. package/dist/src/orchestrator/utils.d.ts.map +1 -1
  64. package/dist/src/types.d.ts +20 -17
  65. package/dist/src/types.d.ts.map +1 -1
  66. package/dist/test/consts.d.ts +2 -2
  67. package/dist/test/consts.d.ts.map +1 -1
  68. package/package.json +1 -1
@@ -8,6 +8,7 @@ exports.signIntent = signIntent;
8
8
  exports.prepareTransactionAsIntent = prepareTransactionAsIntent;
9
9
  exports.submitIntentInternal = submitIntentInternal;
10
10
  exports.getValidatorAccount = getValidatorAccount;
11
+ exports.parseCalls = parseCalls;
11
12
  const viem_1 = require("viem");
12
13
  const account_abstraction_1 = require("viem/account-abstraction");
13
14
  const accounts_1 = require("../accounts");
@@ -91,7 +92,7 @@ function getTransactionParams(transaction) {
91
92
  const initialTokenRequests = transaction.tokenRequests;
92
93
  const signers = transaction.signers;
93
94
  // Across requires passing some value to repay the solvers
94
- const tokenRequests = initialTokenRequests.length === 0
95
+ const tokenRequests = !initialTokenRequests || initialTokenRequests.length === 0
95
96
  ? [
96
97
  {
97
98
  address: viem_1.zeroAddress,
@@ -106,16 +107,17 @@ function getTransactionParams(transaction) {
106
107
  signers,
107
108
  };
108
109
  }
109
- async function prepareTransactionAsUserOp(config, chain, calls, signers) {
110
+ async function prepareTransactionAsUserOp(config, chain, callInputs, signers) {
110
111
  const publicClient = (0, viem_1.createPublicClient)({
111
112
  chain,
112
- transport: (0, viem_1.http)(),
113
+ transport: (0, utils_1.createTransport)(chain, config.provider),
113
114
  });
114
115
  const validatorAccount = await getValidatorAccount(config, signers, publicClient, chain);
115
116
  if (!validatorAccount) {
116
117
  throw new Error('No validator account found');
117
118
  }
118
119
  const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
120
+ const calls = parseCalls(callInputs, chain.id);
119
121
  const userOp = await bundlerClient.prepareUserOperation({
120
122
  account: validatorAccount,
121
123
  calls,
@@ -131,7 +133,9 @@ async function prepareTransactionAsUserOp(config, chain, calls, signers) {
131
133
  }),
132
134
  };
133
135
  }
134
- async function prepareTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress) {
136
+ async function prepareTransactionAsIntent(config, sourceChain, targetChain, callInputs, gasLimit, tokenRequests, accountAddress) {
137
+ const initCode = (0, accounts_1.getInitCode)(config);
138
+ const calls = parseCalls(callInputs, targetChain.id);
135
139
  const accountAccessList = sourceChain
136
140
  ? {
137
141
  chainIds: [sourceChain.id],
@@ -140,20 +144,29 @@ async function prepareTransactionAsIntent(config, sourceChain, targetChain, call
140
144
  const metaIntent = {
141
145
  destinationChainId: targetChain.id,
142
146
  tokenTransfers: tokenRequests.map((tokenRequest) => ({
143
- tokenAddress: tokenRequest.address,
147
+ tokenAddress: (0, registry_1.resolveTokenAddress)(tokenRequest.address, targetChain.id),
144
148
  amount: tokenRequest.amount,
145
149
  })),
146
- account: accountAddress,
147
- destinationExecutions: calls.map((call) => ({
148
- value: call.value ?? 0n,
149
- to: call.to,
150
- data: call.data ?? '0x',
151
- })),
152
- destinationGasUnits: gasLimit,
153
- accountAccessList,
154
- smartAccount: {
150
+ account: {
151
+ address: accountAddress,
155
152
  accountType: 'ERC7579',
153
+ setupOps: initCode
154
+ ? [
155
+ {
156
+ to: initCode.factory,
157
+ data: initCode.factoryData,
158
+ },
159
+ ]
160
+ : [
161
+ {
162
+ to: viem_1.zeroAddress,
163
+ data: '0x',
164
+ },
165
+ ],
156
166
  },
167
+ destinationExecutions: calls,
168
+ destinationGasUnits: gasLimit,
169
+ accountAccessList,
157
170
  };
158
171
  const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
159
172
  const intentRoute = await orchestrator.getIntentRoute(metaIntent);
@@ -188,7 +201,7 @@ async function signUserOp(config, chain, signers, userOp) {
188
201
  }
189
202
  const publicClient = (0, viem_1.createPublicClient)({
190
203
  chain,
191
- transport: (0, viem_1.http)(),
204
+ transport: (0, utils_1.createTransport)(chain, config.provider),
192
205
  });
193
206
  const account = await getValidatorAccount(config, signers, publicClient, chain);
194
207
  if (!account) {
@@ -199,7 +212,7 @@ async function signUserOp(config, chain, signers, userOp) {
199
212
  async function submitUserOp(config, chain, userOp, signature) {
200
213
  const publicClient = (0, viem_1.createPublicClient)({
201
214
  chain,
202
- transport: (0, viem_1.http)(),
215
+ transport: (0, utils_1.createTransport)(chain, config.provider),
203
216
  });
204
217
  const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
205
218
  const hash = await bundlerClient.request({
@@ -237,7 +250,7 @@ async function submitUserOp(config, chain, userOp, signature) {
237
250
  };
238
251
  }
239
252
  async function submitIntent(config, sourceChain, targetChain, intentOp, signature) {
240
- return submitIntentInternal(config, sourceChain, targetChain, intentOp, signature, false);
253
+ return submitIntentInternal(config, sourceChain, targetChain, intentOp, signature);
241
254
  }
242
255
  function getOrchestratorByChain(chainId, apiKey) {
243
256
  const orchestratorUrl = (0, registry_1.isTestnet)(chainId)
@@ -245,15 +258,12 @@ function getOrchestratorByChain(chainId, apiKey) {
245
258
  : consts_1.PROD_ORCHESTRATOR_URL;
246
259
  return (0, orchestrator_1.getOrchestrator)(apiKey, orchestratorUrl);
247
260
  }
248
- async function submitIntentInternal(config, sourceChain, targetChain, intentOp, signature, deploy) {
261
+ async function submitIntentInternal(config, sourceChain, targetChain, intentOp, signature) {
249
262
  const signedIntentOp = {
250
263
  ...intentOp,
251
264
  originSignatures: Array(intentOp.elements.length).fill(signature),
252
265
  destinationSignature: signature,
253
266
  };
254
- if (deploy) {
255
- await (0, accounts_1.deployTarget)(targetChain, config, false);
256
- }
257
267
  const orchestrator = getOrchestratorByChain(targetChain.id, config.rhinestoneApiKey);
258
268
  const intentResults = await orchestrator.submitIntent(signedIntentOp);
259
269
  return {
@@ -356,3 +366,10 @@ function getOwners(config, signers) {
356
366
  }
357
367
  return undefined;
358
368
  }
369
+ function parseCalls(calls, chainId) {
370
+ return calls.map((call) => ({
371
+ data: call.data ?? '0x',
372
+ value: call.value ?? 0n,
373
+ to: (0, registry_1.resolveTokenAddress)(call.to, chainId),
374
+ }));
375
+ }
@@ -1,14 +1,14 @@
1
1
  import type { Address, Chain, Hex } from 'viem';
2
- import { UserOperationReceipt } from 'viem/account-abstraction';
2
+ import type { UserOperationReceipt } from 'viem/account-abstraction';
3
3
  import { AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, SmartSessionsNotEnabledError } from './accounts';
4
+ import { createTransport } from './accounts/utils';
4
5
  import { addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, encodeSmartSessionSignature, recover, removeOwner, setUpRecovery, trustAttester } from './actions';
5
6
  import type { TransactionResult } from './execution';
6
7
  import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainRequiredForSmartSessionsError, SourceTargetChainMismatchError, UserOperationRequiredForSmartSessionsError } from './execution';
7
- import { SessionDetails } from './execution/smart-session';
8
- import { IntentData, PreparedTransactionData, SignedTransactionData } from './execution/utils';
9
- import { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SettlementSystem, SignedIntentOp } from './orchestrator';
10
- import { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundError, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './orchestrator';
11
- import type { Call, Execution, RhinestoneAccountConfig, Session, Transaction } from './types';
8
+ import { type SessionDetails } from './execution/smart-session';
9
+ import { type IntentData, type PreparedTransactionData, type SignedTransactionData } from './execution/utils';
10
+ import { AuthenticationRequiredError, InsufficientBalanceError, type IntentCost, type IntentInput, IntentNotFoundError, type IntentOp, type IntentOpStatus, type IntentResult, type IntentRoute, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, type Portfolio, type SettlementSystem, type SignedIntentOp, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './orchestrator';
11
+ import type { Call, RhinestoneAccountConfig, Session, Transaction } from './types';
12
12
  interface RhinestoneAccount {
13
13
  config: RhinestoneAccountConfig;
14
14
  deploy: (chain: Chain, session?: Session) => Promise<void>;
@@ -36,6 +36,6 @@ interface RhinestoneAccount {
36
36
  * @returns account
37
37
  */
38
38
  declare function createRhinestoneAccount(config: RhinestoneAccountConfig): Promise<RhinestoneAccount>;
39
- export { createRhinestoneAccount, addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, recover, removeOwner, setUpRecovery, encodeSmartSessionSignature, trustAttester, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, isExecutionError, IntentFailedError, ExecutionError, SourceChainRequiredForSmartSessionsError, SourceTargetChainMismatchError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
40
- export type { RhinestoneAccount, Session, Call, Execution, IntentData, PreparedTransactionData, SignedTransactionData, TransactionResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, Portfolio, };
39
+ export { createRhinestoneAccount, createTransport, addOwner, changeThreshold, disableEcdsa, disablePasskeys, enableEcdsa, enablePasskeys, recover, removeOwner, setUpRecovery, encodeSmartSessionSignature, trustAttester, isAccountError, AccountError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, SignMessageNotSupportedByAccountError, Eip7702NotSupportedForAccountError, isExecutionError, IntentFailedError, ExecutionError, SourceChainRequiredForSmartSessionsError, SourceTargetChainMismatchError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
40
+ export type { RhinestoneAccount, Session, Call, IntentData, PreparedTransactionData, SignedTransactionData, TransactionResult, IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, Portfolio, };
41
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EACL,YAAY,EAEZ,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAE5B,cAAc,EACd,kCAAkC,EAClC,qCAAqC,EACrC,4BAA4B,EAC7B,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,eAAe,EACf,WAAW,EACX,cAAc,EACd,2BAA2B,EAC3B,OAAO,EACP,WAAW,EACX,aAAa,EACb,aAAa,EACd,MAAM,WAAW,CAAA;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAEL,cAAc,EAGd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,wCAAwC,EACxC,8BAA8B,EAE9B,0CAA0C,EAE3C,MAAM,aAAa,CAAA;AACpB,OAAO,EAEL,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,UAAU,EACV,uBAAuB,EAEvB,qBAAqB,EAGtB,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EACL,UAAU,EACV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wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EACL,YAAY,EAEZ,8BAA8B,EAC9B,kCAAkC,EAClC,wCAAwC,EACxC,4BAA4B,EAE5B,cAAc,EACd,kCAAkC,EAClC,qCAAqC,EACrC,4BAA4B,EAC7B,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EACL,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,eAAe,EACf,WAAW,EACX,cAAc,EACd,2BAA2B,EAC3B,OAAO,EACP,WAAW,EACX,aAAa,EACb,aAAa,EACd,MAAM,WAAW,CAAA;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAEL,cAAc,EAGd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,wCAAwC,EACxC,8BAA8B,EAE9B,0CAA0C,EAE3C,MAAM,aAAa,CAAA;AACpB,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,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,EAElC,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,wCAAwC,EACxC,8BAA8B,EAC9B,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,EAEzB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,CAAA"}
package/dist/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceTargetChainMismatchError = exports.SourceChainRequiredForSmartSessionsError = exports.ExecutionError = exports.IntentFailedError = exports.isExecutionError = exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = exports.isAccountError = exports.trustAttester = exports.encodeSmartSessionSignature = exports.setUpRecovery = exports.removeOwner = exports.recover = exports.enablePasskeys = exports.enableEcdsa = exports.disablePasskeys = exports.disableEcdsa = exports.changeThreshold = exports.addOwner = void 0;
3
+ exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.isOrchestratorError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceTargetChainMismatchError = exports.SourceChainRequiredForSmartSessionsError = exports.ExecutionError = exports.IntentFailedError = exports.isExecutionError = exports.Eip7702NotSupportedForAccountError = exports.SignMessageNotSupportedByAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountError = exports.isAccountError = exports.trustAttester = exports.encodeSmartSessionSignature = exports.setUpRecovery = exports.removeOwner = exports.recover = exports.enablePasskeys = exports.enableEcdsa = exports.disablePasskeys = exports.disableEcdsa = exports.changeThreshold = exports.addOwner = exports.createTransport = void 0;
4
4
  exports.createRhinestoneAccount = createRhinestoneAccount;
5
5
  const accounts_1 = require("./accounts");
6
6
  Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
@@ -12,6 +12,8 @@ Object.defineProperty(exports, "isAccountError", { enumerable: true, get: functi
12
12
  Object.defineProperty(exports, "SigningNotSupportedForAccountError", { enumerable: true, get: function () { return accounts_1.SigningNotSupportedForAccountError; } });
13
13
  Object.defineProperty(exports, "SignMessageNotSupportedByAccountError", { enumerable: true, get: function () { return accounts_1.SignMessageNotSupportedByAccountError; } });
14
14
  Object.defineProperty(exports, "SmartSessionsNotEnabledError", { enumerable: true, get: function () { return accounts_1.SmartSessionsNotEnabledError; } });
15
+ const utils_1 = require("./accounts/utils");
16
+ Object.defineProperty(exports, "createTransport", { enumerable: true, get: function () { return utils_1.createTransport; } });
15
17
  const actions_1 = require("./actions");
16
18
  Object.defineProperty(exports, "addOwner", { enumerable: true, get: function () { return actions_1.addOwner; } });
17
19
  Object.defineProperty(exports, "changeThreshold", { enumerable: true, get: function () { return actions_1.changeThreshold; } });
@@ -34,7 +36,7 @@ Object.defineProperty(exports, "SourceChainRequiredForSmartSessionsError", { enu
34
36
  Object.defineProperty(exports, "SourceTargetChainMismatchError", { enumerable: true, get: function () { return execution_1.SourceTargetChainMismatchError; } });
35
37
  Object.defineProperty(exports, "UserOperationRequiredForSmartSessionsError", { enumerable: true, get: function () { return execution_1.UserOperationRequiredForSmartSessionsError; } });
36
38
  const smart_session_1 = require("./execution/smart-session");
37
- const utils_1 = require("./execution/utils");
39
+ const utils_2 = require("./execution/utils");
38
40
  const modules_1 = require("./modules");
39
41
  const orchestrator_1 = require("./orchestrator");
40
42
  Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
@@ -61,13 +63,13 @@ async function createRhinestoneAccount(config) {
61
63
  return (0, accounts_1.deploy)(config, chain, session);
62
64
  }
63
65
  function prepareTransaction(transaction) {
64
- return (0, utils_1.prepareTransaction)(config, transaction);
66
+ return (0, utils_2.prepareTransaction)(config, transaction);
65
67
  }
66
68
  function signTransaction(preparedTransaction) {
67
- return (0, utils_1.signTransaction)(config, preparedTransaction);
69
+ return (0, utils_2.signTransaction)(config, preparedTransaction);
68
70
  }
69
71
  function submitTransaction(signedTransaction) {
70
- return (0, utils_1.submitTransaction)(config, signedTransaction);
72
+ return (0, utils_2.submitTransaction)(config, signedTransaction);
71
73
  }
72
74
  /**
73
75
  * Sign and send a transaction
@@ -116,16 +118,16 @@ async function createRhinestoneAccount(config) {
116
118
  }
117
119
  function areAttestersTrusted(chain) {
118
120
  const account = getAddress();
119
- return (0, modules_1.areAttestersTrusted)(account, chain);
121
+ return (0, modules_1.areAttestersTrusted)(account, chain, config.provider);
120
122
  }
121
123
  function getOwners(chain) {
122
124
  const account = getAddress();
123
- return (0, modules_1.getOwners)(account, chain);
125
+ return (0, modules_1.getOwners)(account, chain, config.provider);
124
126
  }
125
127
  function getValidators(chain) {
126
128
  const accountType = config.account?.type || 'nexus';
127
129
  const account = getAddress();
128
- return (0, modules_1.getValidators)(accountType, account, chain);
130
+ return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
129
131
  }
130
132
  async function deposit(chain, amount, tokenAddress) {
131
133
  return (0, execution_1.deposit)(config, chain, amount, tokenAddress);
@@ -1,10 +1,10 @@
1
- import { Address, Chain } from 'viem';
2
- import { AccountType } from '../types';
3
- declare function getValidators(accountType: AccountType, account: Address, chain: Chain): Promise<Address[]>;
4
- declare function getOwners(account: Address, chain: Chain): Promise<{
1
+ import { type Address, type Chain } from 'viem';
2
+ import type { AccountType, ProviderConfig } from '../types';
3
+ declare function getValidators(accountType: AccountType, account: Address, chain: Chain, provider?: ProviderConfig): Promise<Address[]>;
4
+ declare function getOwners(account: Address, chain: Chain, provider?: ProviderConfig): Promise<{
5
5
  accounts: Address[];
6
6
  threshold: number;
7
7
  } | null>;
8
- declare function areAttestersTrusted(account: Address, chain: Chain): Promise<boolean>;
8
+ declare function areAttestersTrusted(account: Address, chain: Chain, provider?: ProviderConfig): Promise<boolean>;
9
9
  export { getValidators, getOwners, areAttestersTrusted };
10
10
  //# sourceMappingURL=read.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../modules/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAwC,MAAM,MAAM,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAKtC,iBAAe,aAAa,CAC1B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EACh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ators = getValidators;
4
4
  exports.getOwners = getOwners;
5
5
  exports.areAttestersTrusted = areAttestersTrusted;
6
6
  const viem_1 = require("viem");
7
+ const utils_1 = require("../accounts/utils");
7
8
  const omni_account_1 = require("./omni-account");
8
9
  const registry_1 = require("./registry");
9
10
  const core_1 = require("./validators/core");
10
- async function getValidators(accountType, account, chain) {
11
+ async function getValidators(accountType, account, chain, provider) {
11
12
  const publicClient = (0, viem_1.createPublicClient)({
12
13
  chain,
13
- transport: (0, viem_1.http)(),
14
+ transport: (0, utils_1.createTransport)(chain, provider),
14
15
  });
15
16
  switch (accountType) {
16
17
  case 'safe':
@@ -53,10 +54,10 @@ async function getValidators(accountType, account, chain) {
53
54
  }
54
55
  }
55
56
  }
56
- async function getOwners(account, chain) {
57
+ async function getOwners(account, chain, provider) {
57
58
  const publicClient = (0, viem_1.createPublicClient)({
58
59
  chain,
59
- transport: (0, viem_1.http)(),
60
+ transport: (0, utils_1.createTransport)(chain, provider),
60
61
  });
61
62
  const moduleAddress = core_1.OWNABLE_VALIDATOR_ADDRESS;
62
63
  const [ownerResult, thresholdResult] = await publicClient.multicall({
@@ -120,11 +121,11 @@ async function getOwners(account, chain) {
120
121
  threshold: thresholdResult.result,
121
122
  };
122
123
  }
123
- async function areAttestersTrusted(account, chain) {
124
+ async function areAttestersTrusted(account, chain, provider) {
124
125
  const { list: requiredAttesters } = (0, registry_1.getAttesters)();
125
126
  const publicClient = (0, viem_1.createPublicClient)({
126
127
  chain,
127
- transport: (0, viem_1.http)(),
128
+ transport: (0, utils_1.createTransport)(chain, provider),
128
129
  });
129
130
  const trustedAttesters = await publicClient.readContract({
130
131
  abi: [
@@ -1,5 +1,5 @@
1
- import { Address, PublicClient } from 'viem';
2
- import { RhinestoneAccountConfig } from '../types';
1
+ import { type Address, type PublicClient } from 'viem';
2
+ import type { RhinestoneAccountConfig } from '../types';
3
3
  declare function getAttesters(): {
4
4
  list: Address[];
5
5
  threshold: number;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../modules/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsB,YAAY,EAAE,MAAM,MAAM,CAAA;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAQlD,iBAAS,YAAY,IAAI;IACvB,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAKA;AAED,iBAAS,oBAAoB,CAAC,MAAM,EAAE,uBAAuB;;;EA0B5D;AAED,iBAAe,mBAAmB,CAChC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAyB7B;AAED,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../modules/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAE1E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAQvD,iBAAS,YAAY,IAAI;IACvB,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAKA;AAED,iBAAS,oBAAoB,CAAC,MAAM,EAAE,uBAAuB;;;EA0B5D;AAED,iBAAe,mBAAmB,CAChC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAyB7B;AAED,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Account, type Address, type Hex } from 'viem';
1
+ import { type Account, type Address, type Hex } from 'viem';
2
2
  import type { OwnerSet, RhinestoneAccountConfig } from '../../types';
3
3
  import { type Module } from '../common';
4
4
  interface PublicKey {
@@ -1 +1 @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0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,CAAA;AACD,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { type Address, type Chain, type Hex, type PublicClient } from 'viem';
2
- import type { AccountType, RhinestoneAccountConfig, Session } from '../../types';
2
+ import type { AccountType, ProviderConfig, RhinestoneAccountConfig, Session } from '../../types';
3
3
  import { type Module } from '../common';
4
4
  interface SessionData {
5
5
  sessionValidator: Address;
@@ -82,8 +82,8 @@ declare const SMART_SESSIONS_VALIDATOR_ADDRESS: Address;
82
82
  declare const SMART_SESSION_MODE_USE = "0x00";
83
83
  declare const SMART_SESSION_MODE_ENABLE = "0x01";
84
84
  declare const SMART_SESSION_MODE_UNSAFE_ENABLE = "0x02";
85
- declare function getSessionData(chain: Chain, session: Session): Promise<SessionData>;
86
- declare function getEnableSessionCall(chain: Chain, session: Session): Promise<{
85
+ declare function getSessionData(chain: Chain, session: Session, provider?: ProviderConfig): Promise<SessionData>;
86
+ declare function getEnableSessionCall(chain: Chain, session: Session, provider?: ProviderConfig): Promise<{
87
87
  to: `0x${string}`;
88
88
  data: `0x${string}`;
89
89
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAKV,KAAK,GAAG,EAIR,KAAK,YAAY,EAKlB,MAAM,MAAM,CAAA;AAKb,OAAO,KAAK,EACV,WAAW,EAEX,uBAAuB,EACvB,OAAO,EAER,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAUjE,UAAU,WAAW;IACnB,gBAAgB,EAAE,OAAO,CAAA;IACzB,wBAAwB,EAAE,GAAG,CAAA;IAC7B,IAAI,EAAE,GAAG,CAAA;IACT,cAAc,EAAE,SAAS,YAAY,EAAE,CAAA;IACvC,eA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AG,EACjB,SAAS,EAAE,GAAG,EACd,iBAAiB,CAAC,EAAE,iBAAiB,iBAyBtC;AAoKD,iBAAS,eAAe,CAAC,OAAO,EAAE,OAAO,iBAyBxC;AAED,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,gCAAgC,EAChC,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,GACjB,CAAA;AACD,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,oBAAoB,GACrB,CAAA"}
1
+ {"version":3,"file":"smart-sessions.d.ts","sourceRoot":"","sources":["../../../../modules/validators/smart-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAKV,KAAK,GAAG,EAGR,KAAK,YAAY,EAKlB,MAAM,MAAM,CAAA;AAMb,OAAO,KAAK,EACV,WAAW,EAEX,cAAc,EACd,uBAAuB,EACvB,OAAO,EAER,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAUjE,UAAU,WAAW;IACnB,gBAAgB,EAAE,OAAO,CAAA;IACzB,wBAAwB,EAAE,GAAG,CAAA;IAC7B,IAAI,EAAE,GAAG,CAAA;IACT,cAAc,EAAE,SAAS,YAAY,EAAE,CAAA;IACvC,eAAe,EAAE;QACf,qBAAqB,EAAE,SAAS,qBAAqB,EAAE,CAAA;QACvD,eAAe,EAAE,SAAS,aAAa,EAAE,CAAA;KAC1C,CAAA;IACD,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;IAC9B,sBAAsB,EAAE,OAAO,CAAA;CAChC;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;CACd;AAED,UAAU,aAAa;IACrB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,GAAG,CAAA;CACd;AAED,UAAU,qBAAq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ACZ,WAAW,EACX,WAAW,EACX,oBAAoB,GACrB,CAAA"}
@@ -9,6 +9,7 @@ exports.getPermissionId = getPermissionId;
9
9
  exports.isSessionEnabled = isSessionEnabled;
10
10
  const solady_1 = require("solady");
11
11
  const viem_1 = require("viem");
12
+ const utils_1 = require("../../accounts/utils");
12
13
  const orchestrator_1 = require("../../orchestrator");
13
14
  const smart_sessions_1 = require("../abi/smart-sessions");
14
15
  const common_1 = require("../common");
@@ -36,8 +37,8 @@ const ACTION_CONDITION_GREATER_THAN_OR_EQUAL = 3;
36
37
  const ACTION_CONDITION_LESS_THAN_OR_EQUAL = 4;
37
38
  const ACTION_CONDITION_NOT_EQUAL = 5;
38
39
  const ACTION_CONDITION_IN_RANGE = 6;
39
- async function getSessionData(chain, session) {
40
- const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain);
40
+ async function getSessionData(chain, session, provider) {
41
+ const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain, provider);
41
42
  const allowedERC7739Content = [
42
43
  {
43
44
  appDomainSeparator,
@@ -46,8 +47,8 @@ async function getSessionData(chain, session) {
46
47
  ];
47
48
  return getSmartSessionData(chain, session, allowedERC7739Content);
48
49
  }
49
- async function getEnableSessionCall(chain, session) {
50
- const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain);
50
+ async function getEnableSessionCall(chain, session, provider) {
51
+ const { appDomainSeparator, contentsType } = await getSessionAllowedERC7739Content(chain, provider);
51
52
  const allowedERC7739Content = [
52
53
  {
53
54
  appDomainSeparator,
@@ -90,10 +91,10 @@ function getOmniAccountActions(chain) {
90
91
  ];
91
92
  return omniActions;
92
93
  }
93
- async function getSessionAllowedERC7739Content(chain) {
94
+ async function getSessionAllowedERC7739Content(chain, provider) {
94
95
  const publicClient = (0, viem_1.createPublicClient)({
95
96
  chain,
96
- transport: (0, viem_1.http)(),
97
+ transport: (0, utils_1.createTransport)(chain, provider),
97
98
  });
98
99
  const appDomainSeparator = await publicClient.readContract({
99
100
  address: omni_account_1.HOOK_ADDRESS,
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,MAAM,CAAA;AAe3C,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EAGT,cAAc,EACf,MAAM,SAAS,CAAA;AAGhB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAQ;gBAEV,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKvC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,SAAS,CAAC;IAmDf,iBAAiB,CACrB,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,MAAM,EAC1B,uBAAuB,EAAE,OAAO,EAChC,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,MAAM,CAAC;IAmCZ,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAqBtD,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAgBxD,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAgBnE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAalE,OAAO,CAAC,UAAU;CAwHnB"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAuB,MAAM,MAAM,CAAA;AAexD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EAET,cAAc,EACf,MAAM,SAAS,CAAA;AAGhB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAQ;gBAEV,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKvC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,SAAS,CAAC;IAmDf,iBAAiB,CACrB,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,MAAM,EAC1B,uBAAuB,EAAE,OAAO,EAChC,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,MAAM,CAAC;IAyCZ,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IA0BtD,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBxD,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAqBnE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAkBlE,OAAO,CAAC,UAAU;CAwHnB"}
@@ -54,7 +54,16 @@ class Orchestrator {
54
54
  }
55
55
  async getMaxTokenAmount(userAddress, destinationChainId, destinationTokenAddress, destinationGasUnits) {
56
56
  const intentCost = await this.getIntentCost({
57
- account: userAddress,
57
+ account: {
58
+ address: userAddress,
59
+ accountType: 'ERC7579',
60
+ setupOps: [
61
+ {
62
+ to: viem_1.zeroAddress,
63
+ data: '0x',
64
+ },
65
+ ],
66
+ },
58
67
  destinationExecutions: [],
59
68
  destinationChainId,
60
69
  destinationGasUnits,
@@ -63,9 +72,6 @@ class Orchestrator {
63
72
  tokenAddress: destinationTokenAddress,
64
73
  },
65
74
  ],
66
- smartAccount: {
67
- accountType: 'ERC7579',
68
- },
69
75
  });
70
76
  if (!intentCost.hasFulfilledAll) {
71
77
  return 0n;
@@ -82,47 +88,71 @@ class Orchestrator {
82
88
  return tokenReceived.destinationAmount;
83
89
  }
84
90
  async getIntentCost(input) {
85
- const response = await axios_1.default.post(`${this.serverUrl}/intents/cost`, {
86
- ...(0, utils_1.convertBigIntFields)({
87
- ...input,
88
- tokenTransfers: input.tokenTransfers.map((transfer) => ({
89
- tokenAddress: transfer.tokenAddress,
90
- })),
91
- }),
92
- }, {
93
- headers: {
94
- 'x-api-key': this.apiKey,
95
- },
96
- });
97
- return response.data;
91
+ try {
92
+ const response = await axios_1.default.post(`${this.serverUrl}/intents/cost`, {
93
+ ...(0, utils_1.convertBigIntFields)({
94
+ ...input,
95
+ tokenTransfers: input.tokenTransfers.map((transfer) => ({
96
+ tokenAddress: transfer.tokenAddress,
97
+ })),
98
+ }),
99
+ }, {
100
+ headers: {
101
+ 'x-api-key': this.apiKey,
102
+ },
103
+ });
104
+ return response.data;
105
+ }
106
+ catch (error) {
107
+ this.parseError(error);
108
+ throw new Error('Failed to get intent cost');
109
+ }
98
110
  }
99
111
  async getIntentRoute(input) {
100
- const response = await axios_1.default.post(`${this.serverUrl}/intents/route`, {
101
- ...(0, utils_1.convertBigIntFields)(input),
102
- }, {
103
- headers: {
104
- 'x-api-key': this.apiKey,
105
- },
106
- });
107
- return response.data;
112
+ try {
113
+ const response = await axios_1.default.post(`${this.serverUrl}/intents/route`, {
114
+ ...(0, utils_1.convertBigIntFields)(input),
115
+ }, {
116
+ headers: {
117
+ 'x-api-key': this.apiKey,
118
+ },
119
+ });
120
+ return response.data;
121
+ }
122
+ catch (error) {
123
+ this.parseError(error);
124
+ throw new Error('Failed to get intent route');
125
+ }
108
126
  }
109
127
  async submitIntent(signedIntentOp) {
110
- const response = await axios_1.default.post(`${this.serverUrl}/intent-operations`, {
111
- signedIntentOp: (0, utils_1.convertBigIntFields)(signedIntentOp),
112
- }, {
113
- headers: {
114
- 'x-api-key': this.apiKey,
115
- },
116
- });
117
- return response.data;
128
+ try {
129
+ const response = await axios_1.default.post(`${this.serverUrl}/intent-operations`, {
130
+ signedIntentOp: (0, utils_1.convertBigIntFields)(signedIntentOp),
131
+ }, {
132
+ headers: {
133
+ 'x-api-key': this.apiKey,
134
+ },
135
+ });
136
+ return response.data;
137
+ }
138
+ catch (error) {
139
+ this.parseError(error);
140
+ throw new Error('Failed to submit intent');
141
+ }
118
142
  }
119
143
  async getIntentOpStatus(intentId) {
120
- const response = await axios_1.default.get(`${this.serverUrl}/intent-operation/${intentId.toString()}/status`, {
121
- headers: {
122
- 'x-api-key': this.apiKey,
123
- },
124
- });
125
- return response.data;
144
+ try {
145
+ const response = await axios_1.default.get(`${this.serverUrl}/intent-operation/${intentId.toString()}/status`, {
146
+ headers: {
147
+ 'x-api-key': this.apiKey,
148
+ },
149
+ });
150
+ return response.data;
151
+ }
152
+ catch (error) {
153
+ this.parseError(error);
154
+ throw new Error('Failed to get intent op status');
155
+ }
126
156
  }
127
157
  parseError(error) {
128
158
  if (error.response) {
@@ -1,11 +1,11 @@
1
1
  import { Orchestrator } from './client';
2
2
  import { RHINESTONE_SPOKE_POOL_ADDRESS } from './consts';
3
3
  import { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundError, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './error';
4
- import { getHookAddress, getRhinestoneSpokePoolAddress, getSameChainModuleAddress, getSupportedTokens, getTargetModuleAddress, getTokenAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry';
4
+ import { getSupportedTokens, getTokenAddress, getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry';
5
5
  import type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SettlementSystem, SignedIntentOp, SupportedChain, TokenConfig } from './types';
6
6
  import { INTENT_STATUS_COMPLETED, INTENT_STATUS_EXPIRED, INTENT_STATUS_FAILED, INTENT_STATUS_FILLED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_PENDING, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN } from './types';
7
7
  import { getIntentOpHash } from './utils';
8
8
  declare function getOrchestrator(apiKey: string, orchestratorUrl?: string): Orchestrator;
9
9
  export type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, SupportedChain, TokenConfig, Portfolio, };
10
- export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator, getIntentOpHash, getWethAddress, getTokenBalanceSlot, getTokenRootBalanceSlot, getTokenSymbol, getHookAddress, getSameChainModuleAddress, getTargetModuleAddress, getRhinestoneSpokePoolAddress, getTokenAddress, getSupportedTokens, isOrchestratorError, isTokenAddressSupported, };
10
+ export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator, getIntentOpHash, getWethAddress, getTokenSymbol, getTokenAddress, getSupportedTokens, isOrchestratorError, isTokenAddressSupported, };
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,cAAc,EACd,6BAA6B,EAC7B,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACZ,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,iBAAS,eAAe,CACtB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,GACvB,YAAY,CAEd;AAED,YAAY,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,GACV,CAAA;AACD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EACjC,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,EACZ,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,GACxB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAu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