1343 lines
37 KiB
JavaScript
1343 lines
37 KiB
JavaScript
let wasm;
|
|
export function __wbg_set_wasm(val) {
|
|
wasm = val;
|
|
}
|
|
|
|
|
|
let WASM_VECTOR_LEN = 0;
|
|
|
|
let cachedUint8ArrayMemory0 = null;
|
|
|
|
function getUint8ArrayMemory0() {
|
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
}
|
|
return cachedUint8ArrayMemory0;
|
|
}
|
|
|
|
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
|
|
|
let cachedTextEncoder = new lTextEncoder('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 addToExternrefTable0(obj) {
|
|
const idx = wasm.__externref_table_alloc();
|
|
wasm.__wbindgen_export_4.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);
|
|
}
|
|
}
|
|
|
|
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
|
|
|
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
|
|
cachedTextDecoder.decode();
|
|
|
|
function getStringFromWasm0(ptr, len) {
|
|
ptr = ptr >>> 0;
|
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
}
|
|
|
|
function isLikeNone(x) {
|
|
return x === undefined || x === null;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
export function setup() {
|
|
wasm.setup();
|
|
}
|
|
|
|
function takeFromExternrefTable0(idx) {
|
|
const value = wasm.__wbindgen_export_4.get(idx);
|
|
wasm.__externref_table_dealloc(idx);
|
|
return value;
|
|
}
|
|
/**
|
|
* @returns {string}
|
|
*/
|
|
export function get_address() {
|
|
let deferred2_0;
|
|
let deferred2_1;
|
|
try {
|
|
const ret = wasm.get_address();
|
|
var ptr1 = ret[0];
|
|
var len1 = ret[1];
|
|
if (ret[3]) {
|
|
ptr1 = 0; len1 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred2_0 = ptr1;
|
|
deferred2_1 = len1;
|
|
return getStringFromWasm0(ptr1, len1);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @returns {Member}
|
|
*/
|
|
export function get_member() {
|
|
const ret = wasm.get_member();
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {any} device
|
|
*/
|
|
export function restore_device(device) {
|
|
const ret = wasm.restore_device(device);
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string} sp_wallet
|
|
* @returns {string}
|
|
*/
|
|
export function create_device_from_sp_wallet(sp_wallet) {
|
|
let deferred3_0;
|
|
let deferred3_1;
|
|
try {
|
|
const ptr0 = passStringToWasm0(sp_wallet, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.create_device_from_sp_wallet(ptr0, len0);
|
|
var ptr2 = ret[0];
|
|
var len2 = ret[1];
|
|
if (ret[3]) {
|
|
ptr2 = 0; len2 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred3_0 = ptr2;
|
|
deferred3_1 = len2;
|
|
return getStringFromWasm0(ptr2, len2);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {number} birthday
|
|
* @param {string} network_str
|
|
* @returns {string}
|
|
*/
|
|
export function create_new_device(birthday, network_str) {
|
|
let deferred3_0;
|
|
let deferred3_1;
|
|
try {
|
|
const ptr0 = passStringToWasm0(network_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.create_new_device(birthday, ptr0, len0);
|
|
var ptr2 = ret[0];
|
|
var len2 = ret[1];
|
|
if (ret[3]) {
|
|
ptr2 = 0; len2 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred3_0 = ptr2;
|
|
deferred3_1 = len2;
|
|
return getStringFromWasm0(ptr2, len2);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @returns {boolean}
|
|
*/
|
|
export function is_paired() {
|
|
const ret = wasm.is_paired();
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return ret[0] !== 0;
|
|
}
|
|
|
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
for (let i = 0; i < array.length; i++) {
|
|
const add = addToExternrefTable0(array[i]);
|
|
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
}
|
|
WASM_VECTOR_LEN = array.length;
|
|
return ptr;
|
|
}
|
|
/**
|
|
* @param {string} process_id
|
|
* @param {string[]} sp_addresses
|
|
*/
|
|
export function pair_device(process_id, sp_addresses) {
|
|
const ptr0 = passStringToWasm0(process_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passArrayJsValueToWasm0(sp_addresses, wasm.__wbindgen_malloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.pair_device(ptr0, len0, ptr1, len1);
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
export function unpair_device() {
|
|
const ret = wasm.unpair_device();
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @returns {string}
|
|
*/
|
|
export function dump_wallet() {
|
|
let deferred2_0;
|
|
let deferred2_1;
|
|
try {
|
|
const ret = wasm.dump_wallet();
|
|
var ptr1 = ret[0];
|
|
var len1 = ret[1];
|
|
if (ret[3]) {
|
|
ptr1 = 0; len1 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred2_0 = ptr1;
|
|
deferred2_1 = len1;
|
|
return getStringFromWasm0(ptr1, len1);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
}
|
|
}
|
|
|
|
export function reset_process_cache() {
|
|
const ret = wasm.reset_process_cache();
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @returns {string}
|
|
*/
|
|
export function dump_process_cache() {
|
|
let deferred2_0;
|
|
let deferred2_1;
|
|
try {
|
|
const ret = wasm.dump_process_cache();
|
|
var ptr1 = ret[0];
|
|
var len1 = ret[1];
|
|
if (ret[3]) {
|
|
ptr1 = 0; len1 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred2_0 = ptr1;
|
|
deferred2_1 = len1;
|
|
return getStringFromWasm0(ptr1, len1);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {any} processes
|
|
*/
|
|
export function set_process_cache(processes) {
|
|
const ret = wasm.set_process_cache(processes);
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string} process_id
|
|
* @param {string} process
|
|
*/
|
|
export function add_to_process_cache(process_id, process) {
|
|
const ptr0 = passStringToWasm0(process_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passStringToWasm0(process, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.add_to_process_cache(ptr0, len0, ptr1, len1);
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
export function reset_shared_secrets() {
|
|
const ret = wasm.reset_shared_secrets();
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string} secrets
|
|
*/
|
|
export function set_shared_secrets(secrets) {
|
|
const ptr0 = passStringToWasm0(secrets, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.set_shared_secrets(ptr0, len0);
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @returns {string}
|
|
*/
|
|
export function get_pairing_process_id() {
|
|
let deferred2_0;
|
|
let deferred2_1;
|
|
try {
|
|
const ret = wasm.get_pairing_process_id();
|
|
var ptr1 = ret[0];
|
|
var len1 = ret[1];
|
|
if (ret[3]) {
|
|
ptr1 = 0; len1 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred2_0 = ptr1;
|
|
deferred2_1 = len1;
|
|
return getStringFromWasm0(ptr1, len1);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @returns {Device}
|
|
*/
|
|
export function dump_device() {
|
|
const ret = wasm.dump_device();
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @returns {Device}
|
|
*/
|
|
export function dump_neutered_device() {
|
|
const ret = wasm.dump_neutered_device();
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
export function reset_device() {
|
|
const ret = wasm.reset_device();
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string} transaction
|
|
* @returns {string}
|
|
*/
|
|
export function get_txid(transaction) {
|
|
let deferred3_0;
|
|
let deferred3_1;
|
|
try {
|
|
const ptr0 = passStringToWasm0(transaction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.get_txid(ptr0, len0);
|
|
var ptr2 = ret[0];
|
|
var len2 = ret[1];
|
|
if (ret[3]) {
|
|
ptr2 = 0; len2 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred3_0 = ptr2;
|
|
deferred3_1 = len2;
|
|
return getStringFromWasm0(ptr2, len2);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string} new_tx_msg
|
|
* @param {number} block_height
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function parse_new_tx(new_tx_msg, block_height, members_list) {
|
|
const ptr0 = passStringToWasm0(new_tx_msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.parse_new_tx(ptr0, len0, block_height, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {string} cipher_msg
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function parse_cipher(cipher_msg, members_list) {
|
|
const ptr0 = passStringToWasm0(cipher_msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.parse_cipher(ptr0, len0, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @returns {any}
|
|
*/
|
|
export function get_outputs() {
|
|
const ret = wasm.get_outputs();
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @returns {bigint}
|
|
*/
|
|
export function get_available_amount() {
|
|
const ret = wasm.get_available_amount();
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return BigInt.asUintN(64, ret[0]);
|
|
}
|
|
|
|
/**
|
|
* We send a transaction that pays at least one output to each address
|
|
* The goal can be to establish a shared_secret to be used as an encryption key for further communication
|
|
* or if the recipient is a relay it can be the init transaction for a new process
|
|
* @param {string[]} addresses
|
|
* @param {number} fee_rate
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function create_transaction(addresses, fee_rate) {
|
|
const ptr0 = passArrayJsValueToWasm0(addresses, wasm.__wbindgen_malloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.create_transaction(ptr0, len0, fee_rate);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {TsUnsignedTransaction} partial_tx
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function sign_transaction(partial_tx) {
|
|
const ret = wasm.sign_transaction(partial_tx);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {Pcd} private_data
|
|
* @param {Roles} roles
|
|
* @param {Pcd} public_data
|
|
* @param {string} relay_address
|
|
* @param {number} fee_rate
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function create_new_process(private_data, roles, public_data, relay_address, fee_rate, members_list) {
|
|
const ptr0 = passStringToWasm0(relay_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.create_new_process(private_data, roles, public_data, ptr0, len0, fee_rate, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {Process} process
|
|
* @param {Pcd} new_attributes
|
|
* @param {Roles} roles
|
|
* @param {Pcd} new_public_data
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function update_process(process, new_attributes, roles, new_public_data, members_list) {
|
|
const ret = wasm.update_process(process, new_attributes, roles, new_public_data, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {string} process_id
|
|
* @param {string[]} state_ids_str
|
|
* @param {any} roles
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function request_data(process_id, state_ids_str, roles, members_list) {
|
|
const ptr0 = passStringToWasm0(process_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passArrayJsValueToWasm0(state_ids_str, wasm.__wbindgen_malloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.request_data(ptr0, len0, ptr1, len1, roles, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {Process} process
|
|
* @param {string} state_id
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function create_update_message(process, state_id, members_list) {
|
|
const ptr0 = passStringToWasm0(state_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.create_update_message(process, ptr0, len0, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {Process} process
|
|
* @param {string} state_id
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function validate_state(process, state_id, members_list) {
|
|
const ptr0 = passStringToWasm0(state_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.validate_state(process, ptr0, len0, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {Process} process
|
|
* @param {string} state_id
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function refuse_state(process, state_id, members_list) {
|
|
const ptr0 = passStringToWasm0(state_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.refuse_state(process, ptr0, len0, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {Process} process
|
|
* @param {string} state_id
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function evaluate_state(process, state_id, members_list) {
|
|
const ptr0 = passStringToWasm0(state_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.evaluate_state(process, ptr0, len0, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {Process} process
|
|
* @param {string} state_id
|
|
* @param {OutPointMemberMap} members_list
|
|
* @returns {ApiReturn}
|
|
*/
|
|
export function create_response_prd(process, state_id, members_list) {
|
|
const ptr0 = passStringToWasm0(state_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.create_response_prd(process, ptr0, len0, members_list);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @returns {string}
|
|
*/
|
|
export function create_faucet_msg() {
|
|
let deferred2_0;
|
|
let deferred2_1;
|
|
try {
|
|
const ret = wasm.create_faucet_msg();
|
|
var ptr1 = ret[0];
|
|
var len1 = ret[1];
|
|
if (ret[3]) {
|
|
ptr1 = 0; len1 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred2_0 = ptr1;
|
|
deferred2_1 = len1;
|
|
return getStringFromWasm0(ptr1, len1);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
}
|
|
}
|
|
|
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
ptr = ptr >>> 0;
|
|
const mem = getDataViewMemory0();
|
|
const result = [];
|
|
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
|
|
}
|
|
wasm.__externref_drop_slice(ptr, len);
|
|
return result;
|
|
}
|
|
/**
|
|
* @param {string} process_outpoint
|
|
* @returns {string[]}
|
|
*/
|
|
export function get_storages(process_outpoint) {
|
|
const ptr0 = passStringToWasm0(process_outpoint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.get_storages(ptr0, len0);
|
|
if (ret[3]) {
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
return v2;
|
|
}
|
|
|
|
/**
|
|
* @param {string} parent_roles
|
|
* @param {string} child_roles
|
|
*/
|
|
export function is_child_role(parent_roles, child_roles) {
|
|
const ptr0 = passStringToWasm0(parent_roles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passStringToWasm0(child_roles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.is_child_role(ptr0, len0, ptr1, len1);
|
|
if (ret[1]) {
|
|
throw takeFromExternrefTable0(ret[0]);
|
|
}
|
|
}
|
|
|
|
function passArray8ToWasm0(arg, malloc) {
|
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
WASM_VECTOR_LEN = arg.length;
|
|
return ptr;
|
|
}
|
|
|
|
function getArrayU8FromWasm0(ptr, len) {
|
|
ptr = ptr >>> 0;
|
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
}
|
|
/**
|
|
* @param {Uint8Array} key
|
|
* @param {Uint8Array} data
|
|
* @returns {Uint8Array}
|
|
*/
|
|
export function decrypt_data(key, data) {
|
|
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.decrypt_data(ptr0, len0, ptr1, len1);
|
|
if (ret[3]) {
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
return v3;
|
|
}
|
|
|
|
/**
|
|
* @param {any} data
|
|
* @returns {Pcd}
|
|
*/
|
|
export function encode_binary(data) {
|
|
const ret = wasm.encode_binary(data);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {any} json_data
|
|
* @returns {Pcd}
|
|
*/
|
|
export function encode_json(json_data) {
|
|
const ret = wasm.encode_json(json_data);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {Uint8Array} value
|
|
* @returns {any}
|
|
*/
|
|
export function decode_value(value) {
|
|
const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.decode_value(ptr0, len0);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* @param {any} value
|
|
* @param {string} commited_in
|
|
* @param {string} label
|
|
* @returns {string}
|
|
*/
|
|
export function hash_value(value, commited_in, label) {
|
|
let deferred4_0;
|
|
let deferred4_1;
|
|
try {
|
|
const ptr0 = passStringToWasm0(commited_in, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ptr1 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len1 = WASM_VECTOR_LEN;
|
|
const ret = wasm.hash_value(value, ptr0, len0, ptr1, len1);
|
|
var ptr3 = ret[0];
|
|
var len3 = ret[1];
|
|
if (ret[3]) {
|
|
ptr3 = 0; len3 = 0;
|
|
throw takeFromExternrefTable0(ret[2]);
|
|
}
|
|
deferred4_0 = ptr3;
|
|
deferred4_1 = len3;
|
|
return getStringFromWasm0(ptr3, len3);
|
|
} finally {
|
|
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Generate a merkle proof for a specific attribute in a process state.
|
|
*
|
|
* This function creates a merkle proof that proves the existence of a specific attribute
|
|
* in a given state of a process. The proof can be used to verify that the attribute
|
|
* was indeed part of the state without revealing the entire state.
|
|
*
|
|
* # Arguments
|
|
* * `process_state` - The process state object as a JavaScript value
|
|
* * `attribute_name` - The name of the attribute to generate a proof for
|
|
*
|
|
* # Returns
|
|
* A MerkleProofResult object containing:
|
|
* * `proof` - The merkle proof as a hex string
|
|
* * `root` - The merkle root (state_id) as a hex string
|
|
* * `attribute` - The attribute name that was proven
|
|
* * `attribute_index` - The index of the attribute in the merkle tree
|
|
* * `total_leaves_count` - The total number of leaves in the merkle tree
|
|
*
|
|
* # Errors
|
|
* * "Failed to deserialize process state" - If the process state cannot be deserialized from JsValue
|
|
* * "Attribute not found in state" - If the attribute doesn't exist in the state
|
|
* @param {any} process_state
|
|
* @param {string} attribute_name
|
|
* @returns {MerkleProofResult}
|
|
*/
|
|
export function get_merkle_proof(process_state, attribute_name) {
|
|
const ptr0 = passStringToWasm0(attribute_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.get_merkle_proof(process_state, ptr0, len0);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return takeFromExternrefTable0(ret[0]);
|
|
}
|
|
|
|
/**
|
|
* Validate a merkle proof for a specific attribute.
|
|
*
|
|
* This function verifies that a merkle proof is valid and proves the existence
|
|
* of a specific attribute in a given state. It checks that the proof correctly
|
|
* leads to the claimed root when combined with the attribute hash.
|
|
*
|
|
* # Arguments
|
|
* * `proof_result` - a JsValue expected to contain a MerkleProofResult with the proof and metadata
|
|
* * `hash` - The hash of the attribute data as a hex string (the leaf value)
|
|
*
|
|
* # Returns
|
|
* A boolean indicating whether the proof is valid
|
|
*
|
|
* # Errors
|
|
* * "serde_wasm_bindgen deserialization error" - If the proof is not a valid MerkleProofResult
|
|
* * "Invalid proof format" - If the proof cannot be parsed
|
|
* * "Invalid hash format" - If the hash is not a valid 32-byte hex string
|
|
* * "Invalid root format" - If the root is not a valid 32-byte hex string
|
|
* @param {any} proof_result
|
|
* @param {string} hash
|
|
* @returns {boolean}
|
|
*/
|
|
export function validate_merkle_proof(proof_result, hash) {
|
|
const ptr0 = passStringToWasm0(hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
const len0 = WASM_VECTOR_LEN;
|
|
const ret = wasm.validate_merkle_proof(proof_result, ptr0, len0);
|
|
if (ret[2]) {
|
|
throw takeFromExternrefTable0(ret[1]);
|
|
}
|
|
return ret[0] !== 0;
|
|
}
|
|
|
|
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
const ret = String(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);
|
|
};
|
|
|
|
export function __wbg_buffer_609cc3eee51ed158(arg0) {
|
|
const ret = arg0.buffer;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_call_672a4d21634d4a24() { return handleError(function (arg0, arg1) {
|
|
const ret = arg0.call(arg1);
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg0, arg1, arg2) {
|
|
const ret = arg0.call(arg1, arg2);
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
export function __wbg_crypto_574e78ad8b13b65f(arg0) {
|
|
const ret = arg0.crypto;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_debug_e17b51583ca6a632(arg0, arg1, arg2, arg3) {
|
|
console.debug(arg0, arg1, arg2, arg3);
|
|
};
|
|
|
|
export function __wbg_done_769e5ede4b31c67b(arg0) {
|
|
const ret = arg0.done;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_entries_3265d4158b33e5dc(arg0) {
|
|
const ret = Object.entries(arg0);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_error_524f506f44df1645(arg0) {
|
|
console.error(arg0);
|
|
};
|
|
|
|
export function __wbg_error_80de38b3f7cc3c3c(arg0, arg1, arg2, arg3) {
|
|
console.error(arg0, arg1, arg2, arg3);
|
|
};
|
|
|
|
export function __wbg_getRandomValues_b8f5dbd5f3995a9e() { return handleError(function (arg0, arg1) {
|
|
arg0.getRandomValues(arg1);
|
|
}, arguments) };
|
|
|
|
export function __wbg_get_67b2ba62fc30de12() { return handleError(function (arg0, arg1) {
|
|
const ret = Reflect.get(arg0, arg1);
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
|
|
const ret = arg0[arg1 >>> 0];
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) {
|
|
const ret = arg0[arg1];
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_info_033d8b8a0838f1d3(arg0, arg1, arg2, arg3) {
|
|
console.info(arg0, arg1, arg2, arg3);
|
|
};
|
|
|
|
export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) {
|
|
let result;
|
|
try {
|
|
result = arg0 instanceof ArrayBuffer;
|
|
} catch (_) {
|
|
result = false;
|
|
}
|
|
const ret = result;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_instanceof_Map_f3469ce2244d2430(arg0) {
|
|
let result;
|
|
try {
|
|
result = arg0 instanceof Map;
|
|
} catch (_) {
|
|
result = false;
|
|
}
|
|
const ret = result;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) {
|
|
let result;
|
|
try {
|
|
result = arg0 instanceof Uint8Array;
|
|
} catch (_) {
|
|
result = false;
|
|
}
|
|
const ret = result;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_isArray_a1eab7e0d067391b(arg0) {
|
|
const ret = Array.isArray(arg0);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) {
|
|
const ret = Number.isSafeInteger(arg0);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_iterator_9a24c88df860dc65() {
|
|
const ret = Symbol.iterator;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_length_a446193dc22c12f8(arg0) {
|
|
const ret = arg0.length;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_length_e2d2a49132c1b256(arg0) {
|
|
const ret = arg0.length;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_log_cad59bb680daec67(arg0, arg1, arg2, arg3) {
|
|
console.log(arg0, arg1, arg2, arg3);
|
|
};
|
|
|
|
export function __wbg_msCrypto_a61aeb35a24c1329(arg0) {
|
|
const ret = arg0.msCrypto;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_new_405e22f390576ce2() {
|
|
const ret = new Object();
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_new_5e0be73521bc8c17() {
|
|
const ret = new Map();
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_new_78feb108b6472713() {
|
|
const ret = new Array();
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_new_a12002a7f91c75be(arg0) {
|
|
const ret = new Uint8Array(arg0);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) {
|
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(arg0, arg1, arg2) {
|
|
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_newwithlength_a381634e90c276d4(arg0) {
|
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_next_25feadfc0913fea9(arg0) {
|
|
const ret = arg0.next;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_next_6574e1a8a62d1055() { return handleError(function (arg0) {
|
|
const ret = arg0.next();
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
export function __wbg_node_905d3e251edff8a2(arg0) {
|
|
const ret = arg0.node;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_parse_def2e24ef1252aff() { return handleError(function (arg0, arg1) {
|
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
export function __wbg_process_dc0fbacc7c1c06f7(arg0) {
|
|
const ret = arg0.process;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_randomFillSync_ac0988aba3254290() { return handleError(function (arg0, arg1) {
|
|
arg0.randomFillSync(arg1);
|
|
}, arguments) };
|
|
|
|
export function __wbg_require_60cc747a6bc5215a() { return handleError(function () {
|
|
const ret = module.require;
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
|
|
arg0[arg1 >>> 0] = arg2;
|
|
};
|
|
|
|
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
|
arg0[arg1] = arg2;
|
|
};
|
|
|
|
export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
|
|
arg0.set(arg1, arg2 >>> 0);
|
|
};
|
|
|
|
export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
|
|
const ret = arg0.set(arg1, arg2);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_set_bb8cecf6a62b9f46() { return handleError(function (arg0, arg1, arg2) {
|
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
export function __wbg_static_accessor_GLOBAL_88a902d13a557d07() {
|
|
const ret = typeof global === 'undefined' ? null : global;
|
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
};
|
|
|
|
export function __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0() {
|
|
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
};
|
|
|
|
export function __wbg_static_accessor_SELF_37c5d418e4bf5819() {
|
|
const ret = typeof self === 'undefined' ? null : self;
|
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
};
|
|
|
|
export function __wbg_static_accessor_WINDOW_5de37043a91a9c40() {
|
|
const ret = typeof window === 'undefined' ? null : window;
|
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
};
|
|
|
|
export function __wbg_stringify_f7ed6987935b4a24() { return handleError(function (arg0) {
|
|
const ret = JSON.stringify(arg0);
|
|
return ret;
|
|
}, arguments) };
|
|
|
|
export function __wbg_subarray_aa9065fa9dc5df96(arg0, arg1, arg2) {
|
|
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
|
|
const ret = arg0.value;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_versions_c01dfd4722a88165(arg0) {
|
|
const ret = arg0.versions;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbg_warn_aaf1f4664a035bd6(arg0, arg1, arg2, arg3) {
|
|
console.warn(arg0, arg1, arg2, arg3);
|
|
};
|
|
|
|
export function __wbindgen_as_number(arg0) {
|
|
const ret = +arg0;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_bigint_from_i64(arg0) {
|
|
const ret = arg0;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_bigint_from_u64(arg0) {
|
|
const ret = BigInt.asUintN(64, arg0);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
|
|
const v = arg1;
|
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
};
|
|
|
|
export function __wbindgen_boolean_get(arg0) {
|
|
const v = arg0;
|
|
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_debug_string(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);
|
|
};
|
|
|
|
export function __wbindgen_error_new(arg0, arg1) {
|
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_in(arg0, arg1) {
|
|
const ret = arg0 in arg1;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_init_externref_table() {
|
|
const table = wasm.__wbindgen_export_4;
|
|
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);
|
|
;
|
|
};
|
|
|
|
export function __wbindgen_is_bigint(arg0) {
|
|
const ret = typeof(arg0) === 'bigint';
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_is_function(arg0) {
|
|
const ret = typeof(arg0) === 'function';
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_is_object(arg0) {
|
|
const val = arg0;
|
|
const ret = typeof(val) === 'object' && val !== null;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_is_string(arg0) {
|
|
const ret = typeof(arg0) === 'string';
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_is_undefined(arg0) {
|
|
const ret = arg0 === undefined;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_jsval_eq(arg0, arg1) {
|
|
const ret = arg0 === arg1;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_jsval_loose_eq(arg0, arg1) {
|
|
const ret = arg0 == arg1;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_memory() {
|
|
const ret = wasm.memory;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_number_get(arg0, arg1) {
|
|
const obj = arg1;
|
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
};
|
|
|
|
export function __wbindgen_number_new(arg0) {
|
|
const ret = arg0;
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_string_get(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);
|
|
};
|
|
|
|
export function __wbindgen_string_new(arg0, arg1) {
|
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
return ret;
|
|
};
|
|
|
|
export function __wbindgen_throw(arg0, arg1) {
|
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
};
|
|
|