@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.
Files changed (78) hide show
  1. package/dist/bitcoin-interface-ordinal.d.ts +108 -108
  2. package/dist/bitcoin-interface-ordinal.js +140 -140
  3. package/dist/bitcoin-interface-teleswap.d.ts +101 -101
  4. package/dist/bitcoin-interface-teleswap.d.ts.map +1 -1
  5. package/dist/bitcoin-interface-teleswap.js +176 -165
  6. package/dist/bitcoin-interface-teleswap.js.map +1 -1
  7. package/dist/bitcoin-interface-utils.d.ts +20 -20
  8. package/dist/bitcoin-interface-utils.js +45 -45
  9. package/dist/bitcoin-interface-wallet.d.ts +28 -28
  10. package/dist/bitcoin-interface-wallet.js +125 -125
  11. package/dist/bitcoin-interface.d.ts +66 -66
  12. package/dist/bitcoin-interface.js +119 -119
  13. package/dist/bitcoin-utils.d.ts +96 -96
  14. package/dist/bitcoin-utils.js +514 -514
  15. package/dist/bitcoin-wallet-base.d.ts +111 -111
  16. package/dist/bitcoin-wallet-base.js +258 -258
  17. package/dist/helper/brc20-helper.d.ts +42 -42
  18. package/dist/helper/brc20-helper.js +127 -127
  19. package/dist/helper/index.d.ts +3 -3
  20. package/dist/helper/index.js +29 -29
  21. package/dist/helper/ordinal-helper.d.ts +12 -12
  22. package/dist/helper/ordinal-helper.js +129 -129
  23. package/dist/helper/teleswap-helper.d.ts +95 -95
  24. package/dist/helper/teleswap-helper.js +186 -186
  25. package/dist/index.d.ts +12 -12
  26. package/dist/index.js +41 -41
  27. package/dist/ordinal-wallet.d.ts +495 -495
  28. package/dist/ordinal-wallet.js +386 -386
  29. package/dist/sign/index.d.ts +1 -1
  30. package/dist/sign/index.js +8 -8
  31. package/dist/sign/sign-transaction.d.ts +12 -12
  32. package/dist/sign/sign-transaction.js +82 -82
  33. package/dist/teleswap-wallet.d.ts +45 -45
  34. package/dist/teleswap-wallet.js +68 -68
  35. package/dist/transaction-builder/bitcoin-transaction-builder.d.ts +9 -9
  36. package/dist/transaction-builder/bitcoin-transaction-builder.js +54 -54
  37. package/dist/transaction-builder/index.d.ts +3 -3
  38. package/dist/transaction-builder/index.js +19 -19
  39. package/dist/transaction-builder/ordinal-transaction-builder.d.ts +63 -63
  40. package/dist/transaction-builder/ordinal-transaction-builder.js +125 -125
  41. package/dist/transaction-builder/transaction-builder.d.ts +223 -223
  42. package/dist/transaction-builder/transaction-builder.js +447 -447
  43. package/dist/type.d.ts +61 -61
  44. package/dist/type.js +2 -2
  45. package/dist/utils/networks.d.ts +5 -5
  46. package/dist/utils/networks.js +53 -53
  47. package/dist/utils/tools.d.ts +18 -18
  48. package/dist/utils/tools.js +74 -74
  49. package/package.json +4 -4
  50. package/src/bitcoin-interface-ordinal.ts +185 -185
  51. package/src/bitcoin-interface-teleswap.ts +251 -237
  52. package/src/bitcoin-interface-utils.ts +60 -60
  53. package/src/bitcoin-interface-wallet.ts +114 -114
  54. package/src/bitcoin-interface.ts +156 -156
  55. package/src/bitcoin-utils.ts +591 -591
  56. package/src/bitcoin-wallet-base.ts +344 -344
  57. package/src/helper/brc20-helper.ts +179 -179
  58. package/src/helper/ordinal-helper.ts +118 -118
  59. package/src/index.ts +15 -15
  60. package/src/ordinal-wallet.ts +659 -659
  61. package/src/sign/index.ts +1 -1
  62. package/src/sign/sign-transaction.ts +108 -108
  63. package/src/teleswap-wallet.ts +133 -133
  64. package/src/transaction-builder/bitcoin-transaction-builder.ts +26 -26
  65. package/src/transaction-builder/index.ts +3 -3
  66. package/src/transaction-builder/ordinal-transaction-builder.ts +139 -139
  67. package/src/transaction-builder/transaction-builder.ts +690 -690
  68. package/src/type.ts +74 -74
  69. package/src/utils/networks.ts +33 -33
  70. package/src/utils/tools.ts +92 -92
  71. package/tsconfig.json +9 -9
  72. package/webpack.config.js +16 -16
  73. package/.tmp/block-parser.ts +0 -58
  74. package/.tmp/check.ts +0 -101
  75. package/.tmp/ordinal-helper.ts +0 -133
  76. package/.tmp/ordinal.ts +0 -25
  77. package/.tmp/psbt/sign-transaction.ts +0 -121
  78. package/.tmp/rbf.ts +0 -45
