A collection of math functions extracted from Astroport smart contracts to be used with WASM in TypeScript/NodeJS.
make build
make run-tests
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"
// }