@bolt-liquidity-hq/cosmwasm-client 0.1.0-beta.14 → 0.1.0-beta.15

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.
package/dist/index.cjs CHANGED
@@ -5569,6 +5569,7 @@ var estimateSwapExactInGasFees = async (client, { assetIn, amountIn, assetOut, m
5569
5569
  };
5570
5570
 
5571
5571
  // src/lib/router/parsers.ts
5572
+ var import_bignumber2 = require("bignumber.js");
5572
5573
  var parseMarketRepresentation = (marketRepresentation) => {
5573
5574
  return {
5574
5575
  poolAddress: marketRepresentation.market_address,
@@ -5602,6 +5603,17 @@ var parseQueryBaseLiquidityAllResponse = (response) => {
5602
5603
  }
5603
5604
  return newMapping;
5604
5605
  };
5606
+ var parseQuerySimulateSwapExactInResponse = (response) => {
5607
+ const protocolFeeAmount = (0, import_bignumber2.BigNumber)(response.protocol_fee).times((0, import_bignumber2.BigNumber)(response.base_out.amount).plus(response.lp_fee)).div((0, import_bignumber2.BigNumber)(response.quote_in.amount).minus(response.protocol_fee));
5608
+ return {
5609
+ poolAddress: response.from_pool,
5610
+ amountOut: response.base_out.amount,
5611
+ assetOut: response.base_out.denom,
5612
+ protocolFee: protocolFeeAmount.toFixed(),
5613
+ lpFee: response.lp_fee,
5614
+ totalFees: protocolFeeAmount.plus(response.lp_fee).toFixed()
5615
+ };
5616
+ };
5605
5617
 
5606
5618
  // src/lib/router/get-all-base-liquidity.ts
5607
5619
  var getAllBaseLiquidity = async (client) => {
@@ -5648,6 +5660,21 @@ var getRouterConfig = async (client) => {
5648
5660
  return parseQueryRouterConfigResponse(response);
5649
5661
  };
5650
5662
 
5663
+ // src/lib/router/simulate-swap-exact-in.ts
5664
+ var simulateSwapExactIn = async (client, { assetIn, amountIn, assetOut }) => {
5665
+ const cosmWasmClient = await client.getCosmWasmClient();
5666
+ const response = await cosmWasmClient.queryContractSmart(client.contracts.router, {
5667
+ simulate_swap_exact_in: {
5668
+ amount_in: {
5669
+ denom: assetIn,
5670
+ amount: amountIn
5671
+ },
5672
+ want_out: assetOut
5673
+ }
5674
+ });
5675
+ return parseQuerySimulateSwapExactInResponse(response);
5676
+ };
5677
+
5651
5678
  // src/lib/router/swap-exact-in.ts
5652
5679
  var import_core3 = require("@bolt-liquidity-hq/core");
5653
5680
 
@@ -6078,5 +6105,9 @@ var BoltCosmWasmClient = class extends import_core4.BaseClient {
6078
6105
  async estimateSwapGasFees(params, signer, gasAdjustment) {
6079
6106
  return await estimateSwapExactInGasFees(this, params, signer, gasAdjustment);
6080
6107
  }
6108
+ /** @inheritdoc */
6109
+ async simulateSwap(params) {
6110
+ return await simulateSwapExactIn(this, params);
6111
+ }
6081
6112
  };
6082
6113
  //# sourceMappingURL=index.cjs.map