@noir-lang/noirc_abi
Advanced tools
Comparing version 0.13.0 to 0.16.0-10eae15.nightly
/* 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. | ||
@@ -21,1 +53,5 @@ export type WitnessMap = Map<number, string>; | ||
export type ABIError = Error; | ||
let imports = {}; | ||
imports['__wbindgen_placeholder__'] = module.exports; | ||
let wasm; | ||
const { TextDecoder, TextEncoder } = require(`util`); | ||
const { TextEncoder, TextDecoder } = require(`util`); | ||
@@ -12,24 +12,2 @@ const heap = new Array(128).fill(undefined); | ||
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; | ||
@@ -49,6 +27,13 @@ | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
cachedTextDecoder.decode(); | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
let cachedUint8Memory0 = null; | ||
@@ -63,18 +48,2 @@ | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
let cachedTextEncoder = new TextEncoder('utf-8'); | ||
@@ -132,6 +101,37 @@ | ||
} | ||
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 }); | ||
cachedTextDecoder.decode(); | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
/** | ||
* @param {any} abi | ||
* @param {any} inputs | ||
* @param {any} return_value | ||
* @param {Abi} abi | ||
* @param {InputMap} inputs | ||
* @param {InputValue | undefined} return_value | ||
* @returns {WitnessMap} | ||
@@ -142,3 +142,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]; | ||
@@ -157,3 +157,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* @param {any} abi | ||
* @param {Abi} abi | ||
* @param {WitnessMap} witness_map | ||
@@ -190,9 +190,2 @@ * @returns {any} | ||
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,18 +195,8 @@ takeObject(arg0); | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
module.exports.__wbg_constructor_ee715a20a6d6befb = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
module.exports.__wbindgen_is_null = function(arg0) { | ||
const ret = getObject(arg0) === null; | ||
return ret; | ||
}; | ||
module.exports.__wbg_new_b3b0a89b9ad0bb3a = function() { | ||
module.exports.__wbg_new_b88faf1d36aaeaaf = function() { | ||
const ret = new Map(); | ||
@@ -237,2 +220,14 @@ 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); | ||
}; | ||
module.exports.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
module.exports.__wbg_new_abda76e883ba8a5f = function() { | ||
@@ -263,2 +258,7 @@ const ret = new Error(); | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) { | ||
@@ -265,0 +265,0 @@ try { |
@@ -6,3 +6,3 @@ { | ||
], | ||
"version": "0.13.0", | ||
"version": "0.16.0-10eae15.nightly", | ||
"license": "(MIT OR Apache-2.0)", | ||
@@ -29,3 +29,8 @@ "files": [ | ||
"test:browser": "web-test-runner", | ||
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" | ||
"clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result", | ||
"nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", | ||
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", | ||
"lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", | ||
"build:nix": "nix build -L .#noirc_abi_wasm", | ||
"install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noirc_abi_wasm/nodejs ./ && cp -rL ./result/noirc_abi_wasm/web ./" | ||
}, | ||
@@ -37,6 +42,5 @@ "devDependencies": { | ||
"@web/test-runner-playwright": "^0.10.0", | ||
"@web/test-runner-webdriver": "^0.7.0", | ||
"eslint": "^8.40.0", | ||
"eslint": "^8.50.0", | ||
"mocha": "^10.2.0" | ||
} | ||
} | ||
} |
/* 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. | ||
@@ -22,2 +54,6 @@ export type WitnessMap = Map<number, string>; | ||
export type ABIError = Error; | ||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
@@ -24,0 +60,0 @@ |
@@ -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; | ||
@@ -46,6 +24,13 @@ | ||
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
let cachedUint8Memory0 = null; | ||
@@ -60,18 +45,2 @@ | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
let WASM_VECTOR_LEN = 0; | ||
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); | ||
@@ -129,6 +98,37 @@ | ||
} | ||
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') } } ); | ||
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; | ||
function getStringFromWasm0(ptr, len) { | ||
ptr = ptr >>> 0; | ||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); | ||
} | ||
/** | ||
* @param {any} abi | ||
* @param {any} inputs | ||
* @param {any} return_value | ||
* @param {Abi} abi | ||
* @param {InputMap} inputs | ||
* @param {InputValue | undefined} return_value | ||
* @returns {WitnessMap} | ||
@@ -139,3 +139,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]; | ||
@@ -154,3 +154,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1]; | ||
/** | ||
* @param {any} abi | ||
* @param {Abi} abi | ||
* @param {WitnessMap} witness_map | ||
@@ -221,24 +221,10 @@ * @returns {any} | ||
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.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
imports.wbg.__wbg_constructor_ee715a20a6d6befb = function(arg0) { | ||
const ret = new Error(takeObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbindgen_is_null = function(arg0) { | ||
const ret = getObject(arg0) === null; | ||
return ret; | ||
}; | ||
imports.wbg.__wbg_new_b3b0a89b9ad0bb3a = function() { | ||
imports.wbg.__wbg_new_b88faf1d36aaeaaf = function() { | ||
const ret = new Map(); | ||
@@ -259,2 +245,12 @@ 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); | ||
}; | ||
imports.wbg.__wbindgen_is_undefined = function(arg0) { | ||
const ret = getObject(arg0) === undefined; | ||
return ret; | ||
}; | ||
imports.wbg.__wbg_new_abda76e883ba8a5f = function() { | ||
@@ -282,2 +278,6 @@ const ret = new Error(); | ||
}; | ||
imports.wbg.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) { | ||
@@ -284,0 +284,0 @@ try { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
858018
6
11
684
332
19
42
237
752