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

  • mayachainQuery an instance of the MayachainQuery (optional, default new xchain_mayachain_query_1.MayachainQuery())
  • wallet (optional, default new wallet_1.Wallet('',xchain_client_1.Network.Mainnet))

estimateSwap

Estimate swap validating the swap params

Parameters

  • quoteSwapParams QuoteSwapParams Swap params
    • quoteSwapParams.fromAsset
    • quoteSwapParams.fromAddress
    • quoteSwapParams.amount
    • quoteSwapParams.destinationAsset
    • quoteSwapParams.destinationAddress
    • quoteSwapParams.affiliateAddress
    • quoteSwapParams.affiliateBps
    • quoteSwapParams.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

  • quoteSwapParams QuoteSwapParams Swap params
    • quoteSwapParams.fromAsset
    • quoteSwapParams.fromAddress
    • quoteSwapParams.destinationAsset
    • quoteSwapParams.destinationAddress
    • quoteSwapParams.amount
    • quoteSwapParams.affiliateAddress
    • quoteSwapParams.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

  • quoteSwapParams QuoteSwapParams Swap params
    • quoteSwapParams.fromAsset
    • quoteSwapParams.fromAddress
    • quoteSwapParams.amount
    • quoteSwapParams.destinationAsset
    • quoteSwapParams.destinationAddress
    • quoteSwapParams.affiliateAddress
    • quoteSwapParams.affiliateBps
    • quoteSwapParams.toleranceBps

Returns TxSubmitted the swap transaction hash and url

isMAYAName

Check if a name is a valid MAYAName

Parameters

Returns boolean true if is a registered MAYAName, otherwise, false

doProtocolAssetSwap

Do swap from native protocol asset to any other asset

Parameters

  • amount CryptoAmount Amount to swap
  • memo string 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

  • amount CryptoAmount Amount to swap
  • recipient string inbound address to make swap transaction to
  • memo string Memo to add to the transaction to successfully make the swap

Returns TxSubmitted the swap transaction hash and url