Skip to content

Commit 1e3d9d9

Browse files
committed
Rename files to match main exported interface
The convention is such that if a file's main purpose is to define a interface/type by a class or factory function, then the file name should match the name of that interface. So, we remove "make" from file names, and we make some changes to interface type names to match the file name.
1 parent d089927 commit 1e3d9d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+65
-65
lines changed

src/bch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/bitcoincash'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

src/bsv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/bitcoinsv'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

src/btc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/bitcoin'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

src/common/plugin/makeCurrencyPlugin.ts renamed to src/common/plugin/CurrencyPlugin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {
77
EdgeWalletInfo
88
} from 'edge-core-js/types'
99

10-
import { makeUtxoEngine } from '../utxobased/engine/makeUtxoEngine'
1110
import { asUtxoUserSettings } from '../utxobased/engine/types'
12-
import { makeCurrencyTools } from './makeCurrencyTools'
13-
import { makeEngineEmitter } from './makeEngineEmitter'
14-
import { makePluginState } from './pluginState'
11+
import { makeUtxoEngine } from '../utxobased/engine/UtxoEngine'
12+
import { makeCurrencyTools } from './CurrencyTools'
13+
import { makeEngineEmitter } from './EngineEmitter'
14+
import { makePluginState } from './PluginState'
1515
import { EngineConfig, PluginInfo } from './types'
1616

