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.fromAsset
params.amount
params.destinationAsset
params.destinationAddress
params.affiliateAddress
(optional, default''
)params.interfaceID
(optional, default`555`
)params.affiliateBps
(optional, default0
)params.toleranceBps
params.wallet
params.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
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
estimateAddSaver
Parameters
addAssetAmount
estimateWithdrawSaver
Parameters
withdrawParams
getSaverPosition
Parameters
getsaver
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
getLoanQuoteOpen
Parameters
loanOpenParams
getLoanQuoteClose
Parameters
loanCloseParams
addLoan
Parameters
wallet
wallet needed to execute transactionloanOpenParams
params needed to open the loan
Returns any submitted tx
withdrawLoan
Parameters
wallet
wallet to execute the transactionloanCloseParams
params needed for withdrawing the loan
getThornamesByAddress
Get all Thornames and its data associated owned by an address
Parameters
address
address
Returns any thornames data