From cb576ce601fabbfcfd717dd22b5a2ef70548162c Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Wed, 26 Oct 2022 12:33:13 -0400 Subject: [PATCH 1/3] Add electrum rpc doc tab for official instance --- .../src/app/docs/api-docs/api-docs.component.html | 13 +++++++++++++ .../src/app/docs/api-docs/api-docs.component.scss | 12 ++++++++++++ frontend/src/app/docs/docs/docs.component.html | 9 +++++++++ frontend/src/app/docs/docs/docs.component.ts | 7 ++++++- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/docs/api-docs/api-docs.component.html b/frontend/src/app/docs/api-docs/api-docs.component.html index f106c4bc5..90c35252a 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.html +++ b/frontend/src/app/docs/api-docs/api-docs.component.html @@ -106,6 +106,19 @@ +
+
+
+ +

This part of the API is available to sponsors only—whitelisting is required.

+
+ +

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

+
+
+
+
+ diff --git a/frontend/src/app/docs/api-docs/api-docs.component.scss b/frontend/src/app/docs/api-docs/api-docs.component.scss index 456983657..aebaafe6f 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.scss +++ b/frontend/src/app/docs/api-docs/api-docs.component.scss @@ -1,3 +1,11 @@ +.center { + text-align: center; +} + +.note { + font-style: italic; +} + .text-small { font-size: 12px; } @@ -116,6 +124,10 @@ li.nav-item { float: right; } +.doc-content.no-sidebar { + width: 100% +} + h3 { margin: 2rem 0 0 0; } diff --git a/frontend/src/app/docs/docs/docs.component.html b/frontend/src/app/docs/docs/docs.component.html index 04f9bb8cf..9e7f57c74 100644 --- a/frontend/src/app/docs/docs/docs.component.html +++ b/frontend/src/app/docs/docs/docs.component.html @@ -32,6 +32,15 @@ +
  • + API - Electrum RPC + + + + + +
  • +
    diff --git a/frontend/src/app/docs/docs/docs.component.ts b/frontend/src/app/docs/docs/docs.component.ts index 74cebc88f..c129cd21e 100644 --- a/frontend/src/app/docs/docs/docs.component.ts +++ b/frontend/src/app/docs/docs/docs.component.ts @@ -15,6 +15,7 @@ export class DocsComponent implements OnInit { env: Env; showWebSocketTab = true; showFaqTab = true; + showElectrsTab = true; @HostBinding('attr.dir') dir = 'ltr'; @@ -34,14 +35,18 @@ export class DocsComponent implements OnInit { } else if( url[1].path === "rest" ) { this.activeTab = 1; this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`); - } else { + } else if( url[1].path === "websocket" ) { this.activeTab = 2; this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`); + } else { + this.activeTab = 3; + this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`); } this.env = this.stateService.env; this.showWebSocketTab = ( ! ( ( this.stateService.network === "bisq" ) || ( this.stateService.network === "liquidtestnet" ) ) ); this.showFaqTab = ( this.env.BASE_MODULE === 'mempool' ) ? true : false; + this.showElectrsTab = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && ( this.stateService.network === "" || this.stateService.network === "mainnet" || this.stateService.network === "testnet" || this.stateService.network === "signet" ); document.querySelector( "html" ).style.scrollBehavior = "smooth"; } From dbb6f267f4945981dc3cef8a6d0e32333586dbe3 Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Sun, 30 Oct 2022 12:39:20 -0400 Subject: [PATCH 2/3] Add electrum rpc port numbers and update note --- .../app/docs/api-docs/api-docs.component.html | 13 +++++++------ .../src/app/docs/api-docs/api-docs.component.ts | 16 ++++++++++++++++ frontend/src/app/docs/docs/docs.component.ts | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/docs/api-docs/api-docs.component.html b/frontend/src/app/docs/api-docs/api-docs.component.html index 90c35252a..e2524a27d 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.html +++ b/frontend/src/app/docs/api-docs/api-docs.component.html @@ -109,12 +109,13 @@
    - -

    This part of the API is available to sponsors only—whitelisting is required.

    -
    - -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    -
    +

    Hostname

    +

    {{plainHostname}}

    +

    Port

    +

    {{electrsPort}}

    +

    SSL

    +

    Enabled

    +

    Electrum RPC interface for Bitcoin Signet is publicly available. Electrum RPC interface for all other networks is available to sponsors only—whitelisting is required.

    diff --git a/frontend/src/app/docs/api-docs/api-docs.component.ts b/frontend/src/app/docs/api-docs/api-docs.component.ts index ed0ecb0a2..7b78d187b 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.ts +++ b/frontend/src/app/docs/api-docs/api-docs.component.ts @@ -12,6 +12,8 @@ import { FaqTemplateDirective } from '../faq-template/faq-template.component'; styleUrls: ['./api-docs.component.scss'] }) export class ApiDocsComponent implements OnInit, AfterViewInit { + plainHostname = document.location.hostname; + electrsPort = 0; hostname = document.location.hostname; network$: Observable; active = 0; @@ -82,6 +84,20 @@ export class ApiDocsComponent implements OnInit, AfterViewInit { this.network$.subscribe((network) => { this.active = (network === 'liquid' || network === 'liquidtestnet') ? 2 : 0; + switch( network ) { + case "": + this.electrsPort = 50002; break; + case "mainnet": + this.electrsPort = 50002; break; + case "testnet": + this.electrsPort = 60002; break; + case "signet": + this.electrsPort = 60602; break; + case "liquid": + this.electrsPort = 51002; break; + case "liquidtestnet": + this.electrsPort = 51302; break; + } }); } diff --git a/frontend/src/app/docs/docs/docs.component.ts b/frontend/src/app/docs/docs/docs.component.ts index c129cd21e..3e74ba959 100644 --- a/frontend/src/app/docs/docs/docs.component.ts +++ b/frontend/src/app/docs/docs/docs.component.ts @@ -46,7 +46,7 @@ export class DocsComponent implements OnInit { this.env = this.stateService.env; this.showWebSocketTab = ( ! ( ( this.stateService.network === "bisq" ) || ( this.stateService.network === "liquidtestnet" ) ) ); this.showFaqTab = ( this.env.BASE_MODULE === 'mempool' ) ? true : false; - this.showElectrsTab = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && ( this.stateService.network === "" || this.stateService.network === "mainnet" || this.stateService.network === "testnet" || this.stateService.network === "signet" ); + this.showElectrsTab = this.stateService.env.OFFICIAL_MEMPOOL_SPACE && ( this.stateService.network !== "bisq" ); document.querySelector( "html" ).style.scrollBehavior = "smooth"; } From 38ec5ef957dfc795db3d44efa0550b3b42aa61f0 Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Sun, 30 Oct 2022 13:08:26 -0400 Subject: [PATCH 3/3] Position docs footer on bottom For short docs pages (like electrum rpc). --- frontend/src/app/docs/api-docs/api-docs.component.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/app/docs/api-docs/api-docs.component.scss b/frontend/src/app/docs/api-docs/api-docs.component.scss index aebaafe6f..acfc209e5 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.scss +++ b/frontend/src/app/docs/api-docs/api-docs.component.scss @@ -10,6 +10,12 @@ font-size: 12px; } +.container-xl { + display: flex; + min-height: 75vh; + flex-direction: column; +} + code { background-color: #1d1f31; font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New;