@@ -1,46 +1,46 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BitcoinInterfaceUtils = void 0;
7
- const networks_1 = __importDefault(require("./utils/networks"));
8
- const bitcoin_utils_1 = require("./bitcoin-utils");
9
- class BitcoinInterfaceUtils {
10
- constructor(networkName) {
11
- this.testnet = networkName.includes("_testnet");
12
- this.network = networks_1.default[networkName];
13
- }
14
- convertHashToAddress(hashHex, addressType) {
15
- let addressObj = (0, bitcoin_utils_1.createAddressObjectByHash)({ addressType, hash: Buffer.from(hashHex, "hex") }, this.network);
16
- if (!addressObj.address)
17
- throw new Error("incorrect input");
18
- return addressObj.address;
19
- }
20
- convertScriptToAddress(scriptHex, addressType) {
21
- let addressObj = (0, bitcoin_utils_1.createAddressObjectByScript)({ addressType, script: Buffer.from(scriptHex, "hex") }, this.network);
22
- if (!addressObj.address)
23
- throw new Error("incorrect input");
24
- return addressObj.address;
25
- }
26
- convertAddressToScript(address) {
27
- let { addressObject, addressType } = (0, bitcoin_utils_1.createAddressObjectByAddress)(address, this.network);
28
- const hash = addressType === "p2tr" ? addressObject.pubkey : addressObject.hash;
29
- return {
30
- script: addressObject.output,
31
- hash,
32
- addressType,
33
- };
34
- }
35
- convertAddressToObject(address) {
36
- let addObj = (0, bitcoin_utils_1.createAddressObjectByAddress)(address, this.network);
37
- return addObj;
38
- }
39
- createAddressObjectByPublicKey(publicKey, addressType) {
40
- let addObj = (0, bitcoin_utils_1.createAddressObjectByPublicKey)({ publicKey: Buffer.from(publicKey, "hex"), addressType }, this.network);
41
- return addObj;
42
- }
43
- }
44
- exports.BitcoinInterfaceUtils = BitcoinInterfaceUtils;
45
- exports.default = BitcoinInterfaceUtils;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BitcoinInterfaceUtils = void 0;
7
+ const networks_1 = __importDefault(require("./utils/networks"));
8
+ const bitcoin_utils_1 = require("./bitcoin-utils");
9
+ class BitcoinInterfaceUtils {
10
+ constructor(networkName) {
11
+ this.testnet = networkName.includes("_testnet");
12
+ this.network = networks_1.default[networkName];
13
+ }
14
+ convertHashToAddress(hashHex, addressType) {
15
+ let addressObj = (0, bitcoin_utils_1.createAddressObjectByHash)({ addressType, hash: Buffer.from(hashHex, "hex") }, this.network);
16
+ if (!addressObj.address)
17
+ throw new Error("incorrect input");
18
+ return addressObj.address;
19
+ }
20
+ convertScriptToAddress(scriptHex, addressType) {
21
+ let addressObj = (0, bitcoin_utils_1.createAddressObjectByScript)({ addressType, script: Buffer.from(scriptHex, "hex") }, this.network);
22
+ if (!addressObj.address)
23
+ throw new Error("incorrect input");
24
+ return addressObj.address;
25
+ }
26
+ convertAddressToScript(address) {
27
+ let { addressObject, addressType } = (0, bitcoin_utils_1.createAddressObjectByAddress)(address, this.network);
28
+ const hash = addressType === "p2tr" ? addressObject.pubkey : addressObject.hash;
29
+ return {
30
+ script: addressObject.output,
31
+ hash,
32
+ addressType,
33
+ };
34
+ }
35
+ convertAddressToObject(address) {
36
+ let addObj = (0, bitcoin_utils_1.createAddressObjectByAddress)(address, this.network);
37
+ return addObj;
38
+ }
39
+ createAddressObjectByPublicKey(publicKey, addressType) {
40
+ let addObj = (0, bitcoin_utils_1.createAddressObjectByPublicKey)({ publicKey: Buffer.from(publicKey, "hex"), addressType }, this.network);
41
+ return addObj;
42
+ }
43
+ }
44
+ exports.BitcoinInterfaceUtils = BitcoinInterfaceUtils;
45
+ exports.default = BitcoinInterfaceUtils;
46
46
  //# sourceMappingURL=bitcoin-interface-utils.js.map
