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
thorchainQueryan 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
paramsObject amount to swapparams.fromAssetparams.amountparams.destinationAssetparams.destinationAddressparams.affiliateAddress(optional, default'')params.interfaceID(optional, default`555`)params.affiliateBps(optional, default0)params.toleranceBpsparams.walletparams.walletIndex
Returns any The SwapEstimate
doSwap
Conducts a swap with the given inputs. Should be called after estimateSwap() to ensure the swap is valid
Parameters
walletwallet to useparamsswap params
Returns SwapSubmitted Tx Hash, URL of BlockExplorer and expected wait time.
estimateAddLiquidity
Wraps estimate from thorchain query
Parameters
paramsestimate add liquidity
Returns any Estimate add lp object
estimateWithdrawLiquidity
Wraps estimate withdraw from thorchain query
Parameters
paramsestimate withdraw liquidity
Returns any Estimate withdraw lp object
addLiquidityPosition
Parameters
walletwallet classparamsliquidity parameters
withdrawLiquidityPosition
Parameters
walletwallet needed to perform txparamsliquidity parameters
estimateAddSaver
Parameters
addAssetAmount
estimateWithdrawSaver
Parameters
withdrawParams
getSaverPosition
Parameters
getsaver
addSaver
Parameters
walletwallet needed to execute txaddAssetAmountasset amount being added to savers
Returns any submitted tx
withdrawSaver
Parameters
walletwallet to execute the transactionwithdrawParamsparams needed for withdraw
getLoanQuoteOpen
Parameters
loanOpenParams
getLoanQuoteClose
Parameters
loanCloseParams
addLoan
Parameters
walletwallet needed to execute transactionloanOpenParamsparams needed to open the loan
Returns any submitted tx
withdrawLoan
Parameters
walletwallet to execute the transactionloanCloseParamsparams needed for withdrawing the loan
getThornamesByAddress
Get all Thornames and its data associated owned by an address
Parameters
addressaddress
Returns any thornames data