@astroport/math
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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"
// }

Package Sidebar

Install

npm i @astroport/math

Weekly Downloads

23

Version

1.0.1

License

GPL-3

Unpacked Size

282 kB

Total Files

6

Last publish

Collaborators

  • andre-labs
  • delphilabs-dev