Maya Protocol One-Stop-Shop
Ask or search…
K

Typescript (XChainJS) WIP

XChainJS library overview and the main components
XChainJS is an open-source library with a common interface for multiple blockchains, built for simple and fast integration for wallets and Dexs and more. XChainJS is designed to abstract MAYAChain and specific blockchain complexity and to provide an easy-to-use API for developers.
The packages implement the complexity detailed in the other sections of this site.
XChain has several key modules allowing powerful functionality.

Mayachain-query

Allows easy information retrieval and estimates from MAYAChain.

Mayachain-amm

Conducts actions such as swap, add and remove. It wraps xchain clients and creates a new wallet class for and balance collection.

Chain clients

For every blockchain connected to MAYAChain with a common interface.
Current clients implemented are:
  • xchain-arb
  • xchain-bitcoin
  • xchain-dash
  • xchain-ethereum
  • xchain-kujira
  • xchain-mayachain
  • xchain-thorchain
APIs for getting data from MAYAChain.
  • Midgard
  • MAYAnode
See the package breakdown for more information.

Install Procedures

Ensure you have the following
  • npm --version v8.5.5 or above
  • node --version v16.15.0
  • yarn --version v1.22.18 or above
Create a new project by creating a new folder, then type npx tsc --init.

Finding required dependencies

The replit code examples have all the required packages within the project.json file, just copy the project dependencies into your own project.json.
Example for the query-package, estimateSwap packages
  1. 1.
    Go to the replit code example then press show files. Select the project.json file.
  2. 2.
    Locate and then copy the dependencies section into your project.json file.
  3. 3.
    From the command line, type yarn. This will download and install the required packages.
The code is available on GitHub and managed by several key developers. Reach out at Telegram group: https://t.me/xchainjs for more information.