Skip to content

Commit

Permalink
refactor: organize imports (typescript)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonilol committed Nov 7, 2024
1 parent eb2a095 commit 49adbcf
Show file tree
Hide file tree
Showing 22 changed files with 85 additions and 86 deletions.
4 changes: 2 additions & 2 deletions addresses.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions addresses.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { strict as assert } from 'assert';
import * as curve from 'tiny-secp256k1';
import * as bitcoin from 'bitcoinjs-lib';
import { ECPairFactory, ECPairInterface } from 'ecpair';
import { Keccak } from 'sha3';
import * as curve from 'tiny-secp256k1';
import { input } from './btc';
import { ECPairFactory, ECPairInterface } from 'ecpair';
import { descsumCreate } from './descriptors';

const mainnet = bitcoin.networks.bitcoin;
Expand Down
8 changes: 4 additions & 4 deletions btc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions btc.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { spawn } from 'child_process';
import { strict as assert } from 'assert';
import * as bitcoin from 'bitcoinjs-lib';
import * as curve from 'tiny-secp256k1';
import { spawn } from 'child_process';
import { ECPairFactory, ECPairInterface } from 'ecpair';
import { createInterface } from 'readline';
import { Writable } from 'stream';
import { ECPairFactory, ECPairInterface } from 'ecpair';
import { strict as assert } from 'assert';
import * as curve from 'tiny-secp256k1';

export { descsumCreate } from './descriptors';

Expand Down
2 changes: 1 addition & 1 deletion ecdh_stealth.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ecdh_stealth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as curve from 'tiny-secp256k1';
import * as bitcoin from 'bitcoinjs-lib';
import bs58check from 'bs58check';
import { randomBytes } from 'crypto';
import * as curve from 'tiny-secp256k1';

