From 1e3d9d96e7c01866a0ce5a10e99ed84abe5af18c Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Mon, 8 Apr 2024 13:46:05 -0700 Subject: [PATCH 1/5] 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. --- src/bch.ts | 2 +- src/bsv.ts | 2 +- src/btc.ts | 2 +- ...akeCurrencyPlugin.ts => CurrencyPlugin.ts} | 8 ++++---- ...{makeCurrencyTools.ts => CurrencyTools.ts} | 0 ...{makeEngineEmitter.ts => EngineEmitter.ts} | 2 +- .../plugin/{makeMetadata.ts => Metadata.ts} | 2 +- .../plugin/{pluginState.ts => PluginState.ts} | 8 ++++---- .../{serverScores.ts => ServerScores.ts} | 0 src/common/plugin/types.ts | 4 ++-- .../db/{makeBaselets.ts => Baselets.ts} | 0 .../db/Models/ProcessorTransaction.ts | 6 +++--- .../utxobased/db/{makeMutex.ts => Mutex.ts} | 0 .../db/{makeProcessor.ts => Processor.ts} | 2 +- src/common/utxobased/db/util/utxo.ts | 2 +- .../{makeServerStates.ts => ServerStates.ts} | 8 ++++---- .../{makeUtxoEngine.ts => UtxoEngine.ts} | 10 +++++----- ...eUtxoEngineState.ts => UtxoEngineState.ts} | 20 +++++++++---------- ...eUtxoWalletTools.ts => UtxoWalletTools.ts} | 6 +++--- .../engine/util/getOwnUtxosFromTx.ts | 2 +- src/common/utxobased/network/BlockBook.ts | 6 +++--- src/common/utxobased/network/Socket.ts | 2 +- ...{MakeSocketEmitter.ts => SocketEmitter.ts} | 0 src/firo.ts | 2 +- src/ftc.ts | 2 +- src/index.ts | 2 +- src/ltc.ts | 2 +- src/tbch.ts | 2 +- src/tbtc.ts | 2 +- src/tbtg.ts | 2 +- .../common.ts | 0 .../currencies/bitcoin.ts | 0 .../currencies/bitcoincash.ts | 0 .../currencies/bitcoinsv.ts | 0 .../currencies/digibyte.ts | 0 .../currencies/feathercoin.ts | 0 .../currencies/groestlcoin.ts | 0 .../currencies/litecoin.ts | 0 .../currencies/smartcash.ts | 0 .../currencies/zcoin.ts | 0 .../index.ts | 0 ...yPlugin.spec.ts => CurrencyPlugin.spec.ts} | 2 +- ...{makeMetadata.spec.ts => Metadata.spec.ts} | 4 ++-- ...verScores.spec.ts => ServerScores.spec.ts} | 4 ++-- test/common/utxobased/db/Processor.spec.ts | 2 +- .../utxobased/engine/UtxoWalletTools.spec.ts | 2 +- .../utxobased/network/BlockBook.spec.ts | 8 ++++---- 47 files changed, 65 insertions(+), 65 deletions(-) rename src/common/plugin/{makeCurrencyPlugin.ts => CurrencyPlugin.ts} (87%) rename src/common/plugin/{makeCurrencyTools.ts => CurrencyTools.ts} (100%) rename src/common/plugin/{makeEngineEmitter.ts => EngineEmitter.ts} (97%) rename src/common/plugin/{makeMetadata.ts => Metadata.ts} (97%) rename src/common/plugin/{pluginState.ts => PluginState.ts} (96%) rename src/common/plugin/{serverScores.ts => ServerScores.ts} (100%) rename src/common/utxobased/db/{makeBaselets.ts => Baselets.ts} (100%) rename src/common/utxobased/db/{makeMutex.ts => Mutex.ts} (100%) rename src/common/utxobased/db/{makeProcessor.ts => Processor.ts} (99%) rename src/common/utxobased/engine/{makeServerStates.ts => ServerStates.ts} (97%) rename src/common/utxobased/engine/{makeUtxoEngine.ts => UtxoEngine.ts} (98%) rename src/common/utxobased/engine/{makeUtxoEngineState.ts => UtxoEngineState.ts} (98%) rename src/common/utxobased/engine/{makeUtxoWalletTools.ts => UtxoWalletTools.ts} (98%) rename src/common/utxobased/network/{MakeSocketEmitter.ts => SocketEmitter.ts} (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/common.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/bitcoin.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/bitcoincash.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/bitcoinsv.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/digibyte.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/feathercoin.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/groestlcoin.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/litecoin.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/smartcash.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/currencies/zcoin.ts (100%) rename test/common/plugin/{currencyPlugin.fixtures => CurrencyPlugin.fixtures}/index.ts (100%) rename test/common/plugin/{currencyPlugin.spec.ts => CurrencyPlugin.spec.ts} (99%) rename test/common/plugin/{makeMetadata.spec.ts => Metadata.spec.ts} (95%) rename test/common/plugin/{serverScores.spec.ts => ServerScores.spec.ts} (98%) diff --git a/src/bch.ts b/src/bch.ts index b2f8b694..8755948e 100644 --- a/src/bch.ts +++ b/src/bch.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/bitcoincash' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/src/bsv.ts b/src/bsv.ts index f51cb9ab..8059f176 100644 --- a/src/bsv.ts +++ b/src/bsv.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/bitcoinsv' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/src/btc.ts b/src/btc.ts index b9fb7b2a..2f457c1c 100644 --- a/src/btc.ts +++ b/src/btc.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/bitcoin' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/src/common/plugin/makeCurrencyPlugin.ts b/src/common/plugin/CurrencyPlugin.ts similarity index 87% rename from src/common/plugin/makeCurrencyPlugin.ts rename to src/common/plugin/CurrencyPlugin.ts index 565b8701..4c46f44e 100644 --- a/src/common/plugin/makeCurrencyPlugin.ts +++ b/src/common/plugin/CurrencyPlugin.ts @@ -7,11 +7,11 @@ import { EdgeWalletInfo } from 'edge-core-js/types' -import { makeUtxoEngine } from '../utxobased/engine/makeUtxoEngine' import { asUtxoUserSettings } from '../utxobased/engine/types' -import { makeCurrencyTools } from './makeCurrencyTools' -import { makeEngineEmitter } from './makeEngineEmitter' -import { makePluginState } from './pluginState' +import { makeUtxoEngine } from '../utxobased/engine/UtxoEngine' +import { makeCurrencyTools } from './CurrencyTools' +import { makeEngineEmitter } from './EngineEmitter' +import { makePluginState } from './PluginState' import { EngineConfig, PluginInfo } from './types' export function makeCurrencyPlugin( diff --git a/src/common/plugin/makeCurrencyTools.ts b/src/common/plugin/CurrencyTools.ts similarity index 100% rename from src/common/plugin/makeCurrencyTools.ts rename to src/common/plugin/CurrencyTools.ts diff --git a/src/common/plugin/makeEngineEmitter.ts b/src/common/plugin/EngineEmitter.ts similarity index 97% rename from src/common/plugin/makeEngineEmitter.ts rename to src/common/plugin/EngineEmitter.ts index 2542f8e6..f8b463c0 100644 --- a/src/common/plugin/makeEngineEmitter.ts +++ b/src/common/plugin/EngineEmitter.ts @@ -5,7 +5,7 @@ import { } from 'edge-core-js/types' import { EventEmitter } from 'events' -import { SubscribeAddressResponse } from '../utxobased/network/BlockBookAPI' +import { SubscribeAddressResponse } from '../utxobased/network/blockbookApi' export declare interface EngineEmitter { emit: (( diff --git a/src/common/plugin/makeMetadata.ts b/src/common/plugin/Metadata.ts similarity index 97% rename from src/common/plugin/makeMetadata.ts rename to src/common/plugin/Metadata.ts index 8361fecb..bec6d8cf 100644 --- a/src/common/plugin/makeMetadata.ts +++ b/src/common/plugin/Metadata.ts @@ -4,7 +4,7 @@ import { EdgeLog } from 'edge-core-js/types' import { makeMemlet } from 'memlet' import AwaitLock from '../utxobased/engine/await-lock' -import { EngineEmitter, EngineEvent } from './makeEngineEmitter' +import { EngineEmitter, EngineEvent } from './EngineEmitter' import { asLocalWalletMetadata, LocalWalletMetadata } from './types' import { removeItem } from './utils' diff --git a/src/common/plugin/pluginState.ts b/src/common/plugin/PluginState.ts similarity index 96% rename from src/common/plugin/pluginState.ts rename to src/common/plugin/PluginState.ts index 780ec3f2..60734a9a 100644 --- a/src/common/plugin/pluginState.ts +++ b/src/common/plugin/PluginState.ts @@ -5,19 +5,19 @@ import { Disklet } from 'disklet' import { EdgeIo, EdgeLog } from 'edge-core-js/types' import { makeMemlet } from 'memlet' -import { UtxoEngineState } from '../utxobased/engine/makeUtxoEngineState' import { UtxoUserSettings } from '../utxobased/engine/types' +import { UtxoEngineState } from '../utxobased/engine/UtxoEngineState' import { asServerCache, ServerCache, ServerList, ServerScores -} from './serverScores' +} from './ServerScores' // Info server endpoint to getting ServerListInfo data const serverListInfoUrl = 'https://info1.edge.app/v1/blockBook/' -// The filename for ServerInfoCache data (see serverScores.ts) -// Perhaps this should be in serverScores.ts file, but that'll take some refactoring +// The filename for ServerInfoCache data (see ServerScores.ts) +// Perhaps this should be in ServerScores.ts file, but that'll take some refactoring const SERVER_CACHE_FILE = 'serverCache.json' // ServerListInfo data structure from info server and saved to disk diff --git a/src/common/plugin/serverScores.ts b/src/common/plugin/ServerScores.ts similarity index 100% rename from src/common/plugin/serverScores.ts rename to src/common/plugin/ServerScores.ts diff --git a/src/common/plugin/types.ts b/src/common/plugin/types.ts index 90c7439d..4884f66f 100644 --- a/src/common/plugin/types.ts +++ b/src/common/plugin/types.ts @@ -25,8 +25,8 @@ import * as wif from 'wif' import { asIUTXO, IProcessorTransaction, IUTXO } from '../utxobased/db/types' import { ScriptTemplates } from '../utxobased/info/scriptTemplates/types' import { UtxoPicker } from '../utxobased/keymanager/utxopicker' -import { EngineEmitter } from './makeEngineEmitter' -import { PluginState } from './pluginState' +import { EngineEmitter } from './EngineEmitter' +import { PluginState } from './PluginState' export type CurrencyFormat = ReturnType export const asCurrencyFormat = asValue('bip32', 'bip44', 'bip49', 'bip84') diff --git a/src/common/utxobased/db/makeBaselets.ts b/src/common/utxobased/db/Baselets.ts similarity index 100% rename from src/common/utxobased/db/makeBaselets.ts rename to src/common/utxobased/db/Baselets.ts diff --git a/src/common/utxobased/db/Models/ProcessorTransaction.ts b/src/common/utxobased/db/Models/ProcessorTransaction.ts index 4bfaa0e5..42933a51 100644 --- a/src/common/utxobased/db/Models/ProcessorTransaction.ts +++ b/src/common/utxobased/db/Models/ProcessorTransaction.ts @@ -4,9 +4,9 @@ import BN from 'bn.js' import { EdgeTransaction, JsonObject } from 'edge-core-js/types' import { PluginInfo } from '../../../plugin/types' -import { UTXOPluginWalletTools } from '../../engine/makeUtxoWalletTools' import { UtxoTxOtherParams } from '../../engine/types' -import { Processor } from '../makeProcessor' +import { UtxoWalletTools } from '../../engine/UtxoWalletTools' +import { Processor } from '../Processor' import { IProcessorTransaction } from '../types' export const fromEdgeTransaction = ( @@ -54,7 +54,7 @@ export const fromEdgeTransaction = ( interface ToEdgeTransactionArgs { walletId: string tx: IProcessorTransaction - walletTools: UTXOPluginWalletTools + walletTools: UtxoWalletTools processor: Processor pluginInfo: PluginInfo } diff --git a/src/common/utxobased/db/makeMutex.ts b/src/common/utxobased/db/Mutex.ts similarity index 100% rename from src/common/utxobased/db/makeMutex.ts rename to src/common/utxobased/db/Mutex.ts diff --git a/src/common/utxobased/db/makeProcessor.ts b/src/common/utxobased/db/Processor.ts similarity index 99% rename from src/common/utxobased/db/makeProcessor.ts rename to src/common/utxobased/db/Processor.ts index 8e6ee2d4..78c651f1 100644 --- a/src/common/utxobased/db/makeProcessor.ts +++ b/src/common/utxobased/db/Processor.ts @@ -6,7 +6,7 @@ import { makeMemlet } from 'memlet' import { unixTime } from '../../../util/unixTime' import { AddressPath, ChangePath } from '../../plugin/types' -import { makeBaselets } from './makeBaselets' +import { makeBaselets } from './Baselets' import { addressPathToPrefix, TxIdByDate } from './Models/baselet' import { IAddress, diff --git a/src/common/utxobased/db/util/utxo.ts b/src/common/utxobased/db/util/utxo.ts index 300d3f5d..07dc07b6 100644 --- a/src/common/utxobased/db/util/utxo.ts +++ b/src/common/utxobased/db/util/utxo.ts @@ -3,7 +3,7 @@ import { BIP43PurposeTypeEnum, ScriptTypeEnum } from '../../keymanager/keymanager' -import { Processor } from '../makeProcessor' +import { Processor } from '../Processor' import { IProcessorTransaction, IUTXO } from '../types' export const utxoFromProcessorTransactionInput = async ( diff --git a/src/common/utxobased/engine/makeServerStates.ts b/src/common/utxobased/engine/ServerStates.ts similarity index 97% rename from src/common/utxobased/engine/makeServerStates.ts rename to src/common/utxobased/engine/ServerStates.ts index 35be1103..f177eb83 100644 --- a/src/common/utxobased/engine/makeServerStates.ts +++ b/src/common/utxobased/engine/ServerStates.ts @@ -1,16 +1,16 @@ import { EdgeLog, EdgeTransaction } from 'edge-core-js/types' import { parse } from 'uri-js' -import { EngineEmitter, EngineEvent } from '../../plugin/makeEngineEmitter' -import { PluginState } from '../../plugin/pluginState' +import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter' +import { PluginState } from '../../plugin/PluginState' import { PluginInfo } from '../../plugin/types' import { removeItem } from '../../plugin/utils' import { SafeWalletInfo } from '../keymanager/cleaners' import { BlockBook, makeBlockBook } from '../network/BlockBook' -import { SubscribeAddressResponse } from '../network/BlockBookAPI' +import { SubscribeAddressResponse } from '../network/blockbookApi' import Deferred from '../network/Deferred' -import { SocketEmitter, SocketEvent } from '../network/MakeSocketEmitter' import { WsTask } from '../network/Socket' +import { SocketEmitter, SocketEvent } from '../network/SocketEmitter' import { pushUpdate, removeIdFromQueue } from '../network/socketQueue' import { MAX_CONNECTIONS, NEW_CONNECTIONS } from './constants' diff --git a/src/common/utxobased/engine/makeUtxoEngine.ts b/src/common/utxobased/engine/UtxoEngine.ts similarity index 98% rename from src/common/utxobased/engine/makeUtxoEngine.ts rename to src/common/utxobased/engine/UtxoEngine.ts index 9e790a9b..8cd90164 100644 --- a/src/common/utxobased/engine/makeUtxoEngine.ts +++ b/src/common/utxobased/engine/UtxoEngine.ts @@ -21,15 +21,15 @@ import { import { filterUndefined } from '../../../util/filterUndefined' import { unixTime } from '../../../util/unixTime' import { makeFees } from '../../fees/makeFees' -import { EngineEmitter, EngineEvent } from '../../plugin/makeEngineEmitter' -import { makeMetadata } from '../../plugin/makeMetadata' +import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter' +import { makeMetadata } from '../../plugin/Metadata' import { EngineConfig, TxOptions } from '../../plugin/types' import { upgradeMemos } from '../../upgradeMemos' -import { makeProcessor } from '../db/makeProcessor' import { fromEdgeTransaction, toEdgeTransaction } from '../db/Models/ProcessorTransaction' +import { makeProcessor } from '../db/Processor' import { IProcessorTransaction, IUTXO } from '../db/types' import { utxoFromProcessorTransactionInput } from '../db/util/utxo' import { @@ -47,8 +47,6 @@ import { } from '../keymanager/keymanager' import { asMaybeInsufficientFundsErrorPlus } from '../keymanager/types' import { transactionSizeFromHex } from '../keymanager/utxopicker/utils' -import { makeUtxoEngineState, transactionChanged } from './makeUtxoEngineState' -import { makeUtxoWalletTools } from './makeUtxoWalletTools' import { createPayment, getPaymentDetails, sendPayment } from './paymentRequest' import { asUtxoSignMessageOtherParams, @@ -63,6 +61,8 @@ import { pathToPurposeType, sumUtxos } from './utils' +import { makeUtxoEngineState, transactionChanged } from './UtxoEngineState' +import { makeUtxoWalletTools } from './UtxoWalletTools' export async function makeUtxoEngine( config: EngineConfig diff --git a/src/common/utxobased/engine/makeUtxoEngineState.ts b/src/common/utxobased/engine/UtxoEngineState.ts similarity index 98% rename from src/common/utxobased/engine/makeUtxoEngineState.ts rename to src/common/utxobased/engine/UtxoEngineState.ts index ca590e01..31dc4148 100644 --- a/src/common/utxobased/engine/makeUtxoEngineState.ts +++ b/src/common/utxobased/engine/UtxoEngineState.ts @@ -7,8 +7,8 @@ import { EdgeTransaction } from 'edge-core-js/types' -import { EngineEmitter, EngineEvent } from '../../plugin/makeEngineEmitter' -import { PluginState } from '../../plugin/pluginState' +import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter' +import { PluginState } from '../../plugin/PluginState' import { AddressPath, ChangePath, @@ -18,8 +18,8 @@ import { PluginInfo } from '../../plugin/types' import { removeItem } from '../../plugin/utils' -import { Processor } from '../db/makeProcessor' import { toEdgeTransaction } from '../db/Models/ProcessorTransaction' +import { Processor } from '../db/Processor' import { IAddress, IProcessorTransaction, @@ -42,19 +42,19 @@ import { transactionMessage, transactionMessageSpecific, TransactionResponse -} from '../network/BlockBookAPI' +} from '../network/blockbookApi' import Deferred from '../network/Deferred' import { WsTask } from '../network/Socket' import AwaitLock from './await-lock' import { BLOCKBOOK_TXS_PER_PAGE, CACHE_THROTTLE } from './constants' -import { makeServerStates, ServerStates } from './makeServerStates' -import { UTXOPluginWalletTools } from './makeUtxoWalletTools' +import { makeServerStates, ServerStates } from './ServerStates' import { getFormatSupportedBranches, getScriptTypeFromPurposeType, pathToPurposeType, validScriptPubkeyFromAddress } from './utils' +import { UtxoWalletTools } from './UtxoWalletTools' export interface UtxoEngineState { processedPercent: number @@ -86,7 +86,7 @@ export interface UtxoEngineState { } export interface UtxoEngineStateConfig extends EngineConfig { - walletTools: UTXOPluginWalletTools + walletTools: UtxoWalletTools walletInfo: SafeWalletInfo processor: Processor } @@ -513,7 +513,7 @@ export function makeUtxoEngineState( interface CommonArgs { pluginInfo: PluginInfo walletInfo: SafeWalletInfo - walletTools: UTXOPluginWalletTools + walletTools: UtxoWalletTools processor: Processor emitter: EngineEmitter taskCache: TaskCache @@ -686,7 +686,7 @@ interface TransactionChangedArgs { walletId: string tx: IProcessorTransaction emitter: EngineEmitter - walletTools: UTXOPluginWalletTools + walletTools: UtxoWalletTools pluginInfo: PluginInfo processor: Processor } @@ -1079,7 +1079,7 @@ const updateTransactions = ( } interface DeriveScriptAddressArgs { - walletTools: UTXOPluginWalletTools + walletTools: UtxoWalletTools engineInfo: EngineInfo processor: Processor format: CurrencyFormat diff --git a/src/common/utxobased/engine/makeUtxoWalletTools.ts b/src/common/utxobased/engine/UtxoWalletTools.ts similarity index 98% rename from src/common/utxobased/engine/makeUtxoWalletTools.ts rename to src/common/utxobased/engine/UtxoWalletTools.ts index ba14e0b7..9cebf59d 100644 --- a/src/common/utxobased/engine/makeUtxoWalletTools.ts +++ b/src/common/utxobased/engine/UtxoWalletTools.ts @@ -32,7 +32,7 @@ export interface WalletToolsConfig { publicKey: PublicKey } -export interface UTXOPluginWalletTools { +export interface UtxoWalletTools { getPubkey: (args: AddressPath) => string getScriptPubkey: (args: AddressPath) => ScriptPubkeyReturn @@ -96,14 +96,14 @@ interface SignMessageArgs { export function makeUtxoWalletTools( config: WalletToolsConfig -): UTXOPluginWalletTools { +): UtxoWalletTools { const { pluginInfo, publicKey } = config const { engineInfo } = pluginInfo const { name: coin } = pluginInfo.coinInfo const xpubKeys = publicKey.publicKeys - const fns: UTXOPluginWalletTools = { + const fns: UtxoWalletTools = { getPubkey(args: AddressPath): string { if (xpubKeys[args.format] == null) { throw new Error( diff --git a/src/common/utxobased/engine/util/getOwnUtxosFromTx.ts b/src/common/utxobased/engine/util/getOwnUtxosFromTx.ts index c13092bd..b94c5c16 100644 --- a/src/common/utxobased/engine/util/getOwnUtxosFromTx.ts +++ b/src/common/utxobased/engine/util/getOwnUtxosFromTx.ts @@ -1,5 +1,5 @@ import { EngineInfo } from '../../../plugin/types' -import { Processor } from '../../db/makeProcessor' +import { Processor } from '../../db/Processor' import { IProcessorTransaction, IUTXO } from '../../db/types' import { BIP43PurposeTypeEnum } from '../../keymanager/keymanager' import { getScriptTypeFromPurposeType, pathToPurposeType } from '../utils' diff --git a/src/common/utxobased/network/BlockBook.ts b/src/common/utxobased/network/BlockBook.ts index 2dad4de3..a7f00b8c 100644 --- a/src/common/utxobased/network/BlockBook.ts +++ b/src/common/utxobased/network/BlockBook.ts @@ -1,7 +1,7 @@ import { Cleaner } from 'cleaners' import { EdgeLog, EdgeTransaction } from 'edge-core-js/types' -import { EngineEmitter, EngineEvent } from '../../plugin/makeEngineEmitter' +import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter' import { addressMessage, AddressResponse, @@ -20,10 +20,10 @@ import { SubscribeNewBlockResponse, transactionMessage, TransactionResponse -} from './BlockBookAPI' +} from './blockbookApi' import Deferred from './Deferred' -import { SocketEmitter } from './MakeSocketEmitter' import { makeSocket, OnQueueSpaceCB } from './Socket' +import { SocketEmitter } from './SocketEmitter' export type WatchAddressesCB = ( response: SubscribeAddressResponse diff --git a/src/common/utxobased/network/Socket.ts b/src/common/utxobased/network/Socket.ts index 09c5af9a..4fa90650 100644 --- a/src/common/utxobased/network/Socket.ts +++ b/src/common/utxobased/network/Socket.ts @@ -3,8 +3,8 @@ import { EdgeLog } from 'edge-core-js/types' import { removeItem } from '../../plugin/utils' import Deferred from './Deferred' -import { SocketEmitter, SocketEvent } from './MakeSocketEmitter' import { setupWS } from './nodejsWS' +import { SocketEmitter, SocketEvent } from './SocketEmitter' import { pushUpdate, removeIdFromQueue } from './socketQueue' import { InnerSocket, InnerSocketCallbacks, ReadyState } from './types' import { setupBrowser } from './windowWS' diff --git a/src/common/utxobased/network/MakeSocketEmitter.ts b/src/common/utxobased/network/SocketEmitter.ts similarity index 100% rename from src/common/utxobased/network/MakeSocketEmitter.ts rename to src/common/utxobased/network/SocketEmitter.ts diff --git a/src/firo.ts b/src/firo.ts index ebe935c8..3f7878d7 100644 --- a/src/firo.ts +++ b/src/firo.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/zcoin' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/src/ftc.ts b/src/ftc.ts index b6b6a1e8..8e609204 100644 --- a/src/ftc.ts +++ b/src/ftc.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/feathercoin' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/src/index.ts b/src/index.ts index cc1592f7..928e0b8b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCorePlugins } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { all } from './common/utxobased/info/all' const plugins: EdgeCorePlugins = {} diff --git a/src/ltc.ts b/src/ltc.ts index 79b28213..127d8325 100644 --- a/src/ltc.ts +++ b/src/ltc.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/litecoin' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/src/tbch.ts b/src/tbch.ts index aa33a3da..d6b432ce 100644 --- a/src/tbch.ts +++ b/src/tbch.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/bitcoincashtestnet' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/src/tbtc.ts b/src/tbtc.ts index 2efcae42..6f0ee210 100644 --- a/src/tbtc.ts +++ b/src/tbtc.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/bitcointestnet' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/src/tbtg.ts b/src/tbtg.ts index d31dfa03..2c8a9869 100644 --- a/src/tbtg.ts +++ b/src/tbtg.ts @@ -1,6 +1,6 @@ import { EdgeCorePluginOptions, EdgeCurrencyPlugin } from 'edge-core-js/types' -import { makeCurrencyPlugin } from './common/plugin/makeCurrencyPlugin' +import { makeCurrencyPlugin } from './common/plugin/CurrencyPlugin' import { info } from './common/utxobased/info/bitcoingoldtestnet' const plugin = (options: EdgeCorePluginOptions): EdgeCurrencyPlugin => diff --git a/test/common/plugin/currencyPlugin.fixtures/common.ts b/test/common/plugin/CurrencyPlugin.fixtures/common.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/common.ts rename to test/common/plugin/CurrencyPlugin.fixtures/common.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoin.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoin.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/bitcoin.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoin.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoincash.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoincash.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/bitcoincash.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoincash.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoinsv.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoinsv.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/bitcoinsv.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/bitcoinsv.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/digibyte.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/digibyte.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/digibyte.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/digibyte.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/feathercoin.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/feathercoin.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/feathercoin.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/feathercoin.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/groestlcoin.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/groestlcoin.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/groestlcoin.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/groestlcoin.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/litecoin.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/litecoin.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/litecoin.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/litecoin.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/smartcash.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/smartcash.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/smartcash.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/smartcash.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/currencies/zcoin.ts b/test/common/plugin/CurrencyPlugin.fixtures/currencies/zcoin.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/currencies/zcoin.ts rename to test/common/plugin/CurrencyPlugin.fixtures/currencies/zcoin.ts diff --git a/test/common/plugin/currencyPlugin.fixtures/index.ts b/test/common/plugin/CurrencyPlugin.fixtures/index.ts similarity index 100% rename from test/common/plugin/currencyPlugin.fixtures/index.ts rename to test/common/plugin/CurrencyPlugin.fixtures/index.ts diff --git a/test/common/plugin/currencyPlugin.spec.ts b/test/common/plugin/CurrencyPlugin.spec.ts similarity index 99% rename from test/common/plugin/currencyPlugin.spec.ts rename to test/common/plugin/CurrencyPlugin.spec.ts index 0532c3bb..7b7e6bf9 100644 --- a/test/common/plugin/currencyPlugin.spec.ts +++ b/test/common/plugin/CurrencyPlugin.spec.ts @@ -11,7 +11,7 @@ import { before, describe, it } from 'mocha' import edgeCorePlugins from '../../../src/index' import { testLog } from '../../util/testLog' -import { fixtures } from './currencyPlugin.fixtures/index' +import { fixtures } from './CurrencyPlugin.fixtures/index' describe('currencyPlugins.spec', () => { for (const fixture of fixtures) { diff --git a/test/common/plugin/makeMetadata.spec.ts b/test/common/plugin/Metadata.spec.ts similarity index 95% rename from test/common/plugin/makeMetadata.spec.ts rename to test/common/plugin/Metadata.spec.ts index 7ed53126..c7239878 100644 --- a/test/common/plugin/makeMetadata.spec.ts +++ b/test/common/plugin/Metadata.spec.ts @@ -7,8 +7,8 @@ import { EdgeLog } from 'edge-core-js/types' import { EngineEmitter, EngineEvent -} from '../../../src/common/plugin/makeEngineEmitter' -import { makeMetadata, Metadata } from '../../../src/common/plugin/makeMetadata' +} from '../../../src/common/plugin/EngineEmitter' +import { makeMetadata, Metadata } from '../../../src/common/plugin/Metadata' import { makeFakeLog } from '../../utils' chai.should() diff --git a/test/common/plugin/serverScores.spec.ts b/test/common/plugin/ServerScores.spec.ts similarity index 98% rename from test/common/plugin/serverScores.spec.ts rename to test/common/plugin/ServerScores.spec.ts index 9d8be9f3..c68bfdc1 100644 --- a/test/common/plugin/serverScores.spec.ts +++ b/test/common/plugin/ServerScores.spec.ts @@ -3,10 +3,10 @@ import { assert } from 'chai' import { describe, it } from 'mocha' -import { ServerScores } from '../../../src/common/plugin/serverScores' +import { ServerScores } from '../../../src/common/plugin/ServerScores' import { makeFakeLog } from '../../utils' -describe(`ServerCache`, function () { +describe(`ServerScores`, function () { const testLog = makeFakeLog() const callback = (_: string): void => { return diff --git a/test/common/utxobased/db/Processor.spec.ts b/test/common/utxobased/db/Processor.spec.ts index 6ebd4046..1cf5be58 100644 --- a/test/common/utxobased/db/Processor.spec.ts +++ b/test/common/utxobased/db/Processor.spec.ts @@ -6,7 +6,7 @@ import { makeMemoryDisklet } from 'disklet' import { makeProcessor, Processor -} from '../../../../src/common/utxobased/db/makeProcessor' +} from '../../../../src/common/utxobased/db/Processor' import { IAddress, IProcessorTransaction, diff --git a/test/common/utxobased/engine/UtxoWalletTools.spec.ts b/test/common/utxobased/engine/UtxoWalletTools.spec.ts index fd0fe2f7..4fc46600 100644 --- a/test/common/utxobased/engine/UtxoWalletTools.spec.ts +++ b/test/common/utxobased/engine/UtxoWalletTools.spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai' -import { makeUtxoWalletTools } from '../../../../src/common/utxobased/engine/makeUtxoWalletTools' +import { makeUtxoWalletTools } from '../../../../src/common/utxobased/engine/UtxoWalletTools' import { info as pluginInfo } from '../../../../src/common/utxobased/info/bitcoin' describe('wallet tools tests', () => { diff --git a/test/common/utxobased/network/BlockBook.spec.ts b/test/common/utxobased/network/BlockBook.spec.ts index 25ed9c1a..66abbca7 100644 --- a/test/common/utxobased/network/BlockBook.spec.ts +++ b/test/common/utxobased/network/BlockBook.spec.ts @@ -6,18 +6,18 @@ import WS from 'ws' import { EngineEmitter, EngineEvent -} from '../../../../src/common/plugin/makeEngineEmitter' +} from '../../../../src/common/plugin/EngineEmitter' import { BlockBook, makeBlockBook } from '../../../../src/common/utxobased/network/BlockBook' -import { SubscribeAddressResponse } from '../../../../src/common/utxobased/network/BlockBookAPI' +import { SubscribeAddressResponse } from '../../../../src/common/utxobased/network/blockbookApi' import Deferred from '../../../../src/common/utxobased/network/Deferred' +import { WsTask } from '../../../../src/common/utxobased/network/Socket' import { SocketEmitter, SocketEvent -} from '../../../../src/common/utxobased/network/MakeSocketEmitter' -import { WsTask } from '../../../../src/common/utxobased/network/Socket' +} from '../../../../src/common/utxobased/network/SocketEmitter' import { makeFakeLog } from '../../../utils' chai.should() From 9112257145bf300030bf772ef55c804ea6c99912 Mon Sep 17 00:00:00 2001 From: Samuel Holmes Date: Fri, 5 Apr 2024 14:28:17 -0700 Subject: [PATCH 2/5] Fix casing for word "Blockbook" --- src/common/plugin/PluginState.ts | 2 +- src/common/utxobased/engine/ServerStates.ts | 8 +-- .../network/{BlockBook.ts => Blockbook.ts} | 10 +-- .../{BlockBookAPI.ts => blockbookApi.ts} | 0 .../{BlockBook.spec.ts => Blockbook.spec.ts} | 64 +++++++++---------- 5 files changed, 42 insertions(+), 42 deletions(-) rename src/common/utxobased/network/{BlockBook.ts => Blockbook.ts} (96%) rename src/common/utxobased/network/{BlockBookAPI.ts => blockbookApi.ts} (100%) rename test/common/utxobased/network/{BlockBook.spec.ts => Blockbook.spec.ts} (87%) diff --git a/src/common/plugin/PluginState.ts b/src/common/plugin/PluginState.ts index 60734a9a..b5414665 100644 --- a/src/common/plugin/PluginState.ts +++ b/src/common/plugin/PluginState.ts @@ -15,7 +15,7 @@ import { } from './ServerScores' // Info server endpoint to getting ServerListInfo data -const serverListInfoUrl = 'https://info1.edge.app/v1/blockBook/' +const serverListInfoUrl = 'https://info1.edge.app/v1/blockbook/' // The filename for ServerInfoCache data (see ServerScores.ts) // Perhaps this should be in ServerScores.ts file, but that'll take some refactoring const SERVER_CACHE_FILE = 'serverCache.json' diff --git a/src/common/utxobased/engine/ServerStates.ts b/src/common/utxobased/engine/ServerStates.ts index f177eb83..4b95bb1c 100644 --- a/src/common/utxobased/engine/ServerStates.ts +++ b/src/common/utxobased/engine/ServerStates.ts @@ -6,7 +6,7 @@ import { PluginState } from '../../plugin/PluginState' import { PluginInfo } from '../../plugin/types' import { removeItem } from '../../plugin/utils' import { SafeWalletInfo } from '../keymanager/cleaners' -import { BlockBook, makeBlockBook } from '../network/BlockBook' +import { Blockbook, makeBlockbook } from '../network/Blockbook' import { SubscribeAddressResponse } from '../network/blockbookApi' import Deferred from '../network/Deferred' import { WsTask } from '../network/Socket' @@ -15,7 +15,7 @@ import { pushUpdate, removeIdFromQueue } from '../network/socketQueue' import { MAX_CONNECTIONS, NEW_CONNECTIONS } from './constants' interface ServerState { - blockbook: BlockBook + blockbook: Blockbook blockSubscriptionStatus: 'unsubscribed' | 'subscribing' | 'subscribed' blockHeight: number txids: Set @@ -122,7 +122,7 @@ export function makeServerStates(config: ServerStateConfig): ServerStates { // eslint-disable-next-line @typescript-eslint/no-explicit-any ) => Promise | undefined> - const makeServerStatesCacheEntry = (blockbook: BlockBook): ServerState => ({ + const makeServerStatesCacheEntry = (blockbook: Blockbook): ServerState => ({ blockbook, blockSubscriptionStatus: 'unsubscribed', txids: new Set(), @@ -208,7 +208,7 @@ export function makeServerStates(config: ServerStateConfig): ServerStates { } // Make new Blockbook instance - const blockbook = makeBlockBook({ + const blockbook = makeBlockbook({ wsAddress: uri, socketEmitter, engineEmitter, diff --git a/src/common/utxobased/network/BlockBook.ts b/src/common/utxobased/network/Blockbook.ts similarity index 96% rename from src/common/utxobased/network/BlockBook.ts rename to src/common/utxobased/network/Blockbook.ts index a7f00b8c..aa7764f9 100644 --- a/src/common/utxobased/network/BlockBook.ts +++ b/src/common/utxobased/network/Blockbook.ts @@ -30,7 +30,7 @@ export type WatchAddressesCB = ( ) => void | Promise export type WatchBlocksCB = () => void | Promise -export interface BlockBook { +export interface Blockbook { isConnected: boolean connect: () => Promise @@ -60,7 +60,7 @@ export interface BlockBook { broadcastTx: (transaction: EdgeTransaction) => Promise } -interface BlockBookConfig { +interface BlockbookConfig { socketEmitter: SocketEmitter engineEmitter: EngineEmitter wsAddress: string @@ -70,7 +70,7 @@ interface BlockBookConfig { asAddress?: Cleaner } -export function makeBlockBook(config: BlockBookConfig): BlockBook { +export function makeBlockbook(config: BlockbookConfig): Blockbook { const { wsAddress, socketEmitter, @@ -80,9 +80,9 @@ export function makeBlockBook(config: BlockBookConfig): BlockBook { walletId, asAddress } = config - log(`makeBlockBook with uri ${wsAddress}`) + log(`makeBlockbook with uri ${wsAddress}`) - const instance: BlockBook = { + const instance: Blockbook = { isConnected: false, connect, disconnect, diff --git a/src/common/utxobased/network/BlockBookAPI.ts b/src/common/utxobased/network/blockbookApi.ts similarity index 100% rename from src/common/utxobased/network/BlockBookAPI.ts rename to src/common/utxobased/network/blockbookApi.ts diff --git a/test/common/utxobased/network/BlockBook.spec.ts b/test/common/utxobased/network/Blockbook.spec.ts similarity index 87% rename from test/common/utxobased/network/BlockBook.spec.ts rename to test/common/utxobased/network/Blockbook.spec.ts index 66abbca7..62726f3f 100644 --- a/test/common/utxobased/network/BlockBook.spec.ts +++ b/test/common/utxobased/network/Blockbook.spec.ts @@ -8,9 +8,9 @@ import { EngineEvent } from '../../../../src/common/plugin/EngineEmitter' import { - BlockBook, - makeBlockBook -} from '../../../../src/common/utxobased/network/BlockBook' + Blockbook, + makeBlockbook +} from '../../../../src/common/utxobased/network/Blockbook' import { SubscribeAddressResponse } from '../../../../src/common/utxobased/network/blockbookApi' import Deferred from '../../../../src/common/utxobased/network/Deferred' import { WsTask } from '../../../../src/common/utxobased/network/Socket' @@ -22,9 +22,9 @@ import { makeFakeLog } from '../../../utils' chai.should() -describe('BlockBook notifications tests with dummy server', function () { +describe('Blockbook notifications tests with dummy server', function () { let websocketServer: WS.Server - let blockBook: BlockBook + let blockbook: Blockbook let websocketClient: WebSocket let engineEmitter: EngineEmitter @@ -74,7 +74,7 @@ describe('BlockBook notifications tests with dummy server', function () { open = true }) - blockBook = makeBlockBook({ + blockbook = makeBlockbook({ socketEmitter, engineEmitter, log, @@ -82,18 +82,18 @@ describe('BlockBook notifications tests with dummy server', function () { onQueueSpaceCB, wsAddress: 'ws://localhost:8555' }) - await blockBook.connect() - blockBook.isConnected.should.be.true + await blockbook.connect() + blockbook.isConnected.should.be.true open.should.be.true }) afterEach(async () => { - await blockBook.disconnect() - blockBook.isConnected.should.be.false + await blockbook.disconnect() + blockbook.isConnected.should.be.false websocketServer.close() }) - it('Test BlockBook watch address and watch block events', async () => { + it('Test Blockbook watch address and watch block events', async () => { let test = false test.should.be.false @@ -104,7 +104,7 @@ describe('BlockBook notifications tests with dummy server', function () { } ) - blockBook.watchBlocks(new Deferred()) + blockbook.watchBlocks(new Deferred()) websocketClient.send( '{"id":"subscribeNewBlock","data":{"height":1916453,"hash":"0000000000000e0444fa7c1540a96e5658898a59733311d08f01292e114e8d5b"}}' ) @@ -127,7 +127,7 @@ describe('BlockBook notifications tests with dummy server', function () { test = true } ) - blockBook.watchAddresses( + blockbook.watchAddresses( ['tb1q8uc93239etekcywh2l0t7aklxwywhaw0xlexld'], new Deferred() ) @@ -145,14 +145,14 @@ describe('BlockBook notifications tests with dummy server', function () { }) }) -describe('BlockBook', function () { +describe('Blockbook', function () { this.timeout(10000) const satoshiAddress = '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa' const engineEmitter = new EngineEmitter() const socketEmitter = new SocketEmitter() const log = makeFakeLog() - let blockBook: BlockBook + let blockbook: Blockbook const onQueueSpaceCB = async ( _uri: string @@ -161,7 +161,7 @@ describe('BlockBook', function () { } beforeEach(async () => { - blockBook = makeBlockBook({ + blockbook = makeBlockbook({ socketEmitter, engineEmitter, log, @@ -169,31 +169,31 @@ describe('BlockBook', function () { walletId: '', onQueueSpaceCB }) - await blockBook.connect() + await blockbook.connect() }) afterEach(async () => { - await blockBook.disconnect() + await blockbook.disconnect() }) describe('connect', function () { - it('should connect to the BlockBook websocket API', async function () { - blockBook.isConnected.should.be.true + it('should connect to the Blockbook websocket API', async function () { + blockbook.isConnected.should.be.true }) }) describe('disconnect', function () { - it('should disconnect from the BlockBook API', async function () { - blockBook.isConnected.should.be.true - await blockBook.disconnect() - blockBook.isConnected.should.be.false + it('should disconnect from the Blockbook API', async function () { + blockbook.isConnected.should.be.true + await blockbook.disconnect() + blockbook.isConnected.should.be.false }) }) describe('fetchInfo', function () { - it('should fetch the BlockBook server info', async function () { - blockBook.isConnected.should.be.true - const info = await blockBook.fetchInfo() + it('should fetch the Blockbook server info', async function () { + blockbook.isConnected.should.be.true + const info = await blockbook.fetchInfo() info.should.have.keys( 'name', 'shortcut', @@ -210,7 +210,7 @@ describe('BlockBook', function () { describe('fetchAddress', function () { it('should fetch basic address information', async function () { - const info = await blockBook.fetchAddress(satoshiAddress) + const info = await blockbook.fetchAddress(satoshiAddress) info.should.have.property('address', satoshiAddress) info.should.have.property('balance') @@ -221,7 +221,7 @@ describe('BlockBook', function () { info.should.have.property('unconfirmedTxs') }) it('should fetch address information with tx ids', async function () { - const info = await blockBook.fetchAddress(satoshiAddress, { + const info = await blockbook.fetchAddress(satoshiAddress, { details: 'txids' }) @@ -238,7 +238,7 @@ describe('BlockBook', function () { info.should.have.property('txids') }) it('should fetch address information with txs', async function () { - const info = await blockBook.fetchAddress(satoshiAddress, { + const info = await blockbook.fetchAddress(satoshiAddress, { details: 'txs' }) @@ -258,7 +258,7 @@ describe('BlockBook', function () { describe('fetchAddressUtxos', function () { it('should fetch an address UTXOS', async function () { - const utxos = await blockBook.fetchAddressUtxos(satoshiAddress) + const utxos = await blockbook.fetchAddressUtxos(satoshiAddress) utxos.length.should.be.greaterThan(0) utxos[0].should.have.property('txid') @@ -271,7 +271,7 @@ describe('BlockBook', function () { const satoshiHash = '3ed86f1b0a0a6fe180195bc1f93fd9d0801aea8c8ad5018de82c026dc21e2b15' it('should fetch details from a transaction hash', async function () { - const tx = await blockBook.fetchTransaction(satoshiHash) + const tx = await blockbook.fetchTransaction(satoshiHash) tx.txid.should.equal(satoshiHash) tx.fees.should.equal('226') From 0b69670458fce4617b0f88ffaa8e66c482c23526 Mon Sep 17 00:00:00 2001 From: Samuel Holmes Date: Wed, 27 Mar 2024 17:33:03 -0700 Subject: [PATCH 3/5] Rename `wsAddress` parameter to `connectionUri` This is less likely to be confused with an on-chain address. --- src/common/utxobased/engine/ServerStates.ts | 2 +- src/common/utxobased/network/Blockbook.ts | 32 +++++++++++-------- .../utxobased/network/Blockbook.spec.ts | 16 ++++++---- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/common/utxobased/engine/ServerStates.ts b/src/common/utxobased/engine/ServerStates.ts index 4b95bb1c..9aaa9a5e 100644 --- a/src/common/utxobased/engine/ServerStates.ts +++ b/src/common/utxobased/engine/ServerStates.ts @@ -209,7 +209,7 @@ export function makeServerStates(config: ServerStateConfig): ServerStates { // Make new Blockbook instance const blockbook = makeBlockbook({ - wsAddress: uri, + connectionUri: uri, socketEmitter, engineEmitter, log, diff --git a/src/common/utxobased/network/Blockbook.ts b/src/common/utxobased/network/Blockbook.ts index aa7764f9..72eea11a 100644 --- a/src/common/utxobased/network/Blockbook.ts +++ b/src/common/utxobased/network/Blockbook.ts @@ -61,26 +61,26 @@ export interface Blockbook { } interface BlockbookConfig { - socketEmitter: SocketEmitter + asAddress?: Cleaner + connectionUri: string engineEmitter: EngineEmitter - wsAddress: string log: EdgeLog - walletId: string onQueueSpaceCB: OnQueueSpaceCB - asAddress?: Cleaner + socketEmitter: SocketEmitter + walletId: string } export function makeBlockbook(config: BlockbookConfig): Blockbook { const { - wsAddress, - socketEmitter, + asAddress, + connectionUri, engineEmitter, log, onQueueSpaceCB, - walletId, - asAddress + socketEmitter, + walletId } = config - log(`makeBlockbook with uri ${wsAddress}`) + log(`makeBlockbook with uri ${connectionUri}`) const instance: Blockbook = { isConnected: false, @@ -96,7 +96,7 @@ export function makeBlockbook(config: BlockbookConfig): Blockbook { broadcastTx } - const socket = makeSocket(wsAddress, { + const socket = makeSocket(connectionUri, { healthCheck: ping, onQueueSpaceCB, log, @@ -105,7 +105,7 @@ export function makeBlockbook(config: BlockbookConfig): Blockbook { }) async function connect(): Promise { - log(`connecting to blockbook socket with uri ${wsAddress}`) + log(`connecting to blockbook socket with uri ${connectionUri}`) if (instance.isConnected) return await socket.connect() @@ -114,7 +114,7 @@ export function makeBlockbook(config: BlockbookConfig): Blockbook { async function disconnect(): Promise { log( - `disconnecting from blockbook socket with uri ${wsAddress}, currently connected: ${instance.isConnected}` + `disconnecting from blockbook socket with uri ${connectionUri}, currently connected: ${instance.isConnected}` ) if (!instance.isConnected) return @@ -163,7 +163,7 @@ export function makeBlockbook(config: BlockbookConfig): Blockbook { const socketCb = async (res: SubscribeNewBlockResponse): Promise => { engineEmitter.emit( EngineEvent.BLOCK_HEIGHT_CHANGED, - wsAddress, + connectionUri, res.height ) } @@ -180,7 +180,11 @@ export function makeBlockbook(config: BlockbookConfig): Blockbook { deferredAddressSub: Deferred ): void { const socketCb = async (res: SubscribeAddressResponse): Promise => { - engineEmitter.emit(EngineEvent.NEW_ADDRESS_TRANSACTION, wsAddress, res) + engineEmitter.emit( + EngineEvent.NEW_ADDRESS_TRANSACTION, + connectionUri, + res + ) } socket.subscribe({ ...subscribeAddressesMessage(addresses, asAddress), diff --git a/test/common/utxobased/network/Blockbook.spec.ts b/test/common/utxobased/network/Blockbook.spec.ts index 62726f3f..af6531da 100644 --- a/test/common/utxobased/network/Blockbook.spec.ts +++ b/test/common/utxobased/network/Blockbook.spec.ts @@ -75,12 +75,12 @@ describe('Blockbook notifications tests with dummy server', function () { }) blockbook = makeBlockbook({ - socketEmitter, + connectionUri: 'ws://localhost:8555', engineEmitter, log, - walletId: '', onQueueSpaceCB, - wsAddress: 'ws://localhost:8555' + socketEmitter, + walletId: '' }) await blockbook.connect() blockbook.isConnected.should.be.true @@ -151,7 +151,9 @@ describe('Blockbook', function () { const satoshiAddress = '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa' const engineEmitter = new EngineEmitter() const socketEmitter = new SocketEmitter() + const log = makeFakeLog() + let blockbook: Blockbook const onQueueSpaceCB = async ( @@ -162,12 +164,12 @@ describe('Blockbook', function () { beforeEach(async () => { blockbook = makeBlockbook({ - socketEmitter, + connectionUri: 'wss://btc1.trezor.io/websocket', engineEmitter, log, - wsAddress: 'wss://btc1.trezor.io/websocket', - walletId: '', - onQueueSpaceCB + onQueueSpaceCB, + socketEmitter, + walletId: '' }) await blockbook.connect() }) From 0674a3dd949b232b32b834aed5fdf17ebebe9ade Mon Sep 17 00:00:00 2001 From: Samuel Holmes Date: Wed, 3 Apr 2024 15:10:03 -0700 Subject: [PATCH 4/5] Expand ServerScores includePattern parameter type to allow RegExp --- src/common/plugin/PluginState.ts | 4 ++-- src/common/plugin/ServerScores.ts | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/common/plugin/PluginState.ts b/src/common/plugin/PluginState.ts index b5414665..6daeecdf 100644 --- a/src/common/plugin/PluginState.ts +++ b/src/common/plugin/PluginState.ts @@ -51,7 +51,7 @@ export interface PluginState { clearCache: () => Promise getLocalServers: ( numServersWanted: number, - includePatterns: string[] + includePatterns?: Array ) => string[] refreshServers: () => Promise updateServers: (settings: UtxoUserSettings) => Promise @@ -209,7 +209,7 @@ export function makePluginState(settings: PluginStateSettings): PluginState { getLocalServers( numServersWanted: number, - includePatterns: string[] = [] + includePatterns: Array = [] ): string[] { return serverScores.getServers( knownServers, diff --git a/src/common/plugin/ServerScores.ts b/src/common/plugin/ServerScores.ts index 5990ad14..9a64a22a 100644 --- a/src/common/plugin/ServerScores.ts +++ b/src/common/plugin/ServerScores.ts @@ -208,7 +208,7 @@ export class ServerScores { getServers( servers: ServerList, numServersWanted: number, - includePatterns: string[] = [] + includePatterns: Array = [] ): string[] { if (servers == null || Object.keys(servers).length === 0) { return [] @@ -236,7 +236,14 @@ export class ServerScores { const filter = (server: ServerInfo): boolean => { for (const pattern of includePatterns) { // make sure that the server URL starts with the required pattern - if (server.serverUrl.indexOf(pattern) === 0) return true + if ( + typeof pattern === 'string' && + server.serverUrl.indexOf(pattern) === 0 + ) + return true + // Or make sure that the server URL matches regex + if (pattern instanceof RegExp && pattern.test(server.serverUrl)) + return true } return false } From fe9e6aae6d11ec5ea92b927c4af7b78fe093fbc5 Mon Sep 17 00:00:00 2001 From: Samuel Holmes Date: Wed, 3 Apr 2024 16:09:53 -0700 Subject: [PATCH 5/5] Add serverConfig to EngineInfo with fallback servers This infra is similar to accountbased currencies in that we maintain a list of server configs that can match with a specific key from initOptions. The only difference with this implementation is that there is no info-server support for this integration yet. These servers will only be used as fallback servers if WebSocket broadcasts fail. --- CHANGELOG.md | 2 + src/common/plugin/CurrencyPlugin.ts | 8 +- src/common/plugin/types.ts | 8 + src/common/utxobased/engine/ServerStates.ts | 165 ++++++++++++++---- .../utxobased/engine/UtxoEngineState.ts | 15 +- src/common/utxobased/engine/types.ts | 5 + src/common/utxobased/info/bitcoin.ts | 6 + src/common/utxobased/info/bitcoincash.ts | 6 + src/common/utxobased/info/dash.ts | 6 + src/common/utxobased/info/digibyte.ts | 6 + src/common/utxobased/info/dogecoin.ts | 6 + src/common/utxobased/info/groestlcoin.ts | 6 + src/common/utxobased/info/litecoin.ts | 6 + 13 files changed, 203 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c74c9d3c..302e6428 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- added: New fallback server engine info, starting with NOWNodes blockbook servers + ## 2.5.4 (2024-01-26) - fixed: Check for NaN target totals in `subtractFee` style transactions diff --git a/src/common/plugin/CurrencyPlugin.ts b/src/common/plugin/CurrencyPlugin.ts index 4c46f44e..6c483339 100644 --- a/src/common/plugin/CurrencyPlugin.ts +++ b/src/common/plugin/CurrencyPlugin.ts @@ -7,7 +7,10 @@ import { EdgeWalletInfo } from 'edge-core-js/types' -import { asUtxoUserSettings } from '../utxobased/engine/types' +import { + asUtxoInitOptions, + asUtxoUserSettings +} from '../utxobased/engine/types' import { makeUtxoEngine } from '../utxobased/engine/UtxoEngine' import { makeCurrencyTools } from './CurrencyTools' import { makeEngineEmitter } from './EngineEmitter' @@ -19,7 +22,7 @@ export function makeCurrencyPlugin( pluginInfo: PluginInfo ): EdgeCurrencyPlugin { const { currencyInfo } = pluginInfo - const { io, log, pluginDisklet } = pluginOptions + const { io, log, pluginDisklet, initOptions } = pluginOptions const currencyTools = makeCurrencyTools(io, pluginInfo) const { defaultSettings, pluginId, currencyCode } = currencyInfo const pluginState = makePluginState({ @@ -43,6 +46,7 @@ export function makeCurrencyPlugin( pluginInfo, pluginDisklet, currencyTools, + initOptions: asUtxoInitOptions(initOptions), io, options: { ...pluginOptions, diff --git a/src/common/plugin/types.ts b/src/common/plugin/types.ts index 4884f66f..0b56561c 100644 --- a/src/common/plugin/types.ts +++ b/src/common/plugin/types.ts @@ -23,6 +23,7 @@ import { import * as wif from 'wif' import { asIUTXO, IProcessorTransaction, IUTXO } from '../utxobased/db/types' +import { UtxoInitOptions } from '../utxobased/engine/types' import { ScriptTemplates } from '../utxobased/info/scriptTemplates/types' import { UtxoPicker } from '../utxobased/keymanager/utxopicker' import { EngineEmitter } from './EngineEmitter' @@ -70,6 +71,7 @@ export interface EngineInfo { mempoolSpaceFeeInfoServer?: string defaultFeeInfo: FeeInfo scriptTemplates?: ScriptTemplates + serverConfigs?: ServerConfig[] // Codec Cleaners asBlockbookAddress?: Cleaner // Coin specific transaction handling @@ -79,6 +81,11 @@ export interface EngineInfo { ) => IProcessorTransaction } +export interface ServerConfig { + type: 'blockbook-nownode' + uris: string[] +} + /** * Coin Info */ @@ -196,6 +203,7 @@ export interface EngineConfig { pluginDisklet: Disklet currencyTools: EdgeCurrencyTools options: EngineOptions + initOptions: UtxoInitOptions io: EdgeIo pluginState: PluginState } diff --git a/src/common/utxobased/engine/ServerStates.ts b/src/common/utxobased/engine/ServerStates.ts index 9aaa9a5e..bce2c2d6 100644 --- a/src/common/utxobased/engine/ServerStates.ts +++ b/src/common/utxobased/engine/ServerStates.ts @@ -1,4 +1,4 @@ -import { EdgeLog, EdgeTransaction } from 'edge-core-js/types' +import { EdgeIo, EdgeLog, EdgeTransaction } from 'edge-core-js/types' import { parse } from 'uri-js' import { EngineEmitter, EngineEvent } from '../../plugin/EngineEmitter' @@ -7,12 +7,17 @@ import { PluginInfo } from '../../plugin/types' import { removeItem } from '../../plugin/utils' import { SafeWalletInfo } from '../keymanager/cleaners' import { Blockbook, makeBlockbook } from '../network/Blockbook' -import { SubscribeAddressResponse } from '../network/blockbookApi' +import { + asBlockbookResponse, + asBroadcastTxResponse, + SubscribeAddressResponse +} from '../network/blockbookApi' import Deferred from '../network/Deferred' import { WsTask } from '../network/Socket' import { SocketEmitter, SocketEvent } from '../network/SocketEmitter' import { pushUpdate, removeIdFromQueue } from '../network/socketQueue' import { MAX_CONNECTIONS, NEW_CONNECTIONS } from './constants' +import { UtxoInitOptions } from './types' interface ServerState { blockbook: Blockbook @@ -24,6 +29,8 @@ interface ServerState { interface ServerStateConfig { engineEmitter: EngineEmitter + initOptions: UtxoInitOptions + io: EdgeIo log: EdgeLog pluginInfo: PluginInfo pluginState: PluginState @@ -58,7 +65,16 @@ interface ServerStatesCache { } export function makeServerStates(config: ServerStateConfig): ServerStates { - const { engineEmitter, log, pluginInfo, pluginState, walletInfo } = config + const { + engineEmitter, + initOptions, + io, + log, + pluginInfo, + pluginState, + walletInfo + } = config + const { serverConfigs = [] } = pluginInfo.engineInfo log('Making server states') const serverStatesCache: ServerStatesCache = {} @@ -209,8 +225,8 @@ export function makeServerStates(config: ServerStateConfig): ServerStates { // Make new Blockbook instance const blockbook = makeBlockbook({ + asAddress: pluginInfo.engineInfo.asBlockbookAddress, connectionUri: uri, - socketEmitter, engineEmitter, log, onQueueSpaceCB: async (): Promise< @@ -229,8 +245,8 @@ export function makeServerStates(config: ServerStateConfig): ServerStates { } return task }, - walletId: walletInfo.id, - asAddress: pluginInfo.engineInfo.asBlockbookAddress + socketEmitter, + walletId: walletInfo.id }) // Make new ServerStates instance @@ -304,38 +320,117 @@ export function makeServerStates(config: ServerStateConfig): ServerStates { const broadcastTx = async (transaction: EdgeTransaction): Promise => { return await new Promise((resolve, reject) => { - const uris = Object.keys(serverStatesCache).filter(uri => { - const { blockbook } = serverStatesCache[uri] - if (blockbook == null) return false - return blockbook.isConnected - }) - if (uris == null || uris.length < 1) { - reject( - new Error('No available connections\nCheck your internet signal') - ) - } let resolved = false let bad = 0 - for (const uri of uris) { - const { blockbook } = serverStatesCache[uri] - if (blockbook == null) continue - blockbook - .broadcastTx(transaction) - .then(response => { - if (!resolved) { - resolved = true - resolve(response.result) - } - }) - .catch((e?: Error) => { - if (++bad === uris.length) { - const msg = e != null ? `With error ${e.message}` : '' - log.error( - `broadcastTx fail: ${JSON.stringify(transaction)}\n${msg}` - ) - reject(e) - } + + const wsUris = Object.keys(serverStatesCache).filter( + uri => serverStatesCache[uri].blockbook != null + ) + + // If there are no blockbook instances, reject the promise + if (wsUris.length < 1) { + reject(new Error('Unexpected error. Missing WebSocket connections.')) + // Exit early if there are blockbook instances + return + } + + // Determine if there are any connected blockbook instances + const isAnyBlockbookConnected = wsUris.some( + uri => serverStatesCache[uri].blockbook.isConnected + ) + + if (isAnyBlockbookConnected) { + for (const uri of wsUris) { + const { blockbook } = serverStatesCache[uri] + if (blockbook == null) continue + blockbook + .broadcastTx(transaction) + .then(response => { + if (!resolved) { + resolved = true + resolve(response.result) + } + }) + .catch((e?: Error) => { + if (++bad === wsUris.length) { + const msg = e != null ? `With error ${e.message}` : '' + log.error( + `broadcastTx fail: ${JSON.stringify(transaction)}\n${msg}` + ) + reject(e) + } + }) + } + } + + // Broadcast through any HTTP URI that may be configured, only if no + // blockbook instances are connected. + if (!isAnyBlockbookConnected) { + // This is for the future when we want to HTTP servers from the user + // settings: + // const httpUris = pluginState.getLocalServers(Infinity, [ + // /^http(?:s)?:/i + // ]) + + const { nowNodeApiKey } = initOptions + const nowNodeUris = serverConfigs + .filter(config => config.type === 'blockbook-nownode') + .map(config => config.uris) + .flat(1) + + // If there are no HTTP servers, reject the promise + if (nowNodeUris.length < 1) { + // If no HTTP servers are available, and we had no connected blockbook + // instances, reject the promise with a message indicating no + // available connections. It's clear we have some connection instances + // if we gotten to this point, but we just don't have any of those + // instances connected at this time. + reject( + new Error('No available connections. Check your internet signal.') + ) + return + } + + // If there is no key for the NowNode servers: + if (nowNodeApiKey == null) { + reject(new Error('Missing connection key for fallback servers.')) + return + } + + for (const uri of nowNodeUris) { + // HTTP Fallback + io.fetchCors(`${uri}/api/v2/sendtx/`, { + method: 'POST', + headers: { + 'api-key': nowNodeApiKey + }, + body: transaction.signedTx }) + .then(async response => { + if (!response.ok) { + throw new Error( + `Failed to broadcast transaction via Blockbook: HTTP ${response.status}` + ) + } + const json = await response.json() + return asBlockbookResponse(asBroadcastTxResponse)(json) + }) + .then(response => { + if (!resolved) { + resolved = true + resolve(response.result) + } + }) + .catch((e?: Error) => { + if (++bad === nowNodeUris.length) { + const msg = e != null ? `With error ${e.message}` : '' + log.error( + `broadcastTx fail: ${JSON.stringify(transaction)}\n${msg}` + ) + reject(e) + } + }) + } } }) } diff --git a/src/common/utxobased/engine/UtxoEngineState.ts b/src/common/utxobased/engine/UtxoEngineState.ts index 31dc4148..999e7b3a 100644 --- a/src/common/utxobased/engine/UtxoEngineState.ts +++ b/src/common/utxobased/engine/UtxoEngineState.ts @@ -95,13 +95,16 @@ export function makeUtxoEngineState( config: UtxoEngineStateConfig ): UtxoEngineState { const { + initOptions, + io, + options, + pluginState, pluginInfo, - walletInfo, - walletTools, - options: { emitter, log }, processor, - pluginState + walletInfo, + walletTools } = config + const { emitter, log } = options const { walletFormats } = walletInfo.keys @@ -178,6 +181,8 @@ export function makeUtxoEngineState( const serverStates = makeServerStates({ engineEmitter: emitter, + initOptions, + io, log, pluginInfo, pluginState, @@ -191,7 +196,7 @@ export function makeUtxoEngineState( emitter, taskCache, updateProgressRatio, - io: config.io, + io, log, serverStates, pluginState, diff --git a/src/common/utxobased/engine/types.ts b/src/common/utxobased/engine/types.ts index 2549f59f..ff1980f1 100644 --- a/src/common/utxobased/engine/types.ts +++ b/src/common/utxobased/engine/types.ts @@ -12,6 +12,11 @@ import { EdgeSpendInfo } from 'edge-core-js/types' import { asTxOptions } from '../../plugin/types' import { Input, Output } from '../keymanager/utxopicker/types' +export type UtxoInitOptions = ReturnType +export const asUtxoInitOptions = asObject({ + nowNodeApiKey: asOptional(asString) +}) + export const asUtxoUserSettings = asObject({ blockbookServers: asMaybe(asArray(asString), []), enableCustomServers: asMaybe(asBoolean, false) diff --git a/src/common/utxobased/info/bitcoin.ts b/src/common/utxobased/info/bitcoin.ts index 9a9ef6c6..09d71ce1 100644 --- a/src/common/utxobased/info/bitcoin.ts +++ b/src/common/utxobased/info/bitcoin.ts @@ -54,6 +54,12 @@ const currencyInfo: EdgeCurrencyInfo = { } const engineInfo: EngineInfo = { + serverConfigs: [ + { + type: 'blockbook-nownode', + uris: ['btcbook.nownodes.io'] + } + ], formats: ['bip49', 'bip84', 'bip44', 'bip32'], forks: ['bitcoincash', 'bitcoingold'], gapLimit: 25, diff --git a/src/common/utxobased/info/bitcoincash.ts b/src/common/utxobased/info/bitcoincash.ts index 7bfe1bbc..ea92c292 100644 --- a/src/common/utxobased/info/bitcoincash.ts +++ b/src/common/utxobased/info/bitcoincash.ts @@ -56,6 +56,12 @@ const currencyInfo: EdgeCurrencyInfo = { } const engineInfo: EngineInfo = { + serverConfigs: [ + { + type: 'blockbook-nownode', + uris: ['bchbook.nownodes.io'] + } + ], formats: ['bip44', 'bip32'], forks: [], // 'bitcoinsv' is currently disabled, so not included in the forks gapLimit: 10, diff --git a/src/common/utxobased/info/dash.ts b/src/common/utxobased/info/dash.ts index b369d256..4c767e2d 100644 --- a/src/common/utxobased/info/dash.ts +++ b/src/common/utxobased/info/dash.ts @@ -49,6 +49,12 @@ const currencyInfo: EdgeCurrencyInfo = { } const engineInfo: EngineInfo = { + serverConfigs: [ + { + type: 'blockbook-nownode', + uris: ['dashbook.nownodes.io'] + } + ], formats: ['bip44', 'bip32'], gapLimit: 10, defaultFee: 10000, diff --git a/src/common/utxobased/info/digibyte.ts b/src/common/utxobased/info/digibyte.ts index d1873ce8..462ce35c 100644 --- a/src/common/utxobased/info/digibyte.ts +++ b/src/common/utxobased/info/digibyte.ts @@ -40,6 +40,12 @@ const currencyInfo: EdgeCurrencyInfo = { } const engineInfo: EngineInfo = { + serverConfigs: [ + { + type: 'blockbook-nownode', + uris: ['dgbbook.nownodes.io'] + } + ], formats: ['bip49', 'bip84', 'bip44', 'bip32'], forks: [], gapLimit: 10, diff --git a/src/common/utxobased/info/dogecoin.ts b/src/common/utxobased/info/dogecoin.ts index 6550afb9..968d0cd8 100644 --- a/src/common/utxobased/info/dogecoin.ts +++ b/src/common/utxobased/info/dogecoin.ts @@ -45,6 +45,12 @@ const currencyInfo: EdgeCurrencyInfo = { } const engineInfo: EngineInfo = { + serverConfigs: [ + { + type: 'blockbook-nownode', + uris: ['https://dogebook.nownodes.io'] + } + ], formats: ['bip44', 'bip32'], gapLimit: 10, defaultFee: 1000, diff --git a/src/common/utxobased/info/groestlcoin.ts b/src/common/utxobased/info/groestlcoin.ts index 93a99353..25c89ee9 100644 --- a/src/common/utxobased/info/groestlcoin.ts +++ b/src/common/utxobased/info/groestlcoin.ts @@ -46,6 +46,12 @@ const currencyInfo: EdgeCurrencyInfo = { } const engineInfo: EngineInfo = { + serverConfigs: [ + { + type: 'blockbook-nownode', + uris: ['grsbook.nownodes.io'] + } + ], formats: ['bip49', 'bip84', 'bip44', 'bip32'], gapLimit: 10, defaultFee: 100000, diff --git a/src/common/utxobased/info/litecoin.ts b/src/common/utxobased/info/litecoin.ts index ce029d3b..119c38da 100644 --- a/src/common/utxobased/info/litecoin.ts +++ b/src/common/utxobased/info/litecoin.ts @@ -52,6 +52,12 @@ export const currencyInfo: EdgeCurrencyInfo = { } export const engineInfo: EngineInfo = { + serverConfigs: [ + { + type: 'blockbook-nownode', + uris: ['ltcbook.nownodes.io'] + } + ], formats: ['bip49', 'bip84', 'bip44', 'bip32'], gapLimit: 10, defaultFee: 50000,