diff --git a/backend/src/index.ts b/backend/src/index.ts index e65a18ab6..6b1f14efb 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -69,7 +69,8 @@ class Server { next(); }) .use(express.urlencoded({ extended: true })) - .use(express.json()); + .use(express.text()) + ; this.server = http.createServer(this.app); this.wss = new WebSocket.Server({ server: this.server }); diff --git a/backend/src/routes.ts b/backend/src/routes.ts index b1f9a2b15..2836bb5b8 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -768,8 +768,13 @@ class Routes { public async $postTransaction(req: Request, res: Response) { res.setHeader('content-type', 'text/plain'); try { - const rawtx = Object.keys(req.body)[0]; - const txIdResult = await bitcoinApi.$sendRawTransaction(rawtx); + let rawTx; + if (typeof req.body === 'object') { + rawTx = Object.keys(req.body)[0]; + } else { + rawTx = req.body; + } + const txIdResult = await bitcoinApi.$sendRawTransaction(rawTx); res.send(txIdResult); } catch (e: any) { res.status(400).send(e.message && e.code ? 'sendrawtransaction RPC error: ' + JSON.stringify({ code: e.code, message: e.message }) diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 511d077e8..0ad66ee2d 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -21,12 +21,17 @@ import { TrademarkPolicyComponent } from './components/trademark-policy/trademar import { BisqMasterPageComponent } from './components/bisq-master-page/bisq-master-page.component'; import { SponsorComponent } from './components/sponsor/sponsor.component'; import { LiquidMasterPageComponent } from './components/liquid-master-page/liquid-master-page.component'; +import { PushTransactionComponent } from './components/push-transaction/push-transaction.component'; let routes: Routes = [ { path: '', component: MasterPageComponent, children: [ + { + path: 'tx/push', + component: PushTransactionComponent, + }, { path: '', component: StartComponent, @@ -95,6 +100,10 @@ let routes: Routes = [ path: '', component: MasterPageComponent, children: [ + { + path: 'tx/push', + component: PushTransactionComponent, + }, { path: '', component: StartComponent, @@ -164,6 +173,10 @@ let routes: Routes = [ path: '', component: MasterPageComponent, children: [ + { + path: 'tx/push', + component: PushTransactionComponent, + }, { path: '', component: StartComponent, @@ -226,6 +239,10 @@ let routes: Routes = [ path: '', component: MasterPageComponent, children: [ + { + path: 'tx/push', + component: PushTransactionComponent, + }, { path: '', component: StartComponent, @@ -325,6 +342,10 @@ if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'liquid') { path: '', component: DashboardComponent }, + { + path: 'tx/push', + component: PushTransactionComponent, + }, { path: 'tx/:id', component: TransactionComponent diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index de67559b3..bb6383421 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -57,6 +57,7 @@ import { TrademarkPolicyComponent } from './components/trademark-policy/trademar import { StorageService } from './services/storage.service'; import { HttpCacheInterceptor } from './services/http-cache.interceptor'; import { SponsorComponent } from './components/sponsor/sponsor.component'; +import { PushTransactionComponent } from './components/push-transaction/push-transaction.component'; @NgModule({ declarations: [ @@ -98,6 +99,7 @@ import { SponsorComponent } from './components/sponsor/sponsor.component'; PrivacyPolicyComponent, TrademarkPolicyComponent, SponsorComponent, + PushTransactionComponent, ], imports: [ BrowserModule.withServerTransition({ appId: 'serverApp' }), diff --git a/frontend/src/app/bisq/bisq.routing.module.ts b/frontend/src/app/bisq/bisq.routing.module.ts index fe99105dd..bebf99867 100644 --- a/frontend/src/app/bisq/bisq.routing.module.ts +++ b/frontend/src/app/bisq/bisq.routing.module.ts @@ -12,6 +12,7 @@ import { BisqDashboardComponent } from './bisq-dashboard/bisq-dashboard.componen import { BisqMarketComponent } from './bisq-market/bisq-market.component'; import { BisqMainDashboardComponent } from './bisq-main-dashboard/bisq-main-dashboard.component'; import { TermsOfServiceComponent } from '../components/terms-of-service/terms-of-service.component'; +import { PushTransactionComponent } from '../components/push-transaction/push-transaction.component'; const routes: Routes = [ { @@ -30,6 +31,10 @@ const routes: Routes = [ path: 'market/:pair', component: BisqMarketComponent, }, + { + path: 'tx/push', + component: PushTransactionComponent, + }, { path: 'tx/:id', component: BisqTransactionComponent diff --git a/frontend/src/app/components/push-transaction/push-transaction.component.html b/frontend/src/app/components/push-transaction/push-transaction.component.html new file mode 100644 index 000000000..5762c8363 --- /dev/null +++ b/frontend/src/app/components/push-transaction/push-transaction.component.html @@ -0,0 +1,12 @@ +