@atomicfinance/bitcoin-esplora-batch-api-provider 3.5.3 → 3.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomicfinance/bitcoin-esplora-batch-api-provider",
3
- "version": "3.5.3",
3
+ "version": "3.6.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": "^3.5.3",
28
- "@atomicfinance/node-provider": "^3.5.3",
29
- "@atomicfinance/types": "^3.5.3",
30
- "@atomicfinance/utils": "^3.5.3",
27
+ "@atomicfinance/bitcoin-esplora-api-provider": "^3.6.1",
28
+ "@atomicfinance/node-provider": "^3.6.1",
29
+ "@atomicfinance/types": "^3.6.1",
30
+ "@atomicfinance/utils": "^3.6.1",
31
31
  "@babel/runtime": "^7.12.1",
32
32
  "bignumber.js": "^9.0.0",
33
33
  "lodash": "^4.17.20"
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const bitcoin_esplora_api_provider_1 = require("@atomicfinance/bitcoin-esplora-api-provider");
4
- const node_provider_1 = require("@atomicfinance/node-provider");
5
- const types_1 = require("@atomicfinance/types");
6
- const utils_1 = require("@atomicfinance/utils");
7
- const lodash_1 = require("lodash");
8
- class BitcoinEsploraBatchApiProvider extends bitcoin_esplora_api_provider_1.BitcoinEsploraApiProvider {
9
- constructor(options) {
10
- super(options);
11
- this._batchAxios = new node_provider_1.NodeProvider({
12
- baseURL: options.batchUrl,
13
- responseType: 'text',
14
- transformResponse: undefined, // https://github.com/axios/axios/issues/907,
15
- });
16
- }
17
- async getUnspentTransactions(_addresses) {
18
- const addresses = _addresses.map(utils_1.addressToString);
19
- const data = await this._batchAxios.nodePost('/addresses/utxo', {
20
- addresses: (0, lodash_1.uniq)(addresses),
21
- });
22
- const utxos = data.map(({ address, utxo }) => {
23
- return utxo.map((obj) => ({
24
- ...obj,
25
- address,
26
- satoshis: obj.value,
27
- amount: new types_1.BigNumber(obj.value).dividedBy(1e8).toNumber(),
28
- blockHeight: obj.status.block_height,
29
- }));
30
- });
31
- return (0, lodash_1.flatten)(utxos);
32
- }
33
- async getAddressTransactionCounts(_addresses) {
34
- const addresses = _addresses.map(utils_1.addressToString);
35
- const data = await this._batchAxios.nodePost('/addresses', {
36
- addresses: (0, lodash_1.uniq)(addresses),
37
- });
38
- return data.reduce((acc, obj) => {
39
- acc[obj.address] = obj.chain_stats.tx_count + obj.mempool_stats.tx_count;
40
- return acc;
41
- }, {});
42
- }
43
- }
44
- exports.default = BitcoinEsploraBatchApiProvider;
45
- //# sourceMappingURL=BitcoinEsploraBatchApiProvider.js.map
package/lib/index.js DELETED
@@ -1,9 +0,0 @@
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.BitcoinEsploraBatchApiProvider = void 0;
7
- const BitcoinEsploraBatchApiProvider_1 = __importDefault(require("./BitcoinEsploraBatchApiProvider"));
8
- exports.BitcoinEsploraBatchApiProvider = BitcoinEsploraBatchApiProvider_1.default;
9
- //# sourceMappingURL=index.js.map