export class StealthAddress {
readonly spendPriv?: Buffer;
Expand Down
6 changes: 3 additions & 3 deletions ecdh_stealth_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ecdh_stealth_test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as curve from 'tiny-secp256k1';
import { strict as assert } from 'assert';
import * as bitcoin from 'bitcoinjs-lib';
import { send, setChain, getnewaddress, fundOutputScript, p2pkh } from './btc';
import { randomBytes } from 'crypto';
import { strict as assert } from 'assert';
import { ECPairFactory } from 'ecpair';
import * as curve from 'tiny-secp256k1';
import { fundOutputScript, getnewaddress, p2pkh, send, setChain } from './btc';
import { StealthAddress } from './ecdh_stealth';

setChain('regtest');
Expand Down
8 changes: 4 additions & 4 deletions ecdsa_sigdata.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ecdsa_sigdata.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { setChain, send, getnewaddress, fundOutputScript, ecPrivateMul, ecPrivateDiv, p2pkh } from './btc';
import * as curve from 'tiny-secp256k1';
import { ECPairFactory } from 'ecpair';
import { strict as assert } from 'assert';
import * as bitcoin from 'bitcoinjs-lib';
import * as crypto from 'crypto';
import { strict as assert } from 'assert';
import { ECPairFactory } from 'ecpair';
import * as curve from 'tiny-secp256k1';
import { ecPrivateDiv, ecPrivateMul, fundOutputScript, getnewaddress, p2pkh, send, setChain } from './btc';

setChain('regtest');

Expand Down
10 changes: 5 additions & 5 deletions lightning/lndforcecloser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions lightning/lndforcecloser.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as bitcoin from 'bitcoinjs-lib';
import { btc, setChain, input } from '../btc';
import * as curve from 'tiny-secp256k1';
import { ECPairFactory } from 'ecpair';
import { strict as assert } from 'assert';
import { BIP32Factory } from 'bip32';
import * as bitcoin from 'bitcoinjs-lib';
import { execSync } from 'child_process';
import { ECPairFactory } from 'ecpair';
import { homedir } from 'os';
import { strict as assert } from 'assert';
import * as curve from 'tiny-secp256k1';
import { btc, input, setChain } from '../btc';

import { parseChannelDB, Channel } from './channeldb_reader';
import { Channel, parseChannelDB } from './channeldb_reader';

const ECPair = ECPairFactory(curve);
const bip32 = BIP32Factory(curve);
Expand Down
2 changes: 1 addition & 1 deletion merkle_tree.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion merkle_tree.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as bitcoin from 'bitcoinjs-lib';
import { strict as assert } from 'assert';
import * as bitcoin from 'bitcoinjs-lib';

type Txid = string | Buffer;

Expand Down
8 changes: 4 additions & 4 deletions miner.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions miner.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { ChildProcessWithoutNullStreams, spawn } from 'child_process';
import * as bitcoin from 'bitcoinjs-lib';
import { ChildProcessWithoutNullStreams, spawn } from 'child_process';
import { randomBytes } from 'crypto';
import { ECPairFactory } from 'ecpair';
import { copyFileSync, existsSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from 'fs';
import { dirname } from 'path';
import * as curve from 'tiny-secp256k1';
import {
btc,
bech32toScriptPubKey,
getBlockTemplate,
BlockTemplate,
BlockTemplateTX,
TemplateRequest,
consoleTrace,
bech32toScriptPubKey,
btc,
encodeVarUintLE,
getBlockTemplate,
insertTransaction,
network,
removeTransaction,
setChain,
network,
encodeVarUintLE,
} from './btc';
import { merkleRoot } from './merkle_tree';
import { randomBytes } from 'crypto';
import { writeFileSync, unlinkSync, copyFileSync, readFileSync, readdirSync, existsSync } from 'fs';
import { dirname } from 'path';
import * as curve from 'tiny-secp256k1';
import { ECPairFactory } from 'ecpair';

const ECPair = ECPairFactory(curve);

Expand Down
8 changes: 4 additions & 4 deletions p2tr_ptlc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions p2tr_ptlc.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import * as curve from 'tiny-secp256k1';
import { strict as assert } from 'assert';
import * as bitcoin from 'bitcoinjs-lib';
import { randomBytes } from 'crypto';
import { ECPairFactory, ECPairInterface } from 'ecpair';
import * as curve from 'tiny-secp256k1';
import {
btc,
send,
cloneBuf,
createTaprootOutput,
ecPrivateMul,
negateIfOddPubkey,
cloneBuf,
input,
tapLeaf,
negateIfOddPubkey,
send,
sleep,
tapLeaf,
} from './btc';
import { ECPairFactory, ECPairInterface } from 'ecpair';
import { randomBytes } from 'crypto';
import { strict as assert } from 'assert';

const ECPair = ECPairFactory(curve);

Expand Down
6 changes: 3 additions & 3 deletions p2tr_tapscript.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions p2tr_tapscript.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import * as curve from 'tiny-secp256k1';
import * as bitcoin from 'bitcoinjs-lib';
import { randomBytes } from 'crypto';
import { ECPairFactory } from 'ecpair';
import * as curve from 'tiny-secp256k1';
import {
send,
bech32toScriptPubKey,
createTaprootOutput,
decodeRawTransaction,
fundAddress,
getnewaddress,
decodeRawTransaction,
negateIfOddPubkey,
tapLeaf,
tapBranch,
createTaprootOutput,
OP_CHECKSIGADD,
send,
tapBranch,
tapLeaf,
} from './btc';
import { ECPairFactory } from 'ecpair';
import { randomBytes } from 'crypto';

const ECPair = ECPairFactory(curve);

Expand Down
6 changes: 3 additions & 3 deletions xpriv.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions xpriv.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { input } from './btc';
import * as bitcoin from 'bitcoinjs-lib';
import { strict as assert } from 'assert';
import * as bs58 from 'bs58';
import BIP32Factory, { BIP32Interface } from 'bip32';
import * as bitcoin from 'bitcoinjs-lib';
import * as bs58 from 'bs58';
import * as curve from 'tiny-secp256k1';
import { input } from './btc';

const bip32 = BIP32Factory(curve);

Expand Down

0 comments on commit 49adbcf

Please sign in to comment.