@atomicfinance/bitcoin-esplora-batch-api-provider 4.0.0 → 4.0.1
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.
|
@@ -16,9 +16,9 @@ class BitcoinEsploraBatchApiProvider extends bitcoin_esplora_api_provider_1.Bitc
|
|
|
16
16
|
}
|
|
17
17
|
async getUnspentTransactions(_addresses) {
|
|
18
18
|
const addresses = _addresses.map(utils_1.addressToString);
|
|
19
|
-
const data = await this._batchAxios.nodePost('/addresses/utxo', {
|
|
19
|
+
const data = (await this._batchAxios.nodePost('/addresses/utxo', {
|
|
20
20
|
addresses: (0, lodash_1.uniq)(addresses),
|
|
21
|
-
});
|
|
21
|
+
}));
|
|
22
22
|
const utxos = data.map(({ address, utxo }) => {
|
|
23
23
|
return utxo.map((obj) => ({
|
|
24
24
|
...obj,
|
|
@@ -32,9 +32,9 @@ class BitcoinEsploraBatchApiProvider extends bitcoin_esplora_api_provider_1.Bitc
|
|
|
32
32
|
}
|
|
33
33
|
async getAddressTransactionCounts(_addresses) {
|
|
34
34
|
const addresses = _addresses.map(utils_1.addressToString);
|
|
35
|
-
const data = await this._batchAxios.nodePost('/addresses', {
|
|
35
|
+
const data = (await this._batchAxios.nodePost('/addresses', {
|
|
36
36
|
addresses: (0, lodash_1.uniq)(addresses),
|
|
37
|
-
});
|
|
37
|
+
}));
|
|
38
38
|
return data.reduce((acc, obj) => {
|
|
39
39
|
acc[obj.address] = obj.chain_stats.tx_count + obj.mempool_stats.tx_count;
|
|
40
40
|
return acc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitcoinEsploraBatchApiProvider.js","sourceRoot":"","sources":["../lib/BitcoinEsploraBatchApiProvider.ts"],"names":[],"mappings":";;AAAA,8FAIqD;AACrD,gEAA4D;AAC5D,gDAA0D;AAC1D,gDAAuD;AACvD,mCAAuC;AAQvC,MAAqB,8BAA+B,SAAQ,wDAAyB;IAGnF,YAAY,OAAuC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CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBACxB,GAAG,GAAG;gBACN,OAAO;gBACP,QAAQ,EAAE,GAAG,CAAC,KAAK;gBACnB,MAAM,EAAE,IAAI,iBAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;gBAC1D,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,YAAY;aACrC,CAAC,CAAC,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,OAAO,IAAA,gBAAO,EAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,UAAgC;QAChE,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,uBAAe,CAAC,CAAC;QAClD,MAAM,IAAI,GAAsB,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAC9D,YAAY,EACZ;YACE,SAAS,EAAE,IAAA,aAAI,EAAC,SAAS,CAAC;SAC3B,CACF,CAAsB,CAAC;QAExB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAgC,EAAE,GAAG,EAAE,EAAE;YAC3D,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC;YACzE,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;CACF;AAjDD,iDAiDC"}
|
|
@@ -29,12 +29,12 @@ export default class BitcoinEsploraBatchApiProvider extends BitcoinEsploraApiPro
|
|
|
29
29
|
|
|
30
30
|
async getUnspentTransactions(_addresses: (Address | string)[]) {
|
|
31
31
|
const addresses = _addresses.map(addressToString);
|
|
32
|
-
const data: BatchUTXOs = await this._batchAxios.nodePost(
|
|
32
|
+
const data: BatchUTXOs = (await this._batchAxios.nodePost(
|
|
33
33
|
'/addresses/utxo',
|
|
34
34
|
{
|
|
35
35
|
addresses: uniq(addresses),
|
|
36
36
|
},
|
|
37
|
-
);
|
|
37
|
+
)) as BatchUTXOs;
|
|
38
38
|
|
|
39
39
|
const utxos = data.map(({ address, utxo }) => {
|
|
40
40
|
return utxo.map((obj) => ({
|
|
@@ -51,12 +51,12 @@ export default class BitcoinEsploraBatchApiProvider extends BitcoinEsploraApiPro
|
|
|
51
51
|
|
|
52
52
|
async getAddressTransactionCounts(_addresses: (Address | string)[]) {
|
|
53
53
|
const addresses = _addresses.map(addressToString);
|
|
54
|
-
const data: esplora.Address[] = await this._batchAxios.nodePost(
|
|
54
|
+
const data: esplora.Address[] = (await this._batchAxios.nodePost(
|
|
55
55
|
'/addresses',
|
|
56
56
|
{
|
|
57
57
|
addresses: uniq(addresses),
|
|
58
58
|
},
|
|
59
|
-
);
|
|
59
|
+
)) as esplora.Address[];
|
|
60
60
|
|
|
61
61
|
return data.reduce((acc: { [index: string]: number }, obj) => {
|
|
62
62
|
acc[obj.address] = obj.chain_stats.tx_count + obj.mempool_stats.tx_count;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomicfinance/bitcoin-esplora-batch-api-provider",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"node": ">=14"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atomicfinance/bitcoin-esplora-api-provider": "^4.0.
|
|
28
|
-
"@atomicfinance/node-provider": "^4.0.
|
|
29
|
-
"@atomicfinance/types": "^4.0.
|
|
30
|
-
"@atomicfinance/utils": "^4.0.
|
|
27
|
+
"@atomicfinance/bitcoin-esplora-api-provider": "^4.0.1",
|
|
28
|
+
"@atomicfinance/node-provider": "^4.0.1",
|
|
29
|
+
"@atomicfinance/types": "^4.0.1",
|
|
30
|
+
"@atomicfinance/utils": "^4.0.1",
|
|
31
31
|
"@babel/runtime": "^7.12.1",
|
|
32
32
|
"bignumber.js": "^9.0.0",
|
|
33
33
|
"lodash": "^4.17.20"
|