@@ -1,29 +1,29 @@
1
- import { bitcoin as bitcoinProvider } from "@teleportdao/providers";
2
- import { BitcoinInterfaceUtils } from "./bitcoin-interface-utils";
3
- import type { BitcoinWalletInterfaceConnectionInfo } from "./type";
4
- import type { SignerInfo } from "./transaction-builder/transaction-builder";
5
- export declare class BitcoinInterfaceWallet extends BitcoinInterfaceUtils {
6
- utxoProvider: bitcoinProvider.Types.UtxoProvider;
7
- apiProvider: bitcoinProvider.MempoolSpace;
8
- constructor(networkName: string, connectionInfo?: BitcoinWalletInterfaceConnectionInfo);
9
- getFeeRate(speed?: "normal" | "slow" | "fast"): Promise<number>;
10
- getUtxo(address: string): Promise<bitcoinProvider.Types.Utxo[]>;
11
- getRawTransaction(txId: string): Promise<string>;
12
- sendRawTransaction(txHex: string): Promise<string>;
13
- getExtendedUtxo(signerInfo: SignerInfo): Promise<{
14
- hash: string;
15
- value: number;
16
- index: number;
17
- signerInfo: SignerInfo;
18
- }[]>;
19
- getAddressesUtxo(allAddresses: string[]): Promise<bitcoinProvider.Types.Utxo[]>;
20
- getAddressesExtendedUtxo(signerInfos: SignerInfo[]): Promise<{
21
- hash: string;
22
- value: number;
23
- index: number;
24
- signerInfo: SignerInfo;
25
- }[]>;
26
- getBalance(address: string): Promise<number>;
27
- }
28
- export default BitcoinInterfaceWallet;
1
+ import { bitcoin as bitcoinProvider } from "@teleportdao/providers";
2
+ import { BitcoinInterfaceUtils } from "./bitcoin-interface-utils";
3
+ import type { BitcoinWalletInterfaceConnectionInfo } from "./type";
4
+ import type { SignerInfo } from "./transaction-builder/transaction-builder";
5
+ export declare class BitcoinInterfaceWallet extends BitcoinInterfaceUtils {
6
+ utxoProvider: bitcoinProvider.Types.UtxoProvider;
7
+ apiProvider: bitcoinProvider.MempoolSpace;
8
+ constructor(networkName: string, connectionInfo?: BitcoinWalletInterfaceConnectionInfo);
9
+ getFeeRate(speed?: "normal" | "slow" | "fast"): Promise<number>;
10
+ getUtxo(address: string): Promise<bitcoinProvider.Types.Utxo[]>;
11
+ getRawTransaction(txId: string): Promise<string>;
12
+ sendRawTransaction(txHex: string): Promise<string>;
13
+ getExtendedUtxo(signerInfo: SignerInfo): Promise<{
14
+ hash: string;
15
+ value: number;
16
+ index: number;
17
+ signerInfo: SignerInfo;
18
+ }[]>;
19
+ getAddressesUtxo(allAddresses: string[]): Promise<bitcoinProvider.Types.Utxo[]>;
20
+ getAddressesExtendedUtxo(signerInfos: SignerInfo[]): Promise<{
21
+ hash: string;
22
+ value: number;
23
+ index: number;
24
+ signerInfo: SignerInfo;
25
+ }[]>;
26
+ getBalance(address: string): Promise<number>;
27
+ }
28
+ export default BitcoinInterfaceWallet;
29
29
  //# sourceMappingURL=bitcoin-interface-wallet.d.ts.map
