Mayachain Amm
MayachainAMM
MAYAChainAMM class for interacting with THORChain. Recommended main class to use for swapping with MAYAChain Has access to Midgard and MayaNode data
Parameters
mayachainQueryan instance of the MayachainQuery (optional, defaultnew xchain_mayachain_query_1.MayachainQuery())wallet(optional, defaultnew wallet_1.Wallet('',xchain_client_1.Network.Mainnet))
estimateSwap
Estimate swap validating the swap params
Parameters
quoteSwapParamsQuoteSwapParams Swap paramsquoteSwapParams.fromAssetquoteSwapParams.fromAddressquoteSwapParams.amountquoteSwapParams.destinationAssetquoteSwapParams.destinationAddressquoteSwapParams.affiliateAddressquoteSwapParams.affiliateBpsquoteSwapParams.toleranceBps
Returns QuoteSwap Quote swap. If swap can not be done, it returns an empty QuoteSwap with the reasons the swap can not be done
validateSwap
Validate swap params
Parameters
quoteSwapParamsQuoteSwapParams Swap paramsquoteSwapParams.fromAssetquoteSwapParams.fromAddressquoteSwapParams.destinationAssetquoteSwapParams.destinationAddressquoteSwapParams.amountquoteSwapParams.affiliateAddressquoteSwapParams.affiliateBps
Returns Array<string> the reasons the swap can not be done. If it is empty there are no reason to avoid the swap
doSwap
Do swap between assets
Parameters
quoteSwapParamsQuoteSwapParams Swap paramsquoteSwapParams.fromAssetquoteSwapParams.fromAddressquoteSwapParams.amountquoteSwapParams.destinationAssetquoteSwapParams.destinationAddressquoteSwapParams.affiliateAddressquoteSwapParams.affiliateBpsquoteSwapParams.toleranceBps
Returns TxSubmitted the swap transaction hash and url
isMAYAName
Check if a name is a valid MAYAName
Parameters
namestring MAYAName
Returns boolean true if is a registered MAYAName, otherwise, false
doProtocolAssetSwap
Do swap from native protocol asset to any other asset
Parameters
amountCryptoAmount Amount to swapmemostring Memo to add to the transaction to successfully make the swap
Returns TxSubmitted the swap transaction hash and url
doNonProtocolAssetSwap
Do swap between assets
Parameters
amountCryptoAmount Amount to swaprecipientstring inbound address to make swap transaction tomemostring Memo to add to the transaction to successfully make the swap
Returns TxSubmitted the swap transaction hash and url