@xchainjs/xchain-utxo-providers 2.0.7 → 2.0.9

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/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { assetAmount, assetToBase, baseAmount, delay } from '@xchainjs/xchain-util';
1
+ import { assetAmount, assetToBase, baseAmount, delay, assetToString } from '@xchainjs/xchain-util';
2
2
  import axios from 'axios';
3
3
  import { TxType, FeeOption } from '@xchainjs/xchain-client';
4
4
  import PromisePool from '@supercharge/promise-pool';
@@ -147,15 +147,13 @@ const broadcastTx$3 = (_a) => __awaiter(void 0, [_a], void 0, function* ({ apiKe
147
147
  });
148
148
 
149
149
  class SochainProvider {
150
- constructor(baseUrl = 'https://sochain.com/api/v3', apiKey, chain, asset, assetDecimals, sochainNetwork) {
150
+ constructor(baseUrl = 'https://sochain.com/api/v3', apiKey, _chain, asset, assetDecimals, sochainNetwork) {
151
151
  this.baseUrl = baseUrl;
152
152
  this._apiKey = apiKey;
153
- this.chain = chain;
153
+ // this.chain = chain
154
154
  this.asset = asset;
155
155
  this.assetDecimals = assetDecimals;
156
156
  this.sochainNetwork = sochainNetwork;
157
- this.asset;
158
- this.chain;
159
157
  }
160
158
  get apiKey() {
161
159
  return this._apiKey;
@@ -211,7 +209,7 @@ class SochainProvider {
211
209
  });
212
210
  return [{ amount, asset: this.asset }];
213
211
  }
214
- catch (error) {
212
+ catch (_error) {
215
213
  throw new Error(`Could not get balances for address ${address}`);
216
214
  }
217
215
  });
@@ -621,14 +619,12 @@ const broadcastTx$2 = (_a) => __awaiter(void 0, [_a], void 0, function* ({ txHex
621
619
  });
622
620
 
623
621
  class HaskoinProvider {
624
- constructor(baseUrl = 'https://api.haskoin.com/', chain, asset, assetDecimals, haskoinNetwork) {
622
+ constructor(baseUrl = 'https://api.haskoin.com/', _chain, asset, assetDecimals, haskoinNetwork) {
625
623
  this.baseUrl = baseUrl;
626
- this.chain = chain;
624
+ // this.chain = chain
627
625
  this.asset = asset;
628
626
  this.assetDecimals = assetDecimals;
629
627
  this.haskoinNetwork = haskoinNetwork;
630
- this.asset;
631
- this.chain;
632
628
  }
633
629
  broadcastTx(txHex) {
634
630
  return __awaiter(this, void 0, void 0, function* () {
@@ -852,15 +848,13 @@ const getBlockchainData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ b
852
848
  });
853
849
 
854
850
  class BlockcypherProvider {
855
- constructor(baseUrl = 'https://api.blockcypher.com/v1/', chain, asset, assetDecimals, blockcypherNetwork, apiKey) {
851
+ constructor(baseUrl = 'https://api.blockcypher.com/v1/', _chain, asset, assetDecimals, blockcypherNetwork, apiKey) {
856
852
  this.baseUrl = baseUrl;
857
853
  this._apiKey = apiKey;
858
- this.chain = chain;
854
+ // this.chain = chain
859
855
  this.asset = asset;
860
856
  this.assetDecimals = assetDecimals;
861
857
  this.blockcypherNetwork = blockcypherNetwork;
862
- this.asset;
863
- this.chain;
864
858
  }
865
859
  get apiKey() {
866
860
  return this._apiKey;
@@ -1045,8 +1039,12 @@ class BlockcypherProvider {
1045
1039
  });
1046
1040
  //remove duplicates
1047
1041
  const txs = [];
1048
- response.txrefs && txs.push(...response.txrefs.map((i) => i.tx_hash));
1049
- response.unconfirmed_txrefs && txs.push(...response.unconfirmed_txrefs.map((i) => i.tx_hash));
1042
+ if (response.txrefs) {
1043
+ txs.push(...response.txrefs.map((i) => i.tx_hash));
1044
+ }
1045
+ if (response.unconfirmed_txrefs) {
1046
+ txs.push(...response.unconfirmed_txrefs.map((i) => i.tx_hash));
1047
+ }
1050
1048
  const uniqTxs = [...new Set(txs)];
1051
1049
  const start = offset >= uniqTxs.length ? uniqTxs.length : offset;
1052
1050
  const end = offset + limit >= uniqTxs.length ? uniqTxs.length : offset + limit;
@@ -1262,7 +1260,7 @@ class NownodesProvider {
1262
1260
  this.asset = asset;
1263
1261
  this.assetDecimals = assetDecimals;
1264
1262
  if (chain !== 'ZEC' || asset.chain !== 'ZEC') {
1265
- throw Error(`Now nodes provider does not support chain or asset ${chain} ${asset}`);
1263
+ throw Error(`Now nodes provider does not support chain or asset ${chain} ${assetToString(asset)}`);
1266
1264
  }
1267
1265
  }
1268
1266
  get apiKey() {
package/lib/index.js CHANGED
@@ -154,15 +154,13 @@ const broadcastTx$3 = (_a) => __awaiter(void 0, [_a], void 0, function* ({ apiKe
154
154
  });
155
155
 
156
156
  class SochainProvider {
157
- constructor(baseUrl = 'https://sochain.com/api/v3', apiKey, chain, asset, assetDecimals, sochainNetwork) {
157
+ constructor(baseUrl = 'https://sochain.com/api/v3', apiKey, _chain, asset, assetDecimals, sochainNetwork) {
158
158
  this.baseUrl = baseUrl;
159
159
  this._apiKey = apiKey;
160
- this.chain = chain;
160
+ // this.chain = chain
161
161
  this.asset = asset;
162
162
  this.assetDecimals = assetDecimals;
163
163
  this.sochainNetwork = sochainNetwork;
164
- this.asset;
165
- this.chain;
166
164
  }
167
165
  get apiKey() {
168
166
  return this._apiKey;
@@ -218,7 +216,7 @@ class SochainProvider {
218
216
  });
219
217
  return [{ amount, asset: this.asset }];
220
218
  }
221
- catch (error) {
219
+ catch (_error) {
222
220
  throw new Error(`Could not get balances for address ${address}`);
223
221
  }
224
222
  });
@@ -628,14 +626,12 @@ const broadcastTx$2 = (_a) => __awaiter(void 0, [_a], void 0, function* ({ txHex
628
626
  });
629
627
 
630
628
  class HaskoinProvider {
631
- constructor(baseUrl = 'https://api.haskoin.com/', chain, asset, assetDecimals, haskoinNetwork) {
629
+ constructor(baseUrl = 'https://api.haskoin.com/', _chain, asset, assetDecimals, haskoinNetwork) {
632
630
  this.baseUrl = baseUrl;
633
- this.chain = chain;
631
+ // this.chain = chain
634
632
  this.asset = asset;
635
633
  this.assetDecimals = assetDecimals;
636
634
  this.haskoinNetwork = haskoinNetwork;
637
- this.asset;
638
- this.chain;
639
635
  }
640
636
  broadcastTx(txHex) {
641
637
  return __awaiter(this, void 0, void 0, function* () {
@@ -859,15 +855,13 @@ const getBlockchainData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ b
859
855
  });
860
856
 
861
857
  class BlockcypherProvider {
862
- constructor(baseUrl = 'https://api.blockcypher.com/v1/', chain, asset, assetDecimals, blockcypherNetwork, apiKey) {
858
+ constructor(baseUrl = 'https://api.blockcypher.com/v1/', _chain, asset, assetDecimals, blockcypherNetwork, apiKey) {
863
859
  this.baseUrl = baseUrl;
864
860
  this._apiKey = apiKey;
865
- this.chain = chain;
861
+ // this.chain = chain
866
862
  this.asset = asset;
867
863
  this.assetDecimals = assetDecimals;
868
864
  this.blockcypherNetwork = blockcypherNetwork;
869
- this.asset;
870
- this.chain;
871
865
  }
872
866
  get apiKey() {
873
867
  return this._apiKey;
@@ -1052,8 +1046,12 @@ class BlockcypherProvider {
1052
1046
  });
1053
1047
  //remove duplicates
1054
1048
  const txs = [];
1055
- response.txrefs && txs.push(...response.txrefs.map((i) => i.tx_hash));
1056
- response.unconfirmed_txrefs && txs.push(...response.unconfirmed_txrefs.map((i) => i.tx_hash));
1049
+ if (response.txrefs) {
1050
+ txs.push(...response.txrefs.map((i) => i.tx_hash));
1051
+ }
1052
+ if (response.unconfirmed_txrefs) {
1053
+ txs.push(...response.unconfirmed_txrefs.map((i) => i.tx_hash));
1054
+ }
1057
1055
  const uniqTxs = [...new Set(txs)];
1058
1056
  const start = offset >= uniqTxs.length ? uniqTxs.length : offset;
1059
1057
  const end = offset + limit >= uniqTxs.length ? uniqTxs.length : offset + limit;
@@ -1269,7 +1267,7 @@ class NownodesProvider {
1269
1267
  this.asset = asset;
1270
1268
  this.assetDecimals = assetDecimals;
1271
1269
  if (chain !== 'ZEC' || asset.chain !== 'ZEC') {
1272
- throw Error(`Now nodes provider does not support chain or asset ${chain} ${asset}`);
1270
+ throw Error(`Now nodes provider does not support chain or asset ${chain} ${xchainUtil.assetToString(asset)}`);
1273
1271
  }
1274
1272
  }
1275
1273
  get apiKey() {
@@ -5,11 +5,10 @@ import { BlockcypherNetwork } from './blockcypher-api-types';
5
5
  export declare class BlockcypherProvider implements UtxoOnlineDataProvider {
6
6
  private baseUrl;
7
7
  private _apiKey?;
8
- private chain;
9
8
  private asset;
10
9
  private assetDecimals;
11
10
  private blockcypherNetwork;
12
- constructor(baseUrl: string | undefined, chain: Chain, asset: Asset, assetDecimals: number, blockcypherNetwork: BlockcypherNetwork, apiKey?: string);
11
+ constructor(baseUrl: string | undefined, _chain: Chain, asset: Asset, assetDecimals: number, blockcypherNetwork: BlockcypherNetwork, apiKey?: string);
13
12
  get apiKey(): string | undefined;
14
13
  set apiKey(value: string | undefined);
15
14
  broadcastTx(txHex: string): Promise<TxHash>;
@@ -4,11 +4,10 @@ import { Balance, Tx, TxsPage, UTXO, UtxoOnlineDataProvider } from '../../types'
4
4
  import { HaskoinNetwork } from './haskoin-api-types';
5
5
  export declare class HaskoinProvider implements UtxoOnlineDataProvider {
6
6
  private baseUrl;
7
- private chain;
8
7
  private asset;
9
8
  private assetDecimals;
10
9
  private haskoinNetwork;
11
- constructor(baseUrl: string | undefined, chain: Chain, asset: Asset, assetDecimals: number, haskoinNetwork: HaskoinNetwork);
10
+ constructor(baseUrl: string | undefined, _chain: Chain, asset: Asset, assetDecimals: number, haskoinNetwork: HaskoinNetwork);
12
11
  broadcastTx(txHex: string): Promise<TxHash>;
13
12
  getConfirmedUnspentTxs(address: string): Promise<UTXO[]>;
14
13
  getUnspentTxs(address: string): Promise<UTXO[]>;
@@ -5,11 +5,10 @@ import { SochainNetwork } from './sochain-api-types';
5
5
  export declare class SochainProvider implements UtxoOnlineDataProvider {
6
6
  private baseUrl;
7
7
  private _apiKey;
8
- private chain;
9
8
  private asset;
10
9
  private assetDecimals;
11
10
  private sochainNetwork;
12
- constructor(baseUrl: string | undefined, apiKey: string, chain: Chain, asset: Asset, assetDecimals: number, sochainNetwork: SochainNetwork);
11
+ constructor(baseUrl: string | undefined, apiKey: string, _chain: Chain, asset: Asset, assetDecimals: number, sochainNetwork: SochainNetwork);
13
12
  get apiKey(): string;
14
13
  set apiKey(value: string);
15
14
  broadcastTx(txHex: string): Promise<TxHash>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-utxo-providers",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@supercharge/promise-pool": "2.4.0",
32
- "@xchainjs/xchain-client": "2.0.7",
33
- "@xchainjs/xchain-util": "2.0.4",
34
- "axios": "^1.8.4"
32
+ "@xchainjs/xchain-client": "2.0.9",
33
+ "@xchainjs/xchain-util": "2.0.5",
34
+ "axios": "1.12.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "axios-mock-adapter": "^2.1.0"