@teleportdao/bitcoin 2.0.5 → 2.0.8
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 +83 -101
- package/dist/bitcoin-interface-teleswap.d.ts.map +1 -1
- package/dist/bitcoin-interface-teleswap.js +119 -176
- 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 +29 -28
- package/dist/bitcoin-interface-wallet.d.ts.map +1 -1
- package/dist/bitcoin-interface-wallet.js +126 -125
- package/dist/bitcoin-interface-wallet.js.map +1 -1
- package/dist/bitcoin-interface.d.ts +63 -66
- package/dist/bitcoin-interface.d.ts.map +1 -1
- package/dist/bitcoin-interface.js +112 -119
- package/dist/bitcoin-interface.js.map +1 -1
- 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.d.ts.map +1 -1
- 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 +492 -495
- package/dist/ordinal-wallet.d.ts.map +1 -1
- package/dist/ordinal-wallet.js +386 -386
- package/dist/ordinal-wallet.js.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/transaction-builder/bitcoin-transaction-builder.js +54 -54
- package/dist/transaction-builder/bitcoin-transaction-builder.js.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/transaction-builder/transaction-builder.js +442 -447
- package/dist/transaction-builder/transaction-builder.js.map +1 -1
- package/dist/type.d.ts +55 -61
- package/dist/type.d.ts.map +1 -1
- 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 +246 -251
- package/src/bitcoin-interface-utils.ts +60 -60
- package/src/bitcoin-interface-wallet.ts +112 -114
- package/src/bitcoin-interface.ts +146 -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 +654 -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 +686 -690
- package/src/type.ts +64 -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,29 +1,30 @@
|
|
|
1
|
-
import { bitcoin as bitcoinProvider } from "@teleportdao/providers";
|
|
2
|
-
import { BitcoinInterfaceUtils } from "./bitcoin-interface-utils";
|
|
3
|
-
import 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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { bitcoin as bitcoinProvider } from "@teleportdao/providers";
|
|
2
|
+
import { BitcoinInterfaceUtils } from "./bitcoin-interface-utils";
|
|
3
|
+
import type { BitcoinConnectionInfo } 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
|
+
rpcProvider?: bitcoinProvider.BitcoinRPC;
|
|
9
|
+
constructor(networkName: string, connectionInfo?: BitcoinConnectionInfo);
|
|
10
|
+
getFeeRate(speed?: "normal" | "slow" | "fast"): Promise<number>;
|
|
11
|
+
getUtxo(address: string): Promise<bitcoinProvider.Types.Utxo[]>;
|
|
12
|
+
getExtendedUtxo(signerInfo: SignerInfo): Promise<{
|
|
13
|
+
hash: string;
|
|
14
|
+
value: number;
|
|
15
|
+
index: number;
|
|
16
|
+
signerInfo: SignerInfo;
|
|
17
|
+
}[]>;
|
|
18
|
+
getAddressesUtxo(allAddresses: string[]): Promise<bitcoinProvider.Types.Utxo[]>;
|
|
19
|
+
getAddressesExtendedUtxo(signerInfos: SignerInfo[]): Promise<{
|
|
20
|
+
hash: string;
|
|
21
|
+
value: number;
|
|
22
|
+
index: number;
|
|
23
|
+
signerInfo: SignerInfo;
|
|
24
|
+
}[]>;
|
|
25
|
+
getBalance(address: string): Promise<number>;
|
|
26
|
+
getRawTransaction(txId: string): Promise<string>;
|
|
27
|
+
sendRawTransaction(txHex: string): Promise<any>;
|
|
28
|
+
}
|
|
29
|
+
export default BitcoinInterfaceWallet;
|
|
29
30
|
//# sourceMappingURL=bitcoin-interface-wallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitcoin-interface-wallet.d.ts","sourceRoot":"","sources":["../src/bitcoin-interface-wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"bitcoin-interface-wallet.d.ts","sourceRoot":"","sources":["../src/bitcoin-interface-wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAA;AAE3E,qBAAa,sBAAuB,SAAQ,qBAAqB;IAC/D,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC,YAAY,CAAA;IAChD,WAAW,EAAE,eAAe,CAAC,YAAY,CAAA;IACzC,WAAW,CAAC,EAAE,eAAe,CAAC,UAAU,CAAA;gBAC5B,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,qBAAqB;IAgBjE,UAAU,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM;IAI7C,OAAO,CAAC,OAAO,EAAE,MAAM;IAIvB,eAAe,CAAC,UAAU,EAAE,UAAU;;;;;;IAUtC,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE;IAyBvC,wBAAwB,CAAC,WAAW,EAAE,UAAU,EAAE;;;;;;IAyBlD,UAAU,CAAC,OAAO,EAAE,MAAM;IAK1B,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAM9B,kBAAkB,CAAC,KAAK,EAAE,MAAM;CAKvC;AAED,eAAe,sBAAsB,CAAA"}
|
|
@@ -1,126 +1,127 @@
|
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
exports.
|
|
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
|
+
if (connectionInfo === null || connectionInfo === void 0 ? void 0 : connectionInfo.rpc)
|
|
29
|
+
this.rpcProvider = providers_1.bitcoin.getRpcProvider(connectionInfo === null || connectionInfo === void 0 ? void 0 : connectionInfo.rpc);
|
|
30
|
+
}
|
|
31
|
+
getFeeRate(speed) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return this.apiProvider.getFeeRate(speed);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
getUtxo(address) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return this.utxoProvider.getUtxos(address);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
getExtendedUtxo(signerInfo) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
let utxos = yield this.getUtxo(signerInfo.address);
|
|
44
|
+
return utxos.map((tx) => ({
|
|
45
|
+
hash: tx.txId,
|
|
46
|
+
value: tx.value,
|
|
47
|
+
index: tx.index,
|
|
48
|
+
signerInfo,
|
|
49
|
+
}));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
getAddressesUtxo(allAddresses) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const chunkOfAddresses = [];
|
|
55
|
+
const chunkLength = 20;
|
|
56
|
+
for (let i = 0; i < allAddresses.length; i += chunkLength) {
|
|
57
|
+
const tmp = allAddresses.slice(i, i + chunkLength);
|
|
58
|
+
chunkOfAddresses.push(tmp);
|
|
59
|
+
}
|
|
60
|
+
let results = [];
|
|
61
|
+
for (let addresses of chunkOfAddresses) {
|
|
62
|
+
const allPromises = [];
|
|
63
|
+
for (let address of addresses) {
|
|
64
|
+
let promise = yield this.getUtxo(address);
|
|
65
|
+
allPromises.push(promise);
|
|
66
|
+
}
|
|
67
|
+
let result = yield Promise.all(allPromises);
|
|
68
|
+
if (result.flat(1).length === 0) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
results.push(result.flat(1));
|
|
72
|
+
}
|
|
73
|
+
return results.flat(1);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
getAddressesExtendedUtxo(signerInfos) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const chunkOfAddresses = [];
|
|
79
|
+
const chunkLength = 20;
|
|
80
|
+
for (let i = 0; i < signerInfos.length; i += chunkLength) {
|
|
81
|
+
const tmp = signerInfos.slice(i, i + chunkLength);
|
|
82
|
+
chunkOfAddresses.push(tmp);
|
|
83
|
+
}
|
|
84
|
+
let results = [];
|
|
85
|
+
for (let addresses of chunkOfAddresses) {
|
|
86
|
+
const allPromises = [];
|
|
87
|
+
for (let signerInfo of addresses) {
|
|
88
|
+
let promise = yield this.getExtendedUtxo(signerInfo);
|
|
89
|
+
allPromises.push(promise);
|
|
90
|
+
}
|
|
91
|
+
let result = yield Promise.all(allPromises);
|
|
92
|
+
if (result.flat(1).length === 0) {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
results.push(result.flat(1));
|
|
96
|
+
}
|
|
97
|
+
return results.flat(1);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
getBalance(address) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
let utxos = yield this.utxoProvider.getUtxos(address);
|
|
103
|
+
return utxos.reduce((a, tx) => a + Number(tx.value), 0);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
getRawTransaction(txId) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
if (this.rpcProvider)
|
|
109
|
+
return this.rpcProvider.getRawTransaction(txId);
|
|
110
|
+
if (this.utxoProvider.getRawTransaction)
|
|
111
|
+
return this.utxoProvider.getRawTransaction(txId);
|
|
112
|
+
return this.apiProvider.getRawTransaction(txId);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
sendRawTransaction(txHex) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
if (this.rpcProvider)
|
|
118
|
+
return this.rpcProvider.sendRawTransaction(txHex);
|
|
119
|
+
if (this.utxoProvider.sendRawTransaction)
|
|
120
|
+
return this.utxoProvider.sendRawTransaction(txHex);
|
|
121
|
+
return this.apiProvider.sendRawTransaction(txHex);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.BitcoinInterfaceWallet = BitcoinInterfaceWallet;
|
|
126
|
+
exports.default = BitcoinInterfaceWallet;
|
|
126
127
|
//# sourceMappingURL=bitcoin-interface-wallet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitcoin-interface-wallet.js","sourceRoot":"","sources":["../src/bitcoin-interface-wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAmE;AACnE,uEAAiE;AAIjE,MAAa,sBAAuB,SAAQ,+CAAqB;IAI/D,YAAY,WAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"bitcoin-interface-wallet.js","sourceRoot":"","sources":["../src/bitcoin-interface-wallet.ts"],"names":[],"mappings":";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W;gBAAE,OAAO,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;YACrE,IAAI,IAAI,CAAC,YAAY,CAAC,iBAAiB;gBAAE,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;YACzF,OAAO,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;QACjD,CAAC;KAAA;IAEK,kBAAkB,CAAC,KAAa;;YACpC,IAAI,IAAI,CAAC,WAAW;gBAAE,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;YACvE,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB;gBAAE,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;YAC5F,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;QACnD,CAAC;KAAA;CACF;AAxGD,wDAwGC;AAED,kBAAe,sBAAsB,CAAA"}
|
|
@@ -1,67 +1,64 @@
|
|
|
1
|
-
import { bitcoin as bitcoinProvider } from "@teleportdao/providers";
|
|
2
|
-
import BitcoinInterfaceWallet from "./bitcoin-interface-wallet";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
export declare class BitcoinInterface extends BitcoinInterfaceWallet {
|
|
4
|
+
getLatestBlockNumber(): Promise<number>;
|
|
5
|
+
getBlockHash(blockNumber: number): Promise<string>;
|
|
6
|
+
getBlockHeaderHex(blockNumber: number): Promise<string>;
|
|
7
|
+
getTransaction(txId: string): Promise<bitcoinProvider.Types.ConfirmedTransaction>;
|
|
8
|
+
getRawTransaction(txId: string): Promise<string>;
|
|
9
|
+
sendRawTransaction(txId: string): Promise<any>;
|
|
10
|
+
getMerkleProof(txId: string, blockHash: string): Promise<{
|
|
11
|
+
intermediateNodes: string;
|
|
12
|
+
transactionIndex: number;
|
|
13
|
+
}>;
|
|
14
|
+
getRequestProof(transaction: {
|
|
15
|
+
txId: string;
|
|
16
|
+
hex?: string;
|
|
17
|
+
blockHash?: string;
|
|
18
|
+
blockNumber?: number;
|
|
19
|
+
merkleProof?: {
|
|
20
|
+
intermediateNodes: string;
|
|
21
|
+
transactionIndex: number;
|
|
22
|
+
};
|
|
23
|
+
}): Promise<{
|
|
24
|
+
parsedTx: {
|
|
25
|
+
version: string;
|
|
26
|
+
flag: string;
|
|
27
|
+
vin: string;
|
|
28
|
+
vout: string;
|
|
29
|
+
witness: string;
|
|
30
|
+
locktime: string;
|
|
31
|
+
};
|
|
32
|
+
merkleProof: {
|
|
33
|
+
intermediateNodes: string;
|
|
34
|
+
transactionIndex: number;
|
|
35
|
+
};
|
|
36
|
+
blockNumber: number;
|
|
37
|
+
blockHash: string;
|
|
38
|
+
}>;
|
|
39
|
+
getBlockTransactions(addresses: string[], blockNumber: number, inputTxIds?: {
|
|
40
|
+
txId: string;
|
|
41
|
+
index: number;
|
|
42
|
+
address: string;
|
|
43
|
+
script?: string | undefined;
|
|
44
|
+
value?: number | undefined;
|
|
45
|
+
}[]): Promise<{
|
|
46
|
+
blockInfo: {
|
|
47
|
+
blockNumber: number;
|
|
48
|
+
blockHash: string;
|
|
49
|
+
merkleRoot: string;
|
|
50
|
+
prvBlockHash: string;
|
|
51
|
+
};
|
|
52
|
+
withdrawTxs: import("./type").Transaction[];
|
|
53
|
+
depositTxs: import("./type").Transaction[];
|
|
54
|
+
}>;
|
|
55
|
+
getMultipleBlocksTransactions(addresses: string[], startBlockNumber: number, endBlockNumber: number, inputTxIds?: {
|
|
56
|
+
txId: string;
|
|
57
|
+
index: number;
|
|
58
|
+
address: string;
|
|
59
|
+
script?: string | undefined;
|
|
60
|
+
value?: number | undefined;
|
|
61
|
+
}[]): Promise<import("./type").Transaction[]>;
|
|
62
|
+
}
|
|
63
|
+
export default BitcoinInterface;
|
|
67
64
|
//# sourceMappingURL=bitcoin-interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitcoin-interface.d.ts","sourceRoot":"","sources":["../src/bitcoin-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAOnE,OAAO,sBAAsB,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"bitcoin-interface.d.ts","sourceRoot":"","sources":["../src/bitcoin-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAOnE,OA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