Nominating Presidential Muppets
    Have ideas to improve npm?Join in the discussion! »

    @gnosis.pm/dex-pricegraph
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.1-alpha.3 • Public • Published

    Pricegraph Wasm Bindings

    This crate provides WebAssembly bindings to the pricegraph crate so that it can be used from JS environments.

    Usage

    The Wasm bindings can be used from JavaScript or TypeScript by importing the generated NodeJS module:

    import { PriceEstimator } from "@gnosis.pm/dex-pricegraph";
     
    const estimator = new PriceEstimator(encodedOrders);
    const [WETH, DAI] = [1, 7];
    console.log(
        "WETH/DAI price estimate:",
        estimator.estimatePrice(WETH, DAI, 100 * 10e18),
    );
    esimator.free();

    Building

    This crate and the resulting npm package are created using wasm-pack.

    To run integration tests inside a NodeJS environment:

    cd pricegraph/wasm
    wasm-pack test --node

    To generate the pkg/ directory containing the npm package:

    cd pricegraph/wasm
    wasm-pack build --scope gnosis.pm --target nodejs

    Keywords

    none

    Install

    npm i @gnosis.pm/dex-pricegraph

    DownloadsWeekly Downloads

    4

    Version

    0.0.1-alpha.3

    License

    none

    Unpacked Size

    110 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar