ecash-lib 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/txBuilder.d.ts.map +1 -1
- package/dist/txBuilder.js +3 -0
- package/dist/txBuilder.js.map +1 -1
- package/package.json +1 -1
- package/.nyc_output/0fc40ca6-d52c-45eb-b31b-2601ce70b887.json +0 -1
- package/.nyc_output/ac5be6db-4e40-41f8-8b84-7598d4747e57.json +0 -1
- package/.nyc_output/b316d46f-5ea0-4e98-884a-bfbf9cc1d0f8.json +0 -1
- package/.nyc_output/f965566b-9422-4874-b45e-9eefda9c769c.json +0 -1
- package/.nyc_output/processinfo/0fc40ca6-d52c-45eb-b31b-2601ce70b887.json +0 -1
- package/.nyc_output/processinfo/ac5be6db-4e40-41f8-8b84-7598d4747e57.json +0 -1
- package/.nyc_output/processinfo/b316d46f-5ea0-4e98-884a-bfbf9cc1d0f8.json +0 -1
- package/.nyc_output/processinfo/f965566b-9422-4874-b45e-9eefda9c769c.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/dist/ffi/ecash_lib_wasm.d.ts +0 -90
- package/dist/ffi/ecash_lib_wasm.js +0 -340
- package/dist/ffi/ecash_lib_wasm_bg.wasm +0 -0
- package/dist/ffi/ecash_lib_wasm_bg.wasm.d.ts +0 -16
- package/dist/init.d.ts +0 -3
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -18
- package/dist/init.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":"b316d46f-5ea0-4e98-884a-bfbf9cc1d0f8","pid":2715843,"argv":["/home/joey/.nvm/versions/node/v20.11.0/bin/node","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/node_modules/mocha/lib/cli/cli.js","./src/ecc.test.ts","./src/hash.test.ts","./src/op.test.ts","./src/script.test.ts","./src/sigHashType.test.ts","./src/tx.test.ts","./src/unsignedTx.test.ts","./src/io/bytes.test.ts","./src/io/varsize.test.ts","./src/io/writerbytes.test.ts","./src/io/writerlength.test.ts","--reporter","mocha-junit-reporter","--reporter-option","mochaFile=test_results/ecash-lib-junit.xml","--reporter-option","testsuitesTitle=Ecash Lib Unit Tests","--reporter-option","rootSuiteTitle=Ecash Lib","--no-config","--no-package","--diff","--extension","js","--extension","cjs","--extension","mjs","--slow","75","--timeout","2000","--ui","bdd","--watch-ignore","node_modules","--watch-ignore",".git"],"execArgv":["--import=tsx"],"cwd":"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib","time":1714065308447,"ppid":2715833,"coverageFilename":"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/.nyc_output/0fc40ca6-d52c-45eb-b31b-2601ce70b887.json","externalId":"","uuid":"0fc40ca6-d52c-45eb-b31b-2601ce70b887","files":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":null,"pid":2715808,"argv":["/home/joey/.nvm/versions/node/v20.11.0/bin/node","/home/joey/.nvm/versions/node/v20.11.0/bin/npm","test","--","--reporter","mocha-junit-reporter","--reporter-options","mochaFile=test_results/ecash-lib-junit.xml","--reporter-options","testsuitesTitle=Ecash Lib Unit Tests","--reporter-options","rootSuiteTitle=Ecash Lib"],"execArgv":[],"cwd":"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib","time":1714065307741,"ppid":2715758,"coverageFilename":"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/.nyc_output/ac5be6db-4e40-41f8-8b84-7598d4747e57.json","externalId":"","uuid":"ac5be6db-4e40-41f8-8b84-7598d4747e57","files":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":"ac5be6db-4e40-41f8-8b84-7598d4747e57","pid":2715833,"argv":["/home/joey/.nvm/versions/node/v20.11.0/bin/node","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/node_modules/.bin/mocha","--import=tsx","./src/ecc.test.ts","./src/hash.test.ts","./src/op.test.ts","./src/script.test.ts","./src/sigHashType.test.ts","./src/tx.test.ts","./src/unsignedTx.test.ts","./src/io/bytes.test.ts","./src/io/varsize.test.ts","./src/io/writerbytes.test.ts","./src/io/writerlength.test.ts","--reporter","mocha-junit-reporter","--reporter-options","mochaFile=test_results/ecash-lib-junit.xml","--reporter-options","testsuitesTitle=Ecash Lib Unit Tests","--reporter-options","rootSuiteTitle=Ecash Lib"],"execArgv":[],"cwd":"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib","time":1714065308079,"ppid":2715832,"coverageFilename":"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/.nyc_output/b316d46f-5ea0-4e98-884a-bfbf9cc1d0f8.json","externalId":"","uuid":"b316d46f-5ea0-4e98-884a-bfbf9cc1d0f8","files":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"parent":null,"pid":2715758,"argv":["/home/joey/.nvm/versions/node/v20.11.0/bin/node","/home/joey/.nvm/versions/node/v20.11.0/bin/nyc","--reporter=text","--reporter=lcov","--reporter=teamcity","npm","test","--","--reporter","mocha-junit-reporter","--reporter-options","mochaFile=test_results/ecash-lib-junit.xml","--reporter-options","testsuitesTitle=Ecash Lib Unit Tests","--reporter-options","rootSuiteTitle=Ecash Lib"],"execArgv":[],"cwd":"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib","time":1714065305953,"ppid":2715321,"coverageFilename":"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/.nyc_output/f965566b-9422-4874-b45e-9eefda9c769c.json","externalId":"","uuid":"f965566b-9422-4874-b45e-9eefda9c769c","files":["/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/ffi/ecash_lib_wasm.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/ecc.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/hash.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/index.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/bytes.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/hex.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/int.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/str.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/varsize.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/writer.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/writerbytes.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/writerlength.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/op.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/opcode.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/script.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/sigHashType.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/token/alp.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/token/common.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/token/empp.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/tx.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/txBuilder.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/unsignedTx.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/eslint.config.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/ecc.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/ffi/ecash_lib_wasm.js","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/hash.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/index.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/bytes.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/hex.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/int.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/str.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/varsize.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/writer.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/writerbytes.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/writerlength.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/op.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/opcode.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/script.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/sigHashType.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/token/alp.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/token/common.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/token/empp.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/tx.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/txBuilder.ts","/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/unsignedTx.ts"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"processes":{"0fc40ca6-d52c-45eb-b31b-2601ce70b887":{"parent":"b316d46f-5ea0-4e98-884a-bfbf9cc1d0f8","children":[]},"ac5be6db-4e40-41f8-8b84-7598d4747e57":{"parent":null,"children":["b316d46f-5ea0-4e98-884a-bfbf9cc1d0f8"]},"b316d46f-5ea0-4e98-884a-bfbf9cc1d0f8":{"parent":"ac5be6db-4e40-41f8-8b84-7598d4747e57","children":["0fc40ca6-d52c-45eb-b31b-2601ce70b887"]},"f965566b-9422-4874-b45e-9eefda9c769c":{"parent":null,"children":[]}},"files":{"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/ffi/ecash_lib_wasm.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/ecc.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/hash.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/index.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/bytes.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/hex.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/int.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/str.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/varsize.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/writer.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/writerbytes.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/io/writerlength.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/op.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/opcode.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/script.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/sigHashType.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/token/alp.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/token/common.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/token/empp.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/tx.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/txBuilder.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/dist/src/unsignedTx.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/eslint.config.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/ecc.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/ffi/ecash_lib_wasm.js":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/hash.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/index.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/bytes.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/hex.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/int.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/str.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/varsize.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/writer.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/writerbytes.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/io/writerlength.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/op.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/opcode.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/script.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/sigHashType.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/token/alp.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/token/common.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/token/empp.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/tx.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/txBuilder.ts":["f965566b-9422-4874-b45e-9eefda9c769c"],"/home/joey/github/abc/bitcoin-abc/modules/ecash-lib/src/unsignedTx.ts":["f965566b-9422-4874-b45e-9eefda9c769c"]},"externalIds":{}}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Calculate SHA256(SHA256(data)).
|
|
5
|
-
* @param {Uint8Array} data
|
|
6
|
-
* @returns {Uint8Array}
|
|
7
|
-
*/
|
|
8
|
-
export function sha256d(data: Uint8Array): Uint8Array;
|
|
9
|
-
/**
|
|
10
|
-
* Calculate SHA256(data).
|
|
11
|
-
* @param {Uint8Array} data
|
|
12
|
-
* @returns {Uint8Array}
|
|
13
|
-
*/
|
|
14
|
-
export function sha256(data: Uint8Array): Uint8Array;
|
|
15
|
-
/**
|
|
16
|
-
* Calculate RIPEMD160(SHA256(data)), commonly used as address hash.
|
|
17
|
-
* @param {Uint8Array} data
|
|
18
|
-
* @returns {Uint8Array}
|
|
19
|
-
*/
|
|
20
|
-
export function shaRmd160(data: Uint8Array): Uint8Array;
|
|
21
|
-
/**
|
|
22
|
-
* ECC signatures with libsecp256k1.
|
|
23
|
-
*/
|
|
24
|
-
export class Ecc {
|
|
25
|
-
free(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Create a new Ecc instance.
|
|
28
|
-
*/
|
|
29
|
-
constructor();
|
|
30
|
-
/**
|
|
31
|
-
* Derive a public key from secret key.
|
|
32
|
-
* @param {Uint8Array} seckey
|
|
33
|
-
* @returns {Uint8Array}
|
|
34
|
-
*/
|
|
35
|
-
derivePubkey(seckey: Uint8Array): Uint8Array;
|
|
36
|
-
/**
|
|
37
|
-
* Sign an ECDSA signature.
|
|
38
|
-
* @param {Uint8Array} seckey
|
|
39
|
-
* @param {Uint8Array} msg
|
|
40
|
-
* @returns {Uint8Array}
|
|
41
|
-
*/
|
|
42
|
-
ecdsaSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
43
|
-
/**
|
|
44
|
-
* Sign a Schnorr signature.
|
|
45
|
-
* @param {Uint8Array} seckey
|
|
46
|
-
* @param {Uint8Array} msg
|
|
47
|
-
* @returns {Uint8Array}
|
|
48
|
-
*/
|
|
49
|
-
schnorrSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
53
|
-
|
|
54
|
-
export interface InitOutput {
|
|
55
|
-
readonly memory: WebAssembly.Memory;
|
|
56
|
-
readonly ecc_new: () => number;
|
|
57
|
-
readonly ecc_derivePubkey: (a: number, b: number, c: number, d: number) => void;
|
|
58
|
-
readonly ecc_ecdsaSign: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
59
|
-
readonly ecc_schnorrSign: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
60
|
-
readonly __wbg_ecc_free: (a: number) => void;
|
|
61
|
-
readonly sha256d: (a: number, b: number, c: number) => void;
|
|
62
|
-
readonly sha256: (a: number, b: number, c: number) => void;
|
|
63
|
-
readonly shaRmd160: (a: number, b: number, c: number) => void;
|
|
64
|
-
readonly secp256k1_default_illegal_callback_fn: (a: number, b: number) => void;
|
|
65
|
-
readonly secp256k1_default_error_callback_fn: (a: number, b: number) => void;
|
|
66
|
-
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
67
|
-
readonly __wbindgen_export_0: (a: number, b: number) => number;
|
|
68
|
-
readonly __wbindgen_export_1: (a: number, b: number, c: number) => void;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
72
|
-
/**
|
|
73
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
74
|
-
* a precompiled `WebAssembly.Module`.
|
|
75
|
-
*
|
|
76
|
-
* @param {SyncInitInput} module
|
|
77
|
-
*
|
|
78
|
-
* @returns {InitOutput}
|
|
79
|
-
*/
|
|
80
|
-
export function initSync(module: SyncInitInput): InitOutput;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
84
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
85
|
-
*
|
|
86
|
-
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
87
|
-
*
|
|
88
|
-
* @returns {Promise<InitOutput>}
|
|
89
|
-
*/
|
|
90
|
-
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
let wasm;
|
|
2
|
-
|
|
3
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
4
|
-
|
|
5
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
6
|
-
|
|
7
|
-
let cachedUint8Memory0 = null;
|
|
8
|
-
|
|
9
|
-
function getUint8Memory0() {
|
|
10
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
11
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
-
}
|
|
13
|
-
return cachedUint8Memory0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getStringFromWasm0(ptr, len) {
|
|
17
|
-
ptr = ptr >>> 0;
|
|
18
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const heap = new Array(128).fill(undefined);
|
|
22
|
-
|
|
23
|
-
heap.push(undefined, null, true, false);
|
|
24
|
-
|
|
25
|
-
let heap_next = heap.length;
|
|
26
|
-
|
|
27
|
-
function addHeapObject(obj) {
|
|
28
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
29
|
-
const idx = heap_next;
|
|
30
|
-
heap_next = heap[idx];
|
|
31
|
-
|
|
32
|
-
heap[idx] = obj;
|
|
33
|
-
return idx;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let WASM_VECTOR_LEN = 0;
|
|
37
|
-
|
|
38
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
39
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
40
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
41
|
-
WASM_VECTOR_LEN = arg.length;
|
|
42
|
-
return ptr;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let cachedInt32Memory0 = null;
|
|
46
|
-
|
|
47
|
-
function getInt32Memory0() {
|
|
48
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
49
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
50
|
-
}
|
|
51
|
-
return cachedInt32Memory0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function getObject(idx) { return heap[idx]; }
|
|
55
|
-
|
|
56
|
-
function dropObject(idx) {
|
|
57
|
-
if (idx < 132) return;
|
|
58
|
-
heap[idx] = heap_next;
|
|
59
|
-
heap_next = idx;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function takeObject(idx) {
|
|
63
|
-
const ret = getObject(idx);
|
|
64
|
-
dropObject(idx);
|
|
65
|
-
return ret;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
69
|
-
ptr = ptr >>> 0;
|
|
70
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Calculate SHA256(SHA256(data)).
|
|
74
|
-
* @param {Uint8Array} data
|
|
75
|
-
* @returns {Uint8Array}
|
|
76
|
-
*/
|
|
77
|
-
export function sha256d(data) {
|
|
78
|
-
try {
|
|
79
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
80
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export_0);
|
|
81
|
-
const len0 = WASM_VECTOR_LEN;
|
|
82
|
-
wasm.sha256d(retptr, ptr0, len0);
|
|
83
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
84
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
85
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
86
|
-
wasm.__wbindgen_export_1(r0, r1 * 1, 1);
|
|
87
|
-
return v2;
|
|
88
|
-
} finally {
|
|
89
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Calculate SHA256(data).
|
|
95
|
-
* @param {Uint8Array} data
|
|
96
|
-
* @returns {Uint8Array}
|
|
97
|
-
*/
|
|
98
|
-
export function sha256(data) {
|
|
99
|
-
try {
|
|
100
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
101
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export_0);
|
|
102
|
-
const len0 = WASM_VECTOR_LEN;
|
|
103
|
-
wasm.sha256(retptr, ptr0, len0);
|
|
104
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
105
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
106
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
107
|
-
wasm.__wbindgen_export_1(r0, r1 * 1, 1);
|
|
108
|
-
return v2;
|
|
109
|
-
} finally {
|
|
110
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Calculate RIPEMD160(SHA256(data)), commonly used as address hash.
|
|
116
|
-
* @param {Uint8Array} data
|
|
117
|
-
* @returns {Uint8Array}
|
|
118
|
-
*/
|
|
119
|
-
export function shaRmd160(data) {
|
|
120
|
-
try {
|
|
121
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
122
|
-
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export_0);
|
|
123
|
-
const len0 = WASM_VECTOR_LEN;
|
|
124
|
-
wasm.shaRmd160(retptr, ptr0, len0);
|
|
125
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
126
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
127
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
128
|
-
wasm.__wbindgen_export_1(r0, r1 * 1, 1);
|
|
129
|
-
return v2;
|
|
130
|
-
} finally {
|
|
131
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const EccFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
136
|
-
? { register: () => {}, unregister: () => {} }
|
|
137
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_ecc_free(ptr >>> 0));
|
|
138
|
-
/**
|
|
139
|
-
* ECC signatures with libsecp256k1.
|
|
140
|
-
*/
|
|
141
|
-
export class Ecc {
|
|
142
|
-
|
|
143
|
-
__destroy_into_raw() {
|
|
144
|
-
const ptr = this.__wbg_ptr;
|
|
145
|
-
this.__wbg_ptr = 0;
|
|
146
|
-
EccFinalization.unregister(this);
|
|
147
|
-
return ptr;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
free() {
|
|
151
|
-
const ptr = this.__destroy_into_raw();
|
|
152
|
-
wasm.__wbg_ecc_free(ptr);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Create a new Ecc instance.
|
|
156
|
-
*/
|
|
157
|
-
constructor() {
|
|
158
|
-
const ret = wasm.ecc_new();
|
|
159
|
-
this.__wbg_ptr = ret >>> 0;
|
|
160
|
-
return this;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Derive a public key from secret key.
|
|
164
|
-
* @param {Uint8Array} seckey
|
|
165
|
-
* @returns {Uint8Array}
|
|
166
|
-
*/
|
|
167
|
-
derivePubkey(seckey) {
|
|
168
|
-
try {
|
|
169
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
170
|
-
const ptr0 = passArray8ToWasm0(seckey, wasm.__wbindgen_export_0);
|
|
171
|
-
const len0 = WASM_VECTOR_LEN;
|
|
172
|
-
wasm.ecc_derivePubkey(retptr, this.__wbg_ptr, ptr0, len0);
|
|
173
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
174
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
175
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
176
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
177
|
-
if (r3) {
|
|
178
|
-
throw takeObject(r2);
|
|
179
|
-
}
|
|
180
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
181
|
-
wasm.__wbindgen_export_1(r0, r1 * 1, 1);
|
|
182
|
-
return v2;
|
|
183
|
-
} finally {
|
|
184
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Sign an ECDSA signature.
|
|
189
|
-
* @param {Uint8Array} seckey
|
|
190
|
-
* @param {Uint8Array} msg
|
|
191
|
-
* @returns {Uint8Array}
|
|
192
|
-
*/
|
|
193
|
-
ecdsaSign(seckey, msg) {
|
|
194
|
-
try {
|
|
195
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
196
|
-
const ptr0 = passArray8ToWasm0(seckey, wasm.__wbindgen_export_0);
|
|
197
|
-
const len0 = WASM_VECTOR_LEN;
|
|
198
|
-
const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_export_0);
|
|
199
|
-
const len1 = WASM_VECTOR_LEN;
|
|
200
|
-
wasm.ecc_ecdsaSign(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
201
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
202
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
203
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
204
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
205
|
-
if (r3) {
|
|
206
|
-
throw takeObject(r2);
|
|
207
|
-
}
|
|
208
|
-
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
209
|
-
wasm.__wbindgen_export_1(r0, r1 * 1, 1);
|
|
210
|
-
return v3;
|
|
211
|
-
} finally {
|
|
212
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Sign a Schnorr signature.
|
|
217
|
-
* @param {Uint8Array} seckey
|
|
218
|
-
* @param {Uint8Array} msg
|
|
219
|
-
* @returns {Uint8Array}
|
|
220
|
-
*/
|
|
221
|
-
schnorrSign(seckey, msg) {
|
|
222
|
-
try {
|
|
223
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
224
|
-
const ptr0 = passArray8ToWasm0(seckey, wasm.__wbindgen_export_0);
|
|
225
|
-
const len0 = WASM_VECTOR_LEN;
|
|
226
|
-
const ptr1 = passArray8ToWasm0(msg, wasm.__wbindgen_export_0);
|
|
227
|
-
const len1 = WASM_VECTOR_LEN;
|
|
228
|
-
wasm.ecc_schnorrSign(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
229
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
230
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
231
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
232
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
233
|
-
if (r3) {
|
|
234
|
-
throw takeObject(r2);
|
|
235
|
-
}
|
|
236
|
-
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
237
|
-
wasm.__wbindgen_export_1(r0, r1 * 1, 1);
|
|
238
|
-
return v3;
|
|
239
|
-
} finally {
|
|
240
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
async function __wbg_load(module, imports) {
|
|
246
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
247
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
248
|
-
try {
|
|
249
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
250
|
-
|
|
251
|
-
} catch (e) {
|
|
252
|
-
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
253
|
-
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
254
|
-
|
|
255
|
-
} else {
|
|
256
|
-
throw e;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
const bytes = await module.arrayBuffer();
|
|
262
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
263
|
-
|
|
264
|
-
} else {
|
|
265
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
266
|
-
|
|
267
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
268
|
-
return { instance, module };
|
|
269
|
-
|
|
270
|
-
} else {
|
|
271
|
-
return instance;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function __wbg_get_imports() {
|
|
277
|
-
const imports = {};
|
|
278
|
-
imports.wbg = {};
|
|
279
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
280
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
281
|
-
return addHeapObject(ret);
|
|
282
|
-
};
|
|
283
|
-
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
284
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
return imports;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
function __wbg_init_memory(imports, maybe_memory) {
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function __wbg_finalize_init(instance, module) {
|
|
295
|
-
wasm = instance.exports;
|
|
296
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
297
|
-
cachedInt32Memory0 = null;
|
|
298
|
-
cachedUint8Memory0 = null;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return wasm;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function initSync(module) {
|
|
305
|
-
if (wasm !== undefined) return wasm;
|
|
306
|
-
|
|
307
|
-
const imports = __wbg_get_imports();
|
|
308
|
-
|
|
309
|
-
__wbg_init_memory(imports);
|
|
310
|
-
|
|
311
|
-
if (!(module instanceof WebAssembly.Module)) {
|
|
312
|
-
module = new WebAssembly.Module(module);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const instance = new WebAssembly.Instance(module, imports);
|
|
316
|
-
|
|
317
|
-
return __wbg_finalize_init(instance, module);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
async function __wbg_init(input) {
|
|
321
|
-
if (wasm !== undefined) return wasm;
|
|
322
|
-
|
|
323
|
-
if (typeof input === 'undefined') {
|
|
324
|
-
input = new URL('ecash_lib_wasm_bg.wasm', import.meta.url);
|
|
325
|
-
}
|
|
326
|
-
const imports = __wbg_get_imports();
|
|
327
|
-
|
|
328
|
-
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
329
|
-
input = fetch(input);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
__wbg_init_memory(imports);
|
|
333
|
-
|
|
334
|
-
const { instance, module } = await __wbg_load(await input, imports);
|
|
335
|
-
|
|
336
|
-
return __wbg_finalize_init(instance, module);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export { initSync }
|
|
340
|
-
export default __wbg_init;
|
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function ecc_new(): number;
|
|
5
|
-
export function ecc_derivePubkey(a: number, b: number, c: number, d: number): void;
|
|
6
|
-
export function ecc_ecdsaSign(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
7
|
-
export function ecc_schnorrSign(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
|
8
|
-
export function __wbg_ecc_free(a: number): void;
|
|
9
|
-
export function sha256d(a: number, b: number, c: number): void;
|
|
10
|
-
export function sha256(a: number, b: number, c: number): void;
|
|
11
|
-
export function shaRmd160(a: number, b: number, c: number): void;
|
|
12
|
-
export function secp256k1_default_illegal_callback_fn(a: number, b: number): void;
|
|
13
|
-
export function secp256k1_default_error_callback_fn(a: number, b: number): void;
|
|
14
|
-
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
15
|
-
export function __wbindgen_export_0(a: number, b: number): number;
|
|
16
|
-
export function __wbindgen_export_1(a: number, b: number, c: number): void;
|
package/dist/init.d.ts
DELETED
package/dist/init.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAMA,0CAA0C;AAC1C,wBAAsB,QAAQ,0DAU7B"}
|
package/dist/init.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2024 The Bitcoin developers
|
|
2
|
-
// Distributed under the MIT software license, see the accompanying
|
|
3
|
-
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
-
import __wbg_init from './ffi/ecash_lib_wasm.js';
|
|
5
|
-
/** Load and initialize the WASM module */
|
|
6
|
-
export async function initWasm() {
|
|
7
|
-
if (typeof window === 'undefined') {
|
|
8
|
-
// On Node, read the file off the disk
|
|
9
|
-
const fs = await import('node:fs/promises');
|
|
10
|
-
const wasmUrl = new URL('ffi/ecash_lib_wasm_bg.wasm', import.meta.url);
|
|
11
|
-
return await __wbg_init(fs.readFile(wasmUrl));
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
// Browser, use default, will use fetch internally
|
|
15
|
-
return await __wbg_init();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;AAEtE,OAAO,UAAU,MAAM,yBAAyB,CAAC;AAEjD,0CAA0C;AAC1C,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC1B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAChC,sCAAsC;QACtC,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvE,OAAO,MAAM,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,CAAC;SAAM,CAAC;QACJ,kDAAkD;QAClD,OAAO,MAAM,UAAU,EAAE,CAAC;IAC9B,CAAC;AACL,CAAC"}
|