JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 51
  • Score
    100M100P100Q65480F
  • License GPL-3

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

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

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