@knuth/js-wasm 2.3.0 → 2.6.0
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/package.json +1 -1
- package/src/kth.js +1 -1
- package/src/kth.wasm +0 -0
- package/types/Bitcoin.d.ts +2 -0
- package/types/DoubleList.d.ts +6 -0
- package/types/EcCompressed.d.ts +7 -0
- package/types/EcPublic.d.ts +13 -0
- package/types/Hash.d.ts +32 -0
- package/types/HdPublic.d.ts +13 -0
- package/types/Input.d.ts +17 -0
- package/types/InputList.d.ts +7 -0
- package/types/Interpreter.d.ts +17 -0
- package/types/Kth.d.ts +1 -0
- package/types/LazySequence copy.d.ts +0 -0
- package/types/ListHelper.d.ts +5 -0
- package/types/ListNative.d.ts +5 -0
- package/types/Opcode.d.ts +9 -0
- package/types/Operation.d.ts +47 -0
- package/types/OperationList.d.ts +7 -0
- package/types/Output.d.ts +18 -0
- package/types/OutputList.d.ts +7 -0
- package/types/OutputPoint.d.ts +14 -0
- package/types/PaymentAddress.d.ts +16 -1
- package/types/PaymentAddressList.d.ts +7 -0
- package/types/Program.d.ts +15 -0
- package/types/RuleFork.d.ts +38 -0
- package/types/Script.d.ts +51 -0
- package/types/Secret.d.ts +4 -0
- package/types/SecretFunctions.d.ts +8 -0
- package/types/SighashAlgorithm.d.ts +19 -0
- package/types/StringList.d.ts +6 -0
- package/types/TokenData.d.ts +18 -0
- package/types/TokenDataBothKinds.d.ts +9 -0
- package/types/TokenDataFungible.d.ts +5 -0
- package/types/TokenDataNonFungible.d.ts +7 -0
- package/types/Transaction.d.ts +30 -0
- package/types/U32List.d.ts +6 -0
- package/types/U64List.d.ts +6 -0
- package/types/Utxo.d.ts +17 -0
- package/types/UtxoList.d.ts +7 -0
- package/types/Wallet.d.ts +19 -6
- package/types/WalletData.d.ts +11 -0
- package/types/WalletManager.d.ts +8 -0
- package/types/encoding.d.ts +5 -0
- package/types/main.d.ts +54 -1
- package/types/wasm/exceptions.d.ts +1 -0
- package/types/wasm/glue copy.d.ts +230 -0
- package/types/wasm/glue.d.ts +388 -2
- package/types/wasm/glue_manual.d.ts +42 -0
- package/types/wasm/manualGeneratedTypes.d.ts +5 -0
- package/types/wasm/mem.d.ts +4 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WalletDataNative } from './wasm/glue';
|
|
2
|
+
import { EncryptedSeed } from './Hash';
|
|
3
|
+
import { HdPublic } from './HdPublic';
|
|
4
|
+
export declare class WalletData {
|
|
5
|
+
mnemonics?: Array<string>;
|
|
6
|
+
encryptedSeed?: EncryptedSeed;
|
|
7
|
+
xpub?: HdPublic;
|
|
8
|
+
static fromNative(native: WalletDataNative, destroy?: boolean): WalletData;
|
|
9
|
+
constructor(mnemonics?: Array<string>, encryptedSeed?: EncryptedSeed, xpub?: HdPublic);
|
|
10
|
+
}
|
|
11
|
+
export default WalletData;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LongHash } from './Hash';
|
|
2
|
+
import { WalletData } from './WalletData';
|
|
3
|
+
import { EncryptedSeed } from './Hash';
|
|
4
|
+
export declare class WalletManager {
|
|
5
|
+
static createWallet(password: string, normalizedPassphrase?: string): WalletData | undefined;
|
|
6
|
+
static decryptSeed(password: string, encryptedSeed: EncryptedSeed): LongHash | undefined;
|
|
7
|
+
}
|
|
8
|
+
export default WalletManager;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Hash } from './Hash';
|
|
2
|
+
export declare function bytesToHexStr(bytes: Uint8Array): string;
|
|
3
|
+
export declare function hexStrToBytes(hex: string): Uint8Array;
|
|
4
|
+
export declare function encodeHash(bytes: Hash): string;
|
|
5
|
+
export declare function decodeHash(hex: string): Hash;
|
package/types/main.d.ts
CHANGED
|
@@ -1,14 +1,67 @@
|
|
|
1
1
|
import Kth from './Kth';
|
|
2
|
+
import Utxo from './Utxo';
|
|
3
|
+
import Opcode from './Opcode';
|
|
4
|
+
import OutputPoint from './OutputPoint';
|
|
5
|
+
import Output from './Output';
|
|
6
|
+
import TokenData from './TokenData';
|
|
7
|
+
import TokenDataFungible from './TokenDataFungible';
|
|
8
|
+
import TokenDataNonFungible from './TokenDataNonFungible';
|
|
9
|
+
import TokenDataBothKinds from './TokenDataBothKinds';
|
|
10
|
+
import Input from './Input';
|
|
11
|
+
import OutputList from './OutputList';
|
|
12
|
+
import InputList from './InputList';
|
|
13
|
+
import UtxoList from './UtxoList';
|
|
2
14
|
import PaymentAddress from './PaymentAddress';
|
|
15
|
+
import Script from './Script';
|
|
16
|
+
import Transaction from './Transaction';
|
|
3
17
|
import Wallet from './Wallet';
|
|
18
|
+
import HdPublic from './HdPublic';
|
|
19
|
+
import EcPublic from './EcPublic';
|
|
20
|
+
import { EcSecret } from './Secret';
|
|
21
|
+
import { SecretFunctions } from './SecretFunctions';
|
|
22
|
+
import { OpcodeEnumNative, OpcodeEnumNativeToInt } from './wasm/glue';
|
|
23
|
+
import { ScriptNative } from './wasm/glue';
|
|
24
|
+
import Operation from './Operation';
|
|
25
|
+
import OperationList from './OperationList';
|
|
26
|
+
import RuleFork from './RuleFork';
|
|
27
|
+
import SighashAlgorithm from './SighashAlgorithm';
|
|
28
|
+
import Program from './Program';
|
|
29
|
+
import { Interpreter, Debugger } from './Interpreter';
|
|
30
|
+
import { bitcoinToSatoshis, satoshisToBitcoin } from './Bitcoin';
|
|
31
|
+
import { RuleForkEnumNative, RuleForkEnumNativeToInt } from './wasm/glue_manual';
|
|
32
|
+
import { bytesToHexStr, hexStrToBytes, encodeHash, decodeHash } from './encoding';
|
|
33
|
+
import { HashFunctions, Hash, ShortHash, LongHash, EncryptedSeed } from './Hash';
|
|
34
|
+
import WalletManager from './WalletManager';
|
|
35
|
+
import WalletData from './WalletData';
|
|
4
36
|
import loadLib from './wasm/loadLib';
|
|
5
37
|
import { free, malloc } from './wasm/mem';
|
|
6
|
-
export { loadLib, Kth, PaymentAddress, Wallet, free, malloc };
|
|
38
|
+
export { loadLib, Kth, OutputPoint, Utxo, Output, OutputList, TokenData, TokenDataFungible, TokenDataNonFungible, TokenDataBothKinds, Input, InputList, UtxoList, PaymentAddress, Script, ScriptNative, Transaction, Wallet, HdPublic, EcPublic, EcSecret, SecretFunctions, Opcode, OpcodeEnumNative, OpcodeEnumNativeToInt, Operation, OperationList, RuleFork, RuleForkEnumNative, RuleForkEnumNativeToInt, SighashAlgorithm, Interpreter, Debugger, Program, bytesToHexStr, hexStrToBytes, encodeHash, decodeHash, bitcoinToSatoshis, satoshisToBitcoin, HashFunctions, Hash, ShortHash, LongHash, EncryptedSeed, WalletManager, WalletData, free, malloc };
|
|
7
39
|
declare const _default: {
|
|
8
40
|
loadLib: typeof loadLib;
|
|
9
41
|
Kth: typeof Kth;
|
|
10
42
|
PaymentAddress: typeof PaymentAddress;
|
|
11
43
|
Wallet: typeof Wallet;
|
|
44
|
+
Script: typeof Script;
|
|
45
|
+
HdPublic: typeof HdPublic;
|
|
46
|
+
EcPublic: typeof EcPublic;
|
|
47
|
+
SecretFunctions: typeof SecretFunctions;
|
|
48
|
+
Opcode: typeof Opcode;
|
|
49
|
+
OpcodeEnumNativeToInt: typeof OpcodeEnumNativeToInt;
|
|
50
|
+
Operation: typeof Operation;
|
|
51
|
+
RuleFork: typeof RuleFork;
|
|
52
|
+
RuleForkEnumNativeToInt: typeof RuleForkEnumNativeToInt;
|
|
53
|
+
SighashAlgorithm: typeof SighashAlgorithm;
|
|
54
|
+
Utxo: typeof Utxo;
|
|
55
|
+
UtxoList: typeof UtxoList;
|
|
56
|
+
bytesToHexStr: typeof bytesToHexStr;
|
|
57
|
+
hexStrToBytes: typeof hexStrToBytes;
|
|
58
|
+
encodeHash: typeof encodeHash;
|
|
59
|
+
decodeHash: typeof decodeHash;
|
|
60
|
+
bitcoinToSatoshis: typeof bitcoinToSatoshis;
|
|
61
|
+
satoshisToBitcoin: typeof satoshisToBitcoin;
|
|
62
|
+
HashFunctions: typeof HashFunctions;
|
|
63
|
+
WalletManager: typeof WalletManager;
|
|
64
|
+
WalletData: typeof WalletData;
|
|
12
65
|
free: typeof free;
|
|
13
66
|
malloc: typeof malloc;
|
|
14
67
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function dummyFunction(): void;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
declare const ptrSym: unique symbol;
|
|
2
|
+
declare const _CurrencyIntToKey: readonly ["bitcoin", "bitcoin_cash", "litecoin"];
|
|
3
|
+
export declare type Currency = (typeof _CurrencyIntToKey)[number];
|
|
4
|
+
declare const _LogLibraryIntToKey: readonly ["boost", "spdlog", "binlog"];
|
|
5
|
+
export declare type LogLibrary = (typeof _LogLibraryIntToKey)[number];
|
|
6
|
+
export declare class LibConfigTypeSizes {
|
|
7
|
+
private readonly [ptrSym];
|
|
8
|
+
static _create(ptr: number): LibConfigTypeSizes;
|
|
9
|
+
get size_int(): number;
|
|
10
|
+
get size_long(): number;
|
|
11
|
+
get size_pointer(): number;
|
|
12
|
+
protected _destructor(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class LibConfig {
|
|
15
|
+
private readonly [ptrSym];
|
|
16
|
+
static _create(ptr: number): LibConfig;
|
|
17
|
+
get log_library(): LogLibrary;
|
|
18
|
+
get use_libmdbx(): boolean;
|
|
19
|
+
get version(): string;
|
|
20
|
+
get microarchitecture_id(): string;
|
|
21
|
+
get currency(): Currency;
|
|
22
|
+
get mempool(): boolean;
|
|
23
|
+
get db_readonly(): boolean;
|
|
24
|
+
get debug_mode(): boolean;
|
|
25
|
+
get architecture(): string;
|
|
26
|
+
get os_name(): string;
|
|
27
|
+
get compiler_name(): string;
|
|
28
|
+
get compiler_version(): string;
|
|
29
|
+
get optimization_level(): string;
|
|
30
|
+
get build_timestamp(): number;
|
|
31
|
+
get endianness(): string;
|
|
32
|
+
get type_sizes(): LibConfigTypeSizes;
|
|
33
|
+
protected _destructor(): void;
|
|
34
|
+
static getLibconfig(): LibConfig;
|
|
35
|
+
static getEmscriptenVersionMajor(): number;
|
|
36
|
+
static getEmscriptenVersionMinor(): number;
|
|
37
|
+
static getEmscriptenVersionTiny(): number;
|
|
38
|
+
static getBuildTimestamp(): number;
|
|
39
|
+
}
|
|
40
|
+
export declare class StringListNative {
|
|
41
|
+
private readonly [ptrSym];
|
|
42
|
+
static _create(ptr: number): StringListNative;
|
|
43
|
+
protected _destructor(): void;
|
|
44
|
+
constructor();
|
|
45
|
+
pushBack(string: string): void;
|
|
46
|
+
}
|
|
47
|
+
export declare class ShortHashNative {
|
|
48
|
+
private readonly [ptrSym];
|
|
49
|
+
static _create(ptr: number): ShortHashNative;
|
|
50
|
+
get hash(): number;
|
|
51
|
+
protected _destructor(): void;
|
|
52
|
+
}
|
|
53
|
+
export declare class HashNative {
|
|
54
|
+
private readonly [ptrSym];
|
|
55
|
+
static _create(ptr: number): HashNative;
|
|
56
|
+
get hash(): number;
|
|
57
|
+
protected _destructor(): void;
|
|
58
|
+
}
|
|
59
|
+
export declare class LongHashNative {
|
|
60
|
+
private readonly [ptrSym];
|
|
61
|
+
static _create(ptr: number): LongHashNative;
|
|
62
|
+
get hash(): number;
|
|
63
|
+
protected _destructor(): void;
|
|
64
|
+
}
|
|
65
|
+
export declare class HdChainCodeNative {
|
|
66
|
+
private readonly [ptrSym];
|
|
67
|
+
static _create(ptr: number): HdChainCodeNative;
|
|
68
|
+
get data(): number;
|
|
69
|
+
protected _destructor(): void;
|
|
70
|
+
}
|
|
71
|
+
export declare class HdKeyNative {
|
|
72
|
+
private readonly [ptrSym];
|
|
73
|
+
static _create(ptr: number): HdKeyNative;
|
|
74
|
+
get data(): number;
|
|
75
|
+
protected _destructor(): void;
|
|
76
|
+
}
|
|
77
|
+
export declare class EcCompressedNative {
|
|
78
|
+
private readonly [ptrSym];
|
|
79
|
+
static _create(ptr: number): EcCompressedNative;
|
|
80
|
+
get data(): number;
|
|
81
|
+
protected _destructor(): void;
|
|
82
|
+
}
|
|
83
|
+
export declare class EcUncompressedNative {
|
|
84
|
+
private readonly [ptrSym];
|
|
85
|
+
static _create(ptr: number): EcUncompressedNative;
|
|
86
|
+
get data(): number;
|
|
87
|
+
protected _destructor(): void;
|
|
88
|
+
}
|
|
89
|
+
export declare class EcSecretNative {
|
|
90
|
+
private readonly [ptrSym];
|
|
91
|
+
static _create(ptr: number): EcSecretNative;
|
|
92
|
+
get hash(): number;
|
|
93
|
+
protected _destructor(): void;
|
|
94
|
+
}
|
|
95
|
+
export declare class WifUncompressedNative {
|
|
96
|
+
private readonly [ptrSym];
|
|
97
|
+
static _create(ptr: number): WifUncompressedNative;
|
|
98
|
+
get data(): number;
|
|
99
|
+
protected _destructor(): void;
|
|
100
|
+
}
|
|
101
|
+
export declare class WifCompressedNative {
|
|
102
|
+
private readonly [ptrSym];
|
|
103
|
+
static _create(ptr: number): WifCompressedNative;
|
|
104
|
+
get data(): number;
|
|
105
|
+
protected _destructor(): void;
|
|
106
|
+
}
|
|
107
|
+
export declare class HdLineageNative {
|
|
108
|
+
private readonly [ptrSym];
|
|
109
|
+
static _create(ptr: number): HdLineageNative;
|
|
110
|
+
get prefixes(): bigint;
|
|
111
|
+
get depth(): number;
|
|
112
|
+
get parent_fingerprint(): number;
|
|
113
|
+
get child_number(): number;
|
|
114
|
+
protected _destructor(): void;
|
|
115
|
+
}
|
|
116
|
+
export declare class EllipticCurveNative {
|
|
117
|
+
static secretToPublic(out: EcCompressedNative, secret: EcSecretNative): boolean;
|
|
118
|
+
}
|
|
119
|
+
export declare class HdPublicNative {
|
|
120
|
+
private readonly [ptrSym];
|
|
121
|
+
static _create(ptr: number): HdPublicNative;
|
|
122
|
+
protected _destructor(): void;
|
|
123
|
+
constructor();
|
|
124
|
+
isValid(): boolean;
|
|
125
|
+
encoded(): string;
|
|
126
|
+
chainCode(): HdChainCodeNative;
|
|
127
|
+
lineage(): HdLineageNative;
|
|
128
|
+
point(): EcCompressedNative;
|
|
129
|
+
toHdKey(): HdKeyNative;
|
|
130
|
+
derivePublic(index: number): HdPublicNative;
|
|
131
|
+
}
|
|
132
|
+
export declare class HdPrivateNative {
|
|
133
|
+
private readonly [ptrSym];
|
|
134
|
+
static _create(ptr: number): HdPrivateNative;
|
|
135
|
+
protected _destructor(): void;
|
|
136
|
+
constructor();
|
|
137
|
+
constructor(encoded: string);
|
|
138
|
+
constructor(seed: number, size: number, prefixes: bigint);
|
|
139
|
+
isValid(): boolean;
|
|
140
|
+
encoded(): string;
|
|
141
|
+
secret(): EcSecretNative;
|
|
142
|
+
chainCode(): HdChainCodeNative;
|
|
143
|
+
lineage(): HdLineageNative;
|
|
144
|
+
point(): EcCompressedNative;
|
|
145
|
+
toHdKeyNative(): HdKeyNative;
|
|
146
|
+
toPublic(): HdPublicNative;
|
|
147
|
+
derivePrivate(index: number): HdPrivateNative;
|
|
148
|
+
derivePublic(index: number): HdPublicNative;
|
|
149
|
+
}
|
|
150
|
+
export declare class PaymentAddressNative {
|
|
151
|
+
private readonly [ptrSym];
|
|
152
|
+
static _create(ptr: number): PaymentAddressNative;
|
|
153
|
+
protected _destructor(): void;
|
|
154
|
+
constructor(address: string);
|
|
155
|
+
constructor(hash: ShortHashNative, version: number);
|
|
156
|
+
encodedLegacy(): string;
|
|
157
|
+
encodedCashaddr(tokenAware: boolean): string;
|
|
158
|
+
hash20(): ShortHashNative;
|
|
159
|
+
hash32(): HashNative;
|
|
160
|
+
version(): number;
|
|
161
|
+
isValid(): boolean;
|
|
162
|
+
}
|
|
163
|
+
export declare class EcPrivateNative {
|
|
164
|
+
private readonly [ptrSym];
|
|
165
|
+
static _create(ptr: number): EcPrivateNative;
|
|
166
|
+
protected _destructor(): void;
|
|
167
|
+
constructor();
|
|
168
|
+
constructor(wif: string, version: number);
|
|
169
|
+
constructor(wif: WifCompressedNative, version: number);
|
|
170
|
+
constructor(wif: WifUncompressedNative, version: number);
|
|
171
|
+
constructor(secret: EcSecretNative, version: number, compress: boolean);
|
|
172
|
+
isValid(): boolean;
|
|
173
|
+
encoded(): string;
|
|
174
|
+
secret(): EcSecretNative;
|
|
175
|
+
version(): number;
|
|
176
|
+
paymentVersion(): number;
|
|
177
|
+
wifVersion(): number;
|
|
178
|
+
compressed(): boolean;
|
|
179
|
+
toPublic(): EcPublicNative;
|
|
180
|
+
toPaymentAddress(): PaymentAddressNative;
|
|
181
|
+
}
|
|
182
|
+
export declare class EcPublicNative {
|
|
183
|
+
private readonly [ptrSym];
|
|
184
|
+
static _create(ptr: number): EcPublicNative;
|
|
185
|
+
protected _destructor(): void;
|
|
186
|
+
constructor();
|
|
187
|
+
constructor(base16: string);
|
|
188
|
+
constructor(secret: EcPrivateNative);
|
|
189
|
+
constructor(point: EcCompressedNative, compress: boolean);
|
|
190
|
+
isValid(): boolean;
|
|
191
|
+
encoded(): string;
|
|
192
|
+
point(): EcCompressedNative;
|
|
193
|
+
compressed(): boolean;
|
|
194
|
+
toUncompressed(outData: EcUncompressedNative): boolean;
|
|
195
|
+
toPaymentAddress(version: number): PaymentAddressNative;
|
|
196
|
+
}
|
|
197
|
+
export declare class WalletNative {
|
|
198
|
+
static mnemonicsToSeed(mnemonics: StringListNative): LongHashNative;
|
|
199
|
+
static hdNew(seed: LongHashNative, version: number): HdPrivateNative;
|
|
200
|
+
static hdPrivateToEc(key: HdPrivateNative): EcSecretNative;
|
|
201
|
+
static ecToPublic(secret: EcSecretNative, uncompressed: boolean): EcPublicNative;
|
|
202
|
+
static ecToAddress(point: EcPublicNative, version: number): PaymentAddressNative;
|
|
203
|
+
}
|
|
204
|
+
export declare class NodeInfoNative {
|
|
205
|
+
static printThreadId(): void;
|
|
206
|
+
static getThreadId(): bigint;
|
|
207
|
+
static capiVersion(): string;
|
|
208
|
+
static cppapiVersion(): string;
|
|
209
|
+
static microarchitecture(): string;
|
|
210
|
+
static marchNames(): string;
|
|
211
|
+
static currencySymbol(): string;
|
|
212
|
+
static currency(): string;
|
|
213
|
+
static cppapiBuildTimestamp(): number;
|
|
214
|
+
}
|
|
215
|
+
export declare class ScriptNative {
|
|
216
|
+
private readonly [ptrSym];
|
|
217
|
+
static _create(ptr: number): ScriptNative;
|
|
218
|
+
protected _destructor(): void;
|
|
219
|
+
constructor();
|
|
220
|
+
constructor(encoded: Uint8Array, prefix: boolean);
|
|
221
|
+
isValid(): boolean;
|
|
222
|
+
isValidOperations(): boolean;
|
|
223
|
+
satoshiContentSize(): number;
|
|
224
|
+
serializedSize(prefix: boolean): number;
|
|
225
|
+
toStr(activeForks: number): string;
|
|
226
|
+
type(): string;
|
|
227
|
+
toData(prefix: boolean): Uint8Array;
|
|
228
|
+
sigops(embedded: boolean): number;
|
|
229
|
+
}
|
|
230
|
+
export {};
|