Skip to content

Commit

Permalink
fix: apply lint --fix on module
Browse files Browse the repository at this point in the history
Issue: BTC-1351
  • Loading branch information
OttoAllmendinger committed Sep 26, 2024
1 parent 94dc349 commit 9799c1a
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 22 deletions.
1 change: 1 addition & 0 deletions modules/utxo-bin/bin/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
import * as yargs from 'yargs';

import { cmdParseTx, cmdParseAddress, cmdParseScript, cmdGenerateAddress, cmdParseXpub } from '../src/commands';

yargs
Expand Down
3 changes: 2 additions & 1 deletion modules/utxo-bin/src/InputParser.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as utxolib from '@bitgo/utxo-lib';
import { script, ScriptSignature } from 'bitcoinjs-lib';

import { Parser, ParserNode } from './Parser';
import { getParserTxInputProperties, getPrevOut, ParserTx, ParserTxInput } from './ParserTx';
import { getHollowSpendMessage, HollowSegwitSpend, parseHollowSegwitSpend } from './hollowSegwitSpend';
import { script, ScriptSignature } from 'bitcoinjs-lib';
import { isHighS } from './ecdsa';
import { ChainInfo } from './TxParser';
import { OutputParser } from './OutputParser';
Expand Down
3 changes: 2 additions & 1 deletion modules/utxo-bin/src/OutputParser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as utxolib from '@bitgo/utxo-lib';
import { Network } from '@bitgo/utxo-lib';

import { ChainInfo } from './TxParser';
import { Parser, ParserNode } from './Parser';
import { AddressParser } from './AddressParser';
import { formatSat } from './format';
import { Network } from '@bitgo/utxo-lib';

