Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm repo importable #1

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/hack_hydra_dx_wasm.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import * as wasm from "./hack_hydra_dx_wasm_bg.wasm";
// import * as wasm from "./hack_hydra_dx_wasm_bg.wasm";
export * from "./hack_hydra_dx_wasm_bg.js";
20 changes: 13 additions & 7 deletions build/hack_hydra_dx_wasm_bg.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as wasm from './hack_hydra_dx_wasm_bg.wasm';

// import * as wasm from './hack_hydra_dx_wasm_bg.wasm';
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;

let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });

cachedTextDecoder.decode();

let cachegetUint8Memory0 = null;
function getUint8Memory0() {
async function getUint8Memory0() {
const wasm = await import('./hack_hydra_dx_wasm_bg.wasm');
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
Expand Down Expand Up @@ -78,7 +78,8 @@ function passStringToWasm0(arg, malloc, realloc) {
}

let cachegetInt32Memory0 = null;
function getInt32Memory0() {
async function getInt32Memory0() {
const wasm = await import('./hack_hydra_dx_wasm_bg.wasm');
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
}
Expand All @@ -90,7 +91,9 @@ function getInt32Memory0() {
* @param {string} a
* @returns {string}
*/
export function get_buy_price(s, b, a) {
export async function get_buy_price(s, b, a) {
const wasm = await import('./hack_hydra_dx_wasm_bg.wasm');

try {
const retptr = wasm.__wbindgen_export_0.value - 16;
wasm.__wbindgen_export_0.value = retptr;
Expand All @@ -116,7 +119,9 @@ export function get_buy_price(s, b, a) {
* @param {string} a
* @returns {string}
*/
export function get_sell_price(s, b, a) {
export async function get_sell_price(s, b, a) {
const wasm = await import('./hack_hydra_dx_wasm_bg.wasm');

try {
const retptr = wasm.__wbindgen_export_0.value - 16;
wasm.__wbindgen_export_0.value = retptr;
Expand All @@ -142,8 +147,9 @@ export function get_sell_price(s, b, a) {
* @param {string} a
* @returns {string}
*/
export function get_spot_price(s, b, a) {
export async function get_spot_price(s, b, a) {
try {
const wasm = await import('./hack_hydra_dx_wasm_bg.wasm');
const retptr = wasm.__wbindgen_export_0.value - 16;
wasm.__wbindgen_export_0.value = retptr;
var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
Expand Down
1 change: 1 addition & 0 deletions build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"files": [
"hack_hydra_dx_wasm_bg.wasm",
"hack_hydra_dx_wasm.js",
"hack_hydra_dx_wasm_bg.js",
"hack_hydra_dx_wasm.d.ts"
],
"module": "hack_hydra_dx_wasm.js",
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "hack-hydra-dx-wasm",
"version": "0.1.0",
"private": true,
"main": "build/hack_hydra_dx_wasm.js"
}