Mangata Software Development Kit (SDK) is a toolset for convenient communication with Mangata Substrate node.
Mangata SDK is a first library, built in typescript that provides easy methods for buying and selling assets on Mangata DEX. The main purpose is to save time for builders of client applications, primarily for algorithmic traders and frontend interface builders.
// with npm
npm i @mangata-finance/sdk
// with yarn
yarn add @mangata-finance/sdk
Here is a quick example to get you started, all you need is Mangata instance:
const { Mangata } = require("@mangata-finance/sdk");
async function main() {
// Connect to the mainet (also testnet, mainnet)
const mangata = Mangata.getInstance(["wss://mangata-x.api.onfinality.io/public-ws"]);
// 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());
For available methods please visit docs