diff --git a/backend/src/api/bitcoin/bitcoin.routes.ts b/backend/src/api/bitcoin/bitcoin.routes.ts index 42ab9f935..fafcfdbcd 100644 --- a/backend/src/api/bitcoin/bitcoin.routes.ts +++ b/backend/src/api/bitcoin/bitcoin.routes.ts @@ -483,7 +483,7 @@ class BitcoinRoutes { private async getBlocks(req: Request, res: Response) { try { - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { // Bitcoin + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { // Bitcoin const height = req.params.height === undefined ? undefined : parseInt(req.params.height, 10); res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); res.json(await blocks.$getBlocks(height, 15)); @@ -497,7 +497,7 @@ class BitcoinRoutes { private async getBlocksByBulk(req: Request, res: Response) { try { - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) === false) { // Liquid - Not implemented + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) === false) { // Liquid - Not implemented handleError(req, res, 404, `This API is only available for Bitcoin networks`); return; } @@ -539,7 +539,7 @@ class BitcoinRoutes { private async getChainTips(req: Request, res: Response) { try { - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { // Bitcoin + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { // Bitcoin res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); const tips = await chainTips.getChainTips(); if (tips.length > 0) { @@ -559,7 +559,7 @@ class BitcoinRoutes { private async getStaleTips(req: Request, res: Response) { try { - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { // Bitcoin + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { // Bitcoin res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); const tips = await chainTips.getStaleTips(); if (tips.length > 0) { diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index cfd5fcae4..f621868f2 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -327,7 +327,7 @@ class Blocks { extras.totalInputAmt = null; } - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { let pool: PoolTag; if (coinbaseTx !== undefined) { pool = await this.$findBlockMiner(coinbaseTx); @@ -1282,7 +1282,7 @@ class Blocks { } // Not Bitcoin network, return the block as it from the bitcoin backend - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) === false) { + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) === false) { return await bitcoinCoreApi.$getBlock(hash); } @@ -1525,7 +1525,7 @@ class Blocks { } public async $getBlockAuditSummary(hash: string): Promise { - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) && Common.auditIndexingEnabled()) { + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) && Common.auditIndexingEnabled()) { return BlocksAuditsRepository.$getBlockAudit(hash); } else { return null; @@ -1533,7 +1533,7 @@ class Blocks { } public async $getBlockTxAuditSummary(hash: string, txid: string): Promise { - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) && Common.auditIndexingEnabled()) { + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) && Common.auditIndexingEnabled()) { return BlocksAuditsRepository.$getBlockTxAudit(hash, txid); } else { return null; diff --git a/backend/src/api/common.ts b/backend/src/api/common.ts index df1767d76..e04feb12d 100644 --- a/backend/src/api/common.ts +++ b/backend/src/api/common.ts @@ -376,6 +376,7 @@ export class Common { 'testnet4': 42_000, 'testnet': 2_900_000, 'signet': 211_000, + 'regtest': 0, '': 863_500, }; static isNonStandardVersion(tx: TransactionExtended, height?: number): boolean { @@ -399,6 +400,7 @@ export class Common { 'testnet4': 42_000, 'testnet': 2_900_000, 'signet': 211_000, + 'regtest': 0, '': 863_500, }; static isNonStandardAnchor(vin: IEsploraApi.Vin, height?: number): boolean { @@ -419,6 +421,7 @@ export class Common { 'testnet4': 90_500, 'testnet': 4_550_000, 'signet': 260_000, + 'regtest': 0, '': 905_000, }; static isStandardEphemeralDust(tx: TransactionExtended, height?: number): boolean { @@ -439,6 +442,7 @@ export class Common { 'testnet4': 108_000, 'testnet': 4_750_000, 'signet': 276_500, + 'regtest': 0, '': 921_000, }; static MAX_DATACARRIER_BYTES = 83; @@ -461,6 +465,7 @@ export class Common { 'testnet4': 108_000, 'testnet': 4_750_000, 'signet': 276_500, + 'regtest': 0, '': 921_000, }; static isNonStandardLegacySigops(tx: TransactionExtended, height?: number): boolean { @@ -854,7 +859,7 @@ export class Common { static indexingEnabled(): boolean { return ( - ['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) && + ['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) && config.DATABASE.ENABLED === true && config.MEMPOOL.INDEXING_BLOCKS_AMOUNT !== 0 ); diff --git a/backend/src/api/database-migration.ts b/backend/src/api/database-migration.ts index b5ab0a81e..42b400966 100644 --- a/backend/src/api/database-migration.ts +++ b/backend/src/api/database-migration.ts @@ -104,7 +104,7 @@ class DatabaseMigration { private async $createMissingTablesAndIndexes(databaseSchemaVersion: number) { await this.$setStatisticsAddedIndexedFlag(databaseSchemaVersion); - const isBitcoin = ['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK); + const isBitcoin = ['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK); await this.$executeQuery(this.getCreateElementsTableQuery(), await this.$checkIfTableExists('elements_pegs')); await this.$executeQuery(this.getCreateStatisticsQuery(), await this.$checkIfTableExists('statistics')); @@ -1300,7 +1300,7 @@ class DatabaseMigration { */ private getMigrationQueriesFromVersion(version: number): string[] { const queries: string[] = []; - const isBitcoin = ['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK); + const isBitcoin = ['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK); if (version < 1) { if (config.MEMPOOL.NETWORK !== 'liquid' && config.MEMPOOL.NETWORK !== 'liquidtestnet') { diff --git a/backend/src/api/liquid/liquid.routes.ts b/backend/src/api/liquid/liquid.routes.ts index 3c99900b3..5353510f0 100644 --- a/backend/src/api/liquid/liquid.routes.ts +++ b/backend/src/api/liquid/liquid.routes.ts @@ -262,7 +262,7 @@ class LiquidRoutes { res.header('Pragma', 'public'); res.header('Cache-control', 'public'); res.setHeader('Expires', new Date(Date.now() + 1000 * 300).toUTCString()); - if (['testnet', 'signet', 'liquidtestnet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (['testnet', 'signet', 'liquidtestnet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { handleError(req, res, 400, 'Prices are not available on testnets.'); return; } diff --git a/backend/src/api/mempool-blocks.ts b/backend/src/api/mempool-blocks.ts index c55e06568..7a87091aa 100644 --- a/backend/src/api/mempool-blocks.ts +++ b/backend/src/api/mempool-blocks.ts @@ -46,7 +46,7 @@ class MempoolBlocks { } public async updatePools$(): Promise { - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) === false) { + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) === false) { this.pools = {}; return; } diff --git a/backend/src/api/mining/mining-routes.ts b/backend/src/api/mining/mining-routes.ts index d63b13a08..47a6b8f0a 100644 --- a/backend/src/api/mining/mining-routes.ts +++ b/backend/src/api/mining/mining-routes.ts @@ -53,7 +53,7 @@ class MiningRoutes { res.header('Pragma', 'public'); res.header('Cache-control', 'public'); res.setHeader('Expires', new Date(Date.now() + 1000 * 300).toUTCString()); - if (['testnet', 'signet', 'liquidtestnet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (['testnet', 'signet', 'liquidtestnet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { handleError(req, res, 400, 'Prices are not available on testnets.'); return; } @@ -394,7 +394,7 @@ class MiningRoutes { res.header('Pragma', 'public'); res.header('Cache-control', 'public'); res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); - if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { handleError(req, res, 400, 'Acceleration data is not available.'); return; } @@ -409,7 +409,7 @@ class MiningRoutes { res.header('Pragma', 'public'); res.header('Cache-control', 'public'); res.setHeader('Expires', new Date(Date.now() + 1000 * 3600 * 24).toUTCString()); - if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { handleError(req, res, 400, 'Acceleration data is not available.'); return; } @@ -425,7 +425,7 @@ class MiningRoutes { res.header('Pragma', 'public'); res.header('Cache-control', 'public'); res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); - if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { handleError(req, res, 400, 'Acceleration data is not available.'); return; } @@ -440,7 +440,7 @@ class MiningRoutes { res.header('Pragma', 'public'); res.header('Cache-control', 'public'); res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); - if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { handleError(req, res, 400, 'Acceleration data is not available.'); return; } @@ -455,7 +455,7 @@ class MiningRoutes { res.header('Pragma', 'public'); res.header('Cache-control', 'public'); res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString()); - if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (!config.MEMPOOL_SERVICES.ACCELERATIONS || ['testnet', 'signet', 'liquidtestnet', 'liquid', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { handleError(req, res, 400, 'Acceleration data is not available.'); return; } diff --git a/backend/src/api/pools-parser.ts b/backend/src/api/pools-parser.ts index 0bcf90bc9..b19eb789e 100644 --- a/backend/src/api/pools-parser.ts +++ b/backend/src/api/pools-parser.ts @@ -195,7 +195,7 @@ class PoolsParser { let firstKnownBlockPool = 130635; // https://mempool.space/block/0000000000000a067d94ff753eec72830f1205ad3a4c216a08a80c832e551a52 if (config.MEMPOOL.NETWORK === 'testnet') { firstKnownBlockPool = 21106; // https://mempool.space/testnet/block/0000000070b701a5b6a1b965f6a38e0472e70b2bb31b973e4638dec400877581 - } else if (['signet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + } else if (['signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { firstKnownBlockPool = 0; } diff --git a/backend/src/config.ts b/backend/src/config.ts index f7f8b371b..aca412e82 100644 --- a/backend/src/config.ts +++ b/backend/src/config.ts @@ -6,7 +6,7 @@ interface IConfig { MEMPOOL: { ENABLED: boolean; OFFICIAL: boolean; - NETWORK: 'mainnet' | 'testnet' | 'signet' | 'liquid' | 'liquidtestnet'; + NETWORK: 'mainnet' | 'testnet' | 'signet' | 'liquid' | 'liquidtestnet' | 'regtest'; BACKEND: 'esplora' | 'electrum' | 'none'; HTTP_PORT: number; UNIX_SOCKET_PATH: string; diff --git a/backend/src/index.ts b/backend/src/index.ts index 249d08056..7fbcc9c4a 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -161,7 +161,7 @@ class Server { this.setUpWebsocketHandling(); await poolsUpdater.updatePoolsJson(); // Needs to be done before loading the disk cache because we sometimes wipe it - if (config.DATABASE.ENABLED === true && config.MEMPOOL.ENABLED && ['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) && !poolsUpdater.currentSha) { + if (config.DATABASE.ENABLED === true && config.MEMPOOL.ENABLED && ['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) && !poolsUpdater.currentSha) { logger.err(`Failed to retreive pools-v2.json sha, cannot run block indexing. Please make sure you've set valid urls in your mempool-config.json::MEMPOOL::POOLS_JSON_URL and mempool-config.json::MEMPOOL::POOLS_JSON_TREE_UR, aborting now`); return process.exit(1); } diff --git a/backend/src/indexer.ts b/backend/src/indexer.ts index d4d2197e1..b052c08c2 100644 --- a/backend/src/indexer.ts +++ b/backend/src/indexer.ts @@ -134,7 +134,7 @@ class Indexer { switch (task) { case 'blocksPrices': { - if (!['testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) && config.FIAT_PRICE.ENABLED) { + if (!['testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) && config.FIAT_PRICE.ENABLED) { let lastestPriceId; try { lastestPriceId = await PricesRepository.$getLatestPriceId(); diff --git a/backend/src/repositories/PoolsRepository.ts b/backend/src/repositories/PoolsRepository.ts index b97fa951d..e17d4136c 100644 --- a/backend/src/repositories/PoolsRepository.ts +++ b/backend/src/repositories/PoolsRepository.ts @@ -102,7 +102,7 @@ class PoolsRepository { if (parse) { rows[0].regexes = JSON.parse(rows[0].regexes); } - if (['testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (['testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { rows[0].addresses = []; // pools-v2.json only contains mainnet addresses } else if (parse) { rows[0].addresses = JSON.parse(rows[0].addresses); @@ -134,7 +134,7 @@ class PoolsRepository { if (parse) { rows[0].regexes = JSON.parse(rows[0].regexes); } - if (['testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (['testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { rows[0].addresses = []; // pools.json only contains mainnet addresses } else if (parse) { rows[0].addresses = JSON.parse(rows[0].addresses); diff --git a/backend/src/tasks/pools-updater.ts b/backend/src/tasks/pools-updater.ts index 05d4ac5fc..d942cee82 100644 --- a/backend/src/tasks/pools-updater.ts +++ b/backend/src/tasks/pools-updater.ts @@ -31,7 +31,7 @@ class PoolsUpdater { } public async updatePoolsJson(): Promise { - if (['mainnet', 'testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK) === false || + if (['mainnet', 'testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK) === false || config.MEMPOOL.ENABLED === false ) { return; diff --git a/backend/src/tasks/price-updater.ts b/backend/src/tasks/price-updater.ts index f40fc7281..4f56af951 100644 --- a/backend/src/tasks/price-updater.ts +++ b/backend/src/tasks/price-updater.ts @@ -134,7 +134,7 @@ class PriceUpdater { } public async $run(): Promise { - if (['testnet', 'signet', 'testnet4'].includes(config.MEMPOOL.NETWORK)) { + if (['testnet', 'signet', 'testnet4', 'regtest'].includes(config.MEMPOOL.NETWORK)) { // Coins have no value on testnet/signet, so we want to always show 0 return; } diff --git a/docker/frontend/entrypoint.sh b/docker/frontend/entrypoint.sh index 64d545e50..17af1f4e4 100644 --- a/docker/frontend/entrypoint.sh +++ b/docker/frontend/entrypoint.sh @@ -27,6 +27,7 @@ __MAINNET_ENABLED__=${MAINNET_ENABLED:=true} __TESTNET_ENABLED__=${TESTNET_ENABLED:=false} __TESTNET4_ENABLED__=${TESTNET_ENABLED:=false} __SIGNET_ENABLED__=${SIGNET_ENABLED:=false} +__REGTEST_ENABLED__=${REGTEST_ENABLED:=false} __LIQUID_ENABLED__=${LIQUID_ENABLED:=false} __LIQUID_TESTNET_ENABLED__=${LIQUID_TESTNET_ENABLED:=false} __ITEMS_PER_PAGE__=${ITEMS_PER_PAGE:=10} @@ -46,6 +47,7 @@ __AUDIT__=${AUDIT:=false} __MAINNET_BLOCK_AUDIT_START_HEIGHT__=${MAINNET_BLOCK_AUDIT_START_HEIGHT:=0} __TESTNET_BLOCK_AUDIT_START_HEIGHT__=${TESTNET_BLOCK_AUDIT_START_HEIGHT:=0} __SIGNET_BLOCK_AUDIT_START_HEIGHT__=${SIGNET_BLOCK_AUDIT_START_HEIGHT:=0} +__REGTEST_BLOCK_AUDIT_START_HEIGHT__=${REGTEST_BLOCK_AUDIT_START_HEIGHT:=0} __ACCELERATOR__=${ACCELERATOR:=false} __ACCELERATOR_BUTTON__=${ACCELERATOR_BUTTON:=true} __SERVICES_API__=${SERVICES_API:=https://mempool.space/api/v1/services} @@ -59,6 +61,7 @@ export __MAINNET_ENABLED__ export __TESTNET_ENABLED__ export __TESTNET4_ENABLED__ export __SIGNET_ENABLED__ +export __REGTEST_ENABLED__ export __LIQUID_ENABLED__ export __LIQUID_TESTNET_ENABLED__ export __ITEMS_PER_PAGE__ @@ -78,6 +81,7 @@ export __AUDIT__ export __MAINNET_BLOCK_AUDIT_START_HEIGHT__ export __TESTNET_BLOCK_AUDIT_START_HEIGHT__ export __SIGNET_BLOCK_AUDIT_START_HEIGHT__ +export __REGTEST_BLOCK_AUDIT_START_HEIGHT__ export __ACCELERATOR__ export __ACCELERATOR_BUTTON__ export __SERVICES_API__ diff --git a/frontend/mempool-frontend-config.sample.json b/frontend/mempool-frontend-config.sample.json index 70dc2edba..9c99e45e6 100644 --- a/frontend/mempool-frontend-config.sample.json +++ b/frontend/mempool-frontend-config.sample.json @@ -2,6 +2,7 @@ "TESTNET_ENABLED": false, "TESTNET4_ENABLED": false, "SIGNET_ENABLED": false, + "REGTEST_ENABLED": false, "LIQUID_ENABLED": false, "LIQUID_TESTNET_ENABLED": false, "MAINNET_ENABLED": true, @@ -21,6 +22,7 @@ "MAINNET_BLOCK_AUDIT_START_HEIGHT": 0, "TESTNET_BLOCK_AUDIT_START_HEIGHT": 0, "SIGNET_BLOCK_AUDIT_START_HEIGHT": 0, + "REGTEST_BLOCK_AUDIT_START_HEIGHT": 0, "LIGHTNING": false, "HISTORICAL_PRICE": true, "ADDITIONAL_CURRENCIES": false, diff --git a/frontend/proxy.conf.js b/frontend/proxy.conf.js index 05f7550e0..1ef2f6934 100644 --- a/frontend/proxy.conf.js +++ b/frontend/proxy.conf.js @@ -24,7 +24,7 @@ PROXY_CONFIG = [ '/api/**', '!/api/v1/ws', '!/liquid', '!/liquid/**', '!/liquid/', '!/liquidtestnet', '!/liquidtestnet/**', '!/liquidtestnet/', - '/testnet/api/**', '/signet/api/**', '/testnet4/api/**' + '/testnet/api/**', '/signet/api/**', '/testnet4/api/**', '/regtest/api/**' ], target: "https://mempool.space", ws: true, diff --git a/frontend/proxy.conf.local-esplora.js b/frontend/proxy.conf.local-esplora.js index 905910294..34acd1cb0 100644 --- a/frontend/proxy.conf.local-esplora.js +++ b/frontend/proxy.conf.local-esplora.js @@ -78,6 +78,27 @@ PROXY_CONFIG.push(...[ "^/testnet": "" }, }, + { + context: ['/regtest/api/v1/**'], + target: `http://127.0.0.1:8999`, + secure: false, + ws: true, + changeOrigin: true, + proxyTimeout: 30000, + pathRewrite: { + "^/regtest": "" + }, + }, + { + context: ['/regtest/api/**'], + target: `http://127.0.0.1:3000`, + secure: false, + changeOrigin: true, + proxyTimeout: 30000, + pathRewrite: { + "^/regtest/api": "" + }, + }, /* Optional proxy to route dev to official acceleration services { context: ['/api/v1/services/accelerator/**'], diff --git a/frontend/proxy.conf.local.js b/frontend/proxy.conf.local.js index e7bfeee70..900629c0c 100644 --- a/frontend/proxy.conf.local.js +++ b/frontend/proxy.conf.local.js @@ -78,6 +78,27 @@ PROXY_CONFIG.push(...[ "^/testnet": "" }, }, + { + context: ['/regtest/api/v1/**'], + target: `http://localhost:8999`, + secure: false, + ws: true, + changeOrigin: true, + proxyTimeout: 30000, + pathRewrite: { + "^/regtest": "" + }, + }, + { + context: ['/regtest/api/**'], + target: `http://localhost:8999`, + secure: false, + changeOrigin: true, + proxyTimeout: 30000, + pathRewrite: { + "^/regtest/api/": "/api/v1/" + }, + }, { context: ['/api/v1/services/**'], target: `http://localhost:9000`, diff --git a/frontend/proxy.conf.mixed.js b/frontend/proxy.conf.mixed.js index db8af5d95..799ce337e 100644 --- a/frontend/proxy.conf.mixed.js +++ b/frontend/proxy.conf.mixed.js @@ -62,6 +62,27 @@ if (configContent && configContent.BASE_MODULE === 'liquid') { } PROXY_CONFIG.push(...[ + { + context: ['/regtest/api/v1/**'], + target: `http://localhost:8999`, + secure: false, + ws: true, + changeOrigin: true, + proxyTimeout: 30000, + pathRewrite: { + "^/regtest": "" + }, + }, + { + context: ['/regtest/api/**'], + target: `http://localhost:8999`, + secure: false, + changeOrigin: true, + proxyTimeout: 30000, + pathRewrite: { + "^/regtest/api/": "/api/v1/" + }, + }, { context: ['/api/v1/services/**'], target: `http://localhost:9000`, diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 8caba9582..98301adcc 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -133,6 +133,49 @@ let routes: Routes = [ }, ] }, + { + path: 'regtest', + children: [ + { + path: 'mining/blocks', + redirectTo: 'blocks', + pathMatch: 'full' + }, + { + path: '', + pathMatch: 'full', + loadChildren: () => import('@app/bitcoin-graphs.module').then(m => m.BitcoinGraphsModule), + data: { preload: true }, + }, + { + path: '', + loadChildren: () => import('@app/master-page.module').then(m => m.MasterPageModule), + data: { preload: true }, + }, + { + path: 'widget/wallet', + children: [], + component: AddressGroupComponent, + data: { + networkSpecific: true, + } + }, + { + path: 'status', + data: { networks: ['bitcoin', 'liquid'] }, + component: StatusViewComponent + }, + { + path: '', + loadChildren: () => import('@app/bitcoin-graphs.module').then(m => m.BitcoinGraphsModule), + data: { preload: true }, + }, + { + path: '**', + redirectTo: '/regtest' + }, + ] + }, { path: '', pathMatch: 'full', @@ -177,6 +220,10 @@ let routes: Routes = [ path: 'signet', loadChildren: () => import('@app/previews.module').then(m => m.PreviewsModule) }, + { + path: 'regtest', + loadChildren: () => import('@app/previews.module').then(m => m.PreviewsModule) + }, ], }, { diff --git a/frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.ts b/frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.ts index e6b75d408..857e9677e 100644 --- a/frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.ts +++ b/frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.ts @@ -73,6 +73,7 @@ export class BlockchainBlocksComponent implements OnInit, OnChanges, OnDestroy { testnet: ['var(--testnet)', 'var(--testnet-alt)'], testnet4: ['var(--testnet)', 'var(--testnet-alt)'], signet: ['var(--signet)', 'var(--signet-alt)'], + regtest: ['var(--regtest)', 'var(--regtest-alt)'], }; constructor( diff --git a/frontend/src/app/components/clock/clock.component.ts b/frontend/src/app/components/clock/clock.component.ts index 592e5bd64..4edc175cf 100644 --- a/frontend/src/app/components/clock/clock.component.ts +++ b/frontend/src/app/components/clock/clock.component.ts @@ -39,6 +39,7 @@ export class ClockComponent implements OnInit { testnet: ['var(--testnet)', 'var(--testnet-alt)'], testnet4: ['var(--testnet)', 'var(--testnet-alt)'], signet: ['var(--signet)', 'var(--signet-alt)'], + regtest: ['var(--regtest)', 'var(--regtest-alt)'], }; constructor( diff --git a/frontend/src/app/components/liquid-master-page/liquid-master-page.component.html b/frontend/src/app/components/liquid-master-page/liquid-master-page.component.html index e6b98f13e..f98bafff6 100644 --- a/frontend/src/app/components/liquid-master-page/liquid-master-page.component.html +++ b/frontend/src/app/components/liquid-master-page/liquid-master-page.component.html @@ -44,7 +44,7 @@ - -