1717
export function makeCurrencyPlugin(

src/common/plugin/makeEngineEmitter.ts renamed to src/common/plugin/EngineEmitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from 'edge-core-js/types'
66
import { EventEmitter } from 'events'
77

8-
import { SubscribeAddressResponse } from '../utxobased/network/BlockBookAPI'
8+
import { SubscribeAddressResponse } from '../utxobased/network/blockbookApi'
99

1010
export declare interface EngineEmitter {
1111
emit: ((

src/common/plugin/makeMetadata.ts renamed to src/common/plugin/Metadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { EdgeLog } from 'edge-core-js/types'
44
import { makeMemlet } from 'memlet'
55

66
import AwaitLock from '../utxobased/engine/await-lock'
7-
import { EngineEmitter, EngineEvent } from './makeEngineEmitter'
7+
import { EngineEmitter, EngineEvent } from './EngineEmitter'
88
import { asLocalWalletMetadata, LocalWalletMetadata } from './types'
99
import { removeItem } from './utils'
1010

src/common/plugin/pluginState.ts renamed to src/common/plugin/PluginState.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ import { Disklet } from 'disklet'
55
import { EdgeIo, EdgeLog } from 'edge-core-js/types'
66
import { makeMemlet } from 'memlet'
77

8-
import { UtxoEngineState } from '../utxobased/engine/makeUtxoEngineState'
98
import { UtxoUserSettings } from '../utxobased/engine/types'
9+
import { UtxoEngineState } from '../utxobased/engine/UtxoEngineState'
1010
import {
1111
asServerCache,
1212
ServerCache,
1313
ServerList,
1414
ServerScores
15-
} from './serverScores'
15+
} from './ServerScores'
1616

1717
// Info server endpoint to getting ServerListInfo data
1818
const serverListInfoUrl = 'https://info1.edge.app/v1/blockBook/'
19-
// The filename for ServerInfoCache data (see serverScores.ts)
20-
// Perhaps this should be in serverScores.ts file, but that'll take some refactoring
19+
// The filename for ServerInfoCache data (see ServerScores.ts)
20+
// Perhaps this should be in ServerScores.ts file, but that'll take some refactoring
2121
const SERVER_CACHE_FILE = 'serverCache.json'
2222

2323
// ServerListInfo data structure from info server and saved to disk
File renamed without changes.

src/common/plugin/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import * as wif from 'wif'
2525
import { asIUTXO, IProcessorTransaction, IUTXO } from '../utxobased/db/types'
2626
import { ScriptTemplates } from '../utxobased/info/scriptTemplates/types'
2727
import { UtxoPicker } from '../utxobased/keymanager/utxopicker'
28-
import { EngineEmitter } from './makeEngineEmitter'
29-
import { PluginState } from './pluginState'
28+
import { EngineEmitter } from './EngineEmitter'
29+
import { PluginState } from './PluginState'
3030

3131
export type CurrencyFormat = ReturnType<typeof asCurrencyFormat>
3232
export const asCurrencyFormat = asValue('bip32', 'bip44', 'bip49', 'bip84')

src/common/utxobased/db/Models/ProcessorTransaction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import BN from 'bn.js'
44
import { EdgeTransaction, JsonObject } from 'edge-core-js/types'
55

66
import { PluginInfo } from '../../../plugin/types'
7-
import { UTXOPluginWalletTools } from '../../engine/makeUtxoWalletTools'
87
import { UtxoTxOtherParams } from '../../engine/types'
9-
import { Processor } from '../makeProcessor'
8+
import { UtxoWalletTools } from '../../engine/UtxoWalletTools'
9+
import { Processor } from '../Processor'
1010
import { IProcessorTransaction } from '../types'
1111

1212
export const fromEdgeTransaction = (
@@ -54,7 +54,7 @@ export const fromEdgeTransaction = (
5454
interface ToEdgeTransactionArgs {
5555
walletId: string
5656
tx: IProcessorTransaction
57-
walletTools: UTXOPluginWalletTools
57+
walletTools: UtxoWalletTools
5858
processor: Processor
5959
pluginInfo: PluginInfo
6060
}

src/common/utxobased/db/makeProcessor.ts renamed to src/common/utxobased/db/Processor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { makeMemlet } from 'memlet'
66

77
import { unixTime } from '../../../util/unixTime'
88
import { AddressPath, ChangePath } from '../../plugin/types'
9-
import { makeBaselets } from './makeBaselets'
9+
import { makeBaselets } from './Baselets'
1010
import { addressPathToPrefix, TxIdByDate } from './Models/baselet'
1111
import {
1212
IAddress,

src/common/utxobased/db/util/utxo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
BIP43PurposeTypeEnum,
44
ScriptTypeEnum
55
} from '../../keymanager/keymanager'
6-
import { Processor } from '../makeProcessor'
6+
import { Processor } from '../Processor'
77
import { IProcessorTransaction, IUTXO } from '../types'
88

99
export const utxoFromProcessorTransactionInput = async (

src/common/utxobased/engine/makeServerStates.ts renamed to src/common/utxobased/engine/ServerStates.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { EdgeLog, EdgeTransaction } from 'edge-core-js/types'
22
import { parse } from 'uri-js'
33

4-
import { EngineEmitter, EngineEvent } from '../../plugin/makeEngineEmitter'
5-
import { PluginState } from '../../plugin/pluginState'
4+
import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter'
5+
import { PluginState } from '../../plugin/PluginState'
66
import { PluginInfo } from '../../plugin/types'
77
import { removeItem } from '../../plugin/utils'
88
import { SafeWalletInfo } from '../keymanager/cleaners'
99
import { BlockBook, makeBlockBook } from '../network/BlockBook'
10-
import { SubscribeAddressResponse } from '../network/BlockBookAPI'
10+
import { SubscribeAddressResponse } from '../network/blockbookApi'
1111
import Deferred from '../network/Deferred'
12-
import { SocketEmitter, SocketEvent } from '../network/MakeSocketEmitter'
1312
import { WsTask } from '../network/Socket'
13+
import { SocketEmitter, SocketEvent } from '../network/SocketEmitter'
1414
import { pushUpdate, removeIdFromQueue } from '../network/socketQueue'
1515
import { MAX_CONNECTIONS, NEW_CONNECTIONS } from './constants'
1616

src/common/utxobased/engine/makeUtxoEngine.ts renamed to src/common/utxobased/engine/UtxoEngine.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ import {
2121
import { filterUndefined } from '../../../util/filterUndefined'
2222
import { unixTime } from '../../../util/unixTime'
2323
import { makeFees } from '../../fees/makeFees'
24-
import { EngineEmitter, EngineEvent } from '../../plugin/makeEngineEmitter'
25-
import { makeMetadata } from '../../plugin/makeMetadata'
24+
import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter'
25+
import { makeMetadata } from '../../plugin/Metadata'
2626
import { EngineConfig, TxOptions } from '../../plugin/types'
2727
import { upgradeMemos } from '../../upgradeMemos'
28-
import { makeProcessor } from '../db/makeProcessor'
2928
import {
3029
fromEdgeTransaction,
3130
toEdgeTransaction
3231
} from '../db/Models/ProcessorTransaction'
32+
import { makeProcessor } from '../db/Processor'
3333
import { IProcessorTransaction, IUTXO } from '../db/types'
3434
import { utxoFromProcessorTransactionInput } from '../db/util/utxo'
3535
import {
@@ -47,8 +47,6 @@ import {
4747
} from '../keymanager/keymanager'
4848
import { asMaybeInsufficientFundsErrorPlus } from '../keymanager/types'
4949
import { transactionSizeFromHex } from '../keymanager/utxopicker/utils'
50-
import { makeUtxoEngineState, transactionChanged } from './makeUtxoEngineState'
51-
import { makeUtxoWalletTools } from './makeUtxoWalletTools'
5250
import { createPayment, getPaymentDetails, sendPayment } from './paymentRequest'
5351
import {
5452
asUtxoSignMessageOtherParams,
@@ -63,6 +61,8 @@ import {
6361
pathToPurposeType,
6462
sumUtxos
6563
} from './utils'
64+
import { makeUtxoEngineState, transactionChanged } from './UtxoEngineState'
65+
import { makeUtxoWalletTools } from './UtxoWalletTools'
6666

6767
export async function makeUtxoEngine(
6868
config: EngineConfig

src/common/utxobased/engine/makeUtxoEngineState.ts renamed to src/common/utxobased/engine/UtxoEngineState.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
EdgeTransaction
88
} from 'edge-core-js/types'
99

10-
import { EngineEmitter, EngineEvent } from '../../plugin/makeEngineEmitter'
11-
import { PluginState } from '../../plugin/pluginState'
10+
import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter'
11+
import { PluginState } from '../../plugin/PluginState'
1212
import {
1313
AddressPath,
1414
ChangePath,
@@ -18,8 +18,8 @@ import {
1818
PluginInfo
1919
} from '../../plugin/types'
2020
import { removeItem } from '../../plugin/utils'
21-
import { Processor } from '../db/makeProcessor'
2221
import { toEdgeTransaction } from '../db/Models/ProcessorTransaction'
22+
import { Processor } from '../db/Processor'
2323
import {
2424
IAddress,
2525
IProcessorTransaction,
@@ -42,19 +42,19 @@ import {
4242
transactionMessage,
4343
transactionMessageSpecific,
4444
TransactionResponse
45-
} from '../network/BlockBookAPI'
45+
} from '../network/blockbookApi'
4646
import Deferred from '../network/Deferred'
4747
import { WsTask } from '../network/Socket'
4848
import AwaitLock from './await-lock'
4949
import { BLOCKBOOK_TXS_PER_PAGE, CACHE_THROTTLE } from './constants'
50-
import { makeServerStates, ServerStates } from './makeServerStates'
51-
import { UTXOPluginWalletTools } from './makeUtxoWalletTools'
50+
import { makeServerStates, ServerStates } from './ServerStates'
5251
import {
5352
getFormatSupportedBranches,
5453
getScriptTypeFromPurposeType,
5554
pathToPurposeType,
5655
validScriptPubkeyFromAddress
5756
} from './utils'
57+
import { UtxoWalletTools } from './UtxoWalletTools'
5858

5959
export interface UtxoEngineState {
6060
processedPercent: number
@@ -86,7 +86,7 @@ export interface UtxoEngineState {
8686
}
8787

8888
export interface UtxoEngineStateConfig extends EngineConfig {
89-
walletTools: UTXOPluginWalletTools
89+
walletTools: UtxoWalletTools
9090
walletInfo: SafeWalletInfo
9191
processor: Processor
9292
}
@@ -513,7 +513,7 @@ export function makeUtxoEngineState(
513513
interface CommonArgs {
514514
pluginInfo: PluginInfo
515515
walletInfo: SafeWalletInfo
516-
walletTools: UTXOPluginWalletTools
516+
walletTools: UtxoWalletTools
517517
processor: Processor
518518
emitter: EngineEmitter
519519
taskCache: TaskCache
@@ -686,7 +686,7 @@ interface TransactionChangedArgs {
686686
walletId: string
687687
tx: IProcessorTransaction
688688
emitter: EngineEmitter
689-
walletTools: UTXOPluginWalletTools
689+
walletTools: UtxoWalletTools
690690
pluginInfo: PluginInfo
691691
processor: Processor
692692
}
@@ -1079,7 +1079,7 @@ const updateTransactions = (
10791079
}
10801080

10811081
interface DeriveScriptAddressArgs {
1082-
walletTools: UTXOPluginWalletTools
1082+
walletTools: UtxoWalletTools
10831083
engineInfo: EngineInfo
10841084
processor: Processor
10851085
format: CurrencyFormat

src/common/utxobased/engine/makeUtxoWalletTools.ts renamed to src/common/utxobased/engine/UtxoWalletTools.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface WalletToolsConfig {
3232
publicKey: PublicKey
3333
}
3434

35-
export interface UTXOPluginWalletTools {
35+
export interface UtxoWalletTools {
3636
getPubkey: (args: AddressPath) => string
3737

3838
getScriptPubkey: (args: AddressPath) => ScriptPubkeyReturn
@@ -96,14 +96,14 @@ interface SignMessageArgs {
9696

9797
export function makeUtxoWalletTools(
9898
config: WalletToolsConfig
99-
): UTXOPluginWalletTools {
99+
): UtxoWalletTools {
100100
const { pluginInfo, publicKey } = config
101101
const { engineInfo } = pluginInfo
102102
const { name: coin } = pluginInfo.coinInfo
103103

104104
const xpubKeys = publicKey.publicKeys
105105

106-
const fns: UTXOPluginWalletTools = {
106+
const fns: UtxoWalletTools = {
107107
getPubkey(args: AddressPath): string {
108108
if (xpubKeys[args.format] == null) {
109109
throw new Error(

src/common/utxobased/engine/util/getOwnUtxosFromTx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { EngineInfo } from '../../../plugin/types'
2-
import { Processor } from '../../db/makeProcessor'
2+
import { Processor } from '../../db/Processor'
33
import { IProcessorTransaction, IUTXO } from '../../db/types'
44
import { BIP43PurposeTypeEnum } from '../../keymanager/keymanager'
55
import { getScriptTypeFromPurposeType, pathToPurposeType } from '../utils'

src/common/utxobased/network/BlockBook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Cleaner } from 'cleaners'
22
import { EdgeLog, EdgeTransaction } from 'edge-core-js/types'
33

4-
import { EngineEmitter, EngineEvent } from '../../plugin/makeEngineEmitter'
4+
import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter'
55
import {
66
addressMessage,
77
AddressResponse,
@@ -20,10 +20,10 @@ import {
2020
SubscribeNewBlockResponse,
2121
transactionMessage,
2222
TransactionResponse
23-
} from './BlockBookAPI'
23+
} from './blockbookApi'
2424
import Deferred from './Deferred'
25-
import { SocketEmitter } from './MakeSocketEmitter'
2625
import { makeSocket, OnQueueSpaceCB } from './Socket'
26+
import { SocketEmitter } from './SocketEmitter'
2727

2828
export type WatchAddressesCB = (
2929
response: SubscribeAddressResponse

src/common/utxobased/network/Socket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { EdgeLog } from 'edge-core-js/types'
33

44
import { removeItem } from '../../plugin/utils'
55
import Deferred from './Deferred'
6-
import { SocketEmitter, SocketEvent } from './MakeSocketEmitter'
76
import { setupWS } from './nodejsWS'
7+
import { SocketEmitter, SocketEvent } from './SocketEmitter'
88
import { pushUpdate, removeIdFromQueue } from './socketQueue'
99
import { InnerSocket, InnerSocketCallbacks, ReadyState } from './types'
1010
import { setupBrowser } from './windowWS'

src/firo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/zcoin'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

src/ftc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/feathercoin'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCorePlugins } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { all } from './common/utxobased/info/all'
55

66
const plugins: EdgeCorePlugins = {}

src/ltc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/litecoin'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

src/tbch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/bitcoincashtestnet'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

src/tbtc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/bitcointestnet'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

src/tbtg.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types'
22

3-
import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin'
3+
import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin'
44
import { info } from './common/utxobased/info/bitcoingoldtestnet'
55

66
const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin =>

test/common/plugin/currencyPlugin.spec.ts renamed to test/common/plugin/CurrencyPlugin.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { before, describe, it } from 'mocha'
1111

1212
import edgeCorePlugins from '../../../src/index'
1313
import { testLog } from '../../util/testLog'
14-
import { fixtures } from './currencyPlugin.fixtures/index'
14+
import { fixtures } from './CurrencyPlugin.fixtures/index'
1515

1616
describe('currencyPlugins.spec', () => {
1717
for (const fixture of fixtures) {

0 commit comments

Comments
 (0)