@@ -1,126 +1,126 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BitcoinInterfaceWallet = void 0;
13
- const providers_1 = require("@teleportdao/providers");
14
- const bitcoin_interface_utils_1 = require("./bitcoin-interface-utils");
15
- class BitcoinInterfaceWallet extends bitcoin_interface_utils_1.BitcoinInterfaceUtils {
16
- constructor(networkName, connectionInfo) {
17
- var _a;
18
- super(networkName);
19
- if (((_a = connectionInfo === null || connectionInfo === void 0 ? void 0 : connectionInfo.api) === null || _a === void 0 ? void 0 : _a.provider) === "BlockStream") {
20
- this.apiProvider = new providers_1.bitcoin.BlockStream(this.testnet);
21
- }
22
- else {
23
- this.apiProvider = new providers_1.bitcoin.MempoolSpace(this.testnet);
24
- }
25
- this.utxoProvider = (connectionInfo === null || connectionInfo === void 0 ? void 0 : connectionInfo.utxo)
26
- ? providers_1.bitcoin.getUtxoProvider(connectionInfo.utxo, networkName)
27
- : this.apiProvider;
28
- }
29
- getFeeRate(speed) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- return new providers_1.bitcoin.MempoolSpace(this.testnet).getRecommendedFeeRate(speed);
32
- });
33
- }
34
- getUtxo(address) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- if (!this.utxoProvider) {
37
- throw new Error("utxo provider not set");
38
- }
39
- return this.utxoProvider.getUtxos(address);
40
- });
41
- }
42
- getRawTransaction(txId) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- if (this.utxoProvider.getRawTransaction) {
45
- return this.utxoProvider.getRawTransaction(txId);
46
- }
47
- return this.apiProvider.getRawTransaction(txId);
48
- });
49
- }
50
- sendRawTransaction(txHex) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- if (this.utxoProvider.sendRawTransaction) {
53
- return this.utxoProvider.sendRawTransaction(txHex);
54
- }
55
- return this.apiProvider.sendRawTransaction(txHex);
56
- });
57
- }
58
- getExtendedUtxo(signerInfo) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- let utxos = yield this.getUtxo(signerInfo.address);
61
- return utxos.map((tx) => ({
62
- hash: tx.txId,
63
- value: tx.value,
64
- index: tx.index,
65
- signerInfo,
66
- }));
67
- });
68
- }
69
- getAddressesUtxo(allAddresses) {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- const chunkOfAddresses = [];
72
- const chunkLength = 20;
73
- for (let i = 0; i < allAddresses.length; i += chunkLength) {
74
- const tmp = allAddresses.slice(i, i + chunkLength);
75
- chunkOfAddresses.push(tmp);
76
- }
77
- let results = [];
78
- for (let addresses of chunkOfAddresses) {
79
- const allPromises = [];
80
- for (let address of addresses) {
81
- let promise = yield this.getUtxo(address);
82
- allPromises.push(promise);
83
- }
84
- let result = yield Promise.all(allPromises);
85
- if (result.flat(1).length === 0) {
86
- break;
87
- }
88
- results.push(result.flat(1));
89
- }
90
- return results.flat(1);
91
- });
92
- }
93
- getAddressesExtendedUtxo(signerInfos) {
94
- return __awaiter(this, void 0, void 0, function* () {
95
- const chunkOfAddresses = [];
96
- const chunkLength = 20;
97
- for (let i = 0; i < signerInfos.length; i += chunkLength) {
98
- const tmp = signerInfos.slice(i, i + chunkLength);
99
- chunkOfAddresses.push(tmp);
100
- }
101
- let results = [];
102
- for (let addresses of chunkOfAddresses) {
103
- const allPromises = [];
104
- for (let signerInfo of addresses) {
105
- let promise = yield this.getExtendedUtxo(signerInfo);
106
- allPromises.push(promise);
107
- }
108
- let result = yield Promise.all(allPromises);
109
- if (result.flat(1).length === 0) {
110
- break;
111
- }
112
- results.push(result.flat(1));
113
- }
114
- return results.flat(1);
115
- });
116
- }
117
- getBalance(address) {
118
- return __awaiter(this, void 0, void 0, function* () {
119
- let utxos = yield this.utxoProvider.getUtxos(address);
120
- return utxos.reduce((a, tx) => a + Number(tx.value), 0);
121
- });
122
- }
123
- }
124
- exports.BitcoinInterfaceWallet = BitcoinInterfaceWallet;
125
- exports.default = BitcoinInterfaceWallet;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BitcoinInterfaceWallet = void 0;
13
+ const providers_1 = require("@teleportdao/providers");
14
+ const bitcoin_interface_utils_1 = require("./bitcoin-interface-utils");
15
+ class BitcoinInterfaceWallet extends bitcoin_interface_utils_1.BitcoinInterfaceUtils {
16
+ constructor(networkName, connectionInfo) {
17
+ var _a;
18
+ super(networkName);
19
+ if (((_a = connectionInfo === null || connectionInfo === void 0 ? void 0 : connectionInfo.api) === null || _a === void 0 ? void 0 : _a.provider) === "BlockStream") {
20
+ this.apiProvider = new providers_1.bitcoin.BlockStream(this.testnet);
21
+ }
22
+ else {
23
+ this.apiProvider = new providers_1.bitcoin.MempoolSpace(this.testnet);
24
+ }
25
+ this.utxoProvider = (connectionInfo === null || connectionInfo === void 0 ? void 0 : connectionInfo.utxo)
26
+ ? providers_1.bitcoin.getUtxoProvider(connectionInfo.utxo, networkName)
27
+ : this.apiProvider;
28
+ }
29
+ getFeeRate(speed) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ return new providers_1.bitcoin.MempoolSpace(this.testnet).getRecommendedFeeRate(speed);
32
+ });
33
+ }
34
+ getUtxo(address) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ if (!this.utxoProvider) {
37
+ throw new Error("utxo provider not set");
38
+ }
39
+ return this.utxoProvider.getUtxos(address);
40
+ });
41
+ }
42
+ getRawTransaction(txId) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ if (this.utxoProvider.getRawTransaction) {
45
+ return this.utxoProvider.getRawTransaction(txId);
46
+ }
47
+ return this.apiProvider.getRawTransaction(txId);
48
+ });
49
+ }
50
+ sendRawTransaction(txHex) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ if (this.utxoProvider.sendRawTransaction) {
53
+ return this.utxoProvider.sendRawTransaction(txHex);
54
+ }
55
+ return this.apiProvider.sendRawTransaction(txHex);
56
+ });
57
+ }
58
+ getExtendedUtxo(signerInfo) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ let utxos = yield this.getUtxo(signerInfo.address);
61
+ return utxos.map((tx) => ({
62
+ hash: tx.txId,
63
+ value: tx.value,
64
+ index: tx.index,
65
+ signerInfo,
66
+ }));
67
+ });
68
+ }
69
+ getAddressesUtxo(allAddresses) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const chunkOfAddresses = [];
72
+ const chunkLength = 20;
73
+ for (let i = 0; i < allAddresses.length; i += chunkLength) {
74
+ const tmp = allAddresses.slice(i, i + chunkLength);
75
+ chunkOfAddresses.push(tmp);
76
+ }
77
+ let results = [];
78
+ for (let addresses of chunkOfAddresses) {
79
+ const allPromises = [];
80
+ for (let address of addresses) {
81
+ let promise = yield this.getUtxo(address);
82
+ allPromises.push(promise);
83
+ }
84
+ let result = yield Promise.all(allPromises);
85
+ if (result.flat(1).length === 0) {
86
+ break;
87
+ }
88
+ results.push(result.flat(1));
89
+ }
90
+ return results.flat(1);
91
+ });
92
+ }
93
+ getAddressesExtendedUtxo(signerInfos) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const chunkOfAddresses = [];
96
+ const chunkLength = 20;
97
+ for (let i = 0; i < signerInfos.length; i += chunkLength) {
98
+ const tmp = signerInfos.slice(i, i + chunkLength);
99
+ chunkOfAddresses.push(tmp);
100
+ }
101
+ let results = [];
102
+ for (let addresses of chunkOfAddresses) {
103
+ const allPromises = [];
104
+ for (let signerInfo of addresses) {
105
+ let promise = yield this.getExtendedUtxo(signerInfo);
106
+ allPromises.push(promise);
107
+ }
108
+ let result = yield Promise.all(allPromises);
109
+ if (result.flat(1).length === 0) {
110
+ break;
111
+ }
112
+ results.push(result.flat(1));
113
+ }
114
+ return results.flat(1);
115
+ });
116
+ }
117
+ getBalance(address) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ let utxos = yield this.utxoProvider.getUtxos(address);
120
+ return utxos.reduce((a, tx) => a + Number(tx.value), 0);
121
+ });
122
+ }
123
+ }
124
+ exports.BitcoinInterfaceWallet = BitcoinInterfaceWallet;
125
+ exports.default = BitcoinInterfaceWallet;
126
126
  //# sourceMappingURL=bitcoin-interface-wallet.js.map
