Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 1.18 KB

README.md

File metadata and controls

46 lines (36 loc) · 1.18 KB

Astroport Math

NPM version Build npm-typescript License

A collection of math functions extracted from Astroport smart contracts to be used with WASM in TypeScript/NodeJS.

Generate WASM

make build

Run tests

make run-tests

Usage

import { xyk_swap } from '@astroport/math';

const swap = JSON.parse(xyk_swap(
  "1000000",
  "0",
  JSON.stringify(["1000000000", "1000000000000"]),
  "0.003"
));
// {
//   "return_amount": "999999",
//   "spread_amount": "1",
//   "commission_amount": "32"
// }