@vbyte/btc-dev 1.1.8 → 2.1.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/CHANGELOG.md +127 -0
- package/LICENSE +21 -121
- package/README.md +69 -3
- package/dist/const.d.ts +3 -0
- package/dist/const.js +23 -22
- package/dist/error.d.ts +11 -0
- package/dist/error.js +20 -0
- package/dist/index.d.ts +12 -11
- package/dist/index.js +11 -10
- package/dist/lib/address/api.d.ts +2 -2
- package/dist/lib/address/api.js +13 -12
- package/dist/lib/address/encode.d.ts +1 -1
- package/dist/lib/address/encode.js +26 -24
- package/dist/lib/address/index.d.ts +6 -6
- package/dist/lib/address/index.js +6 -6
- package/dist/lib/address/p2pkh.d.ts +2 -2
- package/dist/lib/address/p2pkh.js +15 -15
- package/dist/lib/address/p2sh.d.ts +2 -2
- package/dist/lib/address/p2sh.js +14 -14
- package/dist/lib/address/p2tr.d.ts +2 -2
- package/dist/lib/address/p2tr.js +14 -14
- package/dist/lib/address/p2wpkh.d.ts +2 -2
- package/dist/lib/address/p2wpkh.js +15 -15
- package/dist/lib/address/p2wsh.d.ts +2 -2
- package/dist/lib/address/p2wsh.js +14 -14
- package/dist/lib/address/script.d.ts +1 -1
- package/dist/lib/address/script.js +16 -16
- package/dist/lib/address/util.d.ts +1 -1
- package/dist/lib/address/util.js +24 -22
- package/dist/lib/meta/index.d.ts +4 -4
- package/dist/lib/meta/index.js +4 -4
- package/dist/lib/meta/locktime.d.ts +1 -1
- package/dist/lib/meta/locktime.js +13 -12
- package/dist/lib/meta/ref.js +13 -9
- package/dist/lib/meta/scribe.d.ts +2 -2
- package/dist/lib/meta/scribe.js +71 -56
- package/dist/lib/meta/sequence.d.ts +1 -1
- package/dist/lib/meta/sequence.js +21 -19
- package/dist/lib/script/decode.d.ts +2 -2
- package/dist/lib/script/decode.js +53 -17
- package/dist/lib/script/encode.d.ts +1 -1
- package/dist/lib/script/encode.js +21 -16
- package/dist/lib/script/index.d.ts +5 -13
- package/dist/lib/script/index.js +5 -14
- package/dist/lib/script/lock.d.ts +2 -2
- package/dist/lib/script/lock.js +15 -12
- package/dist/lib/script/util.js +4 -4
- package/dist/lib/script/words.js +131 -130
- package/dist/lib/sighash/index.d.ts +3 -3
- package/dist/lib/sighash/index.js +3 -3
- package/dist/lib/sighash/segwit.d.ts +2 -2
- package/dist/lib/sighash/segwit.js +18 -14
- package/dist/lib/sighash/taproot.d.ts +2 -2
- package/dist/lib/sighash/taproot.js +27 -23
- package/dist/lib/sighash/util.d.ts +2 -2
- package/dist/lib/sighash/util.js +8 -7
- package/dist/lib/signer/index.d.ts +2 -2
- package/dist/lib/signer/index.js +2 -2
- package/dist/lib/signer/sign.d.ts +1 -1
- package/dist/lib/signer/sign.js +43 -7
- package/dist/lib/signer/verify.d.ts +17 -3
- package/dist/lib/signer/verify.js +232 -3
- package/dist/lib/taproot/cblock.d.ts +1 -1
- package/dist/lib/taproot/cblock.js +16 -17
- package/dist/lib/taproot/encode.d.ts +1 -1
- package/dist/lib/taproot/encode.js +9 -8
- package/dist/lib/taproot/index.d.ts +4 -4
- package/dist/lib/taproot/index.js +4 -4
- package/dist/lib/taproot/parse.d.ts +1 -1
- package/dist/lib/taproot/parse.js +15 -15
- package/dist/lib/taproot/tree.d.ts +2 -2
- package/dist/lib/taproot/tree.js +12 -7
- package/dist/lib/tx/create.d.ts +1 -1
- package/dist/lib/tx/create.js +28 -12
- package/dist/lib/tx/decode.d.ts +2 -2
- package/dist/lib/tx/decode.js +52 -17
- package/dist/lib/tx/encode.d.ts +2 -2
- package/dist/lib/tx/encode.js +13 -16
- package/dist/lib/tx/index.d.ts +7 -7
- package/dist/lib/tx/index.js +7 -7
- package/dist/lib/tx/parse.d.ts +1 -1
- package/dist/lib/tx/parse.js +9 -9
- package/dist/lib/tx/size.d.ts +2 -2
- package/dist/lib/tx/size.js +9 -11
- package/dist/lib/tx/util.d.ts +2 -2
- package/dist/lib/tx/util.js +22 -20
- package/dist/lib/tx/validate.d.ts +1 -1
- package/dist/lib/tx/validate.js +37 -9
- package/dist/lib/witness/index.d.ts +2 -2
- package/dist/lib/witness/index.js +2 -2
- package/dist/lib/witness/parse.d.ts +2 -2
- package/dist/lib/witness/parse.js +24 -23
- package/dist/lib/witness/util.d.ts +2 -2
- package/dist/lib/witness/util.js +5 -5
- package/dist/main.cjs +3305 -2035
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +3303 -2036
- package/dist/module.mjs.map +1 -1
- package/dist/package.json +24 -19
- package/dist/schema/base.d.ts +1 -1
- package/dist/schema/base.js +17 -13
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +2 -2
- package/dist/schema/taproot.d.ts +1 -1
- package/dist/schema/taproot.js +2 -2
- package/dist/schema/tx.d.ts +1 -1
- package/dist/schema/tx.js +4 -4
- package/dist/script.js +10 -12
- package/dist/script.js.map +1 -1
- package/dist/types/address.d.ts +4 -4
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.js +8 -8
- package/dist/types/meta.d.ts +4 -4
- package/dist/types/psbt.d.ts +2 -2
- package/dist/types/script.d.ts +2 -2
- package/dist/types/sighash.d.ts +2 -2
- package/dist/types/witness.d.ts +5 -5
- package/docs/API.md +1145 -0
- package/docs/CONVENTIONS.md +316 -0
- package/docs/FAQ.md +396 -0
- package/docs/GUIDE.md +1102 -0
- package/package.json +24 -19
- package/src/const.ts +0 -61
- package/src/index.ts +0 -13
- package/src/lib/address/api.ts +0 -50
- package/src/lib/address/encode.ts +0 -183
- package/src/lib/address/index.ts +0 -7
- package/src/lib/address/p2pkh.ts +0 -94
- package/src/lib/address/p2sh.ts +0 -96
- package/src/lib/address/p2tr.ts +0 -91
- package/src/lib/address/p2wpkh.ts +0 -94
- package/src/lib/address/p2wsh.ts +0 -92
- package/src/lib/address/script.ts +0 -63
- package/src/lib/address/util.ts +0 -87
- package/src/lib/meta/index.ts +0 -4
- package/src/lib/meta/locktime.ts +0 -57
- package/src/lib/meta/ref.ts +0 -107
- package/src/lib/meta/scribe.ts +0 -256
- package/src/lib/meta/sequence.ts +0 -146
- package/src/lib/script/decode.ts +0 -85
- package/src/lib/script/encode.ts +0 -129
- package/src/lib/script/index.ts +0 -20
- package/src/lib/script/lock.ts +0 -73
- package/src/lib/script/util.ts +0 -78
- package/src/lib/script/words.ts +0 -182
- package/src/lib/sighash/index.ts +0 -3
- package/src/lib/sighash/segwit.ts +0 -152
- package/src/lib/sighash/taproot.ts +0 -206
- package/src/lib/sighash/util.ts +0 -51
- package/src/lib/signer/index.ts +0 -2
- package/src/lib/signer/sign.ts +0 -39
- package/src/lib/signer/verify.ts +0 -88
- package/src/lib/taproot/cblock.ts +0 -96
- package/src/lib/taproot/encode.ts +0 -49
- package/src/lib/taproot/index.ts +0 -4
- package/src/lib/taproot/parse.ts +0 -65
- package/src/lib/taproot/tree.ts +0 -94
- package/src/lib/tx/create.ts +0 -90
- package/src/lib/tx/decode.ts +0 -123
- package/src/lib/tx/encode.ts +0 -155
- package/src/lib/tx/index.ts +0 -7
- package/src/lib/tx/parse.ts +0 -69
- package/src/lib/tx/size.ts +0 -68
- package/src/lib/tx/util.ts +0 -111
- package/src/lib/tx/validate.ts +0 -49
- package/src/lib/witness/index.ts +0 -2
- package/src/lib/witness/parse.ts +0 -127
- package/src/lib/witness/util.ts +0 -18
- package/src/schema/base.ts +0 -57
- package/src/schema/index.ts +0 -2
- package/src/schema/taproot.ts +0 -12
- package/src/schema/tx.ts +0 -48
- package/src/types/address.ts +0 -35
- package/src/types/index.ts +0 -8
- package/src/types/meta.ts +0 -48
- package/src/types/psbt.ts +0 -15
- package/src/types/script.ts +0 -18
- package/src/types/sighash.ts +0 -16
- package/src/types/taproot.ts +0 -41
- package/src/types/txdata.ts +0 -85
- package/src/types/witness.ts +0 -42
package/dist/types/address.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ScriptInfo } from
|
|
2
|
-
export type AddressFormat =
|
|
3
|
-
export type AddressType =
|
|
4
|
-
export type ChainNetwork =
|
|
1
|
+
import type { ScriptInfo } from "./script.js";
|
|
2
|
+
export type AddressFormat = "base58" | "bech32" | "bech32m";
|
|
3
|
+
export type AddressType = "p2pkh" | "p2sh" | "p2wpkh" | "p2wsh" | "p2tr";
|
|
4
|
+
export type ChainNetwork = "main" | "testnet" | "regtest" | string;
|
|
5
5
|
export type AddressConfigEntry = [
|
|
6
6
|
prefix: string,
|
|
7
7
|
type: AddressType,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
1
|
+
export * from "./address.js";
|
|
2
|
+
export * from "./meta.js";
|
|
3
|
+
export * from "./psbt.js";
|
|
4
|
+
export * from "./script.js";
|
|
5
|
+
export * from "./sighash.js";
|
|
6
|
+
export * from "./taproot.js";
|
|
7
|
+
export * from "./txdata.js";
|
|
8
|
+
export * from "./witness.js";
|
package/dist/types/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
1
|
+
export * from "./address.js";
|
|
2
|
+
export * from "./meta.js";
|
|
3
|
+
export * from "./psbt.js";
|
|
4
|
+
export * from "./script.js";
|
|
5
|
+
export * from "./sighash.js";
|
|
6
|
+
export * from "./taproot.js";
|
|
7
|
+
export * from "./txdata.js";
|
|
8
|
+
export * from "./witness.js";
|
package/dist/types/meta.d.ts
CHANGED
|
@@ -2,20 +2,20 @@ export type LocktimeData = LocktimeStamp | LocktimeHeight;
|
|
|
2
2
|
export type SequenceConfig = Partial<SequenceData>;
|
|
3
3
|
export type SequenceData = SequenceHeightLock | SequenceStampLock;
|
|
4
4
|
export interface LocktimeStamp {
|
|
5
|
-
type:
|
|
5
|
+
type: "timelock";
|
|
6
6
|
stamp: number;
|
|
7
7
|
}
|
|
8
8
|
export interface LocktimeHeight {
|
|
9
|
-
type:
|
|
9
|
+
type: "heightlock";
|
|
10
10
|
height: number;
|
|
11
11
|
}
|
|
12
12
|
export interface SequenceStampLock {
|
|
13
13
|
stamp: number;
|
|
14
|
-
mode:
|
|
14
|
+
mode: "stamp";
|
|
15
15
|
}
|
|
16
16
|
export interface SequenceHeightLock {
|
|
17
17
|
height: number;
|
|
18
|
-
mode:
|
|
18
|
+
mode: "height";
|
|
19
19
|
}
|
|
20
20
|
export interface LocktimeField {
|
|
21
21
|
hex: string;
|
package/dist/types/psbt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Transaction } from
|
|
2
|
-
import type { TransactionInput, TransactionOutput } from
|
|
1
|
+
import type { Transaction } from "@scure/btc-signer";
|
|
2
|
+
import type { TransactionInput, TransactionOutput } from "@scure/btc-signer/psbt.js";
|
|
3
3
|
export type PSBTData = Transaction;
|
|
4
4
|
export type PSBTInput = TransactionInput;
|
|
5
5
|
export type PSBTOutput = TransactionOutput;
|
package/dist/types/script.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type LockScriptType =
|
|
2
|
-
export type SpendScriptType =
|
|
1
|
+
export type LockScriptType = "p2pkh" | "p2sh" | "p2wpkh" | "p2wsh" | "p2tr" | "opreturn";
|
|
2
|
+
export type SpendScriptType = "p2pkh" | "p2sh" | "p2wpkh" | "p2wsh" | "p2tr" | "p2ts";
|
|
3
3
|
export type WitnessVersion = 0 | 1 | null;
|
|
4
4
|
export interface ScriptInfo {
|
|
5
5
|
asm: string[];
|
package/dist/types/sighash.d.ts
CHANGED
package/dist/types/witness.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SpendScriptType, WitnessVersion } from
|
|
1
|
+
import type { SpendScriptType, WitnessVersion } from "./script.js";
|
|
2
2
|
export type WitnessContext = WitnessData | TaprootScript | SegwitScript | TaprootSpend | SegwitSpend;
|
|
3
3
|
export interface WitnessSize {
|
|
4
4
|
total: number;
|
|
@@ -16,19 +16,19 @@ export interface WitnessData {
|
|
|
16
16
|
export interface TaprootScript extends WitnessData {
|
|
17
17
|
cblock: string;
|
|
18
18
|
script: string;
|
|
19
|
-
type:
|
|
19
|
+
type: "p2ts";
|
|
20
20
|
version: 1;
|
|
21
21
|
}
|
|
22
22
|
export interface SegwitScript extends WitnessData {
|
|
23
23
|
script: string;
|
|
24
|
-
type:
|
|
24
|
+
type: "p2wsh";
|
|
25
25
|
version: 0;
|
|
26
26
|
}
|
|
27
27
|
export interface TaprootSpend extends WitnessData {
|
|
28
|
-
type:
|
|
28
|
+
type: "p2tr";
|
|
29
29
|
version: 1;
|
|
30
30
|
}
|
|
31
31
|
export interface SegwitSpend extends WitnessData {
|
|
32
|
-
type:
|
|
32
|
+
type: "p2wpkh";
|
|
33
33
|
version: 0;
|
|
34
34
|
}
|