# Typescript (XChainJS) WIP

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.

{% content-ref url="<https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md>" %}
<https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md>
{% endcontent-ref %}

### **Mayachain-amm**

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

{% content-ref url="<https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md>" %}
<https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md>
{% endcontent-ref %}

### **Chain clients**

For every blockchain connected to MAYAChain with a common interface.

Current clients implemented ar&#x65;**:**

* xchain-arb
* xchain-bitcoin
* xchain-dash
* xchain-ethereum
* xchain-kujira
* xchain-mayachain
* xchain-thorchain

{% content-ref url="<https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md>" %}
<https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md>
{% endcontent-ref %}

**APIs** for getting data from MAYAChain.

* Midgard
* MAYAnode

{% content-ref url="<https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md>" %}
<https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md>
{% endcontent-ref %}

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](https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md), [estimateSwap](https://gitlab.com/mayachain/docs/one-stop-shop/-/blob/main/mayachain-dev-docs/examples/typescript-xchainjs-wip/broken-reference/README.md) packages

1. Go to the replit code example then press show files. Select the project.json file.
2. Locate and then copy the `dependencies` section into your project.json file.
3. From the command line, type `yarn`. This will download and install the required packages.

The code is available on [GitHub](https://github.com/xchainjs/xchainjs-lib/) and managed by several key developers. Reach out at Telegram group: <https://t.me/xchainjs> for more information.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mayaprotocol.com/mayachain-dev-docs/examples/typescript-xchainjs-wip.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
