@substrate/calc
Advanced tools
Comparing version 0.2.0 to 0.2.1
84
calc.js
let imports = {}; | ||
imports['__wbindgen_placeholder__'] = module.exports; | ||
let wasm; | ||
const { TextDecoder } = require(String.raw`util`); | ||
const { TextEncoder, TextDecoder } = require(String.raw`util`); | ||
@@ -14,16 +14,60 @@ const heap = new Array(32).fill(undefined); | ||
let cachegetNodeBufferMemory0 = null; | ||
function getNodeBufferMemory0() { | ||
if (cachegetNodeBufferMemory0 === null || cachegetNodeBufferMemory0.buffer !== wasm.memory.buffer) { | ||
cachegetNodeBufferMemory0 = Buffer.from(wasm.memory.buffer); | ||
let cachegetUint8Memory0 = null; | ||
function getUint8Memory0() { | ||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { | ||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachegetNodeBufferMemory0; | ||
return cachegetUint8Memory0; | ||
} | ||
function passStringToWasm0(arg, malloc) { | ||
let cachedTextEncoder = new TextEncoder('utf-8'); | ||
const len = Buffer.byteLength(arg); | ||
const ptr = malloc(len); | ||
getNodeBufferMemory0().write(arg, ptr, len); | ||
WASM_VECTOR_LEN = len; | ||
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' | ||
? function (arg, view) { | ||
return cachedTextEncoder.encodeInto(arg, view); | ||
} | ||
: function (arg, view) { | ||
const buf = cachedTextEncoder.encode(arg); | ||
view.set(buf); | ||
return { | ||
read: arg.length, | ||
written: buf.length | ||
}; | ||
}); | ||
function passStringToWasm0(arg, malloc, realloc) { | ||
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; | ||
return ptr; | ||
@@ -109,10 +153,2 @@ } | ||
let cachegetUint8Memory0 = null; | ||
function getUint8Memory0() { | ||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { | ||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); | ||
} | ||
return cachegetUint8Memory0; | ||
} | ||
function getStringFromWasm0(ptr, len) { | ||
@@ -180,4 +216,3 @@ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
try { | ||
const retptr = wasm.__wbindgen_export_2.value - 16; | ||
wasm.__wbindgen_export_2.value = retptr; | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
uint64CvtShim[0] = weight; | ||
@@ -194,3 +229,3 @@ const low0 = u32CvtShim[0]; | ||
} finally { | ||
wasm.__wbindgen_export_2.value += 16; | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
wasm.__wbindgen_free(r0, r1); | ||
@@ -239,4 +274,3 @@ } | ||
try { | ||
const retptr = wasm.__wbindgen_export_2.value - 16; | ||
wasm.__wbindgen_export_2.value = retptr; | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
var ptr0 = passStringToWasm0(nominator_exposure, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
@@ -251,3 +285,3 @@ var len0 = WASM_VECTOR_LEN; | ||
} finally { | ||
wasm.__wbindgen_export_2.value += 16; | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
wasm.__wbindgen_free(r0, r1); | ||
@@ -254,0 +288,0 @@ } |
@@ -7,3 +7,3 @@ { | ||
"description": "Off-chain calculations for @substrate/api-sidecar.", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"license": "Apache-2.0", | ||
@@ -17,3 +17,2 @@ "repository": { | ||
"calc.js", | ||
"calc_bg.js", | ||
"calc.d.ts" | ||
@@ -20,0 +19,0 @@ ], |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
149774
6
319