@hyperbridge/sdk 2.3.1 → 2.3.2

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.
@@ -6786,15 +6786,20 @@ var EvmChain = class _EvmChain {
6786
6786
  async quoteNative(request, fee) {
6787
6787
  const totalFee = await this.quote(request) + fee;
6788
6788
  const feeToken = await this.getFeeTokenWithDecimals();
6789
- return this.getAmountsIn(totalFee, feeToken.address, request.source);
6789
+ const hostRouter = await this.publicClient.readContract({
6790
+ address: this.params.host,
6791
+ abi: evmHost_default.ABI,
6792
+ functionName: "uniswapV2Router"
6793
+ });
6794
+ return this.getAmountsIn(totalFee, feeToken.address, request.source, hostRouter);
6790
6795
  }
6791
6796
  /**
6792
6797
  * Given a desired output amount of a token, returns how much native is needed as input.
6793
- * Uses the chain's Uniswap V2 router: WETH → tokenOut path.
6798
+ * Uses the chain's Uniswap V2 router (or `router` when provided): WETH → tokenOut path.
6794
6799
  */
6795
- async getAmountsIn(amountOut, tokenOutForQuote, chain) {
6800
+ async getAmountsIn(amountOut, tokenOutForQuote, chain, router) {
6796
6801
  const chainId = chain ?? `EVM-${this.params.chainId}`;
6797
- const v2Router = this.configService.getUniswapRouterV2Address(chainId);
6802
+ const v2Router = router ?? this.configService.getUniswapRouterV2Address(chainId);
6798
6803
  const WETH = this.configService.getWrappedNativeAssetWithDecimals(chainId).asset;
6799
6804
  const v2AmountIn = await this.publicClient.simulateContract({
6800
6805
  address: v2Router,
@@ -16999,9 +17004,9 @@ var GasEstimator = class {
16999
17004
  from: this.ctx.source.configService.getIntentGatewayAddress(destChainId),
17000
17005
  to: this.ctx.source.configService.getIntentGatewayAddress(sourceChainId)
17001
17006
  };
17007
+ postRequestFeeInDestFeeToken = postRequestFeeInDestFeeToken * 1005n / 1000n;
17002
17008
  let protocolFeeInNativeToken = await this.ctx.dest.quoteNative(postRequest, postRequestFeeInDestFeeToken).catch(() => 0n);
17003
17009
  protocolFeeInNativeToken = protocolFeeInNativeToken * 1005n / 1000n;
17004
- postRequestFeeInDestFeeToken = postRequestFeeInDestFeeToken * 1005n / 1000n;
17005
17010
  return { postRequestFee: postRequestFeeInDestFeeToken, protocolFee: protocolFeeInNativeToken };
17006
17011
  }
17007
17012
  /**