0.13.0 • Published 16 days ago
@delvtech/hyperdrive-wasm v0.13.0
hyperdrive-wasm
WASM wrappers for hyperdrive-rs built using wasm-pack.
Installing
yarn add @delvtech/hyperdrive-wasm
# or
npm i @delvtech/hyperdrive-wasm
Usage
import * as hyperwasm from '@delvtech/hyperdrive-wasm';
hyperwasm.initSync(hyperwasm.wasmBuffer);
const apr = hyperwasm.getSpotRate(poolInfo, poolConfig); // => '0.034999999999999999'
Building
Install wasm-pack then run:
sh ./build.sh
This will create the node package at ./pkg/
, add a couple exports so the
package can be used in apps without any extra work on the app developer to
enable wasm support, then create a tarball for installation.
Running the Example
A boilerplate wasm-pack app can be found at ./example
. To run it, first build
then:
sh ./example_install.sh
cd ./example
npm start