From c950e3d0aea7ec898f2bdee626dab1c0fb1de67c Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Fri, 25 Oct 2024 13:54:40 +0900 Subject: [PATCH 1/2] [core routes] /api/internal -> /api/v1/internal --- backend/src/api/bitcoin/bitcoin-core.routes.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/api/bitcoin/bitcoin-core.routes.ts b/backend/src/api/bitcoin/bitcoin-core.routes.ts index 7933dc17b..14640515d 100644 --- a/backend/src/api/bitcoin/bitcoin-core.routes.ts +++ b/backend/src/api/bitcoin/bitcoin-core.routes.ts @@ -11,15 +11,15 @@ class BitcoinBackendRoutes { public initRoutes(app: Application) { app - .get('/api/internal/bitcoin-core/' + 'get-mempool-entry', this.disableCache, this.$getMempoolEntry) - .post('/api/internal/bitcoin-core/' + 'decode-raw-transaction', this.disableCache, this.$decodeRawTransaction) - .get('/api/internal/bitcoin-core/' + 'get-raw-transaction', this.disableCache, this.$getRawTransaction) - .post('/api/internal/bitcoin-core/' + 'send-raw-transaction', this.disableCache, this.$sendRawTransaction) - .post('/api/internal/bitcoin-core/' + 'test-mempool-accept', this.disableCache, this.$testMempoolAccept) - .get('/api/internal/bitcoin-core/' + 'get-mempool-ancestors', this.disableCache, this.$getMempoolAncestors) - .get('/api/internal/bitcoin-core/' + 'get-block', this.disableCache, this.$getBlock) - .get('/api/internal/bitcoin-core/' + 'get-block-hash', this.disableCache, this.$getBlockHash) - .get('/api/internal/bitcoin-core/' + 'get-block-count', this.disableCache, this.$getBlockCount) + .get('/api/v1/internal/bitcoin-core/' + 'get-mempool-entry', this.disableCache, this.$getMempoolEntry) + .post('/api/v1/internal/bitcoin-core/' + 'decode-raw-transaction', this.disableCache, this.$decodeRawTransaction) + .get('/api/v1/internal/bitcoin-core/' + 'get-raw-transaction', this.disableCache, this.$getRawTransaction) + .post('/api/v1/internal/bitcoin-core/' + 'send-raw-transaction', this.disableCache, this.$sendRawTransaction) + .post('/api/v1/internal/bitcoin-core/' + 'test-mempool-accept', this.disableCache, this.$testMempoolAccept) + .get('/api/v1/internal/bitcoin-core/' + 'get-mempool-ancestors', this.disableCache, this.$getMempoolAncestors) + .get('/api/v1/internal/bitcoin-core/' + 'get-block', this.disableCache, this.$getBlock) + .get('/api/v1/internal/bitcoin-core/' + 'get-block-hash', this.disableCache, this.$getBlockHash) + .get('/api/v1/internal/bitcoin-core/' + 'get-block-count', this.disableCache, this.$getBlockCount) ; } From 185be3d598a282d6117d7b643db983413c310f7a Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Fri, 25 Oct 2024 14:02:09 +0900 Subject: [PATCH 2/2] [core routes] use config.MEMPOOL.API_URL_PREFIX --- .../src/api/bitcoin/bitcoin-core.routes.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/backend/src/api/bitcoin/bitcoin-core.routes.ts b/backend/src/api/bitcoin/bitcoin-core.routes.ts index 14640515d..2c3dd08f6 100644 --- a/backend/src/api/bitcoin/bitcoin-core.routes.ts +++ b/backend/src/api/bitcoin/bitcoin-core.routes.ts @@ -1,6 +1,7 @@ import { Application, NextFunction, Request, Response } from 'express'; import logger from '../../logger'; import bitcoinClient from './bitcoin-client'; +import config from '../../config'; /** * Define a set of routes used by the accelerator server @@ -11,15 +12,15 @@ class BitcoinBackendRoutes { public initRoutes(app: Application) { app - .get('/api/v1/internal/bitcoin-core/' + 'get-mempool-entry', this.disableCache, this.$getMempoolEntry) - .post('/api/v1/internal/bitcoin-core/' + 'decode-raw-transaction', this.disableCache, this.$decodeRawTransaction) - .get('/api/v1/internal/bitcoin-core/' + 'get-raw-transaction', this.disableCache, this.$getRawTransaction) - .post('/api/v1/internal/bitcoin-core/' + 'send-raw-transaction', this.disableCache, this.$sendRawTransaction) - .post('/api/v1/internal/bitcoin-core/' + 'test-mempool-accept', this.disableCache, this.$testMempoolAccept) - .get('/api/v1/internal/bitcoin-core/' + 'get-mempool-ancestors', this.disableCache, this.$getMempoolAncestors) - .get('/api/v1/internal/bitcoin-core/' + 'get-block', this.disableCache, this.$getBlock) - .get('/api/v1/internal/bitcoin-core/' + 'get-block-hash', this.disableCache, this.$getBlockHash) - .get('/api/v1/internal/bitcoin-core/' + 'get-block-count', this.disableCache, this.$getBlockCount) + .get(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'get-mempool-entry', this.disableCache, this.$getMempoolEntry) + .post(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'decode-raw-transaction', this.disableCache, this.$decodeRawTransaction) + .get(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'get-raw-transaction', this.disableCache, this.$getRawTransaction) + .post(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'send-raw-transaction', this.disableCache, this.$sendRawTransaction) + .post(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'test-mempool-accept', this.disableCache, this.$testMempoolAccept) + .get(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'get-mempool-ancestors', this.disableCache, this.$getMempoolAncestors) + .get(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'get-block', this.disableCache, this.$getBlock) + .get(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'get-block-hash', this.disableCache, this.$getBlockHash) + .get(config.MEMPOOL.API_URL_PREFIX + 'internal/bitcoin-core/' + 'get-block-count', this.disableCache, this.$getBlockCount) ; }