@noir-lang/noirc_abi
Advanced tools
Comparing version
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* @param {any} abi | ||
* @param {any} inputs | ||
* @param {any} return_value | ||
* @param {Abi} abi | ||
* @param {InputMap} inputs | ||
* @param {InputValue | undefined} return_value | ||
* @returns {WitnessMap} | ||
*/ | ||
export function abiEncode(abi: any, inputs: any, return_value: any): WitnessMap; | ||
export function abiEncode(abi: Abi, inputs: InputMap, return_value?: InputValue): WitnessMap; | ||
/** | ||
* @param {any} abi | ||
* @param {Abi} abi | ||
* @param {WitnessMap} witness_map | ||
* @returns {any} | ||
*/ | ||
export function abiDecode(abi: any, witness_map: WitnessMap): any; | ||
export function abiDecode(abi: Abi, witness_map: WitnessMap): any; | ||
export type Field = string | number | boolean; | ||
export type InputValue = Field | Field[] | InputMap; | ||
export type InputMap = { [key: string]: InputValue }; | ||
export type Visibility = "public" | "private"; | ||
export type Sign = "unsigned" | "signed"; | ||
export type AbiType = | ||
{ kind: "field" } | | ||
{ kind: "boolean" } | | ||
{ kind: "string", length: number } | | ||
{ kind: "integer", sign: Sign, width: number } | | ||
{ kind: "array", length: number, type: AbiType } | | ||
{ kind: "tuple", fields: AbiType[] } | | ||
{ kind: "struct", path: string, fields: [string, AbiType][] }; | ||
export type AbiParameter = { | ||
name: string, | ||
type: AbiType, | ||
visibility: Visibility, | ||
}; | ||
export type Abi = { | ||
parameters: AbiParameter[], | ||
param_witnesses: Record<string, number[]>, | ||
return_type: AbiType | null, | ||
return_witnesses: number[], | ||
} | ||
// Map from witness index to hex string value of witness. | ||
@@ -18,0 +50,0 @@ export type WitnessMap = Map<number, string>; |
@@ -12,24 +12,2 @@ let imports = {}; | ||
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; | ||
} | ||
let heap_next = heap.length; | ||
@@ -122,2 +100,24 @@ | ||
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; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
@@ -132,5 +132,5 @@ | ||
/** | ||
* @param {any} abi | ||
* @param {any} inputs | ||
* @param {any} return_value | ||
* @param {Abi} abi | ||
* @param {InputMap} inputs | ||
* @param {InputValue | undefined} return_value | ||
* @returns {WitnessMap} | ||
@@ -141,3 +141,3 @@ */ | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.abiEncode(retptr, addHeapObject(abi), addHeapObject(inputs), addHeapObject(return_value)); | ||
wasm.abiEncode(retptr, addHeapObject(abi), addHeapObject(inputs), isLikeNone(return_value) ? 0 : addHeapObject(return_value)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -156,3 +156,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* @param {any} abi | ||
* @param {Abi} abi | ||
* @param {WitnessMap} witness_map | ||
@@ -177,3 +177,3 @@ * @returns {any} | ||
function __wbg_adapter_28(arg0, arg1, arg2, arg3) { | ||
function __wbg_adapter_26(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h345d08f7c40b28d9(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
@@ -190,9 +190,2 @@ } | ||
module.exports.__wbindgen_number_get = function(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); | ||
}; | ||
module.exports.__wbindgen_object_drop_ref = function(arg0) { | ||
@@ -202,2 +195,7 @@ takeObject(arg0); | ||
module.exports.__wbg_constructor_ee715a20a6d6befb = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_new_b88faf1d36aaeaaf = function() { | ||
@@ -222,5 +220,7 @@ const ret = new Map(); | ||
module.exports.__wbg_constructor_ee715a20a6d6befb = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
module.exports.__wbindgen_number_get = function(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); | ||
}; | ||
@@ -233,7 +233,2 @@ | ||
module.exports.__wbindgen_is_null = function(arg0) { | ||
const ret = getObject(arg0) === null; | ||
return ret; | ||
}; | ||
module.exports.__wbg_new_abda76e883ba8a5f = function() { | ||
@@ -276,3 +271,3 @@ const ret = new Error(); | ||
try { | ||
return __wbg_adapter_28(a, state0.b, arg0, arg1); | ||
return __wbg_adapter_26(a, state0.b, arg0, arg1); | ||
} finally { | ||
@@ -279,0 +274,0 @@ state0.a = a; |
@@ -6,3 +6,3 @@ { | ||
], | ||
"version": "0.16.0-38acee5.aztec", | ||
"version": "0.16.0-4646a93.nightly", | ||
"license": "(MIT OR Apache-2.0)", | ||
@@ -9,0 +9,0 @@ "files": [ |
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* @param {any} abi | ||
* @param {any} inputs | ||
* @param {any} return_value | ||
* @param {Abi} abi | ||
* @param {InputMap} inputs | ||
* @param {InputValue | undefined} return_value | ||
* @returns {WitnessMap} | ||
*/ | ||
export function abiEncode(abi: any, inputs: any, return_value: any): WitnessMap; | ||
export function abiEncode(abi: Abi, inputs: InputMap, return_value?: InputValue): WitnessMap; | ||
/** | ||
* @param {any} abi | ||
* @param {Abi} abi | ||
* @param {WitnessMap} witness_map | ||
* @returns {any} | ||
*/ | ||
export function abiDecode(abi: any, witness_map: WitnessMap): any; | ||
export function abiDecode(abi: Abi, witness_map: WitnessMap): any; | ||
export type Field = string | number | boolean; | ||
export type InputValue = Field | Field[] | InputMap; | ||
export type InputMap = { [key: string]: InputValue }; | ||
export type Visibility = "public" | "private"; | ||
export type Sign = "unsigned" | "signed"; | ||
export type AbiType = | ||
{ kind: "field" } | | ||
{ kind: "boolean" } | | ||
{ kind: "string", length: number } | | ||
{ kind: "integer", sign: Sign, width: number } | | ||
{ kind: "array", length: number, type: AbiType } | | ||
{ kind: "tuple", fields: AbiType[] } | | ||
{ kind: "struct", path: string, fields: [string, AbiType][] }; | ||
export type AbiParameter = { | ||
name: string, | ||
type: AbiType, | ||
visibility: Visibility, | ||
}; | ||
export type Abi = { | ||
parameters: AbiParameter[], | ||
param_witnesses: Record<string, number[]>, | ||
return_type: AbiType | null, | ||
return_witnesses: number[], | ||
} | ||
// Map from witness index to hex string value of witness. | ||
@@ -18,0 +50,0 @@ export type WitnessMap = Map<number, string>; |
@@ -9,24 +9,2 @@ 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; | ||
} | ||
let heap_next = heap.length; | ||
@@ -119,2 +97,24 @@ | ||
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; | ||
} | ||
let cachedFloat64Memory0 = null; | ||
function getFloat64Memory0() { | ||
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { | ||
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); | ||
} | ||
return cachedFloat64Memory0; | ||
} | ||
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); | ||
@@ -129,5 +129,5 @@ | ||
/** | ||
* @param {any} abi | ||
* @param {any} inputs | ||
* @param {any} return_value | ||
* @param {Abi} abi | ||
* @param {InputMap} inputs | ||
* @param {InputValue | undefined} return_value | ||
* @returns {WitnessMap} | ||
@@ -138,3 +138,3 @@ */ | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.abiEncode(retptr, addHeapObject(abi), addHeapObject(inputs), addHeapObject(return_value)); | ||
wasm.abiEncode(retptr, addHeapObject(abi), addHeapObject(inputs), isLikeNone(return_value) ? 0 : addHeapObject(return_value)); | ||
var r0 = getInt32Memory0()[retptr / 4 + 0]; | ||
@@ -153,3 +153,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* @param {any} abi | ||
* @param {Abi} abi | ||
* @param {WitnessMap} witness_map | ||
@@ -174,3 +174,3 @@ * @returns {any} | ||
function __wbg_adapter_28(arg0, arg1, arg2, arg3) { | ||
function __wbg_adapter_26(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h345d08f7c40b28d9(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
@@ -221,11 +221,9 @@ } | ||
imports.wbg = {}; | ||
imports.wbg.__wbindgen_number_get = function(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); | ||
}; | ||
imports.wbg.__wbindgen_object_drop_ref = function(arg0) { | ||
takeObject(arg0); | ||
}; | ||
imports.wbg.__wbg_constructor_ee715a20a6d6befb = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_new_b88faf1d36aaeaaf = function() { | ||
@@ -247,5 +245,7 @@ const ret = new Map(); | ||
}; | ||
imports.wbg.__wbg_constructor_ee715a20a6d6befb = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
imports.wbg.__wbindgen_number_get = function(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); | ||
}; | ||
@@ -256,6 +256,2 @@ imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
}; | ||
imports.wbg.__wbindgen_is_null = function(arg0) { | ||
const ret = getObject(arg0) === null; | ||
return ret; | ||
}; | ||
imports.wbg.__wbg_new_abda76e883ba8a5f = function() { | ||
@@ -294,3 +290,3 @@ const ret = new Error(); | ||
try { | ||
return __wbg_adapter_28(a, state0.b, arg0, arg1); | ||
return __wbg_adapter_26(a, state0.b, arg0, arg1); | ||
} finally { | ||
@@ -297,0 +293,0 @@ state0.a = a; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
858018
4.09%684
6.21%