Mayachain Automated Market Maker (AMM) class. MAYAChainAMM class for interacting with THORChain. Recommended main class to use for swapping with MAYAChain Has access to Midgard and MayaNode data

Constructors

  • Constructor to create a MayachainAMM instance.

    Parameters

    • mayachainQuery: MayachainQuery = ...

      An instance of the MayachainQuery class.

    • wallet: Wallet = ...

      A wallet instance containing clients for various blockchains.

    Returns MayachainAMM

    Returns the MayachainAMM instance.

Properties

mayachainQuery: MayachainQuery
wallet: Wallet

Methods

  • Approve the Mayachain router to spend a certain amount in the asset chain.

    Parameters

    • approveParams: ApproveParams

      Parameters for approving the router to spend

    Returns Promise<TxSubmitted>

    Transaction hash and URL

  • Perform a 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 Promise<TxSubmitted>

    Transaction hash and URL of the swap

  • Perform a swap from a native protocol asset to any other asset

    Parameters

    • amount: CryptoAmount

      Amount to swap

    • memo: string

      Memo to add to the transaction

    Returns Promise<TxSubmitted>

    Transaction hash and URL of the swap

  • Perform a swap operation between assets.

    Parameters

    • quoteSwapParams: QuoteSwapParams

      Swap parameters

    Returns Promise<TxSubmitted>

    Transaction hash and URL of the swap

  • Estimate swap by validating the swap parameters.

    Parameters

    • quoteSwapParams: QuoteSwapParams

      Swap parameters.

    Returns Promise<QuoteSwap>

    Quote swap result. If swap cannot be done, it returns an empty QuoteSwap with reasons.

  • Check if the asset is an ERC20 token

    Parameters

    • asset: Asset

      Asset to check

    Returns boolean

    True if the asset is an ERC20 token, otherwise false

  • Check if the chain is an EVM (Ethereum Virtual Machine) chain

    Parameters

    • chain: string

      Chain to check

    Returns boolean

    True if the chain is an EVM chain, otherwise false

  • Check if a name is a valid MAYAName

    Parameters

    • name: string

      MAYAName to check

    Returns Promise<boolean>

    True if the name is registered as a MAYAName, otherwise false

  • Validate if the asset router is allowed to spend the asset amount on behalf of the address.

    Parameters

    Returns Promise<string[]>

    Reasons the asset router is not allowed to spend the amount. Empty array if the router is approved.

  • Validate swap parameters before performing a swap operation.

    Parameters

    • quoteSwapParams: QuoteSwapParams

      Swap parameters.

    Returns Promise<string[]>

    Reasons the swap cannot be executed. Empty array if the swap is valid.

Generated using TypeDoc