Skip to content

Commit

Permalink
Refactor hyperdrive-wasm build script. (#1654)
Browse files Browse the repository at this point in the history
* copy build script

* add wasm-pkg-build

* use async/await

* elevate error handling

* don't worry about backups for now

* add cargo.toml

* refactor build script

* update package files

* cleanup

* pr fixes

* remove initSync

* use esm-sync

* remove initSync

* update build script

* run yarn

* fix import errors

* remove wasm pin

* add comments
  • Loading branch information
sentilesdal authored Dec 6, 2024
1 parent 68be6e6 commit a1ba5b1
Show file tree
Hide file tree
Showing 14 changed files with 2,783 additions and 2,452 deletions.
7 changes: 1 addition & 6 deletions apps/hyperdrive-trading/src/testing/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import * as fixedPoint from "@delvtech/fixed-point-wasm";
import { beforeEach } from "vitest";

beforeEach(() => {
// This is safe to call multiple times. Internally it will return early if
// the WASM module has already been initialized.
fixedPoint.initSync(fixedPoint.wasmBuffer);
});
beforeEach(() => {});
2 changes: 0 additions & 2 deletions crates/hyperdrive-wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ npm i @delvtech/hyperdrive-wasm
```ts
import * as hyperwasm from "@delvtech/hyperdrive-wasm";

hyperwasm.initSync(hyperwasm.wasmBuffer);

const apr = hyperwasm.getFixedApr(poolInfo, poolConfig); // => '0.034999999999999999'
```

Expand Down
3 changes: 2 additions & 1 deletion crates/hyperdrive-wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"@types/proper-lockfile": "^4.1.4",
"onchange": "^7.1.0",
"proper-lockfile": "^4.1.2",
"toml-json": "^1.1.4",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"wasm-pack": "^0.12.1"
"wasm-pkg-build": "^0.5.3"
}
}
Loading

0 comments on commit a1ba5b1

Please sign in to comment.