@teleportdao/bitcoin 2.0.4 → 2.0.7
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/dist/bitcoin-interface-ordinal.d.ts +108 -108
- package/dist/bitcoin-interface-ordinal.js +140 -140
- package/dist/bitcoin-interface-teleswap.d.ts +101 -101
- package/dist/bitcoin-interface-teleswap.d.ts.map +1 -1
- package/dist/bitcoin-interface-teleswap.js +176 -165
- package/dist/bitcoin-interface-teleswap.js.map +1 -1
- package/dist/bitcoin-interface-utils.d.ts +20 -20
- package/dist/bitcoin-interface-utils.js +45 -45
- package/dist/bitcoin-interface-wallet.d.ts +28 -28
- package/dist/bitcoin-interface-wallet.js +125 -125
- package/dist/bitcoin-interface.d.ts +66 -66
- package/dist/bitcoin-interface.js +119 -119
- package/dist/bitcoin-utils.d.ts +96 -96
- package/dist/bitcoin-utils.js +514 -514
- package/dist/bitcoin-wallet-base.d.ts +111 -111
- package/dist/bitcoin-wallet-base.js +258 -258
- package/dist/helper/brc20-helper.d.ts +42 -42
- package/dist/helper/brc20-helper.js +127 -127
- package/dist/helper/index.d.ts +3 -3
- package/dist/helper/index.js +29 -29
- package/dist/helper/ordinal-helper.d.ts +12 -12
- package/dist/helper/ordinal-helper.js +129 -129
- package/dist/helper/teleswap-helper.d.ts +95 -95
- package/dist/helper/teleswap-helper.js +186 -186
- package/dist/index.d.ts +12 -12
- package/dist/index.js +41 -41
- package/dist/ordinal-wallet.d.ts +495 -495
- package/dist/ordinal-wallet.js +386 -386
- package/dist/sign/index.d.ts +1 -1
- package/dist/sign/index.js +8 -8
- package/dist/sign/sign-transaction.d.ts +12 -12
- package/dist/sign/sign-transaction.js +82 -82
- package/dist/teleswap-wallet.d.ts +45 -45
- package/dist/teleswap-wallet.js +68 -68
- package/dist/transaction-builder/bitcoin-transaction-builder.d.ts +9 -9
- package/dist/transaction-builder/bitcoin-transaction-builder.js +54 -54
- package/dist/transaction-builder/index.d.ts +3 -3
- package/dist/transaction-builder/index.js +19 -19
- package/dist/transaction-builder/ordinal-transaction-builder.d.ts +63 -63
- package/dist/transaction-builder/ordinal-transaction-builder.js +125 -125
- package/dist/transaction-builder/transaction-builder.d.ts +223 -223
- package/dist/transaction-builder/transaction-builder.js +447 -447
- package/dist/type.d.ts +61 -61
- package/dist/type.js +2 -2
- package/dist/utils/networks.d.ts +5 -5
- package/dist/utils/networks.js +53 -53
- package/dist/utils/tools.d.ts +18 -18
- package/dist/utils/tools.js +74 -74
- package/package.json +4 -4
- package/src/bitcoin-interface-ordinal.ts +185 -185
- package/src/bitcoin-interface-teleswap.ts +251 -237
- package/src/bitcoin-interface-utils.ts +60 -60
- package/src/bitcoin-interface-wallet.ts +114 -114
- package/src/bitcoin-interface.ts +156 -156
- package/src/bitcoin-utils.ts +591 -591
- package/src/bitcoin-wallet-base.ts +344 -344
- package/src/helper/brc20-helper.ts +179 -179
- package/src/helper/ordinal-helper.ts +118 -118
- package/src/index.ts +15 -15
- package/src/ordinal-wallet.ts +659 -659
- package/src/sign/index.ts +1 -1
- package/src/sign/sign-transaction.ts +108 -108
- package/src/teleswap-wallet.ts +133 -133
- package/src/transaction-builder/bitcoin-transaction-builder.ts +26 -26
- package/src/transaction-builder/index.ts +3 -3
- package/src/transaction-builder/ordinal-transaction-builder.ts +139 -139
- package/src/transaction-builder/transaction-builder.ts +690 -690
- package/src/type.ts +74 -74
- package/src/utils/networks.ts +33 -33
- package/src/utils/tools.ts +92 -92
- package/tsconfig.json +9 -9
- package/webpack.config.js +16 -16
- package/.tmp/block-parser.ts +0 -58
- package/.tmp/check.ts +0 -101
- package/.tmp/ordinal-helper.ts +0 -133
- package/.tmp/ordinal.ts +0 -25
- package/.tmp/psbt/sign-transaction.ts +0 -121
- package/.tmp/rbf.ts +0 -45
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Network, Payment } from "bitcoinjs-lib";
|
|
3
|
-
import { BitcoinTransactionBuilder } from "./transaction-builder";
|
|
4
|
-
import type { RPCConnectionInfo, UtxoConnectionInfo } from "./type";
|
|
5
|
-
import type { ExtendedUtxo, SignerInfo, Target, TargetAddress } from "./transaction-builder/transaction-builder";
|
|
6
|
-
import BitcoinSign from "./sign/sign-transaction";
|
|
7
|
-
import { BitcoinInterfaceWallet } from "./bitcoin-interface-wallet";
|
|
8
|
-
export type FeeRateType = "normal" | "slow" | "fast" | number;
|
|
9
|
-
export declare class BitcoinBaseWallet {
|
|
10
|
-
network: Network;
|
|
11
|
-
hdWalletPath: {
|
|
12
|
-
p2pkh: string;
|
|
13
|
-
p2wpkh: string;
|
|
14
|
-
"p2sh-p2wpkh": string;
|
|
15
|
-
p2sh: string;
|
|
16
|
-
p2wsh: string;
|
|
17
|
-
"p2sh-p2wsh": string;
|
|
18
|
-
p2tr: string;
|
|
19
|
-
};
|
|
20
|
-
transactionBuilder: BitcoinTransactionBuilder;
|
|
21
|
-
btcInterface: BitcoinInterfaceWallet;
|
|
22
|
-
signer: BitcoinSign;
|
|
23
|
-
currentAccount?: string;
|
|
24
|
-
currentAccountType?: string;
|
|
25
|
-
privateKey?: Buffer;
|
|
26
|
-
publicKey?: Buffer;
|
|
27
|
-
publicKeys?: Buffer[];
|
|
28
|
-
addressObj?: Payment;
|
|
29
|
-
bitcoinAddress: string | undefined;
|
|
30
|
-
constructor(networkName: string, connectionInfo?: {
|
|
31
|
-
utxo?: UtxoConnectionInfo;
|
|
32
|
-
rpc?: RPCConnectionInfo;
|
|
33
|
-
});
|
|
34
|
-
static satoshiToBTC(satoshi: number | string): string;
|
|
35
|
-
static btcToSatoshi(btc: number | string): string;
|
|
36
|
-
get signerInfo(): {
|
|
37
|
-
address: string;
|
|
38
|
-
publicKey: string;
|
|
39
|
-
addressType: string;
|
|
40
|
-
} | undefined;
|
|
41
|
-
setAccountPrivateKey(privateKeyHex: string): void;
|
|
42
|
-
setAccountType(accountType?: string): string;
|
|
43
|
-
setAccountPrivateKeyByMnemonic({ mnemonic, mnemonicPassword, index, walletNumber, addressType, }: {
|
|
44
|
-
mnemonic: string;
|
|
45
|
-
mnemonicPassword?: string;
|
|
46
|
-
index?: number;
|
|
47
|
-
walletNumber?: number;
|
|
48
|
-
addressType?: string;
|
|
49
|
-
}): string;
|
|
50
|
-
checkBalanceIsSufficient({ targets, extendedUtxo, changeAddress, feeRate, }: {
|
|
51
|
-
targets: Target[];
|
|
52
|
-
extendedUtxo: ExtendedUtxo[];
|
|
53
|
-
changeAddress: string;
|
|
54
|
-
feeRate: number;
|
|
55
|
-
}): boolean;
|
|
56
|
-
getExtendedUtxo(input: SignerInfo): Promise<{
|
|
57
|
-
hash: string;
|
|
58
|
-
value: number;
|
|
59
|
-
index: number;
|
|
60
|
-
signerInfo: SignerInfo;
|
|
61
|
-
}[]>;
|
|
62
|
-
getFeeRate(feeRate?: FeeRateType): Promise<number>;
|
|
63
|
-
sendBTC(receiverAddress: string, amountInSatoshi: number | "all", fee?: FeeRateType, staticExtendedUtxo?: ExtendedUtxo[]): Promise<string>;
|
|
64
|
-
sendBTCMultipleAddress(receivers: TargetAddress[], fee?: FeeRateType, staticExtendedUtxo?: ExtendedUtxo[]): Promise<string>;
|
|
65
|
-
sendBTCToMultipleAddressUnsignedTx(receivers: TargetAddress[], signerInfo: SignerInfo, fee?: FeeRateType, staticExtendedUtxo?: ExtendedUtxo[], fullAmount?: boolean): Promise<{
|
|
66
|
-
unsignedTransaction: string;
|
|
67
|
-
outputs: Target[];
|
|
68
|
-
inputs: {
|
|
69
|
-
hash: string;
|
|
70
|
-
value: number;
|
|
71
|
-
index: number;
|
|
72
|
-
signerInfo: SignerInfo;
|
|
73
|
-
}[];
|
|
74
|
-
fee: number;
|
|
75
|
-
change: import("./transaction-builder").ChangeTarget | undefined;
|
|
76
|
-
possibleTxId: string | undefined;
|
|
77
|
-
}>;
|
|
78
|
-
sendBTCUnsignedTx(receiver: string, amountInSatoshi: number | "all", signerInfo: SignerInfo, fee?: FeeRateType, staticExtendedUtxo?: ExtendedUtxo[]): Promise<{
|
|
79
|
-
unsignedTransaction: string;
|
|
80
|
-
outputs: Target[];
|
|
81
|
-
inputs: {
|
|
82
|
-
hash: string;
|
|
83
|
-
value: number;
|
|
84
|
-
index: number;
|
|
85
|
-
signerInfo: SignerInfo;
|
|
86
|
-
}[];
|
|
87
|
-
fee: number;
|
|
88
|
-
change: import("./transaction-builder").ChangeTarget | undefined;
|
|
89
|
-
possibleTxId: string | undefined;
|
|
90
|
-
}>;
|
|
91
|
-
sendSignedTx(signedTx: string): Promise<string>;
|
|
92
|
-
sendSignedPsbt(signedPsbt: string): Promise<string>;
|
|
93
|
-
sendSignedPsbtWithRetry(signedPsbt: string, { maxTries, retrySleep }?: {
|
|
94
|
-
maxTries?: number | undefined;
|
|
95
|
-
retrySleep?: number | undefined;
|
|
96
|
-
}): Promise<string>;
|
|
97
|
-
sendMultiSignedPsbt(signedPsbts?: string[]): Promise<string>;
|
|
98
|
-
increaseTransactionFeeUnsignedPsbt(txId: string, signerInfos: SignerInfo[], extraExtendedUtxo: ExtendedUtxo[], changeAddress: string, staticFeeRate?: number): Promise<{
|
|
99
|
-
unsignedTransaction: string;
|
|
100
|
-
outputs: Target[];
|
|
101
|
-
inputs: {
|
|
102
|
-
hash: string;
|
|
103
|
-
value: number;
|
|
104
|
-
index: number;
|
|
105
|
-
signerInfo: SignerInfo;
|
|
106
|
-
}[];
|
|
107
|
-
fee: number;
|
|
108
|
-
change: import("./transaction-builder").ChangeTarget | undefined;
|
|
109
|
-
possibleTxId: string | undefined;
|
|
110
|
-
}>;
|
|
111
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Network, Payment } from "bitcoinjs-lib";
|
|
3
|
+
import { BitcoinTransactionBuilder } from "./transaction-builder";
|
|
4
|
+
import type { RPCConnectionInfo, UtxoConnectionInfo } from "./type";
|
|
5
|
+
import type { ExtendedUtxo, SignerInfo, Target, TargetAddress } from "./transaction-builder/transaction-builder";
|
|
6
|
+
import BitcoinSign from "./sign/sign-transaction";
|
|
7
|
+
import { BitcoinInterfaceWallet } from "./bitcoin-interface-wallet";
|
|
8
|
+
export type FeeRateType = "normal" | "slow" | "fast" | number;
|
|
9
|
+
export declare class BitcoinBaseWallet {
|
|
10
|
+
network: Network;
|
|
11
|
+
hdWalletPath: {
|
|
12
|
+
p2pkh: string;
|
|
13
|
+
p2wpkh: string;
|
|
14
|
+
"p2sh-p2wpkh": string;
|
|
15
|
+
p2sh: string;
|
|
16
|
+
p2wsh: string;
|
|
17
|
+
"p2sh-p2wsh": string;
|
|
18
|
+
p2tr: string;
|
|
19
|
+
};
|
|
20
|
+
transactionBuilder: BitcoinTransactionBuilder;
|
|
21
|
+
btcInterface: BitcoinInterfaceWallet;
|
|
22
|
+
signer: BitcoinSign;
|
|
23
|
+
currentAccount?: string;
|
|
24
|
+
currentAccountType?: string;
|
|
25
|
+
privateKey?: Buffer;
|
|
26
|
+
publicKey?: Buffer;
|
|
27
|
+
publicKeys?: Buffer[];
|
|
28
|
+
addressObj?: Payment;
|
|
29
|
+
bitcoinAddress: string | undefined;
|
|
30
|
+
constructor(networkName: string, connectionInfo?: {
|
|
31
|
+
utxo?: UtxoConnectionInfo;
|
|
32
|
+
rpc?: RPCConnectionInfo;
|
|
33
|
+
});
|
|
34
|
+
static satoshiToBTC(satoshi: number | string): string;
|
|
35
|
+
static btcToSatoshi(btc: number | string): string;
|
|
36
|
+
get signerInfo(): {
|
|
37
|
+
address: string;
|
|
38
|
+
publicKey: string;
|
|
39
|
+
addressType: string;
|
|
40
|
+
} | undefined;
|
|
41
|
+
setAccountPrivateKey(privateKeyHex: string): void;
|
|
42
|
+
setAccountType(accountType?: string): string;
|
|
43
|
+
setAccountPrivateKeyByMnemonic({ mnemonic, mnemonicPassword, index, walletNumber, addressType, }: {
|
|
44
|
+
mnemonic: string;
|
|
45
|
+
mnemonicPassword?: string;
|
|
46
|
+
index?: number;
|
|
47
|
+
walletNumber?: number;
|
|
48
|
+
addressType?: string;
|
|
49
|
+
}): string;
|
|
50
|
+
checkBalanceIsSufficient({ targets, extendedUtxo, changeAddress, feeRate, }: {
|
|
51
|
+
targets: Target[];
|
|
52
|
+
extendedUtxo: ExtendedUtxo[];
|
|
53
|
+
changeAddress: string;
|
|
54
|
+
feeRate: number;
|
|
55
|
+
}): boolean;
|
|
56
|
+
getExtendedUtxo(input: SignerInfo): Promise<{
|
|
57
|
+
hash: string;
|
|
58
|
+
value: number;
|
|
59
|
+
index: number;
|
|
60
|
+
signerInfo: SignerInfo;
|
|
61
|
+
}[]>;
|
|
62
|
+
getFeeRate(feeRate?: FeeRateType): Promise<number>;
|
|
63
|
+
sendBTC(receiverAddress: string, amountInSatoshi: number | "all", fee?: FeeRateType, staticExtendedUtxo?: ExtendedUtxo[]): Promise<string>;
|
|
64
|
+
sendBTCMultipleAddress(receivers: TargetAddress[], fee?: FeeRateType, staticExtendedUtxo?: ExtendedUtxo[]): Promise<string>;
|
|
65
|
+
sendBTCToMultipleAddressUnsignedTx(receivers: TargetAddress[], signerInfo: SignerInfo, fee?: FeeRateType, staticExtendedUtxo?: ExtendedUtxo[], fullAmount?: boolean): Promise<{
|
|
66
|
+
unsignedTransaction: string;
|
|
67
|
+
outputs: Target[];
|
|
68
|
+
inputs: {
|
|
69
|
+
hash: string;
|
|
70
|
+
value: number;
|
|
71
|
+
index: number;
|
|
72
|
+
signerInfo: SignerInfo;
|
|
73
|
+
}[];
|
|
74
|
+
fee: number;
|
|
75
|
+
change: import("./transaction-builder").ChangeTarget | undefined;
|
|
76
|
+
possibleTxId: string | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
sendBTCUnsignedTx(receiver: string, amountInSatoshi: number | "all", signerInfo: SignerInfo, fee?: FeeRateType, staticExtendedUtxo?: ExtendedUtxo[]): Promise<{
|
|
79
|
+
unsignedTransaction: string;
|
|
80
|
+
outputs: Target[];
|
|
81
|
+
inputs: {
|
|
82
|
+
hash: string;
|
|
83
|
+
value: number;
|
|
84
|
+
index: number;
|
|
85
|
+
signerInfo: SignerInfo;
|
|
86
|
+
}[];
|
|
87
|
+
fee: number;
|
|
88
|
+
change: import("./transaction-builder").ChangeTarget | undefined;
|
|
89
|
+
possibleTxId: string | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
sendSignedTx(signedTx: string): Promise<string>;
|
|
92
|
+
sendSignedPsbt(signedPsbt: string): Promise<string>;
|
|
93
|
+
sendSignedPsbtWithRetry(signedPsbt: string, { maxTries, retrySleep }?: {
|
|
94
|
+
maxTries?: number | undefined;
|
|
95
|
+
retrySleep?: number | undefined;
|
|
96
|
+
}): Promise<string>;
|
|
97
|
+
sendMultiSignedPsbt(signedPsbts?: string[]): Promise<string>;
|
|
98
|
+
increaseTransactionFeeUnsignedPsbt(txId: string, signerInfos: SignerInfo[], extraExtendedUtxo: ExtendedUtxo[], changeAddress: string, staticFeeRate?: number): Promise<{
|
|
99
|
+
unsignedTransaction: string;
|
|
100
|
+
outputs: Target[];
|
|
101
|
+
inputs: {
|
|
102
|
+
hash: string;
|
|
103
|
+
value: number;
|
|
104
|
+
index: number;
|
|
105
|
+
signerInfo: SignerInfo;
|
|
106
|
+
}[];
|
|
107
|
+
fee: number;
|
|
108
|
+
change: import("./transaction-builder").ChangeTarget | undefined;
|
|
109
|
+
possibleTxId: string | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
}
|
|
112
112
|
//# sourceMappingURL=bitcoin-wallet-base.d.ts.map
|