0.1.9 • Published 1 year ago

@mayaprotocol/xchain-thorchain-query v0.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@mayaprotocol/xchain-thorchain-query

Thorchain-query module to query thorchain for estimation of swaps. Returns a TxDetail object with all the information needed to conduct a swap.

Installation

yarn add @mayaprotocol/xchain-thorchain-query

Following peer dependencies have to be installed into your project. These are not included in @mayaprotocol/xchain-thorchain-query.

yarn add @mayaprotocol/xchain-client @mayaprotocol/xchain-util @mayaprotocol/xchain-midgard @mayaprotocol/xchain-thornode axios

Examples

Estimation example from a swap of 2 BTC to RUNE

{
  memo: '=:THOR.RUNE::2071168559999',
  expiry: 2022-09-07T02:16:45.732Z,
  toAddress: '',
  txEstimate: {
    input: '₿ 2',
    totalFees: {
      inboundFee: 'ᚱ 0.02',
      swapFee: 'ᚱ 52.85380999',
      outboundFee: 'ᚱ 0.06',
      affiliateFee: 'ᚱ 0'
    },
    slipPercentage: '0.00246920801878638026',
    netOutput: 'ᚱ 21,352.25318742',
    waitTimeSeconds: '1248',
    canSwap: true,
    errors: []
  }
}

Documentation

Overview

For bash exmples, see example folder at the base of this repository xchainjs/xchainjs-lib.

xchain-thorchain-query

How xchain-thorchain-query works: http://docs.xchainjs.org/xchain-thorchain-query/how-it-works.html\ How to use xchain-thorchain-query: http://docs.xchainjs.org/xchain-thorchain-query/how-to-use.html

For Live examples

Estimate swap: https://replit.com/@thorchain/estimateSwap#index.ts\ Estimate add: https://replit.com/@thorchain/estimateAddliquidity\ Estimate withdraw: https://replit.com/@thorchain/estimateWithdrawLiquidity\ Check liquidity: https://replit.com/@thorchain/checkLiquidity\ List pools: https://replit.com/@thorchain/listPools#package.json\ Get Network Values: https://replit.com/@thorchain/networkValues#index.ts\

Estimate AddSaver() & WithdrawSaver() & getSaverPosition() https://replit.com/@thorchain/quoteDepositTS#index.ts