Moving API docs to separate /api page.
This commit is contained in:
parent
0ee2753100
commit
b6738dd9e8
@ -8,11 +8,11 @@
|
||||
"secure": false,
|
||||
"ws": true
|
||||
},
|
||||
"/api": {
|
||||
"/api/": {
|
||||
"target": "http://localhost:50001/",
|
||||
"secure": false,
|
||||
"pathRewrite": {
|
||||
"^/api": ""
|
||||
"^/api/": ""
|
||||
}
|
||||
},
|
||||
"/testnet/api/v1": {
|
||||
@ -30,7 +30,7 @@
|
||||
"^/testnet/api": "/api/v1/ws"
|
||||
}
|
||||
},
|
||||
"/testnet/api": {
|
||||
"/testnet/api/": {
|
||||
"target": "http://localhost:50001/",
|
||||
"secure": false,
|
||||
"pathRewrite": {
|
||||
@ -45,18 +45,18 @@
|
||||
"^/liquid/api": "/api/v1/ws"
|
||||
}
|
||||
},
|
||||
"/liquid/api": {
|
||||
"/liquid/api/": {
|
||||
"target": "http://localhost:50001/",
|
||||
"secure": false,
|
||||
"pathRewrite": {
|
||||
"^/liquid/api": ""
|
||||
"^/liquid/api/": ""
|
||||
}
|
||||
},
|
||||
"/bisq/api": {
|
||||
"/bisq/api/": {
|
||||
"target": "http://localhost:8999/",
|
||||
"secure": false,
|
||||
"pathRewrite": {
|
||||
"^/bisq/api": "/api/v1/bisq"
|
||||
"^/bisq/api/": "/api/v1/bisq"
|
||||
}
|
||||
},
|
||||
"/bisq/api/v1/ws": {
|
||||
@ -64,7 +64,7 @@
|
||||
"secure": false,
|
||||
"ws": true,
|
||||
"pathRewrite": {
|
||||
"^/testnet/api": "/api/v1/ws"
|
||||
"^/bisq/api": "/api/v1/ws"
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ import { AssetsComponent } from './assets/assets.component';
|
||||
import { StatusViewComponent } from './components/status-view/status-view.component';
|
||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||
import { LatestBlocksComponent } from './components/latest-blocks/latest-blocks.component';
|
||||
import { ApiDocsComponent } from './components/api-docs/api-docs.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -54,6 +55,10 @@ const routes: Routes = [
|
||||
path: 'about',
|
||||
component: AboutComponent,
|
||||
},
|
||||
{
|
||||
path: 'api',
|
||||
component: ApiDocsComponent,
|
||||
},
|
||||
{
|
||||
path: 'address/:id',
|
||||
children: [],
|
||||
@ -110,6 +115,10 @@ const routes: Routes = [
|
||||
path: 'assets',
|
||||
component: AssetsComponent,
|
||||
},
|
||||
{
|
||||
path: 'api',
|
||||
component: ApiDocsComponent,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -168,6 +177,10 @@ const routes: Routes = [
|
||||
children: [],
|
||||
component: AddressComponent
|
||||
},
|
||||
{
|
||||
path: 'api',
|
||||
component: ApiDocsComponent,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -43,7 +43,8 @@ import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { FeesBoxComponent } from './components/fees-box/fees-box.component';
|
||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
|
||||
import { faChartArea, faCube, faCubes, faDatabase, faInfo, faInfoCircle, faList, faQuestion, faQuestionCircle, faSearch, faTachometerAlt, faThList, faTv } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faChartArea, faCogs, faCubes, faDatabase, faInfoCircle, faList, faSearch, faTachometerAlt, faThList, faTv } from '@fortawesome/free-solid-svg-icons';
|
||||
import { ApiDocsComponent } from './components/api-docs/api-docs.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -76,6 +77,7 @@ import { faChartArea, faCube, faCubes, faDatabase, faInfo, faInfoCircle, faList,
|
||||
StatusViewComponent,
|
||||
FeesBoxComponent,
|
||||
DashboardComponent,
|
||||
ApiDocsComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -103,6 +105,7 @@ export class AppModule {
|
||||
library.addIcons(faTv);
|
||||
library.addIcons(faTachometerAlt);
|
||||
library.addIcons(faCubes);
|
||||
library.addIcons(faCogs);
|
||||
library.addIcons(faThList);
|
||||
library.addIcons(faList);
|
||||
library.addIcons(faTachometerAlt);
|
||||
|
@ -8,6 +8,7 @@ import { BisqBlocksComponent } from './bisq-blocks/bisq-blocks.component';
|
||||
import { BisqExplorerComponent } from './bisq-explorer/bisq-explorer.component';
|
||||
import { BisqAddressComponent } from './bisq-address/bisq-address.component';
|
||||
import { BisqStatsComponent } from './bisq-stats/bisq-stats.component';
|
||||
import { ApiDocsComponent } from '../components/api-docs/api-docs.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -43,6 +44,10 @@ const routes: Routes = [
|
||||
path: 'about',
|
||||
component: AboutComponent,
|
||||
},
|
||||
{
|
||||
path: 'api',
|
||||
component: ApiDocsComponent,
|
||||
},
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: ''
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
<br><br>
|
||||
|
||||
<h2>GitHub</h2>
|
||||
<h2>Open source</h2>
|
||||
|
||||
<a target="_blank" class="b2812e30 f2874b88 fw6 mb3 mt2 truncate black-80 f4 link" rel="noopener noreferrer nofollow" href="https://github.com/mempool/mempool">
|
||||
<span class="_9e13d83d dib v-mid">
|
||||
@ -70,98 +70,10 @@
|
||||
<span>github.com/mempool/mempool</span></a>
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
|
||||
<div class="text-center">
|
||||
<h2>API</h2>
|
||||
</div>
|
||||
|
||||
<ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs">
|
||||
<li [ngbNavItem]="1">
|
||||
<a ngbNavLink>Mainnet</a>
|
||||
<ng-template ngbNavContent>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th style="border-top: 0;">Endpoint</th>
|
||||
<th style="border-top: 0;">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/api/v1/fees/recommended" target="_blank">GET /api/v1/fees/recommended</a></td>
|
||||
<td>Recommended fees</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/api/v1/fees/mempool-blocks" target="_blank">GET /api/v1/fees/mempool-blocks</a></td>
|
||||
<td>The current mempool blocks</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap">wss://{{ hostname }}/api/v1/ws</td>
|
||||
<td>
|
||||
<span class="text-small">
|
||||
Default push: <span class="code">{{ '{' }} action: 'want', data: ['blocks', ...] {{ '}' }}</span>
|
||||
to express what you want pushed. Available: 'blocks', 'mempool-blocks', 'live-2h-chart' and 'stats'.
|
||||
</span>
|
||||
<br><br>
|
||||
<span class="text-small">
|
||||
Push transactions related to address: <span class="code">{{ '{' }} 'track-address': '3PbJ...bF9B' {{ '}' }}</span>
|
||||
to receive all new transactions containing that address as input or output. Returns an array of transactions. 'address-transactions' for new mempool transactions and 'block-transactions' for new block confirmed transactions.
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="2">
|
||||
<a ngbNavLink>Bisq</a>
|
||||
<ng-template ngbNavContent>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th style="border-top: 0;">Endpoint</th>
|
||||
<th style="border-top: 0;">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/stats" target="_blank">GET /bisq/api/stats</a></td>
|
||||
<td>Stats</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/tx/4b5417ec5ab6112bedf539c3b4f5a806ed539542d8b717e1c4470aa3180edce5" target="_blank">GET /bisq/api/tx/:txId</a></td>
|
||||
<td>Transaction</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/txs/0/25" target="_blank">GET /bisq/api/txs/:index/:length</a></td>
|
||||
<td>Transactions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/block/000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d" target="_blank">GET /bisq/api/block/:hash</a></td>
|
||||
<td>Block</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/blocks/0/25" target="_blank">GET /bisq/api/blocks/:index/:length</a></td>
|
||||
<td>Blocks</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/blocks/tip/height" target="_blank">GET /bisq/api/blocks/tip/height</a></td>
|
||||
<td>Latest block height</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/address/B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz" target="_blank">GET /bisq/api/address/:address</a></td>
|
||||
<td>Address</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ng-template>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div [ngbNavOutlet]="nav" class="mt-2"></div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="text-small text-center">
|
||||
Git commit: {{ gitCommit$ | async }}
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
</div>
|
||||
|
@ -1,20 +1,3 @@
|
||||
.text-small {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.code {
|
||||
background-color: #1d1f31;
|
||||
font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New;
|
||||
}
|
||||
|
||||
tr {
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.qr-wrapper {
|
||||
background-color: #FFF;
|
||||
padding: 10px;
|
||||
@ -28,3 +11,7 @@ tr {
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.text-small {
|
||||
font-size: 12px;
|
||||
}
|
@ -12,8 +12,6 @@ import { ApiService } from 'src/app/services/api.service';
|
||||
styleUrls: ['./about.component.scss'],
|
||||
})
|
||||
export class AboutComponent implements OnInit {
|
||||
active = 1;
|
||||
hostname = document.location.hostname;
|
||||
gitCommit$: Observable<string>;
|
||||
donationForm: FormGroup;
|
||||
donationStatus = 1;
|
||||
@ -32,12 +30,6 @@ export class AboutComponent implements OnInit {
|
||||
this.gitCommit$ = this.stateService.gitCommit$;
|
||||
this.seoService.setTitle('About');
|
||||
this.websocketService.want(['blocks']);
|
||||
if (this.stateService.network === 'bisq') {
|
||||
this.active = 2;
|
||||
}
|
||||
if (document.location.port !== '') {
|
||||
this.hostname = this.hostname + ':' + document.location.port;
|
||||
}
|
||||
|
||||
this.donationForm = this.formBuilder.group({
|
||||
amount: [0.01],
|
||||
|
88
frontend/src/app/components/api-docs/api-docs.component.html
Normal file
88
frontend/src/app/components/api-docs/api-docs.component.html
Normal file
@ -0,0 +1,88 @@
|
||||
<div class="container-xl">
|
||||
<div class="text-center">
|
||||
<h2>API documentation</h2>
|
||||
</div>
|
||||
|
||||
<ul ngbNav #nav="ngbNav" [(activeId)]="active" class="nav-tabs">
|
||||
<li [ngbNavItem]="1">
|
||||
<a ngbNavLink>Mainnet</a>
|
||||
<ng-template ngbNavContent>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th style="border-top: 0;">Endpoint</th>
|
||||
<th style="border-top: 0;">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/api/v1/fees/recommended" target="_blank">GET /api/v1/fees/recommended</a></td>
|
||||
<td>Recommended fees</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/api/v1/fees/mempool-blocks" target="_blank">GET /api/v1/fees/mempool-blocks</a></td>
|
||||
<td>The current mempool blocks</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap">wss://{{ hostname }}/api/v1/ws</td>
|
||||
<td>
|
||||
<span class="text-small">
|
||||
Default push: <span class="code">{{ '{' }} action: 'want', data: ['blocks', ...] {{ '}' }}</span>
|
||||
to express what you want pushed. Available: 'blocks', 'mempool-blocks', 'live-2h-chart' and 'stats'.
|
||||
</span>
|
||||
<br><br>
|
||||
<span class="text-small">
|
||||
Push transactions related to address: <span class="code">{{ '{' }} 'track-address': '3PbJ...bF9B' {{ '}' }}</span>
|
||||
to receive all new transactions containing that address as input or output. Returns an array of transactions. 'address-transactions' for new mempool transactions and 'block-transactions' for new block confirmed transactions.
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="2">
|
||||
<a ngbNavLink>Bisq</a>
|
||||
<ng-template ngbNavContent>
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th style="border-top: 0;">Endpoint</th>
|
||||
<th style="border-top: 0;">Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/stats" target="_blank">GET /bisq/api/stats</a></td>
|
||||
<td>Stats</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/tx/4b5417ec5ab6112bedf539c3b4f5a806ed539542d8b717e1c4470aa3180edce5" target="_blank">GET /bisq/api/tx/:txId</a></td>
|
||||
<td>Transaction</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/txs/0/25" target="_blank">GET /bisq/api/txs/:index/:length</a></td>
|
||||
<td>Transactions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/block/000000000000000000079aa6bfa46eb8fc20474e8673d6e8a123b211236bf82d" target="_blank">GET /bisq/api/block/:hash</a></td>
|
||||
<td>Block</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/blocks/0/25" target="_blank">GET /bisq/api/blocks/:index/:length</a></td>
|
||||
<td>Blocks</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/blocks/tip/height" target="_blank">GET /bisq/api/blocks/tip/height</a></td>
|
||||
<td>Latest block height</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><a href="/bisq/api/address/B1DgwRN92rdQ9xpEVCdXRfgeqGw9X4YtrZz" target="_blank">GET /bisq/api/address/:address</a></td>
|
||||
<td>Address</td>
|
||||
</tr>
|
||||
</table>
|
||||
</ng-template>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div [ngbNavOutlet]="nav" class="mt-2"></div>
|
||||
|
||||
<br>
|
||||
|
||||
</div>
|
16
frontend/src/app/components/api-docs/api-docs.component.scss
Normal file
16
frontend/src/app/components/api-docs/api-docs.component.scss
Normal file
@ -0,0 +1,16 @@
|
||||
.text-small {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.code {
|
||||
background-color: #1d1f31;
|
||||
font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New;
|
||||
}
|
||||
|
||||
tr {
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
26
frontend/src/app/components/api-docs/api-docs.component.ts
Normal file
26
frontend/src/app/components/api-docs/api-docs.component.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { StateService } from 'src/app/services/state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-api-docs',
|
||||
templateUrl: './api-docs.component.html',
|
||||
styleUrls: ['./api-docs.component.scss']
|
||||
})
|
||||
export class ApiDocsComponent implements OnInit {
|
||||
hostname = document.location.hostname;
|
||||
active = 1;
|
||||
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.stateService.network === 'bisq') {
|
||||
this.active = 2;
|
||||
}
|
||||
if (document.location.port !== '') {
|
||||
this.hostname = this.hostname + ':' + document.location.port;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -55,6 +55,9 @@
|
||||
<li *ngIf="network.val === ''" class="nav-item" routerLinkActive="active">
|
||||
<a class="nav-link" [routerLink]="['/about' | relativeUrl]" (click)="collapse()"><fa-icon [icon]="['fas', 'info-circle']" [fixedWidth]="true" title="About"></fa-icon></a>
|
||||
</li>
|
||||
<li class="nav-item mr-2" routerLinkActive="active">
|
||||
<a class="nav-link" [routerLink]="['/api' | relativeUrl]" (click)="collapse()"><fa-icon [icon]="['fas', 'cogs']" [fixedWidth]="true" title="API"></fa-icon></a>
|
||||
</li>
|
||||
</ul>
|
||||
<app-search-form location="top" (searchTriggered)="collapse()"></app-search-form>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user