@knuth/js-wasm 2.4.0 → 2.7.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.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/src/kth.js +1 -1
  3. package/src/kth.wasm +0 -0
  4. package/types/Bitcoin.d.ts +2 -0
  5. package/types/DoubleList.d.ts +6 -0
  6. package/types/EcCompressed.d.ts +7 -0
  7. package/types/EcPublic.d.ts +13 -0
  8. package/types/Hash.d.ts +32 -0
  9. package/types/HdPublic.d.ts +13 -0
  10. package/types/Input.d.ts +17 -0
  11. package/types/InputList.d.ts +7 -0
  12. package/types/Interpreter.d.ts +17 -0
  13. package/types/Kth.d.ts +0 -1
  14. package/types/ListHelper.d.ts +5 -0
  15. package/types/ListNative.d.ts +5 -0
  16. package/types/Operation.d.ts +4 -4
  17. package/types/Output.d.ts +18 -0
  18. package/types/OutputList.d.ts +7 -0
  19. package/types/OutputPoint.d.ts +14 -0
  20. package/types/PaymentAddress.d.ts +16 -1
  21. package/types/PaymentAddressList.d.ts +7 -0
  22. package/types/Program.d.ts +15 -0
  23. package/types/RuleFork.d.ts +35 -2
  24. package/types/Script.d.ts +19 -4
  25. package/types/Secret.d.ts +4 -0
  26. package/types/SecretFunctions.d.ts +8 -0
  27. package/types/SighashAlgorithm.d.ts +19 -0
  28. package/types/StringList.d.ts +6 -0
  29. package/types/TokenData.d.ts +18 -0
  30. package/types/TokenDataBothKinds.d.ts +9 -0
  31. package/types/TokenDataFungible.d.ts +5 -0
  32. package/types/TokenDataNonFungible.d.ts +7 -0
  33. package/types/Transaction.d.ts +30 -0
  34. package/types/U32List.d.ts +6 -0
  35. package/types/U64List.d.ts +6 -0
  36. package/types/Utxo.d.ts +17 -0
  37. package/types/UtxoList.d.ts +7 -0
  38. package/types/Wallet.d.ts +19 -6
  39. package/types/WalletData.d.ts +11 -0
  40. package/types/WalletManager.d.ts +8 -0
  41. package/types/encoding.d.ts +3 -0
  42. package/types/main.d.ts +42 -4
  43. package/types/wasm/glue.d.ts +270 -13
  44. package/types/wasm/glue_manual.d.ts +5 -0
  45. package/types/wasm/manualGeneratedTypes.d.ts +5 -0
@@ -1,2 +1,5 @@
1
+ import { Hash } from './Hash';
1
2
  export declare function bytesToHexStr(bytes: Uint8Array): string;
2
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,29 +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';
3
- import Wallet from './Wallet';
4
15
  import Script from './Script';
5
- import Opcode from './Opcode';
16
+ import Transaction from './Transaction';
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';
6
22
  import { OpcodeEnumNative, OpcodeEnumNativeToInt } from './wasm/glue';
23
+ import { ScriptNative } from './wasm/glue';
7
24
  import Operation from './Operation';
25
+ import OperationList from './OperationList';
8
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';
9
31
  import { RuleForkEnumNative, RuleForkEnumNativeToInt } from './wasm/glue_manual';
10
- import { bytesToHexStr, hexStrToBytes } from './encoding';
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';
11
36
  import loadLib from './wasm/loadLib';
12
37
  import { free, malloc } from './wasm/mem';
13
- export { loadLib, Kth, PaymentAddress, Wallet, Script, Opcode, OpcodeEnumNative, OpcodeEnumNativeToInt, Operation, RuleFork, RuleForkEnumNative, RuleForkEnumNativeToInt, bytesToHexStr, hexStrToBytes, 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 };
14
39
  declare const _default: {
15
40
  loadLib: typeof loadLib;
16
41
  Kth: typeof Kth;
17
42
  PaymentAddress: typeof PaymentAddress;
18
43
  Wallet: typeof Wallet;
19
44
  Script: typeof Script;
45
+ HdPublic: typeof HdPublic;
46
+ EcPublic: typeof EcPublic;
47
+ SecretFunctions: typeof SecretFunctions;
20
48
  Opcode: typeof Opcode;
21
49
  OpcodeEnumNativeToInt: typeof OpcodeEnumNativeToInt;
22
50
  Operation: typeof Operation;
23
51
  RuleFork: typeof RuleFork;
24
52
  RuleForkEnumNativeToInt: typeof RuleForkEnumNativeToInt;
53
+ SighashAlgorithm: typeof SighashAlgorithm;
54
+ Utxo: typeof Utxo;
55
+ UtxoList: typeof UtxoList;
25
56
  bytesToHexStr: typeof bytesToHexStr;
26
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;
27
65
  free: typeof free;
28
66
  malloc: typeof malloc;
29
67
  };
