UNPKG

pipegate-sdk

Version:

A TypeScript client-side payment authentication SDK for stablecoins used with axios

812 lines (696 loc) 26 kB
let imports = {}; imports['__wbindgen_placeholder__'] = module.exports; let wasm; const { TextDecoder, TextEncoder } = require(`util`); let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); cachedTextDecoder.decode(); let cachedUint8ArrayMemory0 = null; function getUint8ArrayMemory0() { if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); } return cachedUint8ArrayMemory0; } function getStringFromWasm0(ptr, len) { ptr = ptr >>> 0; return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); } function addToExternrefTable0(obj) { const idx = wasm.__externref_table_alloc(); wasm.__wbindgen_export_2.set(idx, obj); return idx; } function handleError(f, args) { try { return f.apply(this, args); } catch (e) { const idx = addToExternrefTable0(e); wasm.__wbindgen_exn_store(idx); } } let WASM_VECTOR_LEN = 0; let cachedTextEncoder = new TextEncoder('utf-8'); 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, 1) >>> 0; getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); WASM_VECTOR_LEN = buf.length; return ptr; } let len = arg.length; let ptr = malloc(len, 1) >>> 0; const mem = getUint8ArrayMemory0(); 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, 1) >>> 0; const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); const ret = encodeString(arg, view); offset += ret.written; ptr = realloc(ptr, len, offset, 1) >>> 0; } WASM_VECTOR_LEN = offset; return ptr; } let cachedDataViewMemory0 = null; function getDataViewMemory0() { if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { cachedDataViewMemory0 = new DataView(wasm.memory.buffer); } return cachedDataViewMemory0; } function isLikeNone(x) { return x === undefined || x === null; } const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(state => { wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b) }); function makeMutClosure(arg0, arg1, dtor, f) { const state = { a: arg0, b: arg1, cnt: 1, dtor }; const real = (...args) => { // First up with a closure we increment the internal reference // count. This ensures that the Rust closure environment won't // be deallocated while we're invoking it. state.cnt++; const a = state.a; state.a = 0; try { return f(a, state.b, ...args); } finally { if (--state.cnt === 0) { wasm.__wbindgen_export_6.get(state.dtor)(a, state.b); CLOSURE_DTORS.unregister(state); } else { state.a = a; } } }; real.original = state; CLOSURE_DTORS.register(real, state, state); return real; } function debugString(val) { // primitive types const type = typeof val; if (type == 'number' || type == 'boolean' || val == null) { return `${val}`; } if (type == 'string') { return `"${val}"`; } if (type == 'symbol') { const description = val.description; if (description == null) { return 'Symbol'; } else { return `Symbol(${description})`; } } if (type == 'function') { const name = val.name; if (typeof name == 'string' && name.length > 0) { return `Function(${name})`; } else { return 'Function'; } } // objects if (Array.isArray(val)) { const length = val.length; let debug = '['; if (length > 0) { debug += debugString(val[0]); } for(let i = 1; i < length; i++) { debug += ', ' + debugString(val[i]); } debug += ']'; return debug; } // Test for built-in const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); let className; if (builtInMatches && builtInMatches.length > 1) { className = builtInMatches[1]; } else { // Failed to match the standard '[object ClassName]' return toString.call(val); } if (className == 'Object') { // we're a user defined class or Object // JSON.stringify avoids problems with cycles, and is generally much // easier than looping through ownProperties of `val`. try { return 'Object(' + JSON.stringify(val) + ')'; } catch (_) { return 'Object'; } } // errors if (val instanceof Error) { return `${val.name}: ${val.message}\n${val.stack}`; } // TODO we could test for more things here, like `Set`s and `Map`s. return className; } module.exports.start = function() { wasm.start(); }; function takeFromExternrefTable0(idx) { const value = wasm.__wbindgen_export_2.get(idx); wasm.__externref_table_dealloc(idx); return value; } function passArray8ToWasm0(arg, malloc) { const ptr = malloc(arg.length * 1, 1) >>> 0; getUint8ArrayMemory0().set(arg, ptr / 1); WASM_VECTOR_LEN = arg.length; return ptr; } /** * @param {string} config_json * @param {string | undefined} current_channel_json * @param {string} message * @param {string} signature * @param {string} payment_channel_json * @param {bigint} payment_amount * @param {bigint} timestamp * @param {Uint8Array} body_bytes * @returns {Promise<any>} */ module.exports.verify_channel_no_state = function(config_json, current_channel_json, message, signature, payment_channel_json, payment_amount, timestamp, body_bytes) { const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; var ptr1 = isLikeNone(current_channel_json) ? 0 : passStringToWasm0(current_channel_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); var len1 = WASM_VECTOR_LEN; const ptr2 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len2 = WASM_VECTOR_LEN; const ptr3 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len3 = WASM_VECTOR_LEN; const ptr4 = passStringToWasm0(payment_channel_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len4 = WASM_VECTOR_LEN; const ptr5 = passArray8ToWasm0(body_bytes, wasm.__wbindgen_malloc); const len5 = WASM_VECTOR_LEN; const ret = wasm.verify_channel_no_state(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, payment_amount, timestamp, ptr5, len5); return ret; }; /** * @param {string} ontime_payment_config_json * @param {string} signature * @param {string} tx_hash * @returns {Promise<any>} */ module.exports.verify_onetime_payment_tx = function(ontime_payment_config_json, signature, tx_hash) { const ptr0 = passStringToWasm0(ontime_payment_config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ptr1 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; const ptr2 = passStringToWasm0(tx_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len2 = WASM_VECTOR_LEN; const ret = wasm.verify_onetime_payment_tx(ptr0, len0, ptr1, len1, ptr2, len2); return ret; }; /** * @param {string} stream_config_json * @param {string} signature * @param {string} sender * @returns {Promise<any>} */ module.exports.verify_stream_tx = function(stream_config_json, signature, sender) { const ptr0 = passStringToWasm0(stream_config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ptr1 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; const ptr2 = passStringToWasm0(sender, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len2 = WASM_VECTOR_LEN; const ret = wasm.verify_stream_tx(ptr0, len0, ptr1, len1, ptr2, len2); return ret; }; /** * @param {string} rpc_url * @param {string} private_key * @param {string} signature * @param {string} payment_channel_json * @param {Uint8Array} body_bytes * @returns {Promise<any>} */ module.exports.close_and_withdraw_channel = function(rpc_url, private_key, signature, payment_channel_json, body_bytes) { const ptr0 = passStringToWasm0(rpc_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ptr1 = passStringToWasm0(private_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; const ptr2 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len2 = WASM_VECTOR_LEN; const ptr3 = passStringToWasm0(payment_channel_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len3 = WASM_VECTOR_LEN; const ptr4 = passArray8ToWasm0(body_bytes, wasm.__wbindgen_malloc); const len4 = WASM_VECTOR_LEN; const ret = wasm.close_and_withdraw_channel(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4); return ret; }; function __wbg_adapter_28(arg0, arg1, arg2) { wasm.closure675_externref_shim(arg0, arg1, arg2); } function __wbg_adapter_117(arg0, arg1, arg2, arg3) { wasm.closure962_externref_shim(arg0, arg1, arg2, arg3); } const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"]; const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"]; const PaymentChannelVerifierFinalization = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_paymentchannelverifier_free(ptr >>> 0, 1)); class PaymentChannelVerifier { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; PaymentChannelVerifierFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_paymentchannelverifier_free(ptr, 0); } /** * @param {string} config_json */ constructor(config_json) { const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.paymentchannelverifier_new(ptr0, len0); if (ret[2]) { throw takeFromExternrefTable0(ret[1]); } this.__wbg_ptr = ret[0] >>> 0; PaymentChannelVerifierFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {string} message * @param {string} signature * @param {string} payment_channel_json * @param {bigint} payment_amount * @param {bigint} timestamp * @param {Uint8Array} body_bytes * @returns {Promise<any>} */ verify_request(message, signature, payment_channel_json, payment_amount, timestamp, body_bytes) { const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ptr1 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; const ptr2 = passStringToWasm0(payment_channel_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len2 = WASM_VECTOR_LEN; const ptr3 = passArray8ToWasm0(body_bytes, wasm.__wbindgen_malloc); const len3 = WASM_VECTOR_LEN; const ret = wasm.paymentchannelverifier_verify_request(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, payment_amount, timestamp, ptr3, len3); return ret; } } module.exports.PaymentChannelVerifier = PaymentChannelVerifier; const StreamVerifierFinalization = (typeof FinalizationRegistry === 'undefined') ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry(ptr => wasm.__wbg_streamverifier_free(ptr >>> 0, 1)); class StreamVerifier { __destroy_into_raw() { const ptr = this.__wbg_ptr; this.__wbg_ptr = 0; StreamVerifierFinalization.unregister(this); return ptr; } free() { const ptr = this.__destroy_into_raw(); wasm.__wbg_streamverifier_free(ptr, 0); } /** * @param {string} config_json */ constructor(config_json) { const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.streamverifier_new(ptr0, len0); if (ret[2]) { throw takeFromExternrefTable0(ret[1]); } this.__wbg_ptr = ret[0] >>> 0; StreamVerifierFinalization.register(this, this.__wbg_ptr, this); return this; } /** * @param {string} listener_config_json */ start_listener(listener_config_json) { const ptr0 = passStringToWasm0(listener_config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ret = wasm.streamverifier_start_listener(this.__wbg_ptr, ptr0, len0); if (ret[1]) { throw takeFromExternrefTable0(ret[0]); } } /** * @param {string} signature * @param {string} sender * @returns {Promise<any>} */ verify_request(signature, sender) { const ptr0 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; const ptr1 = passStringToWasm0(sender, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; const ret = wasm.streamverifier_verify_request(this.__wbg_ptr, ptr0, len0, ptr1, len1); return ret; } } module.exports.StreamVerifier = StreamVerifier; module.exports.__wbg_abort_05026c983d86824c = function(arg0) { arg0.abort(); }; module.exports.__wbg_append_72d1635ad8643998 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); }, arguments) }; module.exports.__wbg_arrayBuffer_d0ca2ad8bda0039b = function() { return handleError(function (arg0) { const ret = arg0.arrayBuffer(); return ret; }, arguments) }; module.exports.__wbg_buffer_61b7ce01341d7f88 = function(arg0) { const ret = arg0.buffer; return ret; }; module.exports.__wbg_call_500db948e69c7330 = function() { return handleError(function (arg0, arg1, arg2) { const ret = arg0.call(arg1, arg2); return ret; }, arguments) }; module.exports.__wbg_call_b0d8e36992d9900d = function() { return handleError(function (arg0, arg1) { const ret = arg0.call(arg1); return ret; }, arguments) }; module.exports.__wbg_debug_156ca727dbc3150f = function(arg0) { console.debug(arg0); }; module.exports.__wbg_done_f22c1561fa919baa = function(arg0) { const ret = arg0.done; return ret; }; module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) { let deferred0_0; let deferred0_1; try { deferred0_0 = arg0; deferred0_1 = arg1; console.error(getStringFromWasm0(arg0, arg1)); } finally { wasm.__wbindgen_free(deferred0_0, deferred0_1, 1); } }; module.exports.__wbg_error_fab41a42d22bf2bc = function(arg0) { console.error(arg0); }; module.exports.__wbg_fetch_229368eecee9d217 = function(arg0, arg1) { const ret = arg0.fetch(arg1); return ret; }; module.exports.__wbg_fetch_b335d17f45a8b5a1 = function(arg0) { const ret = fetch(arg0); return ret; }; module.exports.__wbg_get_bbccf8970793c087 = function() { return handleError(function (arg0, arg1) { const ret = Reflect.get(arg0, arg1); return ret; }, arguments) }; module.exports.__wbg_has_94c2fc1d261bbfe9 = function() { return handleError(function (arg0, arg1) { const ret = Reflect.has(arg0, arg1); return ret; }, arguments) }; module.exports.__wbg_headers_24e3e19fe3f187c0 = function(arg0) { const ret = arg0.headers; return ret; }; module.exports.__wbg_info_c3044c86ae29faab = function(arg0) { console.info(arg0); }; module.exports.__wbg_instanceof_Response_d3453657e10c4300 = function(arg0) { let result; try { result = arg0 instanceof Response; } catch (_) { result = false; } const ret = result; return ret; }; module.exports.__wbg_iterator_23604bb983791576 = function() { const ret = Symbol.iterator; return ret; }; module.exports.__wbg_length_65d1cd11729ced11 = function(arg0) { const ret = arg0.length; return ret; }; module.exports.__wbg_log_464d1b2190ca1e04 = function(arg0) { console.log(arg0); }; module.exports.__wbg_new_35d748855c4620b9 = function() { return handleError(function () { const ret = new Headers(); return ret; }, arguments) }; module.exports.__wbg_new_3d446df9155128ef = function(arg0, arg1) { try { var state0 = {a: arg0, b: arg1}; var cb0 = (arg0, arg1) => { const a = state0.a; state0.a = 0; try { return __wbg_adapter_117(a, state0.b, arg0, arg1); } finally { state0.a = a; } }; const ret = new Promise(cb0); return ret; } finally { state0.a = state0.b = 0; } }; module.exports.__wbg_new_3ff5b33b1ce712df = function(arg0) { const ret = new Uint8Array(arg0); return ret; }; module.exports.__wbg_new_5f48f21d4be11586 = function() { return handleError(function () { const ret = new AbortController(); return ret; }, arguments) }; module.exports.__wbg_new_688846f374351c92 = function() { const ret = new Object(); return ret; }; module.exports.__wbg_new_8a6f238a6ece86ea = function() { const ret = new Error(); return ret; }; module.exports.__wbg_newnoargs_fd9e4bf8be2bc16d = function(arg0, arg1) { const ret = new Function(getStringFromWasm0(arg0, arg1)); return ret; }; module.exports.__wbg_newwithbyteoffsetandlength_ba35896968751d91 = function(arg0, arg1, arg2) { const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0); return ret; }; module.exports.__wbg_newwithstrandinit_a1f6583f20e4faff = function() { return handleError(function (arg0, arg1, arg2) { const ret = new Request(getStringFromWasm0(arg0, arg1), arg2); return ret; }, arguments) }; module.exports.__wbg_next_01dd9234a5bf6d05 = function() { return handleError(function (arg0) { const ret = arg0.next(); return ret; }, arguments) }; module.exports.__wbg_next_137428deb98342b0 = function(arg0) { const ret = arg0.next; return ret; }; module.exports.__wbg_now_64d0bb151e5d3889 = function() { const ret = Date.now(); return ret; }; module.exports.__wbg_queueMicrotask_2181040e064c0dc8 = function(arg0) { queueMicrotask(arg0); }; module.exports.__wbg_queueMicrotask_ef9ac43769cbcc4f = function(arg0) { const ret = arg0.queueMicrotask; return ret; }; module.exports.__wbg_resolve_0bf7c44d641804f9 = function(arg0) { const ret = Promise.resolve(arg0); return ret; }; module.exports.__wbg_set_23d69db4e5c66a6e = function(arg0, arg1, arg2) { arg0.set(arg1, arg2 >>> 0); }; module.exports.__wbg_setbody_64920df008e48adc = function(arg0, arg1) { arg0.body = arg1; }; module.exports.__wbg_setcredentials_cfc15e48e3a3a535 = function(arg0, arg1) { arg0.credentials = __wbindgen_enum_RequestCredentials[arg1]; }; module.exports.__wbg_setheaders_4c921e8e226bdfa7 = function(arg0, arg1) { arg0.headers = arg1; }; module.exports.__wbg_setmethod_cfc7f688ba46a6be = function(arg0, arg1, arg2) { arg0.method = getStringFromWasm0(arg1, arg2); }; module.exports.__wbg_setmode_cd03637eb7da01e0 = function(arg0, arg1) { arg0.mode = __wbindgen_enum_RequestMode[arg1]; }; module.exports.__wbg_setsignal_f766190d206f09e5 = function(arg0, arg1) { arg0.signal = arg1; }; module.exports.__wbg_signal_1fdadeba2d04660e = function(arg0) { const ret = arg0.signal; return ret; }; module.exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) { const ret = arg1.stack; const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; module.exports.__wbg_static_accessor_GLOBAL_0be7472e492ad3e3 = function() { const ret = typeof global === 'undefined' ? null : global; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; module.exports.__wbg_static_accessor_GLOBAL_THIS_1a6eb482d12c9bfb = function() { const ret = typeof globalThis === 'undefined' ? null : globalThis; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; module.exports.__wbg_static_accessor_SELF_1dc398a895c82351 = function() { const ret = typeof self === 'undefined' ? null : self; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; module.exports.__wbg_static_accessor_WINDOW_ae1c80c7eea8d64a = function() { const ret = typeof window === 'undefined' ? null : window; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }; module.exports.__wbg_status_317f53bc4c7638df = function(arg0) { const ret = arg0.status; return ret; }; module.exports.__wbg_stringify_f4f701bc34ceda61 = function() { return handleError(function (arg0) { const ret = JSON.stringify(arg0); return ret; }, arguments) }; module.exports.__wbg_then_0438fad860fe38e1 = function(arg0, arg1) { const ret = arg0.then(arg1); return ret; }; module.exports.__wbg_then_0ffafeddf0e182a4 = function(arg0, arg1, arg2) { const ret = arg0.then(arg1, arg2); return ret; }; module.exports.__wbg_url_5327bc0a41a9b085 = function(arg0, arg1) { const ret = arg1.url; const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; module.exports.__wbg_value_4c32fd138a88eee2 = function(arg0) { const ret = arg0.value; return ret; }; module.exports.__wbg_warn_123db6aa8948382e = function(arg0) { console.warn(arg0); }; module.exports.__wbindgen_cb_drop = function(arg0) { const obj = arg0.original; if (obj.cnt-- == 1) { obj.a = 0; return true; } const ret = false; return ret; }; module.exports.__wbindgen_closure_wrapper1289 = function(arg0, arg1, arg2) { const ret = makeMutClosure(arg0, arg1, 676, __wbg_adapter_28); return ret; }; module.exports.__wbindgen_debug_string = function(arg0, arg1) { const ret = debugString(arg1); const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len1 = WASM_VECTOR_LEN; getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; module.exports.__wbindgen_error_new = function(arg0, arg1) { const ret = new Error(getStringFromWasm0(arg0, arg1)); return ret; }; module.exports.__wbindgen_init_externref_table = function() { const table = wasm.__wbindgen_export_2; const offset = table.grow(4); table.set(0, undefined); table.set(offset + 0, undefined); table.set(offset + 1, null); table.set(offset + 2, true); table.set(offset + 3, false); ; }; module.exports.__wbindgen_is_function = function(arg0) { const ret = typeof(arg0) === 'function'; return ret; }; module.exports.__wbindgen_is_object = function(arg0) { const val = arg0; const ret = typeof(val) === 'object' && val !== null; return ret; }; module.exports.__wbindgen_is_undefined = function(arg0) { const ret = arg0 === undefined; return ret; }; module.exports.__wbindgen_memory = function() { const ret = wasm.memory; return ret; }; module.exports.__wbindgen_string_get = function(arg0, arg1) { const obj = arg1; const ret = typeof(obj) === 'string' ? obj : undefined; var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); var len1 = WASM_VECTOR_LEN; getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); }; module.exports.__wbindgen_string_new = function(arg0, arg1) { const ret = getStringFromWasm0(arg0, arg1); return ret; }; module.exports.__wbindgen_throw = function(arg0, arg1) { throw new Error(getStringFromWasm0(arg0, arg1)); }; const path = require('path').join(__dirname, 'pipegate_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; wasm.__wbindgen_start();