@cubexch/health
Advanced tools
Comparing version 0.1.3 to 0.1.6
100
index_bg.js
@@ -27,2 +27,24 @@ let wasm; | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
function addHeapObject(obj) { | ||
@@ -103,15 +125,2 @@ if (heap_next === heap.length) heap.push(heap.length + 1); | ||
function isLikeNone(x) { | ||
return x === undefined || x === null; | ||
} | ||
let cachedInt32Memory0 = null; | ||
function getInt32Memory0() { | ||
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { | ||
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); | ||
} | ||
return cachedInt32Memory0; | ||
} | ||
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; | ||
@@ -128,11 +137,2 @@ | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedBigInt64Memory0 = null; | ||
@@ -227,9 +227,8 @@ | ||
* @param {AssetDefinitions} assets | ||
* @param {ContractDefinitions} contracts | ||
* @param {MarginTables} margin_tables | ||
*/ | ||
export function load_definitions(assets, contracts, margin_tables) { | ||
export function load_definitions(assets, margin_tables) { | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.load_definitions(retptr, addHeapObject(assets), addHeapObject(contracts), addHeapObject(margin_tables)); | ||
wasm.load_definitions(retptr, addHeapObject(assets), addHeapObject(margin_tables)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -426,2 +425,8 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
export function __wbindgen_boolean_get(arg0) { | ||
const v = getObject(arg0); | ||
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; | ||
return ret; | ||
}; | ||
export function __wbindgen_is_bigint(arg0) { | ||
@@ -432,4 +437,11 @@ const ret = typeof(getObject(arg0)) === 'bigint'; | ||
export function __wbindgen_bigint_from_u64(arg0) { | ||
const ret = BigInt.asUintN(64, arg0); | ||
export function __wbindgen_number_get(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'number' ? obj : undefined; | ||
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret; | ||
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); | ||
}; | ||
export function __wbindgen_bigint_from_i64(arg0) { | ||
const ret = arg0; | ||
return addHeapObject(ret); | ||
@@ -458,7 +470,2 @@ }; | ||
export function __wbindgen_is_undefined(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
export function __wbindgen_in(arg0, arg1) { | ||
@@ -469,8 +476,13 @@ const ret = getObject(arg0) in getObject(arg1); | ||
export function __wbindgen_bigint_from_i64(arg0) { | ||
const ret = arg0; | ||
export function __wbindgen_bigint_from_u64(arg0) { | ||
const ret = BigInt.asUintN(64, arg0); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbg_debug_77322e7a322aca53(arg0, arg1) { | ||
export function __wbindgen_is_undefined(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
export function __wbg_debug_963a1726a7ab047c(arg0, arg1) { | ||
console.debug(getStringFromWasm0(arg0, arg1)); | ||
@@ -524,15 +536,2 @@ }; | ||
export function __wbindgen_boolean_get(arg0) { | ||
const v = getObject(arg0); | ||
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; | ||
return ret; | ||
}; | ||
export function __wbindgen_number_get(arg0, arg1) { | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'number' ? obj : undefined; | ||
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret; | ||
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); | ||
}; | ||
export function __wbg_String_88810dfeb4021902(arg0, arg1) { | ||
@@ -636,2 +635,7 @@ const ret = String(getObject(arg1)); | ||
export function __wbg_entries_65a76a413fc91037(arg0) { | ||
const ret = Object.entries(getObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
export function __wbg_buffer_3f3d764d4747d564(arg0) { | ||
@@ -638,0 +642,0 @@ const ret = getObject(arg0).buffer; |
@@ -12,6 +12,5 @@ /* tslint:disable */ | ||
* @param {AssetDefinitions} assets | ||
* @param {ContractDefinitions} contracts | ||
* @param {MarginTables} margin_tables | ||
*/ | ||
export function load_definitions(assets: AssetDefinitions, contracts: ContractDefinitions, margin_tables: MarginTables): void; | ||
export function load_definitions(assets: AssetDefinitions, margin_tables: MarginTables): void; | ||
/** | ||
@@ -98,36 +97,13 @@ * @param {bigint} asset_id | ||
export interface SpotPosition { | ||
assetId: number; | ||
total: RawUnits; | ||
export interface Rate { | ||
rate: number; | ||
} | ||
export interface PerpPosition { | ||
contractId: number; | ||
units: bigint; | ||
quote: HealthValue; | ||
bidUnits: RawUnits; | ||
askUnits: RawUnits; | ||
leverageOverride: number | undefined; | ||
} | ||
export interface Health { | ||
spotAssets: HealthValue; | ||
unsettled: HealthValue; | ||
marginRequired: HealthValue; | ||
} | ||
export type MarginTables = MarginTable[]; | ||
export type ContractDefinitions = ContractDefinition[]; | ||
export type AssetDefinitions = AssetDefinition[]; | ||
export interface ContractDefinition { | ||
contractId: number; | ||
contractDecimals: number; | ||
settlementAssetDecimals: number; | ||
marginTierTableId: number; | ||
} | ||
export type AssetType = { assetType: "Fiat" } | { assetType: "Crypto" } | { assetType: "Perpetual"; settlementAssetId: number; marginTierTableId: number }; | ||
export interface AssetDefinition { | ||
export type AssetDefinition = AssetType & { | ||
assetId: number; | ||
@@ -149,2 +125,22 @@ decimals: number; | ||
export interface SpotPosition { | ||
assetId: number; | ||
total: RawUnits; | ||
} | ||
export interface PerpPosition { | ||
contractId: number; | ||
units: bigint; | ||
quote: HealthValue; | ||
bidUnits: RawUnits; | ||
askUnits: RawUnits; | ||
leverageOverride: number | undefined; | ||
} | ||
export interface Health { | ||
spotAssets: HealthValue; | ||
unsettled: HealthValue; | ||
marginRequired: HealthValue; | ||
} | ||
export interface HealthValue { | ||
@@ -164,5 +160,1 @@ word0: bigint; | ||
export interface Rate { | ||
rate: number; | ||
} | ||
{ | ||
"name": "@cubexch/health", | ||
"version": "0.1.3", | ||
"version": "0.1.6", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "index_bg.wasm", |
Sorry, the diff of this file is not supported yet
213510
731