Skip to content

Commit a09cfdf

Browse files
committed
implented kenny's suggestions: import from crypto-wallet-core instead of bitcore-lib and replaced eslint disable lines
1 parent 979a779 commit a09cfdf

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

packages/bitcore-node/src/chain.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import BitcoreLib from 'bitcore-lib';
2-
import BitcoreLibCash from 'bitcore-lib-cash';
31
import BitcoreP2P from 'bitcore-p2p';
42
import BitcoreP2PCash from 'bitcore-p2p-cash';
3+
import { BitcoreLib, BitcoreLibCash } from 'crypto-wallet-core';
54

65
export default {
76
BTC: {

packages/bitcore-node/src/routes/api/tx.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,10 @@ router.get('/:txId/populated', async (req: Request, res: Response) => {
8080
}
8181

8282
try {
83-
let tx: ITransaction & { blockHeight: number; coins?: Array<ICoin> };
84-
let coins: any;
85-
let tip: any;
86-
87-
// eslint-disable-next-line prefer-const
88-
[tx, coins, tip] = await Promise.all([
89-
ChainStateProvider.getTransaction({ chain, network, txId }),
90-
ChainStateProvider.getCoinsForTx({ chain, network, txid }),
91-
ChainStateProvider.getLocalTip({ chain, network })
83+
const [tx, coins, tip] = await Promise.all([
84+
ChainStateProvider.getTransaction({ chain, network, txId }) as Promise<ITransaction & { blockHeight: number; coins?: Array<ICoin> }>,
85+
ChainStateProvider.getCoinsForTx({ chain, network, txid }) as any, // must cast as any so tx.coins can be set to coins
86+
ChainStateProvider.getLocalTip({ chain, network }) as any
9287
]);
9388

9489
if (!tx) {

packages/bitcore-node/src/server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Node >= 17 started attempting to resolve all dns listings by ipv6 first, these lines are required to make it check ipv4 first
2-
// eslint-disable-next-line import/order
2+
// eslint-disable-next-line import/order, import/newline-after-import
33
import { setDefaultResultOrder } from 'dns';
4-
54
setDefaultResultOrder('ipv4first');
65
import './utils/polyfills';
76
import { FullClusteredWorker } from './workers/all';

packages/bitcore-node/test/integration/websocket.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import { Api } from '../../src/services/api';
88
import { Event } from '../../src/services/event';
99
import { IUtxoNetworkConfig } from '../../src/types/Config';
1010
import { resetDatabase } from '../helpers';
11-
import { PrivateKey } from 'bitcore-lib';
11+
import { BitcoreLib } from 'crypto-wallet-core';
1212

1313
const chain = 'BTC';
1414
const network = 'regtest';
1515
const chainConfig = config.chains[chain][network] as IUtxoNetworkConfig;
1616
const creds = chainConfig.rpc;
1717
const rpc = new AsyncRPC(creds.username, creds.password, creds.host, creds.port);
18+
const { PrivateKey } = BitcoreLib;
1819
import { Client } from 'bitcore-client';
1920
import { WalletStorage } from '../../src/models/wallet';
2021
import { WalletAddressStorage } from '../../src/models/walletAddress';

0 commit comments

Comments
 (0)