XchainJS
  • Overview
  • Installation
  • Examples instructions
  • Clients
    • xchain-evm
      • xchain-avax
        • How to Use
      • xchain-arbitrum
        • How to Use
      • xchain-bsc
        • How to Use
      • xchain-ethereum
        • How to Use
    • xchain-utxo
      • xchain-bitcoin
        • How to use
      • xchain-bitcoincash
        • How to Use
      • xchain-dash
      • xchain-doge
        • How to Use
      • xchain-litecoin
        • How to Use
    • xchain-cosmos-sdk
      • xchain-cosmos
        • How to Use
      • xchain-kujira
        • How to Use
      • xchain-mayachain
        • How to Use
      • xchain-thorchain
        • How to Use
    • xchain-binance
      • How to Use
    • xchain-solana
      • How to use
      • Examples
        • Generate address
        • Get balances
        • Get token balance
        • Prepare transaction
        • Make transaction
        • Make token transaction
  • Wallet
  • Protocols
    • THORChain
      • xchain-thorchain-amm
        • How to Use
        • Make swap using THORChain
        • Handle liquidity and savers
        • Open and close loans
      • xchain-thorchain-query
        • How to Use
        • Check transaction status
        • Estimate a swap
      • xchain-midgard
        • How to Use
      • xchain-thornode
        • How to Use
      • xchain-midgard-query
        • How to Use
    • MAYAProtocol
      • xchain-mayachain-amm
        • How to Use
        • Make swap using MAYAChain
      • xchain-mayachain-query
        • How to Use
      • xchain-mayamidgard
        • How to Use
      • xchain-mayanode
        • How to Use
      • xchain-mayamidgard-query
        • How to Use
  • Aggregator
  • Providers
    • xchain-utxo-providers
      • How it Works
    • xchain-evm-providers
      • How it Works
  • Others
    • xchain-crypto
      • How it Works
      • How to Use
    • xchain-util
      • How it Works
      • How to Use
  • Contributors
  • Documentation maintenance
Powered by GitBook
On this page
  • Installation
  • Initialization
  1. Protocols
  2. MAYAProtocol
  3. xchain-mayachain-amm

How to Use

Installation

You can install MAYAChain AMM package using yarn

yarn add @xchainjs/xchain-mayachain-amm

or using npm

npm install @xchainjs/xchain-mayachain-amm

Initialization

Using Mayachain AMM, you can initialize the main class of the module in consultation mode if you do not provide any parameters, this means you could retrieve information from the protocol, but you will not be able to make actions the protocol needs you to sign.

  import { MayachainAMM } from '@xchainjs/xchain-mayachain-amm'

  const mayachainAmm = new MayachainAMM()

Otherwise, if you want to be able make actions the protocol needs you to sign, you will need to initialize the main class of the protocol as follows

  import { MayachainAMM } from '@xchainjs/xchain-mayachain-amm'
  import { MayachainQuery } from '@xchainjs/xchain-mayachain-query'
  import { Wallet } from '@xchainjs/xchain-wallet'

  const mayaChainQuery = new MayachainQuery()
  const wallet = new Wallet({
    // Your XChainJS clients
  })
  const mayachainAmm = new MayachainAMM(mayaChainQuery, wallet)

Previousxchain-mayachain-ammNextMake swap using MAYAChain

Last updated 11 months ago