@gnosis.pm/dex-pricegraph
Advanced tools
Comparing version 0.0.1-alpha.1 to 0.0.1-alpha.2
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* A graph representation of a complete orderbook. | ||
*/ | ||
export class PriceEstimator { | ||
@@ -4,0 +7,0 @@ free(): void; |
@@ -1,7 +0,8 @@ | ||
import * as wasm from './dex_pricegraph_bg.wasm'; | ||
let imports = {}; | ||
imports['__wbindgen_placeholder__'] = module.exports; | ||
let wasm; | ||
const { TextDecoder } = require(String.raw`util`); | ||
const lTextDecoder = typeof TextDecoder === 'undefined' ? require('util').TextDecoder : TextDecoder; | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
cachedTextDecoder.decode(); | ||
@@ -75,54 +76,16 @@ | ||
const lTextEncoder = typeof TextEncoder === 'undefined' ? require('util').TextEncoder : TextEncoder; | ||
let cachedTextEncoder = new lTextEncoder('utf-8'); | ||
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' | ||
? function (arg, view) { | ||
return cachedTextEncoder.encodeInto(arg, view); | ||
let cachegetNodeBufferMemory0 = null; | ||
function getNodeBufferMemory0() { | ||
if (cachegetNodeBufferMemory0 === null || cachegetNodeBufferMemory0.buffer !== wasm.memory.buffer) { | ||
cachegetNodeBufferMemory0 = Buffer.from(wasm.memory.buffer); | ||
} | ||
return cachegetNodeBufferMemory0; | ||
} | ||
: function (arg, view) { | ||
const buf = cachedTextEncoder.encode(arg); | ||
view.set(buf); | ||
return { | ||
read: arg.length, | ||
written: buf.length | ||
}; | ||
}); | ||
function passStringToWasm0(arg, malloc, realloc) { | ||
function passStringToWasm0(arg, malloc) { | ||
if (realloc === undefined) { | ||
const buf = cachedTextEncoder.encode(arg); | ||
const ptr = malloc(buf.length); | ||
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); | ||
WASM_VECTOR_LEN = buf.length; | ||
return ptr; | ||
} | ||
let len = arg.length; | ||
let ptr = malloc(len); | ||
const mem = getUint8Memory0(); | ||
let offset = 0; | ||
for (; offset < len; offset++) { | ||
const code = arg.charCodeAt(offset); | ||
if (code > 0x7F) break; | ||
mem[ptr + offset] = code; | ||
} | ||
if (offset !== len) { | ||
if (offset !== 0) { | ||
arg = arg.slice(offset); | ||
} | ||
ptr = realloc(ptr, len, len = offset + arg.length * 3); | ||
const view = getUint8Memory0().subarray(ptr + offset, ptr + len); | ||
const ret = encodeString(arg, view); | ||
offset += ret.written; | ||
} | ||
WASM_VECTOR_LEN = offset; | ||
const len = Buffer.byteLength(arg); | ||
const ptr = malloc(len); | ||
getNodeBufferMemory0().write(arg, ptr, len); | ||
WASM_VECTOR_LEN = len; | ||
return ptr; | ||
@@ -133,3 +96,3 @@ } | ||
*/ | ||
export class PriceEstimator { | ||
class PriceEstimator { | ||
@@ -175,4 +138,5 @@ static __wrap(ptr) { | ||
} | ||
module.exports.PriceEstimator = PriceEstimator; | ||
export const __wbindgen_string_new = function(arg0, arg1) { | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
var ret = getStringFromWasm0(arg0, arg1); | ||
@@ -182,3 +146,3 @@ return addHeapObject(ret); | ||
export const __wbg_new_59cb74e423758ede = function() { | ||
module.exports.__wbg_new_59cb74e423758ede = function() { | ||
var ret = new Error(); | ||
@@ -188,3 +152,3 @@ return addHeapObject(ret); | ||
export const __wbg_stack_558ba5917b466edd = function(arg0, arg1) { | ||
module.exports.__wbg_stack_558ba5917b466edd = function(arg0, arg1) { | ||
var ret = getObject(arg1).stack; | ||
@@ -197,3 +161,3 @@ var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
export const __wbg_error_4bb6c2a97407129a = function(arg0, arg1) { | ||
module.exports.__wbg_error_4bb6c2a97407129a = function(arg0, arg1) { | ||
try { | ||
@@ -206,13 +170,21 @@ console.error(getStringFromWasm0(arg0, arg1)); | ||
export const __wbindgen_object_drop_ref = function(arg0) { | ||
module.exports.__wbindgen_object_drop_ref = function(arg0) { | ||
takeObject(arg0); | ||
}; | ||
export const __wbindgen_throw = function(arg0, arg1) { | ||
module.exports.__wbindgen_throw = function(arg0, arg1) { | ||
throw new Error(getStringFromWasm0(arg0, arg1)); | ||
}; | ||
export const __wbindgen_rethrow = function(arg0) { | ||
module.exports.__wbindgen_rethrow = function(arg0) { | ||
throw takeObject(arg0); | ||
}; | ||
const path = require('path').join(__dirname, 'dex_pricegraph_bg.wasm'); | ||
const bytes = require('fs').readFileSync(path); | ||
const wasmModule = new WebAssembly.Module(bytes); | ||
const wasmInstance = new WebAssembly.Instance(wasmModule, imports); | ||
wasm = wasmInstance.exports; | ||
module.exports.__wasm = wasm; | ||
{ | ||
"name": "@gnosis.pm/dex-pricegraph", | ||
"version": "0.0.1-alpha.1", | ||
"collaborators": [ | ||
"Nicholas Rodrigues Lordello <nicholas.lordello@gnosis.pm>" | ||
], | ||
"version": "0.0.1-alpha.2", | ||
"files": [ | ||
"dex_pricegraph_bg.wasm", | ||
"dex_pricegraph.js", | ||
"dex_pricegraph_bg.js", | ||
"dex_pricegraph.d.ts" | ||
], | ||
"module": "dex_pricegraph.js", | ||
"types": "dex_pricegraph.d.ts", | ||
"sideEffects": false | ||
"main": "dex_pricegraph.js", | ||
"types": "dex_pricegraph.d.ts" | ||
} |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
107286
173
3