@@ -17,7 +17,6 @@ export declare class LibConfig {
17
17
  private readonly [ptrSym];
18
18
  static _create(ptr: number): LibConfig;
19
19
  get log_library(): LogLibrary;
20
- get use_libmdbx(): boolean;
21
20
  get version(): string;
22
21
  get microarchitecture_id(): string;
23
22
  get currency(): Currency;
@@ -46,24 +45,69 @@ export declare class StringListNative {
46
45
  protected _destructor(): void;
47
46
  constructor();
48
47
  pushBack(string: string): void;
48
+ count(): number;
49
+ nth(index: number): string;
49
50
  }
50
51
  export declare class ShortHashNative {
51
52
  private readonly [ptrSym];
52
53
  static _create(ptr: number): ShortHashNative;
53
54
  get hash(): number;
54
55
  protected _destructor(): void;
56
+ set(data: number): void;
55
57
  }
56
58
  export declare class HashNative {
57
59
  private readonly [ptrSym];
58
60
  static _create(ptr: number): HashNative;
59
61
  get hash(): number;
60
62
  protected _destructor(): void;
63
+ constructor();
64
+ set(data: number): void;
61
65
  }
62
66
  export declare class LongHashNative {
63
67
  private readonly [ptrSym];
64
68
  static _create(ptr: number): LongHashNative;
65
69
  get hash(): number;
66
70
  protected _destructor(): void;
71
+ set(data: number): void;
72
+ }
73
+ export declare class EncryptedSeedNative {
74
+ private readonly [ptrSym];
75
+ static _create(ptr: number): EncryptedSeedNative;
76
+ get hash(): number;
77
+ protected _destructor(): void;
78
+ set(data: number): void;
79
+ }
80
+ export declare class HashFunctionsNative {
81
+ static sha256(encoded: Uint8Array): HashNative;
82
+ static sha256Reversed(encoded: Uint8Array): HashNative;
83
+ static sha256ReversedStr(encoded: Uint8Array): string;
84
+ }
85
+ export declare class DoubleListNative {
86
+ private readonly [ptrSym];
87
+ static _create(ptr: number): DoubleListNative;
88
+ protected _destructor(): void;
89
+ constructor();
90
+ pushBack(x: number): void;
91
+ count(): number;
92
+ nth(index: number): number;
93
+ }
94
+ export declare class U32ListNative {
95
+ private readonly [ptrSym];
96
+ static _create(ptr: number): U32ListNative;
97
+ protected _destructor(): void;
98
+ constructor();
99
+ pushBack(x: number): void;
100
+ count(): number;
101
+ nth(index: number): number;
102
+ }
103
+ export declare class U64ListNative {
104
+ private readonly [ptrSym];
105
+ static _create(ptr: number): U64ListNative;
106
+ protected _destructor(): void;
107
+ constructor();
108
+ pushBack(x: bigint): void;
109
+ count(): number;
110
+ nth(index: number): bigint;
67
111
  }
68
112
  export declare class HdChainCodeNative {
69
113
  private readonly [ptrSym];
@@ -94,6 +138,8 @@ export declare class EcSecretNative {
94
138
  static _create(ptr: number): EcSecretNative;
95
139
  get hash(): number;
96
140
  protected _destructor(): void;
141
+ constructor();
142
+ set(data: number): void;
97
143
  }
98
144
  export declare class WifUncompressedNative {
99
145
  private readonly [ptrSym];
@@ -124,6 +170,7 @@ export declare class HdPublicNative {
124
170
  static _create(ptr: number): HdPublicNative;
125
171
  protected _destructor(): void;
126
172
  constructor();
173
+ constructor(encoded: string);
127
174
  isValid(): boolean;
128
175
  encoded(): string;
129
176
  chainCode(): HdChainCodeNative;
@@ -150,18 +197,33 @@ export declare class HdPrivateNative {
150
197
  derivePrivate(index: number): HdPrivateNative;
151
198
  derivePublic(index: number): HdPublicNative;
152
199
  }
200
+ export declare class PaymentAddressListNative {
201
+ private readonly [ptrSym];
202
+ static _create(ptr: number): PaymentAddressListNative;
203
+ protected _destructor(): void;
204
+ constructor();
205
+ pushBack(utxo: PaymentAddressNative): void;
206
+ count(): number;
207
+ nth(index: number): PaymentAddressNative;
208
+ }
153
209
  export declare class PaymentAddressNative {
154
210
  private readonly [ptrSym];
155
211
  static _create(ptr: number): PaymentAddressNative;
156
212
  protected _destructor(): void;
157
213
  constructor(address: string);
158
- constructor(hash: ShortHashNative, version: number);
214
+ static fromShortHash(hash: ShortHashNative, version: number): PaymentAddressNative;
215
+ static fromHash(hash: HashNative, version: number): PaymentAddressNative;
216
+ static fromScript(script: ScriptNative, version: number): PaymentAddressNative;
217
+ static fromPayPublicKeyHashScript(script: ScriptNative, version: number): PaymentAddressNative;
159
218
  encodedLegacy(): string;
160
- encodedCashaddr(tokenAware: boolean): string;
219
+ encodedCashAddr(tokenAware: boolean): string;
161
220
  hash20(): ShortHashNative;
162
221
  hash32(): HashNative;
163
222
  version(): number;
164
223
  isValid(): boolean;
224
+ static extract(script: ScriptNative, p2khVersion: number, p2shVersion: number): PaymentAddressListNative;
225
+ static extractInput(script: ScriptNative, p2khVersion: number, p2shVersion: number): PaymentAddressListNative;
226
+ static extractOutput(script: ScriptNative, p2khVersion: number, p2shVersion: number): PaymentAddressListNative;
165
227
  }
166
228
  export declare class EcPrivateNative {
167
229
  private readonly [ptrSym];
@@ -194,6 +256,7 @@ export declare class EcPublicNative {
194
256
  encoded(): string;
195
257
  point(): EcCompressedNative;
196
258
  compressed(): boolean;
259
+ toData(): Uint8Array;
197
260
  toUncompressed(outData: EcUncompressedNative): boolean;
198
261
  toPaymentAddress(version: number): PaymentAddressNative;
199
262
  }
@@ -204,6 +267,18 @@ export declare class WalletNative {
204
267
  static ecToPublic(secret: EcSecretNative, uncompressed: boolean): EcPublicNative;
205
268
  static ecToAddress(point: EcPublicNative, version: number): PaymentAddressNative;
206
269
  }
270
+ export declare class WalletDataNative {
271
+ private readonly [ptrSym];
272
+ static _create(ptr: number): WalletDataNative;
273
+ protected _destructor(): void;
274
+ mnemonics(): StringListNative;
275
+ encryptedSeed(): EncryptedSeedNative;
276
+ xpub(): HdPublicNative;
277
+ }
278
+ export declare class WalletManagerNative {
279
+ static createWallet(password: string, normalizedPassphrase: string): [number, WalletDataNative];
280
+ static decryptSeed(password: string, encryptedSeed: EncryptedSeedNative): [number, LongHashNative];
281
+ }
207
282
  export declare class NodeInfoNative {
208
283
  static printThreadId(): void;
209
284
  static getThreadId(): bigint;
@@ -215,9 +290,6 @@ export declare class NodeInfoNative {
215
290
  static currency(): string;
216
291
  static cppapiBuildTimestamp(): number;
217
292
  }
218
- declare const _OpcodeEnumNativeIntToKey: readonly ["push_size_0", "push_size_1", "push_size_2", "push_size_3", "push_size_4", "push_size_5", "push_size_6", "push_size_7", "push_size_8", "push_size_9", "push_size_10", "push_size_11", "push_size_12", "push_size_13", "push_size_14", "push_size_15", "push_size_16", "push_size_17", "push_size_18", "push_size_19", "push_size_20", "push_size_21", "push_size_22", "push_size_23", "push_size_24", "push_size_25", "push_size_26", "push_size_27", "push_size_28", "push_size_29", "push_size_30", "push_size_31", "push_size_32", "push_size_33", "push_size_34", "push_size_35", "push_size_36", "push_size_37", "push_size_38", "push_size_39", "push_size_40", "push_size_41", "push_size_42", "push_size_43", "push_size_44", "push_size_45", "push_size_46", "push_size_47", "push_size_48", "push_size_49", "push_size_50", "push_size_51", "push_size_52", "push_size_53", "push_size_54", "push_size_55", "push_size_56", "push_size_57", "push_size_58", "push_size_59", "push_size_60", "push_size_61", "push_size_62", "push_size_63", "push_size_64", "push_size_65", "push_size_66", "push_size_67", "push_size_68", "push_size_69", "push_size_70", "push_size_71", "push_size_72", "push_size_73", "push_size_74", "push_size_75", "push_one_size", "push_two_size", "push_four_size", "push_negative_1", "reserved_80", "push_positive_1", "push_positive_2", "push_positive_3", "push_positive_4", "push_positive_5", "push_positive_6", "push_positive_7", "push_positive_8", "push_positive_9", "push_positive_10", "push_positive_11", "push_positive_12", "push_positive_13", "push_positive_14", "push_positive_15", "push_positive_16", "nop", "reserved_98", "if_", "notif", "disabled_verif", "disabled_vernotif", "else_", "endif", "verify", "return_", "toaltstack", "fromaltstack", "drop2", "dup2", "dup3", "over2", "rot2", "swap2", "ifdup", "depth", "drop", "dup", "nip", "over", "pick", "roll", "rot", "swap", "tuck", "disabled_cat", "disabled_substr", "disabled_left", "disabled_right", "size", "disabled_invert", "disabled_and", "disabled_or", "disabled_xor", "equal", "equalverify", "reserved_137", "reserved_138", "add1", "sub1", "disabled_mul2", "disabled_div2", "negate", "abs", "not_", "nonzero", "add", "sub", "disabled_mul", "disabled_div", "disabled_mod", "disabled_lshift", "disabled_rshift", "booland", "boolor", "numequal", "numequalverify", "numnotequal", "lessthan", "greaterthan", "lessthanorequal", "greaterthanorequal", "min", "max", "within", "ripemd160", "sha1", "sha256", "hash160", "hash256", "codeseparator", "checksig", "checksigverify", "checkmultisig", "checkmultisigverify", "nop1", "nop2", "checklocktimeverify", "nop3", "checksequenceverify", "nop4", "nop5", "nop6", "nop7", "nop8", "nop9", "nop10", "checkdatasig", "checkdatasigverify", "reversebytes", "inputindex", "activebytecode", "txversion", "txinputcount", "txoutputcount", "txlocktime", "utxovalue", "utxobytecode", "outpointtxhash", "outpointindex", "inputbytecode", "inputsequencenumber", "outputvalue", "outputbytecode", "utxotokencategory", "utxotokencommitment", "utxotokenamount", "outputtokencategory", "outputtokencommitment", "outputtokenamount", "reserved3", "reserved4", "first_undefined_op_value", "special_token_prefix", "invalidopcode", "reserved_186", "reserved_187", "reserved_188", "reserved_189", "reserved_190", "reserved_191", "reserved_192", "reserved_193", "reserved_194", "reserved_195", "reserved_196", "reserved_197", "reserved_198", "reserved_199", "reserved_200", "reserved_201", "reserved_202", "reserved_203", "reserved_204", "reserved_205", "reserved_206", "reserved_207", "reserved_208", "reserved_209", "reserved_210", "reserved_211", "reserved_212", "reserved_213", "reserved_214", "reserved_215", "reserved_216", "reserved_217", "reserved_218", "reserved_219", "reserved_220", "reserved_221", "reserved_222", "reserved_223", "reserved_224", "reserved_225", "reserved_226", "reserved_227", "reserved_228", "reserved_229", "reserved_230", "reserved_231", "reserved_232", "reserved_233", "reserved_234", "reserved_235", "reserved_236", "reserved_237", "reserved_238", "reserved_239", "reserved_240", "reserved_241", "reserved_242", "reserved_243", "reserved_244", "reserved_245", "reserved_246", "reserved_247", "reserved_248", "reserved_249", "reserved_250", "reserved_251", "reserved_252", "reserved_253", "reserved_254", "reserved_255"];
219
- export declare type OpcodeEnumNative = (typeof _OpcodeEnumNativeIntToKey)[number];
220
- export declare function OpcodeEnumNativeToInt(value: OpcodeEnumNative): number;
221
293
  export declare class OpcodeNative {
222
294
  static to_string(value: OpcodeEnumNative, active_forks: number): string;
223
295
  static from_string(value: string): [boolean, OpcodeEnumNative];
@@ -243,10 +315,10 @@ export declare class OperationNative {
243
315
  isCounted(): boolean;
244
316
  isVersion(): boolean;
245
317
  isPositive(): boolean;
246
- isDisabled(): boolean;
318
+ isDisabled(activeForks: number): boolean;
247
319
  isConditional(): boolean;
248
320
  isRelaxedPush(): boolean;
249
- isOversized(): boolean;
321
+ isOversized(maxSize: number): boolean;
250
322
  isMinimalPush(): boolean;
251
323
  isNominalPush(): boolean;
252
324
  static opcodeFromSize(size: number): OpcodeEnumNative;
@@ -261,7 +333,7 @@ export declare class OperationNative {
261
333
  static opcodeIsNumeric(code: OpcodeEnumNative): boolean;
262
334
  static opcodeIsPositive(code: OpcodeEnumNative): boolean;
263
335
  static opcodeIsReserved(code: OpcodeEnumNative): boolean;
264
- static opcodeIsDisabled(code: OpcodeEnumNative): boolean;
336
+ static opcodeIsDisabled(code: OpcodeEnumNative, activeForks: number): boolean;
265
337
  static opcodeIsConditional(code: OpcodeEnumNative): boolean;
266
338
  static opcodeIsRelaxedPush(code: OpcodeEnumNative): boolean;
267
339
  }
@@ -274,6 +346,12 @@ export declare class OperationListNative {
274
346
  count(): number;
275
347
  nth(index: number): OperationNative;
276
348
  }
349
+ declare const _ScriptPatternIntToKey: readonly ["null_data", "pay_multisig", "pay_public_key", "pay_public_key_hash", "pay_script_hash", "sign_multisig", "sign_public_key", "sign_public_key_hash", "sign_script_hash", "witness_reservation", "non_standard"];
350
+ export declare type ScriptPattern = (typeof _ScriptPatternIntToKey)[number];
351
+ export declare function ScriptPatternToInt(value: ScriptPattern): number;
352
+ declare const _EndorsementTypeIntToKey: readonly ["ecdsa", "schnorr"];
353
+ export declare type EndorsementType = (typeof _EndorsementTypeIntToKey)[number];
354
+ export declare function EndorsementTypeToInt(value: EndorsementType): number;
277
355
  export declare class ScriptNative {
278
356
  private readonly [ptrSym];
279
357
  static _create(ptr: number): ScriptNative;
@@ -289,7 +367,6 @@ export declare class ScriptNative {
289
367
  toStr(activeForks: number): string;
290
368
  type(): string;
291
369
  toData(prefix: boolean): Uint8Array;
292
- sigops(embedded: boolean): number;
293
370
  operations(): OperationListNative;
294
371
  toBytes(): Uint8Array;
295
372
  static isPushOnly(ops: OperationListNative): boolean;
@@ -298,15 +375,195 @@ export declare class ScriptNative {
298
375
  static isNullDataPattern(ops: OperationListNative): boolean;
299
376
  static isPayMultisigPattern(ops: OperationListNative): boolean;
300
377
  static isPayPublicKeyPattern(ops: OperationListNative): boolean;
301
- static isPayKeyHashPattern(ops: OperationListNative): boolean;
378
+ static isPayPublicKeyHashPattern(ops: OperationListNative): boolean;
302
379
  static isPayScriptHashPattern(ops: OperationListNative): boolean;
303
380
  static isSignMultisigPattern(ops: OperationListNative): boolean;
304
381
  static isSignPublicKeyPattern(ops: OperationListNative): boolean;
305
- static isSignKeyHashPattern(ops: OperationListNative): boolean;
382
+ static isSignPublicKeyHashPattern(ops: OperationListNative): boolean;
306
383
  static isSignScriptHashPattern(ops: OperationListNative): boolean;
307
384
  static toNullDataPattern(data: Uint8Array): OperationListNative;
308
385
  static toPayPublicKeyPattern(point: Uint8Array): OperationListNative;
309
- static toPayKeyHashPattern(hash: ShortHashNative): OperationListNative;
386
+ static toPayPublicKeyHashPattern(hash: ShortHashNative): OperationListNative;
310
387
  static toPayScriptHashPattern(hash: ShortHashNative): OperationListNative;
388
+ pattern(): ScriptPattern;
389
+ outputPattern(): ScriptPattern;
390
+ inputPattern(): ScriptPattern;
391
+ sigops(accurate: boolean): number;
392
+ isUnspendable(): boolean;
393
+ reset(): void;
394
+ static createEndorsement(secret: EcSecretNative, prevoutScript: ScriptNative, tx: TransactionNative, inputIndex: number, sighashType: number, activeForks: number, value: bigint, endorsementType: EndorsementType): Uint8Array;
395
+ static verify(tx: TransactionNative, input: number, forks: number, inputScript: ScriptNative, prevoutScript: ScriptNative, value: bigint): number;
396
+ static verifyTransaction(tx: TransactionNative, input: number, forks: number): number;
397
+ }
398
+ export declare class OutputPointNative {
399
+ private readonly [ptrSym];
400
+ static _create(ptr: number): OutputPointNative;
401
+ protected _destructor(): void;
402
+ constructor();
403
+ constructor(hash: HashNative, index: number);
404
+ hash(): HashNative;
405
+ index(): number;
406
+ cachedOutput(): OutputNative;
407
+ setHash(hash: HashNative): void;
408
+ setIndex(index: number): void;
409
+ setCachedOutput(output: OutputNative): void;
311
410
  }
411
+ declare const _TokenKindIntToKey: readonly ["none", "fungible", "non_fungible", "both"];
412
+ export declare type TokenKind = (typeof _TokenKindIntToKey)[number];
413
+ export declare function TokenKindToInt(value: TokenKind): number;
414
+ declare const _TokenCapabilityIntToKey: readonly ["none", "mutable", "minting"];
415
+ export declare type TokenCapability = (typeof _TokenCapabilityIntToKey)[number];
416
+ export declare function TokenCapabilityToInt(value: TokenCapability): number;
417
+ export declare class TokenDataNative {
418
+ private readonly [ptrSym];
419
+ static _create(ptr: number): TokenDataNative;
420
+ protected _destructor(): void;
421
+ static constructFungible(category: HashNative, amount: bigint): TokenDataNative;
422
+ static constructNonFungible(category: HashNative, capability: TokenCapability, commitmentData: Uint8Array): TokenDataNative;
423
+ static constructBothKinds(category: HashNative, amount: bigint, capability: TokenCapability, commitmentData: Uint8Array): TokenDataNative;
424
+ isValid(): boolean;
425
+ serializedSize(): number;
426
+ toData(): Uint8Array;
427
+ kind(): TokenKind;
428
+ category(): HashNative;
429
+ fungibleAmount(): bigint;
430
+ nonFungibleCapability(): TokenCapability;
431
+ nonFungibleCommitment(): Uint8Array;
432
+ }
433
+ export declare class UtxoNative {
434
+ private readonly [ptrSym];
435
+ static _create(ptr: number): UtxoNative;
436
+ protected _destructor(): void;
437
+ constructor();
438
+ static fromPointAmount(hash: HashNative, index: number, amount: bigint): UtxoNative;
439
+ static fromPointAmountFungible(hash: HashNative, index: number, amount: bigint, category: HashNative, tokenAmount: bigint): UtxoNative;
440
+ static fromPointAmountNonFungible(hash: HashNative, index: number, amount: bigint, category: HashNative, capability: TokenCapability, commitmentData: Uint8Array): UtxoNative;
441
+ static fromPointAmountBothKinds(hash: HashNative, index: number, amount: bigint, category: HashNative, tokenAmount: bigint, capability: TokenCapability, commitmentData: Uint8Array): UtxoNative;
442
+ hash(): HashNative;
443
+ index(): number;
444
+ amount(): bigint;
445
+ cachedOutput(): OutputNative;
446
+ hasTokenData(): boolean;
447
+ tokenData(): TokenDataNative;
448
+ tokenCategory(): HashNative;
449
+ tokenAmount(): bigint;
450
+ setHash(hash: HashNative): void;
451
+ setIndex(index: number): void;
452
+ setAmount(amount: bigint): void;
453
+ setCachedOutput(output: OutputNative): void;
454
+ setTokenData(token_data: TokenDataNative): void;
455
+ setTokenCategory(category: HashNative): void;
456
+ setTokenAmount(amount: bigint): void;
457
+ }
458
+ export declare class OutputNative {
459
+ private readonly [ptrSym];
460
+ static _create(ptr: number): OutputNative;
461
+ protected _destructor(): void;
462
+ constructor();
463
+ constructor(value: bigint, script: ScriptNative);
464
+ constructor(value: bigint, script: ScriptNative, tokenData: TokenDataNative);
465
+ static fromData(data: Uint8Array): OutputNative;
466
+ toData(wire: boolean): Uint8Array;
467
+ serializedSize(wire: boolean): number;
468
+ isValid(): boolean;
469
+ value(): bigint;
470
+ script(): ScriptNative;
471
+ hasTokenData(): boolean;
472
+ tokenData(): TokenDataNative;
473
+ }
474
+ export declare class InputNative {
475
+ private readonly [ptrSym];
476
+ static _create(ptr: number): InputNative;
477
+ protected _destructor(): void;
478
+ constructor();
479
+ constructor(previousOutput: OutputPointNative, script: ScriptNative, seq: number);
480
+ static fromData(data: Uint8Array): InputNative;
481
+ toData(wire: boolean): Uint8Array;
482
+ serializedSize(wire: boolean): number;
483
+ isValid(): boolean;
484
+ seq(): number;
485
+ script(): ScriptNative;
486
+ previousOutput(): OutputPointNative;
487
+ }
488
+ export declare class OutputListNative {
489
+ private readonly [ptrSym];
490
+ static _create(ptr: number): OutputListNative;
491
+ protected _destructor(): void;
492
+ constructor();
493
+ pushBack(output: OutputNative): void;
494
+ count(): number;
495
+ nth(index: number): OutputNative;
496
+ }
497
+ export declare class InputListNative {
498
+ private readonly [ptrSym];
499
+ static _create(ptr: number): InputListNative;
500
+ protected _destructor(): void;
501
+ constructor();
502
+ pushBack(input: InputNative): void;
503
+ count(): number;
504
+ nth(index: number): InputNative;
505
+ }
506
+ export declare class UtxoListNative {
507
+ private readonly [ptrSym];
508
+ static _create(ptr: number): UtxoListNative;
509
+ protected _destructor(): void;
510
+ constructor();
511
+ pushBack(utxo: UtxoNative): void;
512
+ count(): number;
513
+ nth(index: number): UtxoNative;
514
+ }
515
+ declare const _CoinSelectionAlgorithmIntToKey: readonly ["smallest_first", "largest_first", "manual", "send_all"];
516
+ export declare type CoinSelectionAlgorithm = (typeof _CoinSelectionAlgorithmIntToKey)[number];
517
+ export declare function CoinSelectionAlgorithmToInt(value: CoinSelectionAlgorithm): number;
518
+ export declare class TransactionNative {
519
+ private readonly [ptrSym];
520
+ static _create(ptr: number): TransactionNative;
521
+ protected _destructor(): void;
522
+ constructor();
523
+ constructor(version: number, locktime: number, inputs: InputListNative, outputs: OutputListNative);
524
+ static fromData(data: Uint8Array): TransactionNative;
525
+ toData(wire: boolean): Uint8Array;
526
+ serializedSize(wire: boolean): number;
527
+ isValid(): boolean;
528
+ hash(): HashNative;
529
+ version(): number;
530
+ locktime(): number;
531
+ outputs(): OutputListNative;
532
+ inputs(): InputListNative;
533
+ isCoinbase(): boolean;
534
+ totalInputValue(): bigint;
535
+ totalOutputValue(): bigint;
536
+ fees(): bigint;
537
+ isMature(target_height: number): boolean;
538
+ static createTemplateWithChangeRatios(available_utxos: UtxoListNative, amount_to_send: bigint, destination_address: PaymentAddressNative, change_addresses: PaymentAddressListNative, change_ratios: DoubleListNative, selection_algo: CoinSelectionAlgorithm): [number, TransactionNative, U32ListNative, PaymentAddressListNative, U64ListNative];
539
+ static createTemplate(available_utxos: UtxoListNative, amount_to_send: bigint, destination_address: PaymentAddressNative, change_addresses: PaymentAddressListNative, selection_algo: CoinSelectionAlgorithm): [number, TransactionNative, U32ListNative, PaymentAddressListNative, U64ListNative];
540
+ }
541
+ export declare class InterpreterNative {
542
+ static run(program: ProgramNative): number;
543
+ static runOperation(operation: OperationNative, program: ProgramNative): number;
544
+ static debugStart(program: ProgramNative): [number, number];
545
+ static debugStepsAvailable(program: ProgramNative, step: number): boolean;
546
+ static debugStep(program: ProgramNative, step: number): [number, number, ProgramNative];
547
+ static debugEnd(program: ProgramNative): number;
548
+ }
549
+ export declare class ProgramNative {
550
+ private readonly [ptrSym];
551
+ static _create(ptr: number): ProgramNative;
552
+ protected _destructor(): void;
553
+ constructor();
554
+ constructor(script: ScriptNative);
555
+ constructor(script: ScriptNative, program: ProgramNative);
556
+ constructor(script: ScriptNative, transaction: TransactionNative, inputIndex: number, forks: number);
557
+ isValid(): boolean;
558
+ evaluate(): number;
559
+ stackResult(clean: boolean): boolean;
560
+ size(): number;
561
+ item(index: number): Uint8Array;
562
+ }
563
+ declare const _RuleForkEnumNativeIntToKey: readonly ["no_rules", "easy_blocks", "bip16_rule", "bip30_rule", "bip34_rule", "bip66_rule", "bip65_rule", "bip90_rule", "allow_collisions", "bip68_rule", "bip112_rule", "bip113_rule", "bch_uahf", "bch_daa_cw144", "bch_pythagoras", "bch_euclid", "bch_pisano", "bch_mersenne", "bch_fermat", "bch_euler", "bch_gauss", "bch_descartes", "bch_lobachevski", "bch_galois", "bch_leibniz", "retarget", "unverified", "bip34_activations", "bip9_bit0_group", "bip9_bit1_group", "all_rules"];
564
+ export declare type RuleForkEnumNative = (typeof _RuleForkEnumNativeIntToKey)[number];
565
+ export declare function RuleForkEnumNativeToInt(value: RuleForkEnumNative): number;
566
+ declare const _OpcodeEnumNativeIntToKey: readonly ["push_size_0", "push_size_1", "push_size_2", "push_size_3", "push_size_4", "push_size_5", "push_size_6", "push_size_7", "push_size_8", "push_size_9", "push_size_10", "push_size_11", "push_size_12", "push_size_13", "push_size_14", "push_size_15", "push_size_16", "push_size_17", "push_size_18", "push_size_19", "push_size_20", "push_size_21", "push_size_22", "push_size_23", "push_size_24", "push_size_25", "push_size_26", "push_size_27", "push_size_28", "push_size_29", "push_size_30", "push_size_31", "push_size_32", "push_size_33", "push_size_34", "push_size_35", "push_size_36", "push_size_37", "push_size_38", "push_size_39", "push_size_40", "push_size_41", "push_size_42", "push_size_43", "push_size_44", "push_size_45", "push_size_46", "push_size_47", "push_size_48", "push_size_49", "push_size_50", "push_size_51", "push_size_52", "push_size_53", "push_size_54", "push_size_55", "push_size_56", "push_size_57", "push_size_58", "push_size_59", "push_size_60", "push_size_61", "push_size_62", "push_size_63", "push_size_64", "push_size_65", "push_size_66", "push_size_67", "push_size_68", "push_size_69", "push_size_70", "push_size_71", "push_size_72", "push_size_73", "push_size_74", "push_size_75", "push_one_size", "push_two_size", "push_four_size", "push_negative_1", "reserved_80", "push_positive_1", "push_positive_2", "push_positive_3", "push_positive_4", "push_positive_5", "push_positive_6", "push_positive_7", "push_positive_8", "push_positive_9", "push_positive_10", "push_positive_11", "push_positive_12", "push_positive_13", "push_positive_14", "push_positive_15", "push_positive_16", "nop", "reserved_98", "if", "notif", "disabled_verif", "disabled_vernotif", "else", "endif", "verify", "return", "toaltstack", "fromaltstack", "drop2", "dup2", "dup3", "over2", "rot2", "swap2", "ifdup", "depth", "drop", "dup", "nip", "over", "pick", "roll", "rot", "swap", "tuck", "cat", "split", "num2bin", "bin2num", "size", "disabled_invert", "and", "or", "xor", "equal", "equalverify", "reserved_137", "reserved_138", "add1", "sub1", "disabled_mul2", "disabled_div2", "negate", "abs", "not", "nonzero", "add", "sub", "mul", "div", "mod", "disabled_lshift", "disabled_rshift", "booland", "boolor", "numequal", "numequalverify", "numnotequal", "lessthan", "greaterthan", "lessthanorequal", "greaterthanorequal", "min", "max", "within", "ripemd160", "sha1", "sha256", "hash160", "hash256", "codeseparator", "checksig", "checksigverify", "checkmultisig", "checkmultisigverify", "nop1", "nop2", "checklocktimeverify", "nop3", "checksequenceverify", "nop4", "nop5", "nop6", "nop7", "nop8", "nop9", "nop10", "checkdatasig", "checkdatasigverify", "reverse_bytes", "available1", "available2", "available3", "input_index", "active_bytecode", "tx_version", "tx_input_count", "tx_output_count", "tx_locktime", "utxo_value", "utxo_bytecode", "outpoint_tx_hash", "outpoint_index", "input_bytecode", "input_sequence_number", "output_value", "output_bytecode", "utxo_token_category", "utxo_token_commitment", "utxo_token_amount", "output_token_category", "output_token_commitment", "output_token_amount", "reserved_212", "reserved_213", "reserved_214", "first_undefined_op_value", "reserved_215", "reserved_216", "reserved_217", "reserved_218", "reserved_219", "reserved_220", "reserved_221", "reserved_222", "reserved_223", "reserved_224", "reserved_225", "reserved_226", "reserved_227", "reserved_228", "reserved_229", "reserved_230", "reserved_231", "reserved_232", "reserved_233", "reserved_234", "reserved_235", "reserved_236", "reserved_237", "reserved_238", "reserved_239", "special_token_prefix", "reserved_240", "reserved_241", "reserved_242", "reserved_243", "reserved_244", "reserved_245", "reserved_246", "reserved_247", "reserved_248", "reserved_249", "reserved_250", "reserved_251", "reserved_252", "reserved_253", "reserved_254", "reserved_255", "invalidopcode"];
567
+ export declare type OpcodeEnumNative = (typeof _OpcodeEnumNativeIntToKey)[number];
568
+ export declare function OpcodeEnumNativeToInt(value: OpcodeEnumNative): number;
312
569
  export {};
@@ -31,7 +31,12 @@ declare const _RuleForkEnumNativeKeyToInt: {
31
31
  readonly bip9_bit1_group: number;
32
32
  readonly all_rules: 4294967295;
33
33
  };
34
+ export declare const RuleForkEnumValues: string[];
34
35
  export declare type RuleForkEnumNative = keyof typeof _RuleForkEnumNativeKeyToInt;
35
36
  export declare function RuleForkEnumNativeToInt(value: RuleForkEnumNative): number;
36
37
  export declare function RuleForkEnumNativeFromInt(value: number): RuleForkEnumNative | undefined;
38
+ declare const _OpcodeEnumNativeIntToKey: readonly ["push_size_0", "push_size_1", "push_size_2", "push_size_3", "push_size_4", "push_size_5", "push_size_6", "push_size_7", "push_size_8", "push_size_9", "push_size_10", "push_size_11", "push_size_12", "push_size_13", "push_size_14", "push_size_15", "push_size_16", "push_size_17", "push_size_18", "push_size_19", "push_size_20", "push_size_21", "push_size_22", "push_size_23", "push_size_24", "push_size_25", "push_size_26", "push_size_27", "push_size_28", "push_size_29", "push_size_30", "push_size_31", "push_size_32", "push_size_33", "push_size_34", "push_size_35", "push_size_36", "push_size_37", "push_size_38", "push_size_39", "push_size_40", "push_size_41", "push_size_42", "push_size_43", "push_size_44", "push_size_45", "push_size_46", "push_size_47", "push_size_48", "push_size_49", "push_size_50", "push_size_51", "push_size_52", "push_size_53", "push_size_54", "push_size_55", "push_size_56", "push_size_57", "push_size_58", "push_size_59", "push_size_60", "push_size_61", "push_size_62", "push_size_63", "push_size_64", "push_size_65", "push_size_66", "push_size_67", "push_size_68", "push_size_69", "push_size_70", "push_size_71", "push_size_72", "push_size_73", "push_size_74", "push_size_75", "push_one_size", "push_two_size", "push_four_size", "push_negative_1", "reserved_80", "push_positive_1", "push_positive_2", "push_positive_3", "push_positive_4", "push_positive_5", "push_positive_6", "push_positive_7", "push_positive_8", "push_positive_9", "push_positive_10", "push_positive_11", "push_positive_12", "push_positive_13", "push_positive_14", "push_positive_15", "push_positive_16", "nop", "reserved_98", "if", "notif", "disabled_verif", "disabled_vernotif", "else", "endif", "verify", "return", "toaltstack", "fromaltstack", "drop2", "dup2", "dup3", "over2", "rot2", "swap2", "ifdup", "depth", "drop", "dup", "nip", "over", "pick", "roll", "rot", "swap", "tuck", "cat", "split", "num2bin", "bin2num", "size", "disabled_invert", "and", "or", "xor", "equal", "equalverify", "reserved_137", "reserved_138", "add1", "sub1", "disabled_mul2", "disabled_div2", "negate", "abs", "not", "nonzero", "add", "sub", "mul", "div", "mod", "disabled_lshift", "disabled_rshift", "booland", "boolor", "numequal", "numequalverify", "numnotequal", "lessthan", "greaterthan", "lessthanorequal", "greaterthanorequal", "min", "max", "within", "ripemd160", "sha1", "sha256", "hash160", "hash256", "codeseparator", "checksig", "checksigverify", "checkmultisig", "checkmultisigverify", "nop1", "checklocktimeverify", "checksequenceverify", "nop4", "nop5", "nop6", "nop7", "nop8", "nop9", "nop10", "checkdatasig", "checkdatasigverify", "reverse_bytes", "available1", "available2", "available3", "input_index", "active_bytecode", "tx_version", "tx_input_count", "tx_output_count", "tx_locktime", "utxo_value", "utxo_bytecode", "outpoint_tx_hash", "outpoint_index", "input_bytecode", "input_sequence_number", "output_value", "output_bytecode", "utxo_token_category", "utxo_token_commitment", "utxo_token_amount", "output_token_category", "output_token_commitment", "output_token_amount", "reserved_212", "reserved_213", "first_undefined_op_value", "reserved_215", "reserved_216", "reserved_217", "reserved_218", "reserved_219", "reserved_220", "reserved_221", "reserved_222", "reserved_223", "reserved_224", "reserved_225", "reserved_226", "reserved_227", "reserved_228", "reserved_229", "reserved_230", "reserved_231", "reserved_232", "reserved_233", "reserved_234", "reserved_235", "reserved_236", "reserved_237", "reserved_238", "special_token_prefix", "reserved_240", "reserved_241", "reserved_242", "reserved_243", "reserved_244", "reserved_245", "reserved_246", "reserved_247", "reserved_248", "reserved_249", "reserved_250", "reserved_251", "reserved_252", "reserved_253", "reserved_254", "invalidopcode"];
39
+ export declare type OpcodeEnumNative = (typeof _OpcodeEnumNativeIntToKey)[number];
40
+ export declare const OpcodeEnumValues: string[];
41
+ export declare function OpcodeEnumNativeToInt(value: OpcodeEnumNative): number;
37
42
  export {};
@@ -0,0 +1,5 @@
1
+ import Klass from '../../tools/wasm-generator/src/klass';
2
+ import Enum from '../../tools/wasm-generator/src/enum';
3
+ import Typedef from '../../tools/wasm-generator/src/typedef';
4
+ declare const manualGeneratedTypes: Array<Klass | Enum | Typedef>;
5
+ export default manualGeneratedTypes;