Installation
Good to know: Latest version: 1.5.0

Install the library

In order to interact with our API one needs to install SDK as follows:
Npm
Yarn
# Install via NPM
npm install @mangata-finance/sdk
# Install via yarn
yarn add @mangata-finance/sdk

Basic use case

Here is a quick example to get you started, all you need is Mangata instance:
import { Mangata } from '@mangata-finance/sdk';
async function main () {
// Connect to the node
const MAINNET_1 = 'wss://mangata-x.api.onfinality.io/public-ws'
const MAINNET_2 = 'wss://prod-kusama-collator-01.mangatafinance.cloud'
const mangata = Mangata.getInstance([MAINNET_1, MAINNET_2])
// Retrieve the chainName, nodeName & nodeVersion information
const [chain, nodeName, nodeVersion] = await Promise.all([
mangata.getChain(),
mangata.getNodeName(),
mangata.getNodeVersion()
]);
console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
}
main().catch(console.error).finally(() => process.exit());
Copy link
On this page
Install the library
Basic use case