@@ -1,67 +1,67 @@
1
- import { bitcoin as bitcoinProvider } from "@teleportdao/providers";
2
- import BitcoinInterfaceWallet from "./bitcoin-interface-wallet";
3
- import type { BitcoinInterfaceConnectionInfo } from "./type";
4
- export declare class BitcoinInterface extends BitcoinInterfaceWallet {
5
- rpcProvider?: bitcoinProvider.BitcoinRPC;
6
- constructor(networkName: string, connectionInfo?: BitcoinInterfaceConnectionInfo);
7
- getLatestBlockNumber(): Promise<number>;
8
- getBlockHash(blockNumber: number): Promise<string>;
9
- getBlockHeaderHex(blockNumber: number): Promise<string>;
10
- getTransaction(txId: string): Promise<bitcoinProvider.Types.ConfirmedTransaction>;
11
- getRawTransaction(txId: string): Promise<string>;
12
- sendRawTransaction(txId: string): Promise<any>;
13
- getMerkleProof(txId: string, blockHash: string): Promise<{
14
- intermediateNodes: string;
15
- transactionIndex: number;
16
- }>;
17
- getRequestProof(transaction: {
18
- txId: string;
19
- hex?: string;
20
- blockHash?: string;
21
- blockNumber?: number;
22
- merkleProof?: {
23
- intermediateNodes: string;
24
- transactionIndex: number;
25
- };
26
- }): Promise<{
27
- parsedTx: {
28
- version: string;
29
- flag: string;
30
- vin: string;
31
- vout: string;
32
- witness: string;
33
- locktime: string;
34
- };
35
- merkleProof: {
36
- intermediateNodes: string;
37
- transactionIndex: number;
38
- };
39
- blockNumber: number;
40
- blockHash: string;
41
- }>;
42
- getBlockTransactions(addresses: string[], blockNumber: number, inputTxIds?: {
43
- txId: string;
44
- index: number;
45
- address: string;
46
- script?: string | undefined;
47
- value?: number | undefined;
48
- }[]): Promise<{
49
- blockInfo: {
50
- blockNumber: number;
51
- blockHash: string;
52
- merkleRoot: string;
53
- prvBlockHash: string;
54
- };
55
- withdrawTxs: import("./type").Transaction[];
56
- depositTxs: import("./type").Transaction[];
57
- }>;
58
- getMultipleBlocksTransactions(addresses: string[], startBlockNumber: number, endBlockNumber: number, inputTxIds?: {
59
- txId: string;
60
- index: number;
61
- address: string;
62
- script?: string | undefined;
63
- value?: number | undefined;
64
- }[]): Promise<import("./type").Transaction[]>;
65
- }
66
- export default BitcoinInterface;
1
+ import { bitcoin as bitcoinProvider } from "@teleportdao/providers";
2
+ import BitcoinInterfaceWallet from "./bitcoin-interface-wallet";
3
+ import type { BitcoinInterfaceConnectionInfo } from "./type";
4
+ export declare class BitcoinInterface extends BitcoinInterfaceWallet {
5
+ rpcProvider?: bitcoinProvider.BitcoinRPC;
6
+ constructor(networkName: string, connectionInfo?: BitcoinInterfaceConnectionInfo);
7
+ getLatestBlockNumber(): Promise<number>;
8
+ getBlockHash(blockNumber: number): Promise<string>;
9
+ getBlockHeaderHex(blockNumber: number): Promise<string>;
10
+ getTransaction(txId: string): Promise<bitcoinProvider.Types.ConfirmedTransaction>;
11
+ getRawTransaction(txId: string): Promise<string>;
12
+ sendRawTransaction(txId: string): Promise<any>;
13
+ getMerkleProof(txId: string, blockHash: string): Promise<{
14
+ intermediateNodes: string;
15
+ transactionIndex: number;
16
+ }>;
17
+ getRequestProof(transaction: {
18
+ txId: string;
19
+ hex?: string;
20
+ blockHash?: string;
21
+ blockNumber?: number;
22
+ merkleProof?: {
23
+ intermediateNodes: string;
24
+ transactionIndex: number;
25
+ };
26
+ }): Promise<{
27
+ parsedTx: {
28
+ version: string;
29
+ flag: string;
30
+ vin: string;
31
+ vout: string;
32
+ witness: string;
33
+ locktime: string;
34
+ };
35
+ merkleProof: {
36
+ intermediateNodes: string;
37
+ transactionIndex: number;
38
+ };
39
+ blockNumber: number;
40
+ blockHash: string;
41
+ }>;
42
+ getBlockTransactions(addresses: string[], blockNumber: number, inputTxIds?: {
43
+ txId: string;
44
+ index: number;
45
+ address: string;
46
+ script?: string | undefined;
47
+ value?: number | undefined;
48
+ }[]): Promise<{
49
+ blockInfo: {
50
+ blockNumber: number;
51
+ blockHash: string;
52
+ merkleRoot: string;
53
+ prvBlockHash: string;
54
+ };
55
+ withdrawTxs: import("./type").Transaction[];
56
+ depositTxs: import("./type").Transaction[];
57
+ }>;
58
+ getMultipleBlocksTransactions(addresses: string[], startBlockNumber: number, endBlockNumber: number, inputTxIds?: {
59
+ txId: string;
60
+ index: number;
61
+ address: string;
62
+ script?: string | undefined;
63
+ value?: number | undefined;
64
+ }[]): Promise<import("./type").Transaction[]>;
65
+ }
66
+ export default BitcoinInterface;
67
67
  //# sourceMappingURL=bitcoin-interface.d.ts.map