Skip to content

Commit 5255cba

Browse files
committed
Merge branch 'cleanupAndUpdateLinter' of https://github.com/kajoseph/bitcore
2 parents 8f5ac21 + 73d0937 commit 5255cba

30 files changed

+315
-320
lines changed

eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export default defineConfig([
1515
ecmaVersion: 2020,
1616
globals: {
1717
...globals.node,
18-
'NodeJS': 'readonly'
18+
'NodeJS': 'readonly',
19+
'BufferEncoding': 'readonly',
1920
}
2021
}
2122
},

packages/bitcore-cli/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
"postcompile": "node createBin -v",
3535
"clean": "rm -rf ./build",
3636
"lint": "eslint .",
37-
"fix": "eslint --fix --quiet .",
38-
"precommit": "echo 'TODO: npm run lint; npm run fix'"
37+
"fix:errors": "eslint --fix --quiet .",
38+
"fix:all": "eslint --fix .",
39+
"precommit": "npm run lint; npm run fix:errors"
3940
},
4041
"dependencies": {
4142
"@clack/prompts": "1.0.0-alpha.3",

packages/bitcore-cli/src/cli.ts

Lines changed: 206 additions & 208 deletions
Large diffs are not rendered by default.

packages/bitcore-cli/src/commands/addresses.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as prompt from '@clack/prompts';
2-
import os from 'os';
32
import type { CommonArgs } from '../../types/cli';
3+
import os from 'os';
44
import { Utils } from '../utils';
55

66
export function command(args: CommonArgs) {
@@ -26,7 +26,7 @@ export async function getAddresses(args: CommonArgs<{ pageSize?: number; page?:
2626
}
2727
const { pageSize } = opts;
2828

29-
await Utils.paginate(async (page, viewAction) => {
29+
await Utils.paginate(async (page, _viewAction) => {
3030
const addresses = await wallet.client.getMainAddresses({
3131
// doNotVerify: true,
3232
limit: pageSize,

packages/bitcore-cli/src/commands/balance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as prompt from '@clack/prompts';
2-
import os from 'os';
32
import type { CommonArgs } from '../../types/cli';
43
import type { ITokenObj } from '../../types/wallet';
4+
import os from 'os';
55
import { Utils } from '../utils';
66

77
export function command(args: CommonArgs) {

packages/bitcore-cli/src/commands/create/createMultiSig.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as prompt from '@clack/prompts';
2+
import { getAddressType, getCopayerName, getPassword } from '../../prompts';
3+
import type { CommonArgs } from '../../../types/cli';
24
import { type Network } from 'bitcore-wallet-client';
35
import os from 'os';
4-
import type { CommonArgs } from '../../../types/cli';
5-
import { getAddressType, getCopayerName, getPassword } from '../../prompts';
66
import { Utils } from '../../utils';
77

88
export async function createMultiSigWallet(
@@ -32,5 +32,5 @@ export async function createMultiSigWallet(
3232

3333
return {
3434
mnemonic: key.get(password).mnemonic,
35-
}
35+
};
3636
}

packages/bitcore-cli/src/commands/create/createSingleSig.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as prompt from '@clack/prompts';
2-
import { type Network } from 'bitcore-wallet-client';
3-
import type { CommonArgs } from '../../../types/cli';
42
import { getAddressType, getPassword } from '../../prompts';
3+
import type { CommonArgs } from '../../../types/cli';
4+
import { type Network } from 'bitcore-wallet-client';
55
import { Utils } from '../../utils';
66

77
export async function createSingleSigWallet(
@@ -34,5 +34,5 @@ export async function createSingleSigWallet(
3434

3535
return {
3636
mnemonic: key.get(password).mnemonic,
37-
}
37+
};
3838
}

packages/bitcore-cli/src/commands/create/createThresholdSig.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as prompt from '@clack/prompts';
2-
import { Key, TssKey, type Network } from 'bitcore-wallet-client'
2+
import { getAddressType, getCopayerName, getPassword } from '../../prompts';
3+
import { Key, type Network, TssKey } from 'bitcore-wallet-client';
4+
import type { CommonArgs } from '../../../types/cli';
35
import crypto from 'crypto';
46
import os from 'os';
57
import url from 'url';
6-
import type { CommonArgs } from '../../../types/cli';
78
import { UserCancelled } from '../../errors';
8-
import { getAddressType, getCopayerName, getPassword } from '../../prompts';
99
import { Utils } from '../../utils';
1010

1111

@@ -45,7 +45,7 @@ export async function createThresholdSigWallet(
4545
for (let i = 1; i < n; i++) {
4646
const pubkey = await prompt.text({
4747
message: `Enter party ${i}'s public key:`,
48-
validate: (input) => !!input ? undefined : 'Public key cannot be empty.',
48+
validate: (input) => input ? undefined : 'Public key cannot be empty.',
4949
});
5050
if (prompt.isCancel(pubkey)) {
5151
throw new UserCancelled();
@@ -98,7 +98,7 @@ export async function createThresholdSigWallet(
9898
});
9999
tss.on('roundsubmitted', (round) => spinner.message(`Round ${round} submitted`));
100100
tss.on('error', prompt.log.error);
101-
tss.on('wallet', async (wallet) => {
101+
tss.on('wallet', async (_wallet) => {
102102
// TODO: what to do with the wallet?
103103
// console.log('Created wallet at BWS:', wallet);
104104
});

packages/bitcore-cli/src/commands/create/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Constants } from 'crypto-wallet-core';
2-
import type { CommonArgs } from '../../../types/cli';
31
import { getChain, getIsMultiParty, getMofN, getMultiPartyScheme, getNetwork } from '../../prompts';
4-
import { Utils } from '../../utils';
2+
import type { CommonArgs } from '../../../types/cli';
3+
import { Constants } from 'crypto-wallet-core';
54
import { createMultiSigWallet } from './createMultiSig';
65
import { createSingleSigWallet } from './createSingleSig';
76
import { createThresholdSigWallet } from './createThresholdSig';
7+
import { Utils } from '../../utils';
88

99
export async function createWallet(args: CommonArgs<{ mnemonic?: string }>) {
1010
const { wallet, opts } = args;
@@ -31,7 +31,7 @@ export async function createWallet(args: CommonArgs<{ mnemonic?: string }>) {
3131
if (useTss) {
3232
({ mnemonic } = await createThresholdSigWallet({ wallet, chain, network, opts, m, n }));
3333
} else {
34-
({ mnemonic} = await createMultiSigWallet({ wallet, chain, network, opts, m, n }));
34+
({ mnemonic } = await createMultiSigWallet({ wallet, chain, network, opts, m, n }));
3535
}
3636
}
3737

packages/bitcore-cli/src/commands/derive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as prompt from '@clack/prompts';
2+
import type { CommonArgs } from '../../types/cli';
23
import { Deriver } from 'crypto-wallet-core';
4+
import { getAction } from '../prompts';
35
import os from 'os';
4-
import type { CommonArgs } from '../../types/cli';
56
import { UserCancelled } from '../errors';
6-
import { getAction } from '../prompts';
77

88
export function command(args: CommonArgs) {
99
const { program } = args;

0 commit comments

Comments
 (0)