@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
package/src/kth.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EcPublicNative } from './wasm/glue';
|
|
2
|
+
import { PaymentAddress } from './PaymentAddress';
|
|
3
|
+
import { EcCompressed } from './EcCompressed';
|
|
4
|
+
export declare class EcPublic {
|
|
5
|
+
private native;
|
|
6
|
+
constructor(native: EcPublicNative);
|
|
7
|
+
constructor(compressed: EcCompressed, compress: boolean);
|
|
8
|
+
toNative(): EcPublicNative;
|
|
9
|
+
toPaymentAddress(version: number): PaymentAddress;
|
|
10
|
+
get encoded(): string;
|
|
11
|
+
toData(): Uint8Array<ArrayBufferLike>;
|
|
12
|
+
}
|
|
13
|
+
export default EcPublic;
|
package/types/Hash.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HashNative, ShortHashNative, EncryptedSeedNative, LongHashNative } from './wasm/glue';
|
|
2
|
+
export type Hash = Uint8Array & {
|
|
3
|
+
length: 32;
|
|
4
|
+
};
|
|
5
|
+
export type ShortHash = Uint8Array & {
|
|
6
|
+
length: 20;
|
|
7
|
+
};
|
|
8
|
+
export type LongHash = Uint8Array & {
|
|
9
|
+
length: 64;
|
|
10
|
+
};
|
|
11
|
+
export type EncryptedSeed = Uint8Array & {
|
|
12
|
+
length: 96;
|
|
13
|
+
};
|
|
14
|
+
export declare class HashFunctions {
|
|
15
|
+
static nullHash: Hash;
|
|
16
|
+
static nullShortHash: ShortHash;
|
|
17
|
+
static nullLongHash: LongHash;
|
|
18
|
+
static nullEncryptedSeed: EncryptedSeed;
|
|
19
|
+
static fromNative(native: HashNative, destroy: boolean): Hash;
|
|
20
|
+
static fromNative(native: ShortHashNative, destroy: boolean): ShortHash;
|
|
21
|
+
static fromNative(native: LongHashNative, destroy: boolean): LongHash;
|
|
22
|
+
static fromNative(native: EncryptedSeedNative, destroy: boolean): EncryptedSeed;
|
|
23
|
+
static toNative(hash: Hash): HashNative;
|
|
24
|
+
static toNative(hash: ShortHash): ShortHashNative;
|
|
25
|
+
static toNative(hash: LongHash): LongHashNative;
|
|
26
|
+
static toNative(hash: EncryptedSeed): EncryptedSeedNative;
|
|
27
|
+
static encryptedSeedtoNative(hash: Uint8Array): EncryptedSeedNative;
|
|
28
|
+
static sha256(data: Uint8Array): Hash;
|
|
29
|
+
static sha256Reversed(data: Uint8Array): Hash;
|
|
30
|
+
static sha256ReversedStr(data: Uint8Array): string;
|
|
31
|
+
}
|
|
32
|
+
export default HashFunctions;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HdPublicNative } from './wasm/glue';
|
|
2
|
+
import { EcCompressed } from './EcCompressed';
|
|
3
|
+
export declare class HdPublic {
|
|
4
|
+
private native;
|
|
5
|
+
static fromString(encoded: string): HdPublic | undefined;
|
|
6
|
+
static isValid(encoded: string): boolean;
|
|
7
|
+
constructor(native: HdPublicNative);
|
|
8
|
+
toNative(): HdPublicNative;
|
|
9
|
+
derivePublic(index: number): HdPublic;
|
|
10
|
+
get encoded(): string;
|
|
11
|
+
get point(): EcCompressed;
|
|
12
|
+
}
|
|
13
|
+
export default HdPublic;
|
package/types/Input.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InputNative } from './wasm/glue';
|
|
2
|
+
import { Script } from './Script';
|
|
3
|
+
import { OutputPoint } from './OutputPoint';
|
|
4
|
+
export declare class Input {
|
|
5
|
+
previousOutput?: OutputPoint;
|
|
6
|
+
script?: Script;
|
|
7
|
+
seq?: number;
|
|
8
|
+
static fromNative(native: InputNative, destroy?: boolean): Input;
|
|
9
|
+
static fromData(data: Uint8Array): Input | undefined;
|
|
10
|
+
static isValid(previousOutput: OutputPoint, script: Script, seq: number): boolean;
|
|
11
|
+
constructor(previousOutput?: OutputPoint, script?: Script, seq?: number);
|
|
12
|
+
get valid(): boolean;
|
|
13
|
+
toNative(): InputNative;
|
|
14
|
+
serializedSize(wire: boolean): number;
|
|
15
|
+
toData(wire: boolean): Uint8Array<ArrayBufferLike>;
|
|
16
|
+
}
|
|
17
|
+
export default Input;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Program } from './Program';
|
|
2
|
+
import { Operation } from './Operation';
|
|
3
|
+
export declare class Debugger {
|
|
4
|
+
stepNumber?: number;
|
|
5
|
+
programHistory: Map<number, Program>;
|
|
6
|
+
get lastProgram(): Program | undefined;
|
|
7
|
+
start(program: Program): number;
|
|
8
|
+
get stepsAvailable(): boolean;
|
|
9
|
+
stepForward(): number;
|
|
10
|
+
end(): number;
|
|
11
|
+
}
|
|
12
|
+
export declare class Interpreter {
|
|
13
|
+
static run(program: Program): number;
|
|
14
|
+
static runOperation(operation: Operation, program: Program): number;
|
|
15
|
+
static debug(program: Program): Debugger | number;
|
|
16
|
+
}
|
|
17
|
+
export default Interpreter;
|
package/types/Kth.d.ts
CHANGED
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ListNative } from './ListNative';
|
|
2
|
+
export declare function fromNative<T, N, L extends ListNative<N>>(nativeList: L, fromNativeFunc: (nativeItem: N) => T): Array<T>;
|
|
3
|
+
export declare function toNative<T, N, L extends ListNative<N>>(items: Array<T>, toNativeFunc: (item: T) => N, NativeConstructor: new () => L): L;
|
|
4
|
+
export declare function fromNativePrimitive<T, L extends ListNative<T>>(nativeList: L): Array<T>;
|
|
5
|
+
export declare function toNativePrimitive<T, L extends ListNative<T>>(items: Array<T>, NativeConstructor: new () => L): L;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OpcodeEnumNative } from './wasm/glue';
|
|
2
|
+
export declare class Opcode {
|
|
3
|
+
static toInt(value: OpcodeEnumNative): number;
|
|
4
|
+
static toString(value: OpcodeEnumNative, activeForks: number): string;
|
|
5
|
+
static fromString(value: string): OpcodeEnumNative | undefined;
|
|
6
|
+
static toHexadecimal(code: OpcodeEnumNative): string;
|
|
7
|
+
static fromHexadecimal(value: string): OpcodeEnumNative | undefined;
|
|
8
|
+
}
|
|
9
|
+
export default Opcode;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { OperationNative, OpcodeEnumNative } from './wasm/glue';
|
|
2
|
+
export declare class Operation {
|
|
3
|
+
private opcode;
|
|
4
|
+
private encoded;
|
|
5
|
+
private minimal;
|
|
6
|
+
private rawData;
|
|
7
|
+
static fromNative(native: OperationNative, destroy?: boolean): Operation;
|
|
8
|
+
static fromData(encoded: Uint8Array): Operation | undefined;
|
|
9
|
+
static fromString(str: string): Operation | undefined;
|
|
10
|
+
static isValid(encoded: Uint8Array, minimal: boolean): boolean;
|
|
11
|
+
constructor();
|
|
12
|
+
constructor(opcode: OpcodeEnumNative);
|
|
13
|
+
constructor(encoded: Uint8Array, minimal?: boolean);
|
|
14
|
+
toNative(): OperationNative;
|
|
15
|
+
toString(activeForks: number): string;
|
|
16
|
+
toData(): Uint8Array<ArrayBufferLike>;
|
|
17
|
+
get isValid(): boolean;
|
|
18
|
+
get serializedSize(): number;
|
|
19
|
+
get code(): "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";
|
|
20
|
+
get data(): Uint8Array<ArrayBufferLike>;
|
|
21
|
+
get isPush(): boolean;
|
|
22
|
+
get isCounted(): boolean;
|
|
23
|
+
get isVersion(): boolean;
|
|
24
|
+
get isPositive(): boolean;
|
|
25
|
+
isDisabled(activeForks: number): void;
|
|
26
|
+
get isConditional(): boolean;
|
|
27
|
+
get isRelaxedPush(): boolean;
|
|
28
|
+
isOversized(maxSize: number): boolean;
|
|
29
|
+
get isMinimalPush(): boolean;
|
|
30
|
+
get isNominalPush(): boolean;
|
|
31
|
+
static opcodeFromSize(size: number): OpcodeEnumNative;
|
|
32
|
+
static minimalOpcodeFromData(data: Uint8Array): OpcodeEnumNative;
|
|
33
|
+
static nominalOpcodeFromData(data: Uint8Array): OpcodeEnumNative;
|
|
34
|
+
static opcodeFromPositive(value: number): OpcodeEnumNative;
|
|
35
|
+
static opcodeToPositive(code: OpcodeEnumNative): number;
|
|
36
|
+
static opcodeIsPush(code: OpcodeEnumNative): boolean;
|
|
37
|
+
static opcodeIsPayload(code: OpcodeEnumNative): boolean;
|
|
38
|
+
static opcodeIsCounted(code: OpcodeEnumNative): boolean;
|
|
39
|
+
static opcodeIsVersion(code: OpcodeEnumNative): boolean;
|
|
40
|
+
static opcodeIsNumeric(code: OpcodeEnumNative): boolean;
|
|
41
|
+
static opcodeIsPositive(code: OpcodeEnumNative): boolean;
|
|
42
|
+
static opcodeIsReserved(code: OpcodeEnumNative): boolean;
|
|
43
|
+
static opcodeIsDisabled(code: OpcodeEnumNative, activeForks: number): boolean;
|
|
44
|
+
static opcodeIsConditional(code: OpcodeEnumNative): boolean;
|
|
45
|
+
static opcodeIsRelaxedPush(code: OpcodeEnumNative): boolean;
|
|
46
|
+
}
|
|
47
|
+
export default Operation;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OperationListNative } from './wasm/glue';
|
|
2
|
+
import { Operation } from './Operation';
|
|
3
|
+
export declare class OperationList {
|
|
4
|
+
static fromNative(native: OperationListNative): Array<Operation>;
|
|
5
|
+
static toNative(operations: Array<Operation>): OperationListNative;
|
|
6
|
+
}
|
|
7
|
+
export default OperationList;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OutputNative } from './wasm/glue';
|
|
2
|
+
import { Script } from './Script';
|
|
3
|
+
import { TokenData } from './TokenData';
|
|
4
|
+
export declare class Output {
|
|
5
|
+
value?: bigint;
|
|
6
|
+
script?: Script;
|
|
7
|
+
tokenData?: TokenData;
|
|
8
|
+
static fromNative(native: OutputNative, destroy?: boolean): Output;
|
|
9
|
+
static fromData(data: Uint8Array): Output | undefined;
|
|
10
|
+
static isValid(value: bigint, script: Script, tokenData?: TokenData): boolean;
|
|
11
|
+
private static validU64Int;
|
|
12
|
+
constructor(value?: bigint, script?: Script, tokenData?: TokenData);
|
|
13
|
+
get valid(): boolean;
|
|
14
|
+
toNative(): OutputNative;
|
|
15
|
+
serializedSize(wire: boolean): number;
|
|
16
|
+
toData(wire: boolean): Uint8Array<ArrayBufferLike>;
|
|
17
|
+
}
|
|
18
|
+
export default Output;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OutputListNative } from './wasm/glue';
|
|
2
|
+
import { Output } from './Output';
|
|
3
|
+
export declare class OutputList {
|
|
4
|
+
static fromNative(native: OutputListNative): Array<Output>;
|
|
5
|
+
static toNative(operations: Array<Output>): OutputListNative;
|
|
6
|
+
}
|
|
7
|
+
export default OutputList;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OutputPointNative } from './wasm/glue';
|
|
2
|
+
import { Hash } from './Hash';
|
|
3
|
+
import Output from './Output';
|
|
4
|
+
export declare class OutputPoint {
|
|
5
|
+
hash?: Hash;
|
|
6
|
+
index?: number;
|
|
7
|
+
cachedOutput?: Output;
|
|
8
|
+
static fromNative(native: OutputPointNative, destroy?: boolean): OutputPoint;
|
|
9
|
+
static isValid(hash: Hash, index: number): boolean;
|
|
10
|
+
constructor(hash?: Hash, index?: number);
|
|
11
|
+
get valid(): boolean;
|
|
12
|
+
toNative(): OutputPointNative;
|
|
13
|
+
}
|
|
14
|
+
export default OutputPoint;
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import { PaymentAddressNative } from './wasm/glue';
|
|
2
|
+
import { Hash, ShortHash } from './Hash';
|
|
3
|
+
import { Script } from './Script';
|
|
2
4
|
export declare class PaymentAddress {
|
|
3
5
|
private addressStr;
|
|
4
6
|
private tokenAware;
|
|
5
7
|
private legacy;
|
|
8
|
+
static mainnetP2kh: number;
|
|
9
|
+
static mainnetP2sh: number;
|
|
10
|
+
static testnetP2kh: number;
|
|
11
|
+
static testnetP2sh: number;
|
|
6
12
|
static fromNative(native: PaymentAddressNative, destroy?: boolean): PaymentAddress;
|
|
13
|
+
static fromHash(hash: Hash, version: number): PaymentAddress;
|
|
14
|
+
static fromShortHash(hash: ShortHash, version: number): PaymentAddress;
|
|
7
15
|
static fromString(addressStr: string): PaymentAddress | undefined;
|
|
8
16
|
static isValid(addressStr: string): boolean;
|
|
9
17
|
constructor(addressStr: string, tokenAware?: boolean, legacy?: boolean);
|
|
18
|
+
static fromScript(script: Script, version: number): PaymentAddress;
|
|
19
|
+
static fromPayPublicKeyHashScript(script: Script, version: number): PaymentAddress;
|
|
10
20
|
toNative(): PaymentAddressNative;
|
|
11
|
-
get
|
|
21
|
+
get hash20(): ShortHash;
|
|
22
|
+
get hash32(): Hash;
|
|
23
|
+
get hash(): ShortHash;
|
|
12
24
|
get version(): number;
|
|
13
25
|
encoded(): string;
|
|
14
26
|
encodedCashAddr(): string;
|
|
15
27
|
encodedCashTokens(): string;
|
|
16
28
|
encodedLegacy(): string;
|
|
29
|
+
static extract(script: Script, p2khVersion: number, p2shVersion: number): PaymentAddress[];
|
|
30
|
+
static extractInput(script: Script, p2khVersion: number, p2shVersion: number): PaymentAddress[];
|
|
31
|
+
static extractOutput(script: Script, p2khVersion: number, p2shVersion: number): PaymentAddress[];
|
|
17
32
|
}
|
|
18
33
|
export default PaymentAddress;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PaymentAddressListNative } from './wasm/glue';
|
|
2
|
+
import { PaymentAddress } from './PaymentAddress';
|
|
3
|
+
export declare class PaymentAddressList {
|
|
4
|
+
static fromNative(native: PaymentAddressListNative): Array<PaymentAddress>;
|
|
5
|
+
static toNative(paymentAddresses: Array<PaymentAddress>): PaymentAddressListNative;
|
|
6
|
+
}
|
|
7
|
+
export default PaymentAddressList;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProgramNative } from './wasm/glue';
|
|
2
|
+
import { Script } from './Script';
|
|
3
|
+
import { Transaction } from './Transaction';
|
|
4
|
+
export declare class Program {
|
|
5
|
+
private native;
|
|
6
|
+
constructor(native: ProgramNative);
|
|
7
|
+
constructor(script?: Script, programOrTransaction?: Program | Transaction, inputIndex?: number, forks?: number);
|
|
8
|
+
toNative(): ProgramNative;
|
|
9
|
+
get valid(): boolean;
|
|
10
|
+
evaluate(): number;
|
|
11
|
+
stackResult(clean: boolean): boolean;
|
|
12
|
+
get size(): number;
|
|
13
|
+
item(index: number): Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
export default Program;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare class RuleFork {
|
|
2
|
+
static forkMinYear: number;
|
|
3
|
+
static forkMaxYear: number;
|
|
4
|
+
static noRules: number;
|
|
5
|
+
static easyBlocks: number;
|
|
6
|
+
static bip16Rule: number;
|
|
7
|
+
static bip30Rule: number;
|
|
8
|
+
static bip34Rule: number;
|
|
9
|
+
static bip66Rule: number;
|
|
10
|
+
static bip65Rule: number;
|
|
11
|
+
static bip90Rule: number;
|
|
12
|
+
static allowCollisions: number;
|
|
13
|
+
static bip68Rule: number;
|
|
14
|
+
static bip112Rule: number;
|
|
15
|
+
static bip113Rule: number;
|
|
16
|
+
static bchUahf: number;
|
|
17
|
+
static bchDaaCw144: number;
|
|
18
|
+
static bchPythagoras: number;
|
|
19
|
+
static bchEuclid: number;
|
|
20
|
+
static bchPisano: number;
|
|
21
|
+
static bchMersenne: number;
|
|
22
|
+
static bchFermat: number;
|
|
23
|
+
static bchEuler: number;
|
|
24
|
+
static bchGauss: number;
|
|
25
|
+
static bchDescartes: number;
|
|
26
|
+
static bchLobachevski: number;
|
|
27
|
+
static bchGalois: number;
|
|
28
|
+
static bchLeibniz: number;
|
|
29
|
+
static retarget: number;
|
|
30
|
+
static unverified: number;
|
|
31
|
+
static bip34Activations: number;
|
|
32
|
+
static allRules: number;
|
|
33
|
+
static baseForks(easyBlocks?: boolean): number;
|
|
34
|
+
static allForks(easyBlocks?: boolean): number;
|
|
35
|
+
static enabledForksByDate(year: number, month: number, easyBlocks?: boolean): number;
|
|
36
|
+
static enabledForksByYear(year: number, easyBlocks?: boolean): number;
|
|
37
|
+
}
|
|
38
|
+
export default RuleFork;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ScriptNative, EndorsementType } from './wasm/glue';
|
|
2
|
+
import { Operation } from './Operation';
|
|
3
|
+
import { Transaction } from './Transaction';
|
|
4
|
+
import { ShortHash } from './Hash';
|
|
5
|
+
import { EcSecret } from './Secret';
|
|
6
|
+
export declare class Script {
|
|
7
|
+
private encoded;
|
|
8
|
+
private prefix;
|
|
9
|
+
static fromNative(native: ScriptNative, destroy?: boolean): Script;
|
|
10
|
+
static fromData(encoded: Uint8Array, prefix: boolean): Script | undefined;
|
|
11
|
+
static fromString(str: string): Script | undefined;
|
|
12
|
+
static fromOperations(operations: Array<Operation>): Script | undefined;
|
|
13
|
+
static isValid(encoded: Uint8Array, prefix: boolean): boolean;
|
|
14
|
+
constructor(encoded: Uint8Array, prefix: boolean);
|
|
15
|
+
toNative(): ScriptNative;
|
|
16
|
+
get valid(): boolean;
|
|
17
|
+
get isValidOperations(): boolean;
|
|
18
|
+
get satoshiContentSize(): number;
|
|
19
|
+
get serializedSize(): number;
|
|
20
|
+
get type(): string;
|
|
21
|
+
get operations(): Operation[];
|
|
22
|
+
toString(activeForks: number): string;
|
|
23
|
+
toData(prefix: boolean): Uint8Array<ArrayBufferLike>;
|
|
24
|
+
toBytes(): Uint8Array<ArrayBufferLike>;
|
|
25
|
+
static isPushOnly(ops: Array<Operation>): boolean;
|
|
26
|
+
static isRelaxedPush(ops: Array<Operation>): boolean;
|
|
27
|
+
static isCoinbasePattern(ops: Array<Operation>, height: number): boolean;
|
|
28
|
+
static isNullDataPattern(ops: Array<Operation>): boolean;
|
|
29
|
+
static isPayPublicKeyPattern(ops: Array<Operation>): boolean;
|
|
30
|
+
static isPayPublicKeyHashPattern(ops: Array<Operation>): boolean;
|
|
31
|
+
static isPayScriptHashPattern(ops: Array<Operation>): boolean;
|
|
32
|
+
static isSignMultisigPattern(ops: Array<Operation>): boolean;
|
|
33
|
+
static isSignPublicKeyPattern(ops: Array<Operation>): boolean;
|
|
34
|
+
static isSignPublicKeyHashPattern(ops: Array<Operation>): boolean;
|
|
35
|
+
static isSignScriptHashPattern(ops: Array<Operation>): boolean;
|
|
36
|
+
static toNullDataPattern(data: Uint8Array): Array<Operation>;
|
|
37
|
+
static toPayPublicKeyPattern(point: Uint8Array): Array<Operation>;
|
|
38
|
+
static toPayPublicKeyHashPattern(hash: ShortHash): Array<Operation>;
|
|
39
|
+
static toPayScriptHashPattern(hash: ShortHash): Array<Operation>;
|
|
40
|
+
pattern(): "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";
|
|
41
|
+
outputPattern(): "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";
|
|
42
|
+
inputPattern(): "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";
|
|
43
|
+
get sigops(): number;
|
|
44
|
+
get sigopsAccurate(): number;
|
|
45
|
+
get isUnspendable(): boolean;
|
|
46
|
+
reset(): void;
|
|
47
|
+
static createEndorsement(secret: EcSecret, prevoutScript: Script, tx: Transaction, inputIndex: number, sighashType: number, activeForks: number, value: bigint, endorsementType: EndorsementType): Uint8Array;
|
|
48
|
+
static verify(tx: Transaction, input: number, forks: number, inputScript: Script, prevoutScript: Script, value: bigint): number;
|
|
49
|
+
static verifyTransaction(tx: Transaction, input: number, forks: number): number;
|
|
50
|
+
}
|
|
51
|
+
export default Script;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EcSecretNative } from './wasm/glue';
|
|
2
|
+
import { EcSecret } from './Secret';
|
|
3
|
+
export declare class SecretFunctions {
|
|
4
|
+
static nullSecret: EcSecret;
|
|
5
|
+
static fromNative(native: EcSecretNative, destroy?: boolean): EcSecret;
|
|
6
|
+
static toNative(secret: EcSecret): EcSecretNative;
|
|
7
|
+
}
|
|
8
|
+
export default SecretFunctions;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class SighashAlgorithm {
|
|
2
|
+
static all: number;
|
|
3
|
+
static none: number;
|
|
4
|
+
static single: number;
|
|
5
|
+
static utxos: number;
|
|
6
|
+
static utxos_all: number;
|
|
7
|
+
static utxos_none: number;
|
|
8
|
+
static utxos_single: number;
|
|
9
|
+
static forkid: number;
|
|
10
|
+
static forkid_all: number;
|
|
11
|
+
static forkid_none: number;
|
|
12
|
+
static forkid_single: number;
|
|
13
|
+
static anyone_can_pay: number;
|
|
14
|
+
static anyone_can_pay_all: number;
|
|
15
|
+
static anyone_can_pay_none: number;
|
|
16
|
+
static anyone_can_pay_single: number;
|
|
17
|
+
static mask: number;
|
|
18
|
+
}
|
|
19
|
+
export default SighashAlgorithm;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TokenDataNative } from './wasm/glue';
|
|
2
|
+
import { Hash } from './Hash';
|
|
3
|
+
import { TokenDataFungible } from './TokenDataFungible';
|
|
4
|
+
import { TokenDataNonFungible } from './TokenDataNonFungible';
|
|
5
|
+
import { TokenDataBothKinds } from './TokenDataBothKinds';
|
|
6
|
+
export type TokenDataInternal = TokenDataFungible | TokenDataNonFungible | TokenDataBothKinds;
|
|
7
|
+
export declare class TokenData {
|
|
8
|
+
category?: Hash;
|
|
9
|
+
data?: TokenDataInternal;
|
|
10
|
+
static fromNative(native: TokenDataNative, destroy?: boolean): TokenData;
|
|
11
|
+
constructor(category?: Hash, data?: TokenDataInternal);
|
|
12
|
+
get valid(): boolean;
|
|
13
|
+
get kind(): 'fungible' | 'non_fungible' | 'both' | undefined;
|
|
14
|
+
toNative(): TokenDataNative;
|
|
15
|
+
serializedSize(): number;
|
|
16
|
+
toData(): Uint8Array<ArrayBufferLike>;
|
|
17
|
+
}
|
|
18
|
+
export default TokenData;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TokenDataFungible } from './TokenDataFungible';
|
|
2
|
+
import { TokenDataNonFungible } from './TokenDataNonFungible';
|
|
3
|
+
import { TokenCapability } from './wasm/glue';
|
|
4
|
+
export declare class TokenDataBothKinds {
|
|
5
|
+
fungible: TokenDataFungible;
|
|
6
|
+
nonFungible: TokenDataNonFungible;
|
|
7
|
+
constructor(amount: bigint, capability: TokenCapability, commitment: Uint8Array);
|
|
8
|
+
}
|
|
9
|
+
export default TokenDataBothKinds;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TransactionNative, CoinSelectionAlgorithm } from './wasm/glue';
|
|
2
|
+
import { Hash } from './Hash';
|
|
3
|
+
import { Input } from './Input';
|
|
4
|
+
import { Output } from './Output';
|
|
5
|
+
import { PaymentAddress } from './PaymentAddress';
|
|
6
|
+
import { Utxo } from './Utxo';
|
|
7
|
+
export declare class Transaction {
|
|
8
|
+
version?: number;
|
|
9
|
+
locktime?: number;
|
|
10
|
+
inputs?: Array<Input>;
|
|
11
|
+
outputs?: Array<Output>;
|
|
12
|
+
static fromNative(native: TransactionNative, destroy?: boolean): Transaction;
|
|
13
|
+
static fromData(data: Uint8Array): Transaction | undefined;
|
|
14
|
+
static isValid(data: Uint8Array): boolean;
|
|
15
|
+
constructor(version?: number, locktime?: number, inputs?: Array<Input>, outputs?: Array<Output>);
|
|
16
|
+
get valid(): boolean;
|
|
17
|
+
toNative(): TransactionNative;
|
|
18
|
+
serializedSize(wire: boolean): number;
|
|
19
|
+
toData(wire: boolean): Uint8Array<ArrayBufferLike>;
|
|
20
|
+
clone(): Transaction | undefined;
|
|
21
|
+
get hash(): Hash;
|
|
22
|
+
get isCoinbase(): boolean;
|
|
23
|
+
get totalInputValue(): bigint;
|
|
24
|
+
get totalOutputValue(): bigint;
|
|
25
|
+
get fees(): bigint;
|
|
26
|
+
isMature(targetHeight: number): boolean;
|
|
27
|
+
static createTemplateWithChangeRatios(availableUtxos: Array<Utxo>, amountToSend: bigint, destinationAddress: PaymentAddress, changeAddresses: Array<PaymentAddress>, changeRatios: Array<number>, selectionAlgo: CoinSelectionAlgorithm): [number, Transaction | undefined, Array<number> | undefined, Array<PaymentAddress> | undefined, Array<bigint> | undefined];
|
|
28
|
+
static createTemplate(availableUtxos: Array<Utxo>, amountToSend: bigint, destinationAddress: PaymentAddress, changeAddresses: Array<PaymentAddress>, selectionAlgo: CoinSelectionAlgorithm): [number, Transaction | undefined, Array<number> | undefined, Array<PaymentAddress> | undefined, Array<bigint> | undefined];
|
|
29
|
+
}
|
|
30
|
+
export default Transaction;
|
package/types/Utxo.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UtxoNative } from './wasm/glue';
|
|
2
|
+
import { Hash } from './Hash';
|
|
3
|
+
import Output from './Output';
|
|
4
|
+
import TokenData from './TokenData';
|
|
5
|
+
export declare class Utxo {
|
|
6
|
+
hash?: Hash;
|
|
7
|
+
index?: number;
|
|
8
|
+
amount?: bigint;
|
|
9
|
+
cachedOutput?: Output;
|
|
10
|
+
tokenData?: TokenData;
|
|
11
|
+
static fromNative(native: UtxoNative, destroy?: boolean): Utxo;
|
|
12
|
+
static isValid(hash: Hash, index: number, amount: bigint): boolean;
|
|
13
|
+
constructor(hash?: Hash, index?: number, amount?: bigint, tokenData?: TokenData);
|
|
14
|
+
get valid(): boolean;
|
|
15
|
+
toNative(): UtxoNative;
|
|
16
|
+
}
|
|
17
|
+
export default Utxo;
|
package/types/Wallet.d.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
import { LongHashNative } from './wasm/glue';
|
|
2
1
|
import { PaymentAddress } from './PaymentAddress';
|
|
2
|
+
import { EcSecret } from './Secret';
|
|
3
|
+
import { EcPublic } from './EcPublic';
|
|
4
|
+
import { LongHash } from './Hash';
|
|
3
5
|
export declare class Wallet {
|
|
4
6
|
private mnemonic;
|
|
5
7
|
private derivationPath;
|
|
6
8
|
private network;
|
|
7
|
-
seed
|
|
9
|
+
private seed;
|
|
8
10
|
private master;
|
|
9
11
|
private lastDerived;
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
constructor(seed: LongHash, derivationPath: string, network: string);
|
|
13
|
+
constructor(mnemonic: string[], derivationPath: string, network: string);
|
|
14
|
+
getSecret(index: number): EcSecret;
|
|
15
|
+
getTripleOf(address: PaymentAddress, maxLoops?: number): {
|
|
16
|
+
secret: EcSecret;
|
|
17
|
+
publicKey: EcPublic;
|
|
18
|
+
address: PaymentAddress;
|
|
19
|
+
} | undefined;
|
|
20
|
+
getPublicKey(index: number): EcPublic;
|
|
21
|
+
getPublicKeys(count?: number, from?: number): EcPublic[];
|
|
14
22
|
getAddress(index: number): PaymentAddress;
|
|
15
23
|
getAddresses(count?: number, from?: number): PaymentAddress[];
|
|
24
|
+
getTriple(index: number): {
|
|
25
|
+
secret: EcSecret;
|
|
26
|
+
publicKey: EcPublic;
|
|
27
|
+
address: PaymentAddress;
|
|
28
|
+
};
|
|
16
29
|
deriveAccount(derivationPath: string): Wallet;
|
|
17
30
|
}
|
|
18
31
|
export default Wallet;
|