Thorchain Amm
ThorchainAMM
THORChain Class for interacting with THORChain. Recommended main class to use for swapping with THORChain Has access to Midgard and THORNode data
Parameters
thorchainQuery
an instance of the ThorchainQuery (optional, defaultdefaultQuery
)
estimateSwap
Provides a swap estimate for the given swap detail. Will check the params for errors before trying to get the estimate. Uses current pool data, works out inbound and outboud fee, affiliate fees and works out the expected wait time for the swap (in and out)
Parameters
params
Object amount to swapparams.input
params.destinationAsset
params.destinationAddress
params.affiliateAddress
(optional, default''
)params.interfaceID
(optional, default`555`
)params.affiliateFeeBasisPoints
(optional, default0
)params.slipLimit
Returns any The SwapEstimate
doSwap
Conducts a swap with the given inputs. Should be called after estimateSwap() to ensure the swap is valid
Parameters
wallet
wallet to useparams
swap params
Returns SwapSubmitted Tx Hash, URL of BlockExplorer and expected wait time.
estimateAddLiquidity
Wraps estimate from thorchain query
Parameters
params
estimate add liquidity
Returns any Estimate add lp object
estimateWithdrawLiquidity
Wraps estimate withdraw from thorchain query
Parameters
params
estimate withdraw liquidity
Returns any Estimate withdraw lp object
addLiquidityPosition
Parameters
wallet
wallet classparams
liquidity parameters
withdrawLiquidityPosition
Parameters
wallet
wallet needed to perform txparams
liquidity parameters
addSaver
Parameters
wallet
wallet needed to execute txaddAssetAmount
asset amount being added to savers
Returns any submitted tx
withdrawSaver
Parameters
wallet
wallet to execute the transactionwithdrawParams
params needed for withdraw