export class OutputParser extends Parser {
constructor(
Expand Down
3 changes: 2 additions & 1 deletion modules/utxo-bin/src/ScriptParser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Parser, ParserNode } from './Parser';
import * as utxolib from '@bitgo/utxo-lib';

import { Parser, ParserNode } from './Parser';
import { parseUnknown } from './parseUnknown';

const paymentTypes = ['p2sh', 'p2pkh', 'p2wpkh', 'p2wsh', 'p2ms'] as const;
Expand Down
1 change: 1 addition & 0 deletions modules/utxo-bin/src/TxParser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { OutputSpend, TransactionStatus } from '@bitgo/blockapis';
import * as utxolib from '@bitgo/utxo-lib';

import { Parser, ParserNode } from './Parser';
import { formatSat } from './format';
import { getParserTxProperties, ParserTx, ParserTxInput, ParserTxOutput } from './ParserTx';
Expand Down
1 change: 1 addition & 0 deletions modules/utxo-bin/src/args/walletKeys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as assert from 'assert';

import * as utxolib from '@bitgo/utxo-lib';

export function isWalletKeyName(name: string): name is utxolib.bitgo.KeyName {
Expand Down
1 change: 1 addition & 0 deletions modules/utxo-bin/src/bip32.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as utxolib from '@bitgo/utxo-lib';

import { Parser, ParserNode } from './Parser';
import { parseUnknown } from './parseUnknown';

Expand Down
3 changes: 2 additions & 1 deletion modules/utxo-bin/src/commands/cmdGenerateAddress.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getNetworkOptionsDemand, keyOptions, KeyOptions } from '../args';
import * as utxolib from '@bitgo/utxo-lib';
import * as yargs from 'yargs';

import { getNetworkOptionsDemand, keyOptions, KeyOptions } from '../args';
import {
formatAddressTree,
formatAddressWithFormatString,
Expand Down
6 changes: 4 additions & 2 deletions modules/utxo-bin/src/commands/cmdParseAddress.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as utxolib from '@bitgo/utxo-lib';
import { OutputFormat } from './cmdParseTx';
import { AddressParser } from '../AddressParser';
import * as yargs from 'yargs';

import { AddressParser } from '../AddressParser';
import { getNetworkOptions } from '../args';

import { OutputFormat } from './cmdParseTx';
import { formatString } from './formatString';

export type ArgsParseAddress = {
Expand Down
6 changes: 4 additions & 2 deletions modules/utxo-bin/src/commands/cmdParseScript.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as utxolib from '@bitgo/utxo-lib';
import { OutputFormat } from './cmdParseTx';
import { ScriptParser } from '../ScriptParser';
import * as yargs from 'yargs';

import { ScriptParser } from '../ScriptParser';
import { getNetworkOptions, stringToBuffer } from '../args';

import { OutputFormat } from './cmdParseTx';
import { formatString } from './formatString';

export type ArgsParseScript = {
Expand Down
6 changes: 4 additions & 2 deletions modules/utxo-bin/src/commands/cmdParseTx.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as utxolib from '@bitgo/utxo-lib';
import { TxParser, TxParserArgs } from '../TxParser';
import * as yargs from 'yargs';

import { argToString, getNetworkOptionsDemand, ReadStringOptions, readStringOptions, stringToBuffer } from '../args';
import { TxParser, TxParserArgs } from '../TxParser';
import {
fetchOutputSpends,
fetchPrevOutputs,
Expand All @@ -11,10 +12,11 @@ import {
getClient,
} from '../fetch';
import { getParserTxProperties } from '../ParserTx';
import { formatString } from './formatString';
import { parseUnknown } from '../parseUnknown';
import { Parser } from '../Parser';

import { formatString } from './formatString';

export type OutputFormat = 'tree' | 'json';
export type ArgsParseTransaction = ReadStringOptions & {
network: utxolib.Network;
Expand Down
4 changes: 3 additions & 1 deletion modules/utxo-bin/src/commands/cmdParseXpub.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as yargs from 'yargs';
import { formatString, FormatStringArgs } from './formatString';

import { parseXpub } from '../bip32';

import { formatString, FormatStringArgs } from './formatString';

export const cmdParseXpub = {
command: 'parseXpub [xpub]',
describe: 'show xpub info',
Expand Down
6 changes: 4 additions & 2 deletions modules/utxo-bin/src/commands/formatString.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { OutputFormat } from './cmdParseTx';
import { ParserNode } from '../Parser';
import * as yargs from 'yargs';

import { ParserNode } from '../Parser';
import { formatTree } from '../format';

import { OutputFormat } from './cmdParseTx';

export type FormatStringArgs = {
format: OutputFormat;
all: boolean;
Expand Down
2 changes: 1 addition & 1 deletion modules/utxo-bin/src/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as fs from 'fs';
import * as process from 'process';
import { promisify } from 'util';

import * as utxolib from '@bitgo/utxo-lib';
import * as blockapis from '@bitgo/blockapis';
import { BaseHttpClient, CachingHttpClient, getTransactionIdsAtHeight, HttpClient } from '@bitgo/blockapis';
import { coins, UtxoCoin } from '@bitgo/statics';

import { ParserTx } from './ParserTx';
import { promisify } from 'util';

function getTxOutPoints(tx: ParserTx): utxolib.bitgo.TxOutPoint[] {
if (tx instanceof utxolib.bitgo.UtxoTransaction) {
Expand Down
1 change: 1 addition & 0 deletions modules/utxo-bin/src/format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Chalk, Instance } from 'chalk';
import * as archy from 'archy';

import { ParserNode, ParserNodeValue } from './Parser';

const hideDefault = ['pubkeys', 'sequence', 'locktime', 'scriptSig', 'witness'];
Expand Down
2 changes: 2 additions & 0 deletions modules/utxo-bin/src/generateAddress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'assert';

import * as utxolib from '@bitgo/utxo-lib';

import { Parser } from './Parser';
import { parseUnknown } from './parseUnknown';
import { formatTree } from './format';
Expand Down
6 changes: 4 additions & 2 deletions modules/utxo-bin/test/bip32.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { formatTreeNoColor, getFixtureString } from './fixtures';
import { parseXpub } from '../src/bip32';
import * as assert from 'assert';

import { parseXpub } from '../src/bip32';

import { formatTreeNoColor, getFixtureString } from './fixtures';
import { getKey } from './bip32.util';

function runTest(xpub: string, args: { derive?: string }) {
Expand Down
3 changes: 2 additions & 1 deletion modules/utxo-bin/test/bip32.util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as utxolib from '@bitgo/utxo-lib';
import * as crypto from 'crypto';

import * as utxolib from '@bitgo/utxo-lib';
import { BIP32Interface } from 'bip32';

export type Triple<T> = [T, T, T];
Expand Down
2 changes: 2 additions & 0 deletions modules/utxo-bin/test/generateAddress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'assert';

import { formatAddressWithFormatString, generateAddress, parseIndexRange } from '../src/generateAddress';

import { getKeyTriple } from './bip32.util';

describe('generateAddresses', function () {
Expand Down
4 changes: 3 additions & 1 deletion modules/utxo-bin/test/parseAddress.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import * as assert from 'assert';

import * as yargs from 'yargs';
import * as utxolib from '@bitgo/utxo-lib';

import { cmdParseAddress, getAddressParser } from '../src/commands';

import { formatTreeNoColor, getFixtureString } from './fixtures';
import { getKeyTriple, KeyTriple } from './bip32.util';
import { cmdParseAddress, getAddressParser } from '../src/commands';

const scriptTypesSingleSig = ['p2pkh', 'p2wkh'] as const;
const scriptTypes = [...utxolib.bitgo.outputScripts.scriptTypes2Of3, ...scriptTypesSingleSig] as const;
Expand Down
5 changes: 4 additions & 1 deletion modules/utxo-bin/test/parseScript.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import * as assert from 'assert';

import * as utxolib from '@bitgo/utxo-lib';
import { formatTreeNoColor, getFixtureString, getTransactionWithSpendType, ParsedFixture } from './fixtures';

import { ParserNode } from '../src/Parser';
import { ScriptParser } from '../src/ScriptParser';

import { formatTreeNoColor, getFixtureString, getTransactionWithSpendType, ParsedFixture } from './fixtures';

function testParseScript(type: utxolib.bitgo.outputScripts.ScriptType2Of3) {
let tx: ParsedFixture;
before('setup transaction', async function () {
Expand Down
9 changes: 6 additions & 3 deletions modules/utxo-bin/test/parseTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import * as mocha from 'mocha';
import * as yargs from 'yargs';
import * as assert from 'assert';

import * as yargs from 'yargs';
import * as mocha from 'mocha';
import * as utxolib from '@bitgo/utxo-lib';
import { formatTreeNoColor, getFixtureString, getTransactionWithSpendType, ParsedFixture } from './fixtures';

import { ParserNode } from '../src/Parser';
import { ParserTx } from '../src/ParserTx';
import { cmdParseTx, getTxParser } from '../src/commands';

import { formatTreeNoColor, getFixtureString, getTransactionWithSpendType, ParsedFixture } from './fixtures';

type TestParams = {
scriptType: utxolib.bitgo.outputScripts.ScriptType2Of3;
spendType: 'keyPath' | 'scriptPath' | undefined;
Expand Down

0 comments on commit 9799c1a

Please sign in to comment.