Package Exports
- @astroport/math
- @astroport/math/math.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@astroport/math) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Astroport Math
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"
// }