@hyperbridge/sdk 1.3.26 → 1.4.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.
@@ -3479,13 +3479,7 @@ var addresses = {
3479
3479
  ["EVM-130" /* UNICHAIN_MAINNET */]: "0x52f0e24d1c21c8a0cb1e5a5dd6198556bd9e1203"
3480
3480
  },
3481
3481
  Calldispatcher: {
3482
- ["EVM-11155111" /* SEPOLIA */]: "0xC7f13b6D03A0A7F3239d38897503E90553ABe155",
3483
- ["EVM-1" /* MAINNET */]: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3484
- ["EVM-56" /* BSC_MAINNET */]: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3485
- ["EVM-42161" /* ARBITRUM_MAINNET */]: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3486
- ["EVM-8453" /* BASE_MAINNET */]: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3487
- ["EVM-137" /* POLYGON_MAINNET */]: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333",
3488
- ["EVM-130" /* UNICHAIN_MAINNET */]: "0xc71251c8b3e7b02697a84363eef6dce8dfbdf333"
3482
+ ["EVM-11155111" /* SEPOLIA */]: "0xC7f13b6D03A0A7F3239d38897503E90553ABe155"
3489
3483
  },
3490
3484
  Permit2: {
3491
3485
  ["EVM-1" /* MAINNET */]: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
@@ -5622,10 +5616,43 @@ var DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
5622
5616
  var EvmChain = class {
5623
5617
  constructor(params) {
5624
5618
  this.params = params;
5619
+ const defaultConsensusStateIds = {
5620
+ 1: "ETH0",
5621
+ // Ethereum Mainnet
5622
+ 11155111: "ETH0",
5623
+ // Sepolia
5624
+ 42161: "ETH0",
5625
+ // Arbitrum One
5626
+ 421614: "ETH0",
5627
+ // Arbitrum Sepolia
5628
+ 10: "ETH0",
5629
+ // Optimism
5630
+ 11155420: "ETH0",
5631
+ // Optimism Sepolia
5632
+ 8453: "ETH0",
5633
+ // Base
5634
+ 84532: "ETH0",
5635
+ // Base Sepolia
5636
+ 137: "POLY",
5637
+ // Polygon Mainnet
5638
+ 80002: "POLY",
5639
+ // Polygon Amoy
5640
+ 56: "BSC0",
5641
+ // BSC
5642
+ 97: "BSC0",
5643
+ // BSC Testnet
5644
+ 100: "GNO0",
5645
+ // Gnosis
5646
+ 10200: "GNO0"
5647
+ // Gnosis Chiado
5648
+ };
5649
+ if (!params.consensusStateId) {
5650
+ params.consensusStateId = defaultConsensusStateIds[params.chainId];
5651
+ }
5625
5652
  this.publicClient = createPublicClient({
5626
5653
  // @ts-ignore
5627
5654
  chain: chains[params.chainId],
5628
- transport: http(params.url)
5655
+ transport: http(params.rpcUrl)
5629
5656
  });
5630
5657
  this.chainConfigService = new ChainConfigService();
5631
5658
  }
@@ -5639,6 +5666,14 @@ var EvmChain = class {
5639
5666
  return this.params.host;
5640
5667
  }
5641
5668
  get config() {
5669
+ return {
5670
+ rpcUrl: this.params.rpcUrl,
5671
+ stateMachineId: `EVM-${this.params.chainId}`,
5672
+ host: this.params.host,
5673
+ consensusStateId: this.params.consensusStateId
5674
+ };
5675
+ }
5676
+ get configService() {
5642
5677
  return this.chainConfigService;
5643
5678
  }
5644
5679
  /**
@@ -5938,8 +5973,8 @@ var EvmChain = class {
5938
5973
  return this.getAmountsIn(totalFee, feeToken.address, request.source);
5939
5974
  }
5940
5975
  async getAmountsIn(amountOut, tokenOutForQuote, chain) {
5941
- const v2Router = this.config.getUniswapRouterV2Address(chain);
5942
- const WETH = this.config.getWrappedNativeAssetWithDecimals(chain).asset;
5976
+ const v2Router = this.configService.getUniswapRouterV2Address(chain);
5977
+ const WETH = this.configService.getWrappedNativeAssetWithDecimals(chain).asset;
5943
5978
  const v2AmountIn = await this.publicClient.simulateContract({
5944
5979
  address: v2Router,
5945
5980
  abi: uniswapRouterV2_default.ABI,
@@ -6062,6 +6097,14 @@ var EvmChain = class {
6062
6097
  return nonce;
6063
6098
  }
6064
6099
  };
6100
+ function createEvmChain(chainId, host, options) {
6101
+ return new EvmChain({
6102
+ chainId,
6103
+ host,
6104
+ rpcUrl: options.rpcUrl,
6105
+ consensusStateId: options.consensusStateId
6106
+ });
6107
+ }
6065
6108
  var REQUEST_COMMITMENTS_SLOT = 0n;
6066
6109
  var RESPONSE_COMMITMENTS_SLOT = 1n;
6067
6110
  var REQUEST_RECEIPTS_SLOT = 2n;
@@ -6149,7 +6192,7 @@ var HttpRpcClient = class {
6149
6192
  var SubstrateChain = class {
6150
6193
  constructor(params) {
6151
6194
  this.params = params;
6152
- const url = this.params.ws;
6195
+ const url = this.params.wsUrl;
6153
6196
  const httpUrl = replaceWebsocketWithHttp(url);
6154
6197
  this.rpcClient = new HttpRpcClient(httpUrl);
6155
6198
  }
@@ -6158,11 +6201,19 @@ var SubstrateChain = class {
6158
6201
  */
6159
6202
  api;
6160
6203
  rpcClient;
6204
+ get config() {
6205
+ return {
6206
+ wsUrl: this.params.wsUrl,
6207
+ consensusStateId: this.params.consensusStateId,
6208
+ hasher: this.params.hasher,
6209
+ stateMachineId: this.params.stateMachineId
6210
+ };
6211
+ }
6161
6212
  /*
6162
6213
  * connect: Connects to the Substrate chain using the provided WebSocket URL.
6163
6214
  */
6164
6215
  async connect() {
6165
- const wsProvider = new WsProvider(this.params.ws);
6216
+ const wsProvider = new WsProvider(this.params.wsUrl);
6166
6217
  const typesBundle = this.params.hasher === "Keccak" ? {
6167
6218
  spec: {
6168
6219
  nexus: {
@@ -6566,17 +6617,15 @@ async function getChain(chainConfig) {
6566
6617
  const chainId = Number.parseInt(chainConfig.stateMachineId.split("-")[1]);
6567
6618
  const evmChain = new EvmChain({
6568
6619
  chainId,
6569
- url: config.rpcUrl,
6570
- host: config.host
6620
+ rpcUrl: config.rpcUrl,
6621
+ host: config.host,
6622
+ consensusStateId: config.consensusStateId
6571
6623
  });
6572
6624
  return evmChain;
6573
6625
  }
6574
6626
  if (isSubstrateChain(chainConfig.stateMachineId)) {
6575
6627
  const config = chainConfig;
6576
- const substrateChain = new SubstrateChain({
6577
- ws: config.wsUrl,
6578
- hasher: config.hasher
6579
- });
6628
+ const substrateChain = new SubstrateChain(config);
6580
6629
  await substrateChain.connect();
6581
6630
  return substrateChain;
6582
6631
  }
@@ -7014,6 +7063,25 @@ async function _queryOrderInternal(params) {
7014
7063
  }
7015
7064
 
7016
7065
  // src/client.ts
7066
+ async function createChain(config) {
7067
+ const chainConfig = "wsUrl" in config && !("hasher" in config) ? { ...config, hasher: "Keccak" } : config;
7068
+ return await getChain(chainConfig);
7069
+ }
7070
+ async function createIndexerClient(config) {
7071
+ const [source, dest, hyperbridge] = await Promise.all([
7072
+ createChain(config.source),
7073
+ createChain(config.dest),
7074
+ createChain(config.hyperbridge)
7075
+ ]);
7076
+ return new IndexerClient({
7077
+ pollInterval: config.pollInterval,
7078
+ queryClient: config.queryClient,
7079
+ tracing: config.tracing,
7080
+ source,
7081
+ dest,
7082
+ hyperbridge
7083
+ });
7084
+ }
7017
7085
  var IndexerClient = class {
7018
7086
  /**
7019
7087
  * GraphQL client used for making requests to the indexer
@@ -7052,6 +7120,24 @@ var IndexerClient = class {
7052
7120
  }
7053
7121
  });
7054
7122
  }
7123
+ /**
7124
+ * Get the source chain instance
7125
+ */
7126
+ get source() {
7127
+ return this.config.source;
7128
+ }
7129
+ /**
7130
+ * Get the destination chain instance
7131
+ */
7132
+ get dest() {
7133
+ return this.config.dest;
7134
+ }
7135
+ /**
7136
+ * Get the hyperbridge chain instance
7137
+ */
7138
+ get hyperbridge() {
7139
+ return this.config.hyperbridge;
7140
+ }
7055
7141
  /**
7056
7142
  * Query for a single state machine update event greater than or equal to the given height.
7057
7143
  * @params statemachineId - ID of the state machine
@@ -7205,13 +7291,13 @@ var IndexerClient = class {
7205
7291
  return request2;
7206
7292
  };
7207
7293
  let hyperbridgeDelivered;
7208
- if (request.source === this.config.hyperbridge.stateMachineId) {
7294
+ if (request.source === this.config.hyperbridge.config.stateMachineId) {
7209
7295
  hyperbridgeDelivered = request.statuses[0];
7210
7296
  } else {
7211
7297
  const sourceFinality = await this.queryStateMachineUpdateByHeight({
7212
7298
  statemachineId: request.source,
7213
7299
  height: request.statuses[0].metadata.blockNumber,
7214
- chain: this.config.hyperbridge.stateMachineId
7300
+ chain: this.config.hyperbridge.config.stateMachineId
7215
7301
  });
7216
7302
  if (!sourceFinality) return addFinalityEvents(request);
7217
7303
  events.push({
@@ -7226,20 +7312,17 @@ var IndexerClient = class {
7226
7312
  hyperbridgeDelivered = request.statuses.find((item) => item.status === RequestStatus.HYPERBRIDGE_DELIVERED);
7227
7313
  if (!hyperbridgeDelivered) return addFinalityEvents(request);
7228
7314
  }
7229
- if (request.dest === this.config.hyperbridge.stateMachineId) {
7315
+ if (request.dest === this.config.hyperbridge.config.stateMachineId) {
7230
7316
  return addFinalityEvents(request);
7231
7317
  }
7232
7318
  const hyperbridgeFinality = await this.queryStateMachineUpdateByHeight({
7233
- statemachineId: this.config.hyperbridge.stateMachineId,
7319
+ statemachineId: this.config.hyperbridge.config.stateMachineId,
7234
7320
  height: hyperbridgeDelivered.metadata.blockNumber,
7235
7321
  chain: request.dest
7236
7322
  });
7237
7323
  if (!hyperbridgeFinality) return addFinalityEvents(request);
7238
- const destChain = await getChain(this.config.dest);
7239
- const hyperbridge = await getChain({
7240
- ...this.config.hyperbridge,
7241
- hasher: "Keccak"
7242
- });
7324
+ const destChain = this.config.dest;
7325
+ const hyperbridge = this.config.hyperbridge;
7243
7326
  const proof = await hyperbridge.queryProof(
7244
7327
  { Requests: [postRequestCommitment(request).commitment] },
7245
7328
  request.dest,
@@ -7248,8 +7331,8 @@ var IndexerClient = class {
7248
7331
  const calldata = destChain.encode({
7249
7332
  kind: "PostRequest",
7250
7333
  proof: {
7251
- stateMachine: this.config.hyperbridge.stateMachineId,
7252
- consensusStateId: this.config.hyperbridge.consensusStateId,
7334
+ stateMachine: this.config.hyperbridge.config.stateMachineId,
7335
+ consensusStateId: this.config.hyperbridge.config.consensusStateId,
7253
7336
  proof,
7254
7337
  height: BigInt(hyperbridgeFinality.height)
7255
7338
  },
@@ -7285,11 +7368,8 @@ var IndexerClient = class {
7285
7368
  * @private
7286
7369
  */
7287
7370
  async addTimeoutFinalityEvents(request) {
7288
- const destChain = await getChain(this.config.dest);
7289
- const hyperbridge = await getChain({
7290
- ...this.config.hyperbridge,
7291
- hasher: "Keccak"
7292
- });
7371
+ const destChain = this.config.dest;
7372
+ const hyperbridge = this.config.hyperbridge;
7293
7373
  const events = [];
7294
7374
  const commitment = postRequestCommitment(request).commitment;
7295
7375
  const reciept = await destChain.queryRequestReceipt(commitment);
@@ -7318,7 +7398,7 @@ var IndexerClient = class {
7318
7398
  let hyperbridgeFinalized;
7319
7399
  if (!delivered) {
7320
7400
  hyperbridgeFinalized = await this.queryStateMachineUpdateByTimestamp({
7321
- statemachineId: this.config.hyperbridge.stateMachineId,
7401
+ statemachineId: this.config.hyperbridge.config.stateMachineId,
7322
7402
  commitmentTimestamp: request.timeoutTimestamp,
7323
7403
  chain: request.source
7324
7404
  });
@@ -7326,7 +7406,7 @@ var IndexerClient = class {
7326
7406
  const destFinalized = await this.queryStateMachineUpdateByTimestamp({
7327
7407
  statemachineId: request.dest,
7328
7408
  commitmentTimestamp: request.timeoutTimestamp,
7329
- chain: this.config.hyperbridge.stateMachineId
7409
+ chain: this.config.hyperbridge.config.stateMachineId
7330
7410
  });
7331
7411
  if (!destFinalized) return addTimeoutEvents(request);
7332
7412
  events.push({
@@ -7338,13 +7418,13 @@ var IndexerClient = class {
7338
7418
  timestamp: destFinalized.timestamp
7339
7419
  }
7340
7420
  });
7341
- if (request.source === this.config.hyperbridge.stateMachineId) return request;
7421
+ if (request.source === this.config.hyperbridge.config.stateMachineId) return request;
7342
7422
  const hyperbridgeTimedOut = request.statuses.find(
7343
7423
  (item) => item.status === TimeoutStatus.HYPERBRIDGE_TIMED_OUT
7344
7424
  );
7345
7425
  if (!hyperbridgeTimedOut) return addTimeoutEvents(request);
7346
7426
  hyperbridgeFinalized = await this.queryStateMachineUpdateByHeight({
7347
- statemachineId: this.config.hyperbridge.stateMachineId,
7427
+ statemachineId: this.config.hyperbridge.config.stateMachineId,
7348
7428
  height: hyperbridgeTimedOut.metadata.blockNumber,
7349
7429
  chain: request.source
7350
7430
  });
@@ -7353,14 +7433,14 @@ var IndexerClient = class {
7353
7433
  const proof = await hyperbridge.queryStateProof(BigInt(hyperbridgeFinalized.height), [
7354
7434
  hyperbridge.requestReceiptKey(commitment)
7355
7435
  ]);
7356
- const sourceChain = await getChain(this.config.source);
7436
+ const sourceChain = this.config.source;
7357
7437
  const calldata = sourceChain.encode({
7358
7438
  kind: "TimeoutPostRequest",
7359
7439
  proof: {
7360
7440
  proof,
7361
7441
  height: BigInt(hyperbridgeFinalized.height),
7362
- stateMachine: this.config.hyperbridge.stateMachineId,
7363
- consensusStateId: this.config.hyperbridge.consensusStateId
7442
+ stateMachine: this.config.hyperbridge.config.stateMachineId,
7443
+ consensusStateId: this.config.hyperbridge.config.consensusStateId
7364
7444
  },
7365
7445
  requests: [
7366
7446
  {
@@ -7442,14 +7522,14 @@ var IndexerClient = class {
7442
7522
  return request2;
7443
7523
  };
7444
7524
  let hyperbridgeDelivered;
7445
- if (request.source === this.config.hyperbridge.stateMachineId) {
7525
+ if (request.source === this.config.hyperbridge.config.stateMachineId) {
7446
7526
  hyperbridgeDelivered = request.statuses[0];
7447
7527
  return addFinalityEvents(request);
7448
7528
  } else {
7449
7529
  const sourceFinality = await this.queryStateMachineUpdateByHeight({
7450
7530
  statemachineId: request.source,
7451
7531
  height: request.statuses[0].metadata.blockNumber,
7452
- chain: this.config.hyperbridge.stateMachineId
7532
+ chain: this.config.hyperbridge.config.stateMachineId
7453
7533
  });
7454
7534
  if (!sourceFinality) return addFinalityEvents(request);
7455
7535
  events.push({
@@ -7465,16 +7545,13 @@ var IndexerClient = class {
7465
7545
  if (!hyperbridgeDelivered) return addFinalityEvents(request);
7466
7546
  }
7467
7547
  const hyperbridgeFinality = await this.queryStateMachineUpdateByHeight({
7468
- statemachineId: this.config.hyperbridge.stateMachineId,
7548
+ statemachineId: this.config.hyperbridge.config.stateMachineId,
7469
7549
  height: hyperbridgeDelivered.metadata.blockNumber,
7470
7550
  chain: request.source
7471
7551
  });
7472
7552
  if (!hyperbridgeFinality) return addFinalityEvents(request);
7473
- const sourceChain = await getChain(this.config.source);
7474
- const hyperbridge = await getChain({
7475
- ...this.config.hyperbridge,
7476
- hasher: "Keccak"
7477
- });
7553
+ const sourceChain = this.config.source;
7554
+ const hyperbridge = this.config.hyperbridge;
7478
7555
  try {
7479
7556
  const response = await this.queryResponseByRequestId(request.commitment);
7480
7557
  if (!response) return addFinalityEvents(request);
@@ -7486,8 +7563,8 @@ var IndexerClient = class {
7486
7563
  const calldata = sourceChain.encode({
7487
7564
  kind: "GetResponse",
7488
7565
  proof: {
7489
- stateMachine: this.config.hyperbridge.stateMachineId,
7490
- consensusStateId: this.config.hyperbridge.consensusStateId,
7566
+ stateMachine: this.config.hyperbridge.config.stateMachineId,
7567
+ consensusStateId: this.config.hyperbridge.config.consensusStateId,
7491
7568
  proof,
7492
7569
  height: BigInt(hyperbridgeFinality.height)
7493
7570
  },
@@ -7552,7 +7629,7 @@ var IndexerClient = class {
7552
7629
  promise: () => this.queryPostRequest(hash)
7553
7630
  });
7554
7631
  logger.trace("`Request` found");
7555
- const chain = await getChain(this.config.dest);
7632
+ const chain = this.config.dest;
7556
7633
  const timeoutStream = request.timeoutTimestamp > 0n ? this.timeoutStream(request.timeoutTimestamp, chain) : void 0;
7557
7634
  const statusStream = this.postRequestStatusStreamInternal(hash, controller.signal);
7558
7635
  logger.trace("Listening for events");
@@ -7602,7 +7679,7 @@ var IndexerClient = class {
7602
7679
  */
7603
7680
  async *postRequestStatusStreamInternal(hash, signal) {
7604
7681
  let request = await this.waitOrAbort({ signal, promise: () => this.queryPostRequest(hash) });
7605
- let status = request.source === this.config.hyperbridge.stateMachineId ? RequestStatus.HYPERBRIDGE_DELIVERED : RequestStatus.SOURCE;
7682
+ let status = request.source === this.config.hyperbridge.config.stateMachineId ? RequestStatus.HYPERBRIDGE_DELIVERED : RequestStatus.SOURCE;
7606
7683
  const latestMetadata = request.statuses[request.statuses.length - 1];
7607
7684
  const latest_request = maxBy(
7608
7685
  [status, latestMetadata.status],
@@ -7619,7 +7696,7 @@ var IndexerClient = class {
7619
7696
  promise: () => this.queryStateMachineUpdateByHeight({
7620
7697
  statemachineId: request.source,
7621
7698
  height: request.statuses[0].metadata.blockNumber,
7622
- chain: this.config.hyperbridge.stateMachineId
7699
+ chain: this.config.hyperbridge.config.stateMachineId
7623
7700
  })
7624
7701
  });
7625
7702
  yield {
@@ -7641,7 +7718,7 @@ var IndexerClient = class {
7641
7718
  promise: () => this.queryPostRequest(hash),
7642
7719
  predicate: (request2) => !request2 || request2.statuses.length < 2
7643
7720
  });
7644
- status = request.dest === this.config.hyperbridge.stateMachineId ? RequestStatus.DESTINATION : RequestStatus.HYPERBRIDGE_DELIVERED;
7721
+ status = request.dest === this.config.hyperbridge.config.stateMachineId ? RequestStatus.DESTINATION : RequestStatus.HYPERBRIDGE_DELIVERED;
7645
7722
  yield {
7646
7723
  status,
7647
7724
  metadata: {
@@ -7659,7 +7736,7 @@ var IndexerClient = class {
7659
7736
  const hyperbridgeFinalized = await this.waitOrAbort({
7660
7737
  signal,
7661
7738
  promise: () => {
7662
- const stateMachineId = this.config.hyperbridge.stateMachineId;
7739
+ const stateMachineId = this.config.hyperbridge.config.stateMachineId;
7663
7740
  const index = request.source === stateMachineId ? 0 : 1;
7664
7741
  return this.queryStateMachineUpdateByHeight({
7665
7742
  statemachineId: stateMachineId,
@@ -7668,11 +7745,8 @@ var IndexerClient = class {
7668
7745
  });
7669
7746
  }
7670
7747
  });
7671
- const destChain = await getChain(this.config.dest);
7672
- const hyperbridge = await getChain({
7673
- ...this.config.hyperbridge,
7674
- hasher: "Keccak"
7675
- });
7748
+ const destChain = this.config.dest;
7749
+ const hyperbridge = this.config.hyperbridge;
7676
7750
  const safeFetchProof = async () => {
7677
7751
  try {
7678
7752
  const proof_hex = await hyperbridge.queryProof(
@@ -7700,20 +7774,20 @@ var IndexerClient = class {
7700
7774
  const calldata = destChain.encode({
7701
7775
  kind: "PostRequest",
7702
7776
  proof: {
7703
- stateMachine: this.config.hyperbridge.stateMachineId,
7704
- consensusStateId: this.config.hyperbridge.consensusStateId,
7777
+ stateMachine: this.config.hyperbridge.config.stateMachineId,
7778
+ consensusStateId: this.config.hyperbridge.config.consensusStateId,
7705
7779
  proof: proof.data,
7706
7780
  height: BigInt(hyperbridgeFinalized.height)
7707
7781
  },
7708
7782
  requests: [request],
7709
7783
  signer: pad("0x")
7710
7784
  });
7711
- const { stateId } = parseStateMachineId(this.config.hyperbridge.stateMachineId);
7785
+ const { stateId } = parseStateMachineId(this.config.hyperbridge.config.stateMachineId);
7712
7786
  await waitForChallengePeriod(destChain, {
7713
7787
  height: BigInt(hyperbridgeFinalized.height),
7714
7788
  id: {
7715
7789
  stateId,
7716
- consensusStateId: toHex(this.config.hyperbridge.consensusStateId)
7790
+ consensusStateId: toHex(this.config.hyperbridge.config.consensusStateId)
7717
7791
  }
7718
7792
  });
7719
7793
  yield {
@@ -7736,7 +7810,7 @@ var IndexerClient = class {
7736
7810
  promise: () => this.queryPostRequest(hash),
7737
7811
  predicate: (request2) => !request2 || !request2.statuses.find((s) => s.status === RequestStatus.DESTINATION)
7738
7812
  });
7739
- const index = request.source === this.config.hyperbridge.stateMachineId ? 1 : 2;
7813
+ const index = request.source === this.config.hyperbridge.config.stateMachineId ? 1 : 2;
7740
7814
  yield {
7741
7815
  status: RequestStatus.DESTINATION,
7742
7816
  metadata: {
@@ -7795,7 +7869,7 @@ var IndexerClient = class {
7795
7869
  signal: controller.signal,
7796
7870
  promise: () => this.queryGetRequest(hash)
7797
7871
  });
7798
- const chain = await getChain(this.config.dest);
7872
+ const chain = this.config.dest;
7799
7873
  const timeoutStream = request.timeoutTimestamp > 0n ? this.timeoutStream(request.timeoutTimestamp, chain) : void 0;
7800
7874
  const statusStream = this.getRequestStatusStreamInternal(hash, controller.signal);
7801
7875
  const combined = timeoutStream ? mergeRace(timeoutStream, statusStream) : statusStream;
@@ -7819,7 +7893,7 @@ var IndexerClient = class {
7819
7893
  */
7820
7894
  async *getRequestStatusStreamInternal(hash, signal) {
7821
7895
  let request = await this.waitOrAbort({ signal, promise: () => this.queryGetRequest(hash) });
7822
- let status = request.source === this.config.hyperbridge.stateMachineId ? RequestStatus.HYPERBRIDGE_DELIVERED : RequestStatus.SOURCE;
7896
+ let status = request.source === this.config.hyperbridge.config.stateMachineId ? RequestStatus.HYPERBRIDGE_DELIVERED : RequestStatus.SOURCE;
7823
7897
  const latestMetadata = request.statuses[request.statuses.length - 1];
7824
7898
  status = maxBy([status, latestMetadata.status], (item) => REQUEST_STATUS_WEIGHTS[item]);
7825
7899
  if (!status) return;
@@ -7832,7 +7906,7 @@ var IndexerClient = class {
7832
7906
  promise: () => this.queryStateMachineUpdateByHeight({
7833
7907
  statemachineId: request.source,
7834
7908
  height: request.statuses[0].metadata.blockNumber,
7835
- chain: this.config.hyperbridge.stateMachineId
7909
+ chain: this.config.hyperbridge.config.stateMachineId
7836
7910
  })
7837
7911
  });
7838
7912
  yield {
@@ -7854,7 +7928,7 @@ var IndexerClient = class {
7854
7928
  promise: () => this.queryGetRequest(hash),
7855
7929
  predicate: (request2) => !request2 || request2.statuses.length < 2
7856
7930
  });
7857
- status = request.source === this.config.hyperbridge.stateMachineId ? RequestStatus.DESTINATION : RequestStatus.HYPERBRIDGE_DELIVERED;
7931
+ status = request.source === this.config.hyperbridge.config.stateMachineId ? RequestStatus.DESTINATION : RequestStatus.HYPERBRIDGE_DELIVERED;
7858
7932
  yield {
7859
7933
  status,
7860
7934
  metadata: {
@@ -7869,22 +7943,19 @@ var IndexerClient = class {
7869
7943
  }
7870
7944
  // the request has been verified and aggregated on Hyperbridge
7871
7945
  case RequestStatus.HYPERBRIDGE_DELIVERED: {
7872
- if (request.source === this.config.hyperbridge.stateMachineId) {
7946
+ if (request.source === this.config.hyperbridge.config.stateMachineId) {
7873
7947
  return;
7874
7948
  }
7875
7949
  const hyperbridgeFinalized = await this.waitOrAbort({
7876
7950
  signal,
7877
7951
  promise: () => this.queryStateMachineUpdateByHeight({
7878
- statemachineId: this.config.hyperbridge.stateMachineId,
7952
+ statemachineId: this.config.hyperbridge.config.stateMachineId,
7879
7953
  height: request.statuses[1].metadata.blockNumber,
7880
7954
  chain: request.source
7881
7955
  })
7882
7956
  });
7883
- const sourceChain = await getChain(this.config.source);
7884
- const hyperbridge = await getChain({
7885
- ...this.config.hyperbridge,
7886
- hasher: "Keccak"
7887
- });
7957
+ const sourceChain = this.config.source;
7958
+ const hyperbridge = this.config.hyperbridge;
7888
7959
  const response = await this.queryResponseByRequestId(hash);
7889
7960
  const proof = await hyperbridge.queryProof(
7890
7961
  { Responses: [response?.commitment] },
@@ -7894,8 +7965,8 @@ var IndexerClient = class {
7894
7965
  const calldata = sourceChain.encode({
7895
7966
  kind: "GetResponse",
7896
7967
  proof: {
7897
- stateMachine: this.config.hyperbridge.stateMachineId,
7898
- consensusStateId: this.config.hyperbridge.consensusStateId,
7968
+ stateMachine: this.config.hyperbridge.config.stateMachineId,
7969
+ consensusStateId: this.config.hyperbridge.config.consensusStateId,
7899
7970
  proof,
7900
7971
  height: BigInt(hyperbridgeFinalized.height)
7901
7972
  },
@@ -7925,7 +7996,7 @@ var IndexerClient = class {
7925
7996
  }
7926
7997
  // request has been finalized by hyperbridge
7927
7998
  case RequestStatus.HYPERBRIDGE_FINALIZED: {
7928
- if (request.source === this.config.hyperbridge.stateMachineId) {
7999
+ if (request.source === this.config.hyperbridge.config.stateMachineId) {
7929
8000
  return;
7930
8001
  }
7931
8002
  request = await this.waitOrAbort({
@@ -8008,13 +8079,10 @@ var IndexerClient = class {
8008
8079
  signal,
8009
8080
  promise: () => this.queryPostRequest(hash)
8010
8081
  });
8011
- const destChain = await getChain(this.config.dest);
8012
- let status = request.dest === this.config.hyperbridge.stateMachineId ? TimeoutStatus.HYPERBRIDGE_TIMED_OUT : TimeoutStatus.PENDING_TIMEOUT;
8082
+ const destChain = this.config.dest;
8083
+ let status = request.dest === this.config.hyperbridge.config.stateMachineId ? TimeoutStatus.HYPERBRIDGE_TIMED_OUT : TimeoutStatus.PENDING_TIMEOUT;
8013
8084
  const commitment = postRequestCommitment(request).commitment;
8014
- const hyperbridge = await getChain({
8015
- ...this.config.hyperbridge,
8016
- hasher: "Keccak"
8017
- });
8085
+ const hyperbridge = this.config.hyperbridge;
8018
8086
  const latest = request.statuses[request.statuses.length - 1];
8019
8087
  const latest_request = maxBy(
8020
8088
  [status, latest.status],
@@ -8028,7 +8096,7 @@ var IndexerClient = class {
8028
8096
  switch (status) {
8029
8097
  case TimeoutStatus.PENDING_TIMEOUT: {
8030
8098
  const receipt = await hyperbridge.queryRequestReceipt(commitment);
8031
- if (!receipt && request.source !== this.config.hyperbridge.stateMachineId) {
8099
+ if (!receipt && request.source !== this.config.hyperbridge.config.stateMachineId) {
8032
8100
  status = TimeoutStatus.HYPERBRIDGE_TIMED_OUT;
8033
8101
  break;
8034
8102
  }
@@ -8037,7 +8105,7 @@ var IndexerClient = class {
8037
8105
  promise: () => this.queryStateMachineUpdateByTimestamp({
8038
8106
  statemachineId: request.dest,
8039
8107
  commitmentTimestamp: request.timeoutTimestamp,
8040
- chain: this.config.hyperbridge.stateMachineId
8108
+ chain: this.config.hyperbridge.config.stateMachineId
8041
8109
  })
8042
8110
  });
8043
8111
  yield {
@@ -8053,7 +8121,7 @@ var IndexerClient = class {
8053
8121
  break;
8054
8122
  }
8055
8123
  case TimeoutStatus.DESTINATION_FINALIZED_TIMEOUT: {
8056
- if (request.source !== this.config.hyperbridge.stateMachineId) {
8124
+ if (request.source !== this.config.hyperbridge.config.stateMachineId) {
8057
8125
  const receipt = await hyperbridge.queryRequestReceipt(commitment);
8058
8126
  if (!receipt) {
8059
8127
  status = TimeoutStatus.HYPERBRIDGE_TIMED_OUT;
@@ -8063,7 +8131,7 @@ var IndexerClient = class {
8063
8131
  const update = await this.queryStateMachineUpdateByTimestamp({
8064
8132
  statemachineId: request.dest,
8065
8133
  commitmentTimestamp: request.timeoutTimestamp,
8066
- chain: this.config.hyperbridge.stateMachineId
8134
+ chain: this.config.hyperbridge.config.stateMachineId
8067
8135
  });
8068
8136
  const proof = await destChain.queryStateProof(BigInt(update.height), [
8069
8137
  destChain.requestReceiptKey(commitment)
@@ -8073,7 +8141,7 @@ var IndexerClient = class {
8073
8141
  height: BigInt(update.height),
8074
8142
  id: {
8075
8143
  stateId,
8076
- consensusStateId: toHex(this.config.dest.consensusStateId)
8144
+ consensusStateId: toHex(this.config.dest.config.consensusStateId)
8077
8145
  }
8078
8146
  });
8079
8147
  const { blockHash, transactionHash, blockNumber, timestamp } = await hyperbridge.submitUnsigned({
@@ -8082,7 +8150,7 @@ var IndexerClient = class {
8082
8150
  proof,
8083
8151
  height: BigInt(update.height),
8084
8152
  stateMachine: request.dest,
8085
- consensusStateId: this.config.dest.consensusStateId
8153
+ consensusStateId: this.config.dest.config.consensusStateId
8086
8154
  },
8087
8155
  requests: [
8088
8156
  {
@@ -8096,7 +8164,7 @@ var IndexerClient = class {
8096
8164
  }
8097
8165
  ]
8098
8166
  });
8099
- status = request.source === this.config.hyperbridge.stateMachineId ? TimeoutStatus.TIMED_OUT : TimeoutStatus.HYPERBRIDGE_TIMED_OUT;
8167
+ status = request.source === this.config.hyperbridge.config.stateMachineId ? TimeoutStatus.TIMED_OUT : TimeoutStatus.HYPERBRIDGE_TIMED_OUT;
8100
8168
  yield {
8101
8169
  status,
8102
8170
  metadata: {
@@ -8117,7 +8185,7 @@ var IndexerClient = class {
8117
8185
  update = await this.waitOrAbort({
8118
8186
  signal,
8119
8187
  promise: () => this.queryStateMachineUpdateByTimestamp({
8120
- statemachineId: this.config.hyperbridge.stateMachineId,
8188
+ statemachineId: this.config.hyperbridge.config.stateMachineId,
8121
8189
  commitmentTimestamp: request.timeoutTimestamp,
8122
8190
  chain: request.source
8123
8191
  })
@@ -8136,7 +8204,7 @@ var IndexerClient = class {
8136
8204
  update = await this.waitOrAbort({
8137
8205
  signal,
8138
8206
  promise: async () => this.queryStateMachineUpdateByHeight({
8139
- statemachineId: this.config.hyperbridge.stateMachineId,
8207
+ statemachineId: this.config.hyperbridge.config.stateMachineId,
8140
8208
  height: timeout.metadata.blockNumber,
8141
8209
  chain: request.source
8142
8210
  })
@@ -8145,14 +8213,14 @@ var IndexerClient = class {
8145
8213
  const proof = await hyperbridge.queryStateProof(BigInt(update.height), [
8146
8214
  hyperbridge.requestReceiptKey(commitment)
8147
8215
  ]);
8148
- const sourceChain = await getChain(this.config.source);
8216
+ const sourceChain = this.config.source;
8149
8217
  const calldata = sourceChain.encode({
8150
8218
  kind: "TimeoutPostRequest",
8151
8219
  proof: {
8152
8220
  proof,
8153
8221
  height: BigInt(update.height),
8154
- stateMachine: this.config.hyperbridge.stateMachineId,
8155
- consensusStateId: this.config.hyperbridge.consensusStateId
8222
+ stateMachine: this.config.hyperbridge.config.stateMachineId,
8223
+ consensusStateId: this.config.hyperbridge.config.consensusStateId
8156
8224
  },
8157
8225
  requests: [
8158
8226
  {
@@ -8166,12 +8234,12 @@ var IndexerClient = class {
8166
8234
  }
8167
8235
  ]
8168
8236
  });
8169
- const { stateId } = parseStateMachineId(this.config.hyperbridge.stateMachineId);
8237
+ const { stateId } = parseStateMachineId(this.config.hyperbridge.config.stateMachineId);
8170
8238
  await waitForChallengePeriod(sourceChain, {
8171
8239
  height: BigInt(update.height),
8172
8240
  id: {
8173
8241
  stateId,
8174
- consensusStateId: toHex(this.config.hyperbridge.consensusStateId)
8242
+ consensusStateId: toHex(this.config.hyperbridge.config.consensusStateId)
8175
8243
  }
8176
8244
  });
8177
8245
  yield {
@@ -8357,12 +8425,9 @@ var IndexerClient = class {
8357
8425
  */
8358
8426
  async aggregateTransactionWithCommitment(commitment) {
8359
8427
  const logger = this.logger.withTag("aggregateTransactionWithCommitment");
8360
- const { stateMachineId, consensusStateId } = this.config.source;
8361
- const sourceChain = await getChain(this.config.source);
8362
- const hyperbridge = await getChain({
8363
- ...this.config.hyperbridge,
8364
- hasher: "Keccak"
8365
- });
8428
+ const { stateMachineId, consensusStateId } = this.config.source.config;
8429
+ const sourceChain = this.config.source;
8430
+ const hyperbridge = this.config.hyperbridge;
8366
8431
  logger.trace("Querying post request with commitment hash");
8367
8432
  const request = await this.queryPostRequest(commitment);
8368
8433
  if (!request) throw new Error("Request not found");
@@ -8374,15 +8439,15 @@ var IndexerClient = class {
8374
8439
  logger.trace("Query Request Proof from sourceChain");
8375
8440
  const proof = await sourceChain.queryProof(
8376
8441
  { Requests: [commitment] },
8377
- this.config.hyperbridge.stateMachineId,
8442
+ this.config.hyperbridge.config.stateMachineId,
8378
8443
  latestStateMachineHeight
8379
8444
  );
8380
8445
  logger.trace("Construct Extrinsic and Submit Unsigned");
8381
8446
  const calldata = await hyperbridge.submitUnsigned({
8382
8447
  kind: "PostRequest",
8383
8448
  proof: {
8384
- stateMachine: this.config.source.stateMachineId,
8385
- consensusStateId: this.config.source.consensusStateId,
8449
+ stateMachine: this.config.source.config.stateMachineId,
8450
+ consensusStateId: this.config.source.config.consensusStateId,
8386
8451
  proof,
8387
8452
  height: BigInt(latestStateMachineHeight)
8388
8453
  },
@@ -10897,8 +10962,8 @@ var IntentGateway = class {
10897
10962
  body: constructRedeemEscrowRequestBody(order, MOCK_ADDRESS),
10898
10963
  timeoutTimestamp: 0n,
10899
10964
  nonce: await this.source.getHostNonce(),
10900
- from: this.source.config.getIntentGatewayAddress(order.destChain),
10901
- to: this.source.config.getIntentGatewayAddress(order.sourceChain)
10965
+ from: this.source.configService.getIntentGatewayAddress(order.destChain),
10966
+ to: this.source.configService.getIntentGatewayAddress(order.sourceChain)
10902
10967
  };
10903
10968
  const { decimals: sourceChainFeeTokenDecimals } = await this.source.getFeeTokenWithDecimals();
10904
10969
  const { address: destChainFeeTokenAddress, decimals: destChainFeeTokenDecimals } = await this.dest.getFeeTokenWithDecimals();
@@ -10920,7 +10985,7 @@ var IntentGateway = class {
10920
10985
  relayerFee: relayerFeeInDestFeeToken
10921
10986
  };
10922
10987
  const totalEthValue = order.outputs.filter((output) => bytes32ToBytes20(output.token) === ADDRESS_ZERO).reduce((sum, output) => sum + output.amount, 0n);
10923
- const intentGatewayAddress = this.source.config.getIntentGatewayAddress(order.destChain);
10988
+ const intentGatewayAddress = this.source.configService.getIntentGatewayAddress(order.destChain);
10924
10989
  const testValue = toHex(maxUint256 / 2n);
10925
10990
  const orderOverrides = await Promise.all(
10926
10991
  order.outputs.map(async (output) => {
@@ -11054,7 +11119,7 @@ var IntentGateway = class {
11054
11119
  */
11055
11120
  async convertFeeTokenToNative(feeTokenAmount, getQuoteIn, evmChainID) {
11056
11121
  const client = this[getQuoteIn].client;
11057
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11122
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11058
11123
  const feeToken = await this[getQuoteIn].getFeeTokenWithDecimals();
11059
11124
  try {
11060
11125
  const { amountOut } = await this.findBestProtocolWithAmountIn(
@@ -11091,7 +11156,7 @@ var IntentGateway = class {
11091
11156
  async convertGasToFeeToken(gasEstimate, gasEstimateIn, evmChainID) {
11092
11157
  const client = this[gasEstimateIn].client;
11093
11158
  const useEtherscan = USE_ETHERSCAN_CHAINS.has(evmChainID);
11094
- const etherscanApiKey = useEtherscan ? this[gasEstimateIn].config.getEtherscanApiKey() : void 0;
11159
+ const etherscanApiKey = useEtherscan ? this[gasEstimateIn].configService.getEtherscanApiKey() : void 0;
11095
11160
  const gasPrice = useEtherscan && etherscanApiKey ? await retryPromise(() => getGasPriceFromEtherscan(evmChainID, etherscanApiKey), {
11096
11161
  maxRetries: 3,
11097
11162
  backoffMs: 250
@@ -11100,7 +11165,7 @@ var IntentGateway = class {
11100
11165
  return await client.getGasPrice();
11101
11166
  }) : await client.getGasPrice();
11102
11167
  const gasCostInWei = gasEstimate * gasPrice;
11103
- const wethAddr = this[gasEstimateIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11168
+ const wethAddr = this[gasEstimateIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11104
11169
  const feeToken = await this[gasEstimateIn].getFeeTokenWithDecimals();
11105
11170
  try {
11106
11171
  const { amountOut } = await this.findBestProtocolWithAmountIn(
@@ -11144,7 +11209,7 @@ var IntentGateway = class {
11144
11209
  payer: postRequest.from
11145
11210
  };
11146
11211
  const quoteNative = await this.dest.client.readContract({
11147
- address: this.dest.config.getIntentGatewayAddress(postRequest.dest),
11212
+ address: this.dest.configService.getIntentGatewayAddress(postRequest.dest),
11148
11213
  abi: IntentGateway_default.ABI,
11149
11214
  functionName: "quoteNative",
11150
11215
  args: [dispatchPost]
@@ -11156,8 +11221,8 @@ var IntentGateway = class {
11156
11221
  */
11157
11222
  async getV2QuoteWithAmountOut(getQuoteIn, tokenIn, tokenOut, amountOut, evmChainID) {
11158
11223
  const client = this[getQuoteIn].client;
11159
- const v2Router = this[getQuoteIn].config.getUniswapRouterV2Address(evmChainID);
11160
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11224
+ const v2Router = this[getQuoteIn].configService.getUniswapRouterV2Address(evmChainID);
11225
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11161
11226
  const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
11162
11227
  const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
11163
11228
  try {
@@ -11180,8 +11245,8 @@ var IntentGateway = class {
11180
11245
  */
11181
11246
  async getV2QuoteWithAmountIn(getQuoteIn, tokenIn, tokenOut, amountIn, evmChainID) {
11182
11247
  const client = this[getQuoteIn].client;
11183
- const v2Router = this[getQuoteIn].config.getUniswapRouterV2Address(evmChainID);
11184
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11248
+ const v2Router = this[getQuoteIn].configService.getUniswapRouterV2Address(evmChainID);
11249
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11185
11250
  const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
11186
11251
  const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
11187
11252
  try {
@@ -11207,8 +11272,8 @@ var IntentGateway = class {
11207
11272
  const commonFees = [100, 500, 3e3, 1e4];
11208
11273
  let bestAmountIn = maxUint256;
11209
11274
  let bestFee = 0;
11210
- const v3Quoter = this[getQuoteIn].config.getUniswapV3QuoterAddress(evmChainID);
11211
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11275
+ const v3Quoter = this[getQuoteIn].configService.getUniswapV3QuoterAddress(evmChainID);
11276
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11212
11277
  const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
11213
11278
  const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
11214
11279
  for (const fee of commonFees) {
@@ -11246,8 +11311,8 @@ var IntentGateway = class {
11246
11311
  const commonFees = [100, 500, 3e3, 1e4];
11247
11312
  let bestAmountOut = BigInt(0);
11248
11313
  let bestFee = 0;
11249
- const v3Quoter = this[getQuoteIn].config.getUniswapV3QuoterAddress(evmChainID);
11250
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11314
+ const v3Quoter = this[getQuoteIn].configService.getUniswapV3QuoterAddress(evmChainID);
11315
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11251
11316
  const tokenInForQuote = tokenIn === ADDRESS_ZERO ? wethAsset : tokenIn;
11252
11317
  const tokenOutForQuote = tokenOut === ADDRESS_ZERO ? wethAsset : tokenOut;
11253
11318
  for (const fee of commonFees) {
@@ -11285,7 +11350,7 @@ var IntentGateway = class {
11285
11350
  const commonFees = [100, 500, 3e3, 1e4];
11286
11351
  let bestAmountIn = maxUint256;
11287
11352
  let bestFee = 0;
11288
- const v4Quoter = this[getQuoteIn].config.getUniswapV4QuoterAddress(evmChainID);
11353
+ const v4Quoter = this[getQuoteIn].configService.getUniswapV4QuoterAddress(evmChainID);
11289
11354
  for (const fee of commonFees) {
11290
11355
  try {
11291
11356
  const currency0 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenIn : tokenOut;
@@ -11330,7 +11395,7 @@ var IntentGateway = class {
11330
11395
  const commonFees = [100, 500, 3e3, 1e4];
11331
11396
  let bestAmountOut = BigInt(0);
11332
11397
  let bestFee = 0;
11333
- const v4Quoter = this[getQuoteIn].config.getUniswapV4QuoterAddress(evmChainID);
11398
+ const v4Quoter = this[getQuoteIn].configService.getUniswapV4QuoterAddress(evmChainID);
11334
11399
  for (const fee of commonFees) {
11335
11400
  try {
11336
11401
  const currency0 = tokenIn.toLowerCase() < tokenOut.toLowerCase() ? tokenIn : tokenOut;
@@ -11375,7 +11440,7 @@ var IntentGateway = class {
11375
11440
  throw new Error("Source and target tokens cannot be the same");
11376
11441
  }
11377
11442
  const isPermit2 = false;
11378
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11443
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11379
11444
  const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
11380
11445
  const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
11381
11446
  const path = [swapSourceAddress, swapTargetAddress];
@@ -11385,7 +11450,7 @@ var IntentGateway = class {
11385
11450
  commands.push(11 /* WRAP_ETH */);
11386
11451
  inputs.push(
11387
11452
  encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
11388
- this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11453
+ this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11389
11454
  amountIn
11390
11455
  ])
11391
11456
  );
@@ -11397,7 +11462,7 @@ var IntentGateway = class {
11397
11462
  "address recipient, uint256 amountIn, uint256 amountOutMinimum, address[] path, bool isPermit2"
11398
11463
  ),
11399
11464
  [
11400
- targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
11465
+ targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID) : recipient,
11401
11466
  amountIn,
11402
11467
  amountOutMinimum,
11403
11468
  path,
@@ -11425,7 +11490,7 @@ var IntentGateway = class {
11425
11490
  const transferData = encodeFunctionData({
11426
11491
  abi: erc20Abi,
11427
11492
  functionName: "transfer",
11428
- args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountIn]
11493
+ args: [this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID), amountIn]
11429
11494
  });
11430
11495
  transactions.push({
11431
11496
  to: sourceTokenAddress,
@@ -11434,7 +11499,7 @@ var IntentGateway = class {
11434
11499
  });
11435
11500
  }
11436
11501
  transactions.push({
11437
- to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11502
+ to: this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11438
11503
  value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
11439
11504
  data: executeData
11440
11505
  });
@@ -11448,7 +11513,7 @@ var IntentGateway = class {
11448
11513
  throw new Error("Source and target tokens cannot be the same");
11449
11514
  }
11450
11515
  const isPermit2 = false;
11451
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11516
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11452
11517
  const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
11453
11518
  const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
11454
11519
  const path = [swapSourceAddress, swapTargetAddress];
@@ -11459,7 +11524,7 @@ var IntentGateway = class {
11459
11524
  commands.push(11 /* WRAP_ETH */);
11460
11525
  inputs.push(
11461
11526
  encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
11462
- this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11527
+ this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11463
11528
  amountInMax
11464
11529
  ])
11465
11530
  );
@@ -11471,7 +11536,7 @@ var IntentGateway = class {
11471
11536
  "address recipient, uint256 amountOut, uint256 amountInMax, address[] path, bool isPermit2"
11472
11537
  ),
11473
11538
  [
11474
- targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
11539
+ targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID) : recipient,
11475
11540
  amountOut,
11476
11541
  amountInMax,
11477
11542
  path,
@@ -11495,7 +11560,7 @@ var IntentGateway = class {
11495
11560
  const transferData = encodeFunctionData({
11496
11561
  abi: erc20Abi,
11497
11562
  functionName: "transfer",
11498
- args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountInMax]
11563
+ args: [this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID), amountInMax]
11499
11564
  });
11500
11565
  transactions.push({
11501
11566
  to: sourceTokenAddress,
@@ -11504,7 +11569,7 @@ var IntentGateway = class {
11504
11569
  });
11505
11570
  }
11506
11571
  transactions.push({
11507
- to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11572
+ to: this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11508
11573
  value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
11509
11574
  data: executeData
11510
11575
  });
@@ -11518,7 +11583,7 @@ var IntentGateway = class {
11518
11583
  throw new Error("Source and target tokens cannot be the same");
11519
11584
  }
11520
11585
  const isPermit2 = false;
11521
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11586
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11522
11587
  const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
11523
11588
  const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
11524
11589
  const pathV3 = encodePacked(["address", "uint24", "address"], [swapSourceAddress, fee, swapTargetAddress]);
@@ -11528,7 +11593,7 @@ var IntentGateway = class {
11528
11593
  commands.push(11 /* WRAP_ETH */);
11529
11594
  inputs.push(
11530
11595
  encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
11531
- this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11596
+ this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11532
11597
  amountIn
11533
11598
  ])
11534
11599
  );
@@ -11540,7 +11605,7 @@ var IntentGateway = class {
11540
11605
  "address recipient, uint256 amountIn, uint256 amountOutMinimum, bytes path, bool isPermit2"
11541
11606
  ),
11542
11607
  [
11543
- targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
11608
+ targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID) : recipient,
11544
11609
  amountIn,
11545
11610
  amountOutMinimum,
11546
11611
  pathV3,
@@ -11568,7 +11633,7 @@ var IntentGateway = class {
11568
11633
  const transferData = encodeFunctionData({
11569
11634
  abi: erc20Abi,
11570
11635
  functionName: "transfer",
11571
- args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountIn]
11636
+ args: [this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID), amountIn]
11572
11637
  });
11573
11638
  transactions.push({
11574
11639
  to: sourceTokenAddress,
@@ -11577,7 +11642,7 @@ var IntentGateway = class {
11577
11642
  });
11578
11643
  }
11579
11644
  transactions.push({
11580
- to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11645
+ to: this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11581
11646
  value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
11582
11647
  data: executeData
11583
11648
  });
@@ -11591,7 +11656,7 @@ var IntentGateway = class {
11591
11656
  throw new Error("Source and target tokens cannot be the same");
11592
11657
  }
11593
11658
  const isPermit2 = false;
11594
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11659
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
11595
11660
  const swapSourceAddress = sourceTokenAddress === ADDRESS_ZERO ? wethAsset : sourceTokenAddress;
11596
11661
  const swapTargetAddress = targetTokenAddress === ADDRESS_ZERO ? wethAsset : targetTokenAddress;
11597
11662
  const pathV3 = encodePacked(["address", "uint24", "address"], [swapTargetAddress, fee, swapSourceAddress]);
@@ -11601,7 +11666,7 @@ var IntentGateway = class {
11601
11666
  commands.push(11 /* WRAP_ETH */);
11602
11667
  inputs.push(
11603
11668
  encodeAbiParameters(parseAbiParameters("address recipient, uint256 amountMin"), [
11604
- this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11669
+ this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11605
11670
  amountInMax
11606
11671
  ])
11607
11672
  );
@@ -11613,7 +11678,7 @@ var IntentGateway = class {
11613
11678
  "address recipient, uint256 amountOut, uint256 amountInMax, bytes path, bool isPermit2"
11614
11679
  ),
11615
11680
  [
11616
- targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].config.getUniversalRouterAddress(evmChainID) : recipient,
11681
+ targetTokenAddress === ADDRESS_ZERO ? this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID) : recipient,
11617
11682
  amountOut,
11618
11683
  amountInMax,
11619
11684
  pathV3,
@@ -11638,7 +11703,7 @@ var IntentGateway = class {
11638
11703
  const transferData = encodeFunctionData({
11639
11704
  abi: erc20Abi,
11640
11705
  functionName: "transfer",
11641
- args: [this[getQuoteIn].config.getUniversalRouterAddress(evmChainID), amountInMax]
11706
+ args: [this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID), amountInMax]
11642
11707
  });
11643
11708
  transactions.push({
11644
11709
  to: sourceTokenAddress,
@@ -11647,7 +11712,7 @@ var IntentGateway = class {
11647
11712
  });
11648
11713
  }
11649
11714
  transactions.push({
11650
- to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11715
+ to: this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11651
11716
  value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
11652
11717
  data: executeData
11653
11718
  });
@@ -11713,7 +11778,7 @@ var IntentGateway = class {
11713
11778
  const approveToPermit2Data = encodeFunctionData({
11714
11779
  abi: erc20Abi,
11715
11780
  functionName: "approve",
11716
- args: [this[getQuoteIn].config.getPermit2Address(evmChainID), amountIn]
11781
+ args: [this[getQuoteIn].configService.getPermit2Address(evmChainID), amountIn]
11717
11782
  });
11718
11783
  transactions.push({
11719
11784
  to: sourceTokenAddress,
@@ -11725,20 +11790,20 @@ var IntentGateway = class {
11725
11790
  functionName: "approve",
11726
11791
  args: [
11727
11792
  sourceTokenAddress,
11728
- this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11793
+ this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11729
11794
  amountIn,
11730
11795
  281474976710655
11731
11796
  // Max expiration
11732
11797
  ]
11733
11798
  });
11734
11799
  transactions.push({
11735
- to: this[getQuoteIn].config.getPermit2Address(evmChainID),
11800
+ to: this[getQuoteIn].configService.getPermit2Address(evmChainID),
11736
11801
  value: 0n,
11737
11802
  data: permit2ApprovalData
11738
11803
  });
11739
11804
  }
11740
11805
  transactions.push({
11741
- to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11806
+ to: this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11742
11807
  value: sourceTokenAddress === ADDRESS_ZERO ? amountIn : 0n,
11743
11808
  data: executeData
11744
11809
  });
@@ -11804,7 +11869,7 @@ var IntentGateway = class {
11804
11869
  const approveToPermit2Data = encodeFunctionData({
11805
11870
  abi: erc20Abi,
11806
11871
  functionName: "approve",
11807
- args: [this[getQuoteIn].config.getPermit2Address(evmChainID), amountInMax]
11872
+ args: [this[getQuoteIn].configService.getPermit2Address(evmChainID), amountInMax]
11808
11873
  });
11809
11874
  transactions.push({
11810
11875
  to: sourceTokenAddress,
@@ -11816,20 +11881,20 @@ var IntentGateway = class {
11816
11881
  functionName: "approve",
11817
11882
  args: [
11818
11883
  sourceTokenAddress,
11819
- this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11884
+ this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11820
11885
  amountInMax,
11821
11886
  281474976710655
11822
11887
  // Max expiration
11823
11888
  ]
11824
11889
  });
11825
11890
  transactions.push({
11826
- to: this[getQuoteIn].config.getPermit2Address(evmChainID),
11891
+ to: this[getQuoteIn].configService.getPermit2Address(evmChainID),
11827
11892
  value: 0n,
11828
11893
  data: permit2ApprovalData
11829
11894
  });
11830
11895
  }
11831
11896
  transactions.push({
11832
- to: this[getQuoteIn].config.getUniversalRouterAddress(evmChainID),
11897
+ to: this[getQuoteIn].configService.getUniversalRouterAddress(evmChainID),
11833
11898
  value: sourceTokenAddress === ADDRESS_ZERO ? amountInMax : 0n,
11834
11899
  data: executeData
11835
11900
  });
@@ -12255,8 +12320,8 @@ var IntentGateway = class {
12255
12320
  }
12256
12321
  async createMultiHopSwapThroughPair(dexPairAddress, tokenIn, tokenOut, amountIn, evmChainID, getQuoteIn, recipient, protocol = "v2") {
12257
12322
  const client = this[getQuoteIn].client;
12258
- const wethAsset = this[getQuoteIn].config.getWrappedNativeAssetWithDecimals(evmChainID).asset;
12259
- const calldispatcher = this[getQuoteIn].config.getCalldispatcherAddress(evmChainID);
12323
+ const wethAsset = this[getQuoteIn].configService.getWrappedNativeAssetWithDecimals(evmChainID).asset;
12324
+ const calldispatcher = this[getQuoteIn].configService.getCalldispatcherAddress(evmChainID);
12260
12325
  const [token0, token1] = await Promise.all([
12261
12326
  client.readContract({
12262
12327
  address: dexPairAddress,
@@ -12363,7 +12428,7 @@ var IntentGateway = class {
12363
12428
  * @returns True if the order has been filled, false otherwise
12364
12429
  */
12365
12430
  async isOrderFilled(order) {
12366
- const intentGatewayAddress = this.source.config.getIntentGatewayAddress(order.destChain);
12431
+ const intentGatewayAddress = this.source.configService.getIntentGatewayAddress(order.destChain);
12367
12432
  const filledSlot = await this.dest.client.readContract({
12368
12433
  abi: IntentGateway_default.ABI,
12369
12434
  address: intentGatewayAddress,
@@ -12402,8 +12467,8 @@ var IntentGateway = class {
12402
12467
  const hyperbridge = await getChain({ ...hyperbridgeConfig, hasher: "Keccak" });
12403
12468
  const sourceStateMachine = hexToString$1(order.sourceChain);
12404
12469
  const destStateMachine = hexToString$1(order.destChain);
12405
- const sourceConsensusStateId = this.source.config.getConsensusStateId(sourceStateMachine);
12406
- const destConsensusStateId = this.dest.config.getConsensusStateId(destStateMachine);
12470
+ const sourceConsensusStateId = this.source.configService.getConsensusStateId(sourceStateMachine);
12471
+ const destConsensusStateId = this.dest.configService.getConsensusStateId(destStateMachine);
12407
12472
  let destIProof;
12408
12473
  if (storedData?.destIProof) {
12409
12474
  destIProof = storedData.destIProof;
@@ -12438,7 +12503,7 @@ var IntentGateway = class {
12438
12503
  continue;
12439
12504
  }
12440
12505
  try {
12441
- const intentGatewayAddress = this.dest.config.getIntentGatewayAddress(destStateMachine);
12506
+ const intentGatewayAddress = this.dest.configService.getIntentGatewayAddress(destStateMachine);
12442
12507
  const orderId = orderCommitment(order);
12443
12508
  const slotHash = await this.dest.client.readContract({
12444
12509
  abi: IntentGateway_default.ABI,
@@ -12929,6 +12994,6 @@ async function teleportDot(param_) {
12929
12994
  return stream;
12930
12995
  }
12931
12996
 
12932
- export { ADDRESS_ZERO, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DUMMY_PRIVATE_KEY, ERC20Method, EvmChain, HyperClientStatus, IndexerClient, IntentGateway, OrderStatus, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, STATE_COMMITMENTS_SLOT, SubstrateChain, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, USE_ETHERSCAN_CHAINS, WrappedNativeDecimals, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, coingeckoIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateIdToStateMachineId, convertStateMachineIdToEnum, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getGasPriceFromEtherscan, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, maxBigInt, orderCommitment, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, viemChains };
12997
+ export { ADDRESS_ZERO, ChainConfigService, Chains, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DUMMY_PRIVATE_KEY, ERC20Method, EvmChain, HyperClientStatus, IndexerClient, IntentGateway, OrderStatus, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, RequestKind, RequestStatus, STATE_COMMITMENTS_SLOT, SubstrateChain, TESTNET_CHAINS, TeleportStatus, TimeoutStatus, USE_ETHERSCAN_CHAINS, WrappedNativeDecimals, __test, addresses, adjustFeeDecimals, assets, bytes20ToBytes32, bytes32ToBytes20, chainIds, coingeckoIds, consensusStateIds, constructRedeemEscrowRequestBody, convertStateIdToStateMachineId, convertStateMachineIdToEnum, createChain, createEvmChain, createIndexerClient, createQueryClient, createRpcUrls, encodeISMPMessage, estimateGasForPost, fetchPrice, generateRootWithProof, getChain, getGasPriceFromEtherscan, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, hexToString, maxBigInt, orderCommitment, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, viemChains };
12933
12998
  //# sourceMappingURL=index.js.map
12934
12999
  //# sourceMappingURL=index.js.map