Compare commits
266 Commits
v2.2.0-rc4
...
v2.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
251a1af442 | ||
|
|
9bdf42530a | ||
|
|
8525fbb177 | ||
|
|
63a3568481 | ||
|
|
e4941740de | ||
|
|
25bd33f7da | ||
|
|
2d007b9100 | ||
|
|
b71330c606 | ||
|
|
844b640c8c | ||
|
|
1277e58e68 | ||
|
|
fde6fe324a | ||
|
|
4ed114a4d5 | ||
|
|
8c2dfea6a6 | ||
|
|
a0624df06b | ||
|
|
1eedcf900b | ||
|
|
0b077d6fda | ||
|
|
80047313e7 | ||
|
|
71229b94c8 | ||
|
|
c256daf8c8 | ||
|
|
ba0fb996d2 | ||
|
|
5977e96034 | ||
|
|
a151c5cddd | ||
|
|
0323fd966d | ||
|
|
beb834bc30 | ||
|
|
ad6503c7b3 | ||
|
|
f8c11c8b6b | ||
|
|
ba5421e77b | ||
|
|
20fa803cee | ||
|
|
393fa78a43 | ||
|
|
3f290dae06 | ||
|
|
24d18b9f2f | ||
|
|
79ef8ca371 | ||
|
|
ec12f21113 | ||
|
|
2e8ecc7277 | ||
|
|
fc28b06a0f | ||
|
|
8fdbfdc04c | ||
|
|
bdfcfc96a8 | ||
|
|
bb8649bc81 | ||
|
|
777e3d58b7 | ||
|
|
c552f1aab6 | ||
|
|
c0f2fa3042 | ||
|
|
05936f82bd | ||
|
|
c7db81c97c | ||
|
|
bd1a37b8ef | ||
|
|
efc4e6a8ed | ||
|
|
dd5d87e91e | ||
|
|
ca6df488c5 | ||
|
|
1e018a6aa5 | ||
|
|
0a627f96be | ||
|
|
17a8e67d8a | ||
|
|
815c2c5ad5 | ||
|
|
4376de85ff | ||
|
|
7e89de4612 | ||
|
|
4b72a14706 | ||
|
|
b34f6fedb6 | ||
|
|
58af0d78af | ||
|
|
ca13d9109c | ||
|
|
e103fb5876 | ||
|
|
58178f4563 | ||
|
|
04f1879fd1 | ||
|
|
f5bc9ced0a | ||
|
|
7fe9993f91 | ||
|
|
7c95339324 | ||
|
|
006442f9de | ||
|
|
e20100e437 | ||
|
|
d7cf2b37d5 | ||
|
|
278c2b9aae | ||
|
|
944246fcf5 | ||
|
|
03d87f4993 | ||
|
|
cf8cab5f77 | ||
|
|
49d1376647 | ||
|
|
de5518d262 | ||
|
|
7e4c51f47f | ||
|
|
fe1d153632 | ||
|
|
a98f9ab80e | ||
|
|
867afaf265 | ||
|
|
3d2ec64b14 | ||
|
|
bb407c0b42 | ||
|
|
83c3d901c7 | ||
|
|
901cee903c | ||
|
|
250ea09c7e | ||
|
|
648d59631b | ||
|
|
ed06e3c491 | ||
|
|
3e8d646edd | ||
|
|
9c2c698575 | ||
|
|
e2b0a286a4 | ||
|
|
154809f0f9 | ||
|
|
8d9a51a7c4 | ||
|
|
b3294369d4 | ||
|
|
53730920e3 | ||
|
|
d73b814277 | ||
|
|
dd0050c066 | ||
|
|
ae51ee3e26 | ||
|
|
4b16e5d65f | ||
|
|
4f73bba132 | ||
|
|
3c229602e4 | ||
|
|
c74c902ebc | ||
|
|
8bfd315ba3 | ||
|
|
9d75c47792 | ||
|
|
e183be1a5c | ||
|
|
7e273ce63d | ||
|
|
6d070e75b0 | ||
|
|
af5e0d7cd6 | ||
|
|
a2f1003916 | ||
|
|
f4f96fd18e | ||
|
|
f3b470b63e | ||
|
|
398a72c1a6 | ||
|
|
ddd6420d9b | ||
|
|
d76f42296a | ||
|
|
45af88774f | ||
|
|
71c6b0e11d | ||
|
|
47a6118ffb | ||
|
|
994eb378af | ||
|
|
34d46e8ca5 | ||
|
|
a940f7e3b4 | ||
|
|
8c29395533 | ||
|
|
8208bbf0b7 | ||
|
|
dbd205b73f | ||
|
|
7ef4be26ed | ||
|
|
1223c58a98 | ||
|
|
7d3757676f | ||
|
|
073bd60ed8 | ||
|
|
18c38fc1c1 | ||
|
|
0eb95447bb | ||
|
|
c6b1979391 | ||
|
|
0f390e65a4 | ||
|
|
5dc0f4e270 | ||
|
|
223288cc52 | ||
|
|
72a35200b3 | ||
|
|
11817c04f7 | ||
|
|
7a8b2db3fb | ||
|
|
6d910a5e24 | ||
|
|
e1f07884b9 | ||
|
|
e00e61edfa | ||
|
|
4f988e186a | ||
|
|
1aa54faa35 | ||
|
|
99adccf43c | ||
|
|
0bb9247609 | ||
|
|
d841933b21 | ||
|
|
bc8b78a01b | ||
|
|
b0c708659b | ||
|
|
e31b906084 | ||
|
|
7249620471 | ||
|
|
dc9d5d0be3 | ||
|
|
a9009d4de2 | ||
|
|
a265787cd4 | ||
|
|
c6e72be483 | ||
|
|
4680519d2e | ||
|
|
5b17f88de2 | ||
|
|
a6d34ba4f1 | ||
|
|
508c8b0be3 | ||
|
|
ef7dd6c8fb | ||
|
|
f03249761b | ||
|
|
cb5877ba0a | ||
|
|
96f14d2781 | ||
|
|
8eb70416da | ||
|
|
b9246a72f2 | ||
|
|
43e222b9df | ||
|
|
5548d08a9e | ||
|
|
10fa39634e | ||
|
|
e6b90385b2 | ||
|
|
61181c6791 | ||
|
|
d2cccd2422 | ||
|
|
b05ebe1598 | ||
|
|
d92827a411 | ||
|
|
d061f7589c | ||
|
|
1c01094e07 | ||
|
|
f28a85f91b | ||
|
|
15903faf49 | ||
|
|
4895343d4e | ||
|
|
a0559cbb24 | ||
|
|
0293ba4a52 | ||
|
|
8b0d1db776 | ||
|
|
1908b1a5a6 | ||
|
|
037f472f8c | ||
|
|
a32c1f40b1 | ||
|
|
837e714b1f | ||
|
|
91a37d8fe8 | ||
|
|
a00aa27ae4 | ||
|
|
226e72451c | ||
|
|
544be77bdc | ||
|
|
b8a110a772 | ||
|
|
7788a2d6bd | ||
|
|
da17fd16fa | ||
|
|
e670f80fed | ||
|
|
857a5ff6fc | ||
|
|
2de28b9926 | ||
|
|
e6f8cf6cc8 | ||
|
|
d7586af392 | ||
|
|
35881b2457 | ||
|
|
59cd80b6d1 | ||
|
|
735c2ba587 | ||
|
|
be1ef43cd1 | ||
|
|
34ad88d3d0 | ||
|
|
751c7d6e69 | ||
|
|
60d8697b09 | ||
|
|
41aa1248be | ||
|
|
cedd94c654 | ||
|
|
bf13994d28 | ||
|
|
8a44ccc55d | ||
|
|
81df40681f | ||
|
|
9e46cde9b7 | ||
|
|
723034b3d3 | ||
|
|
59898f1269 | ||
|
|
195b9bf542 | ||
|
|
0333d91b15 | ||
|
|
f0bd487ea9 | ||
|
|
cd8e308870 | ||
|
|
f6a889298c | ||
|
|
11f5e99187 | ||
|
|
334f9358b0 | ||
|
|
820561610a | ||
|
|
2c895e7b03 | ||
|
|
f36f48b11c | ||
|
|
f12f1b4a4e | ||
|
|
037d6a75ea | ||
|
|
775323de3e | ||
|
|
d91dfa2f41 | ||
|
|
3ac06bb983 | ||
|
|
1ba0075829 | ||
|
|
95436d398d | ||
|
|
f2f5749769 | ||
|
|
cb90b09a0e | ||
|
|
2e54f4ca94 | ||
|
|
853e2fcb8f | ||
|
|
9e0a5300b0 | ||
|
|
1b5930887c | ||
|
|
5b39c018db | ||
|
|
ad08c3a907 | ||
|
|
08328cbf0f | ||
|
|
03ce592ab0 | ||
|
|
21db5a4102 | ||
|
|
7234734056 | ||
|
|
7bf9d604b9 | ||
|
|
08fd4a4835 | ||
|
|
9a715871c5 | ||
|
|
d405334109 | ||
|
|
38aee1a897 | ||
|
|
52aea12f22 | ||
|
|
ecbd18087b | ||
|
|
d13e18a72a | ||
|
|
8749b8b0fa | ||
|
|
f2e0a71b01 | ||
|
|
b4eea3dc72 | ||
|
|
cdfc03f352 | ||
|
|
2c5ccab77c | ||
|
|
80d76ad1f4 | ||
|
|
9a2428ad79 | ||
|
|
71cf41362f | ||
|
|
652f88770e | ||
|
|
7de2cf89f4 | ||
|
|
d7a827ba7f | ||
|
|
9dae7020c8 | ||
|
|
3ae3df6722 | ||
|
|
2e2e6aa01f | ||
|
|
1e9f131a2a | ||
|
|
5197a15e31 | ||
|
|
1d29fad986 | ||
|
|
eb6db6caf3 | ||
|
|
78c44eedbc | ||
|
|
b48a48a6be | ||
|
|
8e1aae1bbf | ||
|
|
807d4b0327 | ||
|
|
df588695ec | ||
|
|
da13349b14 | ||
|
|
f6e4907128 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
|
|||||||
liberapay: # Replace with a single Liberapay username
|
liberapay: # Replace with a single Liberapay username
|
||||||
issuehunt: # Replace with a single IssueHunt username
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
otechie: # Replace with a single Otechie username
|
otechie: # Replace with a single Otechie username
|
||||||
custom: ['https://mempool.space/about'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
custom: ['https://mempool.space/sponsor'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
|
|||||||
77
.github/workflows/cypress.yml
vendored
Normal file
77
.github/workflows/cypress.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
name: Cypress Tests
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cypress:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
containers: [1, 2, 3, 4, 5]
|
||||||
|
os: ["ubuntu-latest"]
|
||||||
|
browser: [chrome]
|
||||||
|
name: E2E tests on ${{ matrix.browser }} - ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: ${{ matrix.browser }} browser tests (Mempool)
|
||||||
|
uses: cypress-io/github-action@v2
|
||||||
|
with:
|
||||||
|
working-directory: frontend
|
||||||
|
build: npm run config:defaults:mempool
|
||||||
|
start: npm run start:local-prod
|
||||||
|
wait-on: 'http://localhost:4200'
|
||||||
|
wait-on-timeout: 120
|
||||||
|
record: true
|
||||||
|
parallel: true
|
||||||
|
env: BASE_MODULE=mempool
|
||||||
|
group: Tests on ${{ matrix.browser }} (Mempool)
|
||||||
|
browser: ${{ matrix.browser }}
|
||||||
|
ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}'
|
||||||
|
env:
|
||||||
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
||||||
|
|
||||||
|
- name: ${{ matrix.browser }} browser tests (Liquid)
|
||||||
|
uses: cypress-io/github-action@v2
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
working-directory: frontend
|
||||||
|
build: npm run config:defaults:liquid
|
||||||
|
start: npm run start:local-prod
|
||||||
|
wait-on: 'http://localhost:4200'
|
||||||
|
wait-on-timeout: 120
|
||||||
|
record: true
|
||||||
|
parallel: true
|
||||||
|
spec: cypress/integration/liquid/liquid.spec.ts
|
||||||
|
env: BASE_MODULE=liquid
|
||||||
|
group: Tests on ${{ matrix.browser }} (Liquid)
|
||||||
|
browser: ${{ matrix.browser }}
|
||||||
|
ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}'
|
||||||
|
env:
|
||||||
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
||||||
|
|
||||||
|
- name: ${{ matrix.browser }} browser tests (Bisq)
|
||||||
|
uses: cypress-io/github-action@v2
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
working-directory: frontend
|
||||||
|
build: npm run config:defaults:bisq
|
||||||
|
start: npm run start:local-prod
|
||||||
|
wait-on: 'http://localhost:4200'
|
||||||
|
wait-on-timeout: 120
|
||||||
|
record: true
|
||||||
|
parallel: true
|
||||||
|
spec: cypress/integration/bisq/bisq.spec.ts
|
||||||
|
env: BASE_MODULE=bisq
|
||||||
|
group: Tests on ${{ matrix.browser }} (Bisq)
|
||||||
|
browser: ${{ matrix.browser }}
|
||||||
|
ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}'
|
||||||
|
env:
|
||||||
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
||||||
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"editor.tabSize": 2,
|
||||||
|
"typescript.tsdk": "./backend/node_modules/typescript/lib"
|
||||||
|
}
|
||||||
9
LICENSE
9
LICENSE
@@ -12,8 +12,13 @@ the terms of (at your option) either:
|
|||||||
Foundation, either version 3 of the License or any later version approved by a
|
Foundation, either version 3 of the License or any later version approved by a
|
||||||
proxy statement published on <https://mempool.space/about>.
|
proxy statement published on <https://mempool.space/about>.
|
||||||
|
|
||||||
However, these licenses do not grant you any rights to use the "mempool.space"
|
However, this copyright license does not include an implied right or license to
|
||||||
trademarks or logos, or any other trademarks of Mempool Space K.K.
|
use our trademarks: The Mempool Open Source Project™, mempool.space™, the
|
||||||
|
mempool Logo™, the mempool.space Vertical Logo™, the mempool.space Horizontal
|
||||||
|
Logo™, the mempool Square Logo™, and the mempool Blocks logo™ are registered
|
||||||
|
trademarks or trademarks of Mempool Space K.K in Japan, the United States,
|
||||||
|
and/or other countries. See our full Trademark Policy and Guidelines for more
|
||||||
|
details, published on <https://mempool.space/trademark-policy>.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ Install mempool dependencies from npm and build the frontend static HTML/CSS/JS:
|
|||||||
Install the output into nginx webroot folder:
|
Install the output into nginx webroot folder:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo rsync -av --delete dist/mempool/ /var/www/html/
|
sudo rsync -av --delete dist/mempool /var/www/
|
||||||
```
|
```
|
||||||
|
|
||||||
## nginx + certbot
|
## nginx + certbot
|
||||||
@@ -179,7 +179,7 @@ Install the supplied nginx.conf and nginx-mempool.conf in /etc/nginx
|
|||||||
apt-get install -y nginx python-certbot-nginx
|
apt-get install -y nginx python-certbot-nginx
|
||||||
|
|
||||||
# install the mempool configuration for nginx
|
# install the mempool configuration for nginx
|
||||||
cp nginx.conf nginx-mempool.conf /etc/nginx/nginx.conf
|
cp nginx.conf nginx-mempool.conf /etc/nginx/
|
||||||
|
|
||||||
# replace example.com with your domain name
|
# replace example.com with your domain name
|
||||||
certbot --nginx -d example.com
|
certbot --nginx -d example.com
|
||||||
|
|||||||
4
backend/.vscode/settings.json
vendored
Normal file
4
backend/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"editor.tabSize": 2,
|
||||||
|
"typescript.tsdk": "../backend/node_modules/typescript/lib"
|
||||||
|
}
|
||||||
@@ -8,7 +8,11 @@
|
|||||||
"POLL_RATE_MS": 2000,
|
"POLL_RATE_MS": 2000,
|
||||||
"CACHE_DIR": "./cache",
|
"CACHE_DIR": "./cache",
|
||||||
"CLEAR_PROTECTION_MINUTES": 20,
|
"CLEAR_PROTECTION_MINUTES": 20,
|
||||||
"RECOMMENDED_FEE_PERCENTILE": 50
|
"RECOMMENDED_FEE_PERCENTILE": 50,
|
||||||
|
"BLOCK_WEIGHT_UNITS": 4000000,
|
||||||
|
"INITIAL_BLOCKS_AMOUNT": 8,
|
||||||
|
"MEMPOOL_BLOCKS_AMOUNT": 8,
|
||||||
|
"PRICE_FEED_UPDATE_INTERVAL": 3600
|
||||||
},
|
},
|
||||||
"CORE_RPC": {
|
"CORE_RPC": {
|
||||||
"HOST": "127.0.0.1",
|
"HOST": "127.0.0.1",
|
||||||
|
|||||||
33
backend/package-lock.json
generated
33
backend/package-lock.json
generated
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "mempool-backend",
|
"name": "mempool-backend",
|
||||||
"version": "2.2.0-dev",
|
"version": "2.2.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mempool-backend",
|
"name": "mempool-backend",
|
||||||
"version": "2.2.0-dev",
|
"version": "2.2.2",
|
||||||
"license": "GNU Affero General Public License v3.0",
|
"license": "GNU Affero General Public License v3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mempool/bitcoin": "^3.0.2",
|
"@mempool/bitcoin": "^3.0.3",
|
||||||
"@mempool/electrum-client": "^1.1.7",
|
"@mempool/electrum-client": "^1.1.7",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"bitcoinjs-lib": "^5.2.0",
|
"bitcoinjs-lib": "^5.2.0",
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
"@types/locutus": "^0.0.6",
|
"@types/locutus": "^0.0.6",
|
||||||
"@types/ws": "^7.4.4",
|
"@types/ws": "^7.4.4",
|
||||||
"tslint": "^6.1.0",
|
"tslint": "^6.1.0",
|
||||||
"typescript": "^4.1.5"
|
"typescript": "4.4.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/code-frame": {
|
"node_modules/@babel/code-frame": {
|
||||||
@@ -56,9 +56,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mempool/bitcoin": {
|
"node_modules/@mempool/bitcoin": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@mempool/bitcoin/-/bitcoin-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@mempool/bitcoin/-/bitcoin-3.0.3.tgz",
|
||||||
"integrity": "sha512-WNHFTDJEEBmakSPAbrJ933mGgm1uYxmOElyQYZVW7D7CRUd8mKek+QlViin63e71vyfMVOGXtWwSb87dxghggQ==",
|
"integrity": "sha512-10UdbwchnevlebDTN+Xhv75AEhDmTMy9UgWHlqx5MG2mheFG6+eqmtHsdxeYnv3IAtTtlRfA6fY0RbV/x4TNFQ==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.10.0"
|
"node": ">= 0.10.0"
|
||||||
}
|
}
|
||||||
@@ -1473,10 +1473,11 @@
|
|||||||
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
|
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.2.3",
|
"version": "4.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
||||||
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
|
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@@ -1590,9 +1591,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@mempool/bitcoin": {
|
"@mempool/bitcoin": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@mempool/bitcoin/-/bitcoin-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@mempool/bitcoin/-/bitcoin-3.0.3.tgz",
|
||||||
"integrity": "sha512-WNHFTDJEEBmakSPAbrJ933mGgm1uYxmOElyQYZVW7D7CRUd8mKek+QlViin63e71vyfMVOGXtWwSb87dxghggQ=="
|
"integrity": "sha512-10UdbwchnevlebDTN+Xhv75AEhDmTMy9UgWHlqx5MG2mheFG6+eqmtHsdxeYnv3IAtTtlRfA6fY0RbV/x4TNFQ=="
|
||||||
},
|
},
|
||||||
"@mempool/electrum-client": {
|
"@mempool/electrum-client": {
|
||||||
"version": "1.1.8",
|
"version": "1.1.8",
|
||||||
@@ -2770,9 +2771,9 @@
|
|||||||
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
|
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.2.3",
|
"version": "4.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
||||||
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
|
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"unpipe": {
|
"unpipe": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mempool-backend",
|
"name": "mempool-backend",
|
||||||
"version": "2.2.0-dev",
|
"version": "2.2.2",
|
||||||
"description": "Bitcoin mempool visualizer and blockchain explorer backend",
|
"description": "Bitcoin mempool visualizer and blockchain explorer backend",
|
||||||
"license": "GNU Affero General Public License v3.0",
|
"license": "GNU Affero General Public License v3.0",
|
||||||
"homepage": "https://mempool.space",
|
"homepage": "https://mempool.space",
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mempool/bitcoin": "^3.0.2",
|
"@mempool/bitcoin": "^3.0.3",
|
||||||
"@mempool/electrum-client": "^1.1.7",
|
"@mempool/electrum-client": "^1.1.7",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"bitcoinjs-lib": "^5.2.0",
|
"bitcoinjs-lib": "^5.2.0",
|
||||||
@@ -45,6 +45,6 @@
|
|||||||
"@types/locutus": "^0.0.6",
|
"@types/locutus": "^0.0.6",
|
||||||
"@types/ws": "^7.4.4",
|
"@types/ws": "^7.4.4",
|
||||||
"tslint": "^6.1.0",
|
"tslint": "^6.1.0",
|
||||||
"typescript": "^4.1.5"
|
"typescript": "4.4.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class BackendInfo {
|
|||||||
try {
|
try {
|
||||||
this.gitCommitHash = fs.readFileSync('../.git/refs/heads/master').toString().trim();
|
this.gitCommitHash = fs.readFileSync('../.git/refs/heads/master').toString().trim();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('Could not load git commit info: ' + e.message || e);
|
logger.err('Could not load git commit info: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ class BackendInfo {
|
|||||||
const packageJson = fs.readFileSync('package.json').toString();
|
const packageJson = fs.readFileSync('package.json').toString();
|
||||||
this.version = JSON.parse(packageJson).version;
|
this.version = JSON.parse(packageJson).version;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(e instanceof Error ? e.message : 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ class Bisq {
|
|||||||
this.buildIndex();
|
this.buildIndex();
|
||||||
this.calculateStats();
|
this.calculateStats();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('loadBisqDumpFile() error.' + e.message || e);
|
logger.info('loadBisqDumpFile() error.' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class Bisq {
|
|||||||
logger.debug('Bisq market data updated in ' + time + ' ms');
|
logger.debug('Bisq market data updated in ' + time + ' ms');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('loadBisqMarketDataDumpFile() error.' + e.message || e);
|
logger.err('loadBisqMarketDataDumpFile() error.' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export interface AbstractBitcoinApi {
|
|||||||
$getBlockHeightTip(): Promise<number>;
|
$getBlockHeightTip(): Promise<number>;
|
||||||
$getTxIdsForBlock(hash: string): Promise<string[]>;
|
$getTxIdsForBlock(hash: string): Promise<string[]>;
|
||||||
$getBlockHash(height: number): Promise<string>;
|
$getBlockHash(height: number): Promise<string>;
|
||||||
|
$getBlockHeader(hash: string): Promise<string>;
|
||||||
$getBlock(hash: string): Promise<IEsploraApi.Block>;
|
$getBlock(hash: string): Promise<IEsploraApi.Block>;
|
||||||
$getAddress(address: string): Promise<IEsploraApi.Address>;
|
$getAddress(address: string): Promise<IEsploraApi.Address>;
|
||||||
$getAddressTransactions(address: string, lastSeenTxId: string): Promise<IEsploraApi.Transaction[]>;
|
$getAddressTransactions(address: string, lastSeenTxId: string): Promise<IEsploraApi.Transaction[]>;
|
||||||
|
|||||||
@@ -98,12 +98,15 @@ export namespace IBitcoinApi {
|
|||||||
|
|
||||||
export interface AddressInformation {
|
export interface AddressInformation {
|
||||||
isvalid: boolean; // (boolean) If the address is valid or not. If not, this is the only property returned.
|
isvalid: boolean; // (boolean) If the address is valid or not. If not, this is the only property returned.
|
||||||
|
isvalid_parent?: boolean; // (boolean) Elements only
|
||||||
address: string; // (string) The bitcoin address validated
|
address: string; // (string) The bitcoin address validated
|
||||||
scriptPubKey: string; // (string) The hex-encoded scriptPubKey generated by the address
|
scriptPubKey: string; // (string) The hex-encoded scriptPubKey generated by the address
|
||||||
isscript: boolean; // (boolean) If the key is a script
|
isscript: boolean; // (boolean) If the key is a script
|
||||||
iswitness: boolean; // (boolean) If the address is a witness
|
iswitness: boolean; // (boolean) If the address is a witness
|
||||||
witness_version?: boolean; // (numeric, optional) The version number of the witness program
|
witness_version?: boolean; // (numeric, optional) The version number of the witness program
|
||||||
witness_program: string; // (string, optional) The hex value of the witness program
|
witness_program: string; // (string, optional) The hex value of the witness program
|
||||||
|
confidential_key?: string; // (string) Elements only
|
||||||
|
unconfidential?: string; // (string) Elements only
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChainTips {
|
export interface ChainTips {
|
||||||
@@ -113,4 +116,46 @@ export namespace IBitcoinApi {
|
|||||||
status: 'invalid' | 'headers-only' | 'valid-headers' | 'valid-fork' | 'active';
|
status: 'invalid' | 'headers-only' | 'valid-headers' | 'valid-fork' | 'active';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BlockchainInfo {
|
||||||
|
chain: number; // (string) current network name as defined in BIP70 (main, test, regtest)
|
||||||
|
blocks: number; // (numeric) the current number of blocks processed in the server
|
||||||
|
headers: number; // (numeric) the current number of headers we have validated
|
||||||
|
bestblockhash: string, // (string) the hash of the currently best block
|
||||||
|
difficulty: number; // (numeric) the current difficulty
|
||||||
|
mediantime: number; // (numeric) median time for the current best block
|
||||||
|
verificationprogress: number; // (numeric) estimate of verification progress [0..1]
|
||||||
|
initialblockdownload: boolean; // (bool) (debug information) estimate of whether this node is in Initial Block Download mode.
|
||||||
|
chainwork: string // (string) total amount of work in active chain, in hexadecimal
|
||||||
|
size_on_disk: number; // (numeric) the estimated size of the block and undo files on disk
|
||||||
|
pruned: number; // (boolean) if the blocks are subject to pruning
|
||||||
|
pruneheight: number; // (numeric) lowest-height complete block stored (only present if pruning is enabled)
|
||||||
|
automatic_pruning: number; // (boolean) whether automatic pruning is enabled (only present if pruning is enabled)
|
||||||
|
prune_target_size: number; // (numeric) the target size used by pruning (only present if automatic pruning is enabled)
|
||||||
|
softforks: SoftFork[]; // (array) status of softforks in progress
|
||||||
|
bip9_softforks: { [name: string]: Bip9SoftForks[] } // (object) status of BIP9 softforks in progress
|
||||||
|
warnings: string; // (string) any network and blockchain warnings.
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SoftFork {
|
||||||
|
id: string; // (string) name of softfork
|
||||||
|
version: number; // (numeric) block version
|
||||||
|
reject: { // (object) progress toward rejecting pre-softfork blocks
|
||||||
|
status: boolean; // (boolean) true if threshold reached
|
||||||
|
},
|
||||||
|
}
|
||||||
|
interface Bip9SoftForks {
|
||||||
|
status: number; // (string) one of defined, started, locked_in, active, failed
|
||||||
|
bit: number; // (numeric) the bit (0-28) in the block version field used to signal this softfork (only for started status)
|
||||||
|
startTime: number; // (numeric) the minimum median time past of a block at which the bit gains its meaning
|
||||||
|
timeout: number; // (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in
|
||||||
|
since: number; // (numeric) height of the first block to which the status applies
|
||||||
|
statistics: { // (object) numeric statistics about BIP9 signalling for a softfork (only for started status)
|
||||||
|
period: number; // (numeric) the length in blocks of the BIP9 signalling period
|
||||||
|
threshold: number; // (numeric) the number of blocks with the version bit set required to activate the feature
|
||||||
|
elapsed: number; // (numeric) the number of blocks elapsed since the beginning of the current period
|
||||||
|
count: number; // (numeric) the number of blocks with the version bit set in the current period
|
||||||
|
possible: boolean; // (boolean) returns false if there are not enough blocks left in this period to pass activation threshold
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,10 +56,18 @@ class BitcoinApi implements AbstractBitcoinApi {
|
|||||||
.then((rpcBlock: IBitcoinApi.Block) => rpcBlock.tx);
|
.then((rpcBlock: IBitcoinApi.Block) => rpcBlock.tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$getRawBlock(hash: string): Promise<string> {
|
||||||
|
return this.bitcoindClient.getBlock(hash, 0);
|
||||||
|
}
|
||||||
|
|
||||||
$getBlockHash(height: number): Promise<string> {
|
$getBlockHash(height: number): Promise<string> {
|
||||||
return this.bitcoindClient.getBlockHash(height);
|
return this.bitcoindClient.getBlockHash(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$getBlockHeader(hash: string): Promise<string> {
|
||||||
|
return this.bitcoindClient.getBlockHeader(hash, false);
|
||||||
|
}
|
||||||
|
|
||||||
async $getBlock(hash: string): Promise<IEsploraApi.Block> {
|
async $getBlock(hash: string): Promise<IEsploraApi.Block> {
|
||||||
const foundBlock = blocks.getBlocks().find((block) => block.id === hash);
|
const foundBlock = blocks.getBlocks().find((block) => block.id === hash);
|
||||||
if (foundBlock) {
|
if (foundBlock) {
|
||||||
@@ -229,10 +237,6 @@ class BitcoinApi implements AbstractBitcoinApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $validateAddress(address: string): Promise<IBitcoinApi.AddressInformation> {
|
|
||||||
return this.bitcoindClient.validateAddress(address);
|
|
||||||
}
|
|
||||||
|
|
||||||
private $getMempoolEntry(txid: string): Promise<IBitcoinApi.MempoolEntry> {
|
private $getMempoolEntry(txid: string): Promise<IBitcoinApi.MempoolEntry> {
|
||||||
return this.bitcoindClient.getMempoolEntry(txid);
|
return this.bitcoindClient.getMempoolEntry(txid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,14 @@ class BitcoinBaseApi {
|
|||||||
}
|
}
|
||||||
return this.bitcoindClient.getMempoolInfo();
|
return this.bitcoindClient.getMempoolInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$getBlockchainInfo(): Promise<IBitcoinApi.BlockchainInfo> {
|
||||||
|
return this.bitcoindClient.getBlockchainInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
$validateAddress(address: string): Promise<IBitcoinApi.AddressInformation> {
|
||||||
|
return this.bitcoindClient.validateAddress(address);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new BitcoinBaseApi();
|
export default new BitcoinBaseApi();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import * as sha256 from 'crypto-js/sha256';
|
|||||||
import * as hexEnc from 'crypto-js/enc-hex';
|
import * as hexEnc from 'crypto-js/enc-hex';
|
||||||
import loadingIndicators from '../loading-indicators';
|
import loadingIndicators from '../loading-indicators';
|
||||||
import memoryCache from '../memory-cache';
|
import memoryCache from '../memory-cache';
|
||||||
|
import bitcoinBaseApi from './bitcoin-base.api';
|
||||||
|
|
||||||
class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
|
class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
|
||||||
private electrumClient: any;
|
private electrumClient: any;
|
||||||
@@ -44,7 +45,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async $getAddress(address: string): Promise<IEsploraApi.Address> {
|
async $getAddress(address: string): Promise<IEsploraApi.Address> {
|
||||||
const addressInfo = await this.$validateAddress(address);
|
const addressInfo = await bitcoinBaseApi.$validateAddress(address);
|
||||||
if (!addressInfo || !addressInfo.isvalid) {
|
if (!addressInfo || !addressInfo.isvalid) {
|
||||||
return ({
|
return ({
|
||||||
'address': address,
|
'address': address,
|
||||||
@@ -93,12 +94,12 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
|
|||||||
if (e === 'failed to get confirmed status') {
|
if (e === 'failed to get confirmed status') {
|
||||||
e = 'The number of transactions on this address exceeds the Electrum server limit';
|
e = 'The number of transactions on this address exceeds the Electrum server limit';
|
||||||
}
|
}
|
||||||
throw new Error(e);
|
throw new Error(typeof e === 'string' ? e : 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async $getAddressTransactions(address: string, lastSeenTxId: string): Promise<IEsploraApi.Transaction[]> {
|
async $getAddressTransactions(address: string, lastSeenTxId: string): Promise<IEsploraApi.Transaction[]> {
|
||||||
const addressInfo = await this.$validateAddress(address);
|
const addressInfo = await bitcoinBaseApi.$validateAddress(address);
|
||||||
if (!addressInfo || !addressInfo.isvalid) {
|
if (!addressInfo || !addressInfo.isvalid) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -131,7 +132,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
|
|||||||
if (e === 'failed to get confirmed status') {
|
if (e === 'failed to get confirmed status') {
|
||||||
e = 'The number of transactions on this address exceeds the Electrum server limit';
|
e = 'The number of transactions on this address exceeds the Electrum server limit';
|
||||||
}
|
}
|
||||||
throw new Error(e);
|
throw new Error(typeof e === 'string' ? e : 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export namespace IEsploraApi {
|
|||||||
vin: Vin[];
|
vin: Vin[];
|
||||||
vout: Vout[];
|
vout: Vout[];
|
||||||
status: Status;
|
status: Status;
|
||||||
|
hex?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Recent {
|
export interface Recent {
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ class ElectrsApi implements AbstractBitcoinApi {
|
|||||||
.then((response) => response.data);
|
.then((response) => response.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$getBlockHeader(hash: string): Promise<string> {
|
||||||
|
return axios.get<string>(config.ESPLORA.REST_API_URL + '/block/' + hash + '/header', this.axiosConfig)
|
||||||
|
.then((response) => response.data);
|
||||||
|
}
|
||||||
|
|
||||||
$getBlock(hash: string): Promise<IEsploraApi.Block> {
|
$getBlock(hash: string): Promise<IEsploraApi.Block> {
|
||||||
return axios.get<IEsploraApi.Block>(config.ESPLORA.REST_API_URL + '/block/' + hash, this.axiosConfig)
|
return axios.get<IEsploraApi.Block>(config.ESPLORA.REST_API_URL + '/block/' + hash, this.axiosConfig)
|
||||||
.then((response) => response.data);
|
.then((response) => response.data);
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ import { BlockExtended, TransactionExtended } from '../mempool.interfaces';
|
|||||||
import { Common } from './common';
|
import { Common } from './common';
|
||||||
import diskCache from './disk-cache';
|
import diskCache from './disk-cache';
|
||||||
import transactionUtils from './transaction-utils';
|
import transactionUtils from './transaction-utils';
|
||||||
|
import bitcoinBaseApi from './bitcoin/bitcoin-base.api';
|
||||||
|
|
||||||
class Blocks {
|
class Blocks {
|
||||||
private static INITIAL_BLOCK_AMOUNT = 8;
|
|
||||||
private blocks: BlockExtended[] = [];
|
private blocks: BlockExtended[] = [];
|
||||||
private currentBlockHeight = 0;
|
private currentBlockHeight = 0;
|
||||||
|
private currentDifficulty = 0;
|
||||||
private lastDifficultyAdjustmentTime = 0;
|
private lastDifficultyAdjustmentTime = 0;
|
||||||
|
private previousDifficultyRetarget = 0;
|
||||||
private newBlockCallbacks: ((block: BlockExtended, txIds: string[], transactions: TransactionExtended[]) => void)[] = [];
|
private newBlockCallbacks: ((block: BlockExtended, txIds: string[], transactions: TransactionExtended[]) => void)[] = [];
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
@@ -32,21 +34,32 @@ class Blocks {
|
|||||||
const blockHeightTip = await bitcoinApi.$getBlockHeightTip();
|
const blockHeightTip = await bitcoinApi.$getBlockHeightTip();
|
||||||
|
|
||||||
if (this.blocks.length === 0) {
|
if (this.blocks.length === 0) {
|
||||||
this.currentBlockHeight = blockHeightTip - Blocks.INITIAL_BLOCK_AMOUNT;
|
this.currentBlockHeight = blockHeightTip - config.MEMPOOL.INITIAL_BLOCKS_AMOUNT;
|
||||||
} else {
|
} else {
|
||||||
this.currentBlockHeight = this.blocks[this.blocks.length - 1].height;
|
this.currentBlockHeight = this.blocks[this.blocks.length - 1].height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockHeightTip - this.currentBlockHeight > Blocks.INITIAL_BLOCK_AMOUNT * 2) {
|
if (blockHeightTip - this.currentBlockHeight > config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 2) {
|
||||||
logger.info(`${blockHeightTip - this.currentBlockHeight} blocks since tip. Fast forwarding to the ${Blocks.INITIAL_BLOCK_AMOUNT} recent blocks`);
|
logger.info(`${blockHeightTip - this.currentBlockHeight} blocks since tip. Fast forwarding to the ${config.MEMPOOL.INITIAL_BLOCKS_AMOUNT} recent blocks`);
|
||||||
this.currentBlockHeight = blockHeightTip - Blocks.INITIAL_BLOCK_AMOUNT;
|
this.currentBlockHeight = blockHeightTip - config.MEMPOOL.INITIAL_BLOCKS_AMOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.lastDifficultyAdjustmentTime) {
|
if (!this.lastDifficultyAdjustmentTime) {
|
||||||
const heightDiff = blockHeightTip % 2016;
|
const blockchainInfo = await bitcoinBaseApi.$getBlockchainInfo();
|
||||||
const blockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff);
|
if (blockchainInfo.blocks === blockchainInfo.headers) {
|
||||||
const block = await bitcoinApi.$getBlock(blockHash);
|
const heightDiff = blockHeightTip % 2016;
|
||||||
this.lastDifficultyAdjustmentTime = block.timestamp;
|
const blockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff);
|
||||||
|
const block = await bitcoinApi.$getBlock(blockHash);
|
||||||
|
this.lastDifficultyAdjustmentTime = block.timestamp;
|
||||||
|
this.currentDifficulty = block.difficulty;
|
||||||
|
|
||||||
|
const previousPeriodBlockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff - 2016);
|
||||||
|
const previousPeriodBlock = await bitcoinApi.$getBlock(previousPeriodBlockHash);
|
||||||
|
this.previousDifficultyRetarget = (block.difficulty - previousPeriodBlock.difficulty) / previousPeriodBlock.difficulty * 100;
|
||||||
|
logger.debug(`Initial difficulty adjustment data set.`);
|
||||||
|
} else {
|
||||||
|
logger.debug(`Blockchain headers (${blockchainInfo.headers}) and blocks (${blockchainInfo.blocks}) not in sync. Waiting...`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (this.currentBlockHeight < blockHeightTip) {
|
while (this.currentBlockHeight < blockHeightTip) {
|
||||||
@@ -76,7 +89,7 @@ class Blocks {
|
|||||||
const tx = await transactionUtils.$getTransactionExtended(txIds[i]);
|
const tx = await transactionUtils.$getTransactionExtended(txIds[i]);
|
||||||
transactions.push(tx);
|
transactions.push(tx);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error fetching block tx: ' + e.message || e);
|
logger.debug('Error fetching block tx: ' + (e instanceof Error ? e.message : e));
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
throw new Error('Failed to fetch Coinbase transaction: ' + txIds[i]);
|
throw new Error('Failed to fetch Coinbase transaction: ' + txIds[i]);
|
||||||
}
|
}
|
||||||
@@ -97,16 +110,18 @@ class Blocks {
|
|||||||
blockExtended.coinbaseTx = transactionUtils.stripCoinbaseTransaction(transactions[0]);
|
blockExtended.coinbaseTx = transactionUtils.stripCoinbaseTransaction(transactions[0]);
|
||||||
transactions.shift();
|
transactions.shift();
|
||||||
transactions.sort((a, b) => b.effectiveFeePerVsize - a.effectiveFeePerVsize);
|
transactions.sort((a, b) => b.effectiveFeePerVsize - a.effectiveFeePerVsize);
|
||||||
blockExtended.medianFee = transactions.length > 1 ? Common.median(transactions.map((tx) => tx.effectiveFeePerVsize)) : 0;
|
blockExtended.medianFee = transactions.length > 0 ? Common.median(transactions.map((tx) => tx.effectiveFeePerVsize)) : 0;
|
||||||
blockExtended.feeRange = transactions.length > 1 ? Common.getFeesInRange(transactions, 8) : [0, 0];
|
blockExtended.feeRange = transactions.length > 0 ? Common.getFeesInRange(transactions, 8) : [0, 0];
|
||||||
|
|
||||||
if (block.height % 2016 === 0) {
|
if (block.height % 2016 === 0) {
|
||||||
|
this.previousDifficultyRetarget = (block.difficulty - this.currentDifficulty) / this.currentDifficulty * 100;
|
||||||
this.lastDifficultyAdjustmentTime = block.timestamp;
|
this.lastDifficultyAdjustmentTime = block.timestamp;
|
||||||
|
this.currentDifficulty = block.difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.blocks.push(blockExtended);
|
this.blocks.push(blockExtended);
|
||||||
if (this.blocks.length > Blocks.INITIAL_BLOCK_AMOUNT * 4) {
|
if (this.blocks.length > config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 4) {
|
||||||
this.blocks = this.blocks.slice(-Blocks.INITIAL_BLOCK_AMOUNT * 4);
|
this.blocks = this.blocks.slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.newBlockCallbacks.length) {
|
if (this.newBlockCallbacks.length) {
|
||||||
@@ -122,6 +137,10 @@ class Blocks {
|
|||||||
return this.lastDifficultyAdjustmentTime;
|
return this.lastDifficultyAdjustmentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getPreviousDifficultyRetarget(): number {
|
||||||
|
return this.previousDifficultyRetarget;
|
||||||
|
}
|
||||||
|
|
||||||
public getCurrentBlockHeight(): number {
|
public getCurrentBlockHeight(): number {
|
||||||
return this.currentBlockHeight;
|
return this.currentBlockHeight;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { CpfpInfo, TransactionExtended, TransactionStripped } from '../mempool.interfaces';
|
import { CpfpInfo, TransactionExtended, TransactionStripped } from '../mempool.interfaces';
|
||||||
|
import config from '../config';
|
||||||
export class Common {
|
export class Common {
|
||||||
static median(numbers: number[]) {
|
static median(numbers: number[]) {
|
||||||
let medianNr = 0;
|
let medianNr = 0;
|
||||||
@@ -105,7 +105,7 @@ export class Common {
|
|||||||
totalFees += tx.bestDescendant.fee;
|
totalFees += tx.bestDescendant.fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.effectiveFeePerVsize = totalFees / (totalWeight / 4);
|
tx.effectiveFeePerVsize = Math.max(config.MEMPOOL.NETWORK === 'liquid' ? 0.1 : 1, totalFees / (totalWeight / 4));
|
||||||
tx.cpfpChecked = true;
|
tx.cpfpChecked = true;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class DiskCache {
|
|||||||
logger.debug('Mempool and blocks data saved to disk cache');
|
logger.debug('Mempool and blocks data saved to disk cache');
|
||||||
this.isWritingCache = false;
|
this.isWritingCache = false;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn('Error writing to cache file: ' + e.message || e);
|
logger.warn('Error writing to cache file: ' + (e instanceof Error ? e.message : e));
|
||||||
this.isWritingCache = false;
|
this.isWritingCache = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import logger from '../logger';
|
import logger from '../logger';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { IConversionRates } from '../mempool.interfaces';
|
import { IConversionRates } from '../mempool.interfaces';
|
||||||
|
import config from '../config';
|
||||||
|
|
||||||
class FiatConversion {
|
class FiatConversion {
|
||||||
private conversionRates: IConversionRates = {
|
private conversionRates: IConversionRates = {
|
||||||
@@ -16,7 +17,7 @@ class FiatConversion {
|
|||||||
|
|
||||||
public startService() {
|
public startService() {
|
||||||
logger.info('Starting currency rates service');
|
logger.info('Starting currency rates service');
|
||||||
setInterval(this.updateCurrency.bind(this), 1000 * 60);
|
setInterval(this.updateCurrency.bind(this), 1000 * config.MEMPOOL.PRICE_FEED_UPDATE_INTERVAL);
|
||||||
this.updateCurrency();
|
this.updateCurrency();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ class FiatConversion {
|
|||||||
this.ratesChangedCallback(this.conversionRates);
|
this.ratesChangedCallback(this.conversionRates);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('Error updating fiat conversion rates: ' + e);
|
logger.err('Error updating fiat conversion rates: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { Common } from './common';
|
|||||||
import config from '../config';
|
import config from '../config';
|
||||||
|
|
||||||
class MempoolBlocks {
|
class MempoolBlocks {
|
||||||
private static DEFAULT_PROJECTED_BLOCKS_AMOUNT = 8;
|
|
||||||
private mempoolBlocks: MempoolBlockWithTransactions[] = [];
|
private mempoolBlocks: MempoolBlockWithTransactions[] = [];
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
@@ -72,29 +71,29 @@ class MempoolBlocks {
|
|||||||
|
|
||||||
private calculateMempoolBlocks(transactionsSorted: TransactionExtended[]): MempoolBlockWithTransactions[] {
|
private calculateMempoolBlocks(transactionsSorted: TransactionExtended[]): MempoolBlockWithTransactions[] {
|
||||||
const mempoolBlocks: MempoolBlockWithTransactions[] = [];
|
const mempoolBlocks: MempoolBlockWithTransactions[] = [];
|
||||||
let blockVSize = 0;
|
let blockWeight = 0;
|
||||||
let blockSize = 0;
|
let blockSize = 0;
|
||||||
let transactions: TransactionExtended[] = [];
|
let transactions: TransactionExtended[] = [];
|
||||||
transactionsSorted.forEach((tx) => {
|
transactionsSorted.forEach((tx) => {
|
||||||
if (blockVSize + tx.vsize <= 1000000 || mempoolBlocks.length === MempoolBlocks.DEFAULT_PROJECTED_BLOCKS_AMOUNT - 1) {
|
if (blockWeight + tx.weight <= config.MEMPOOL.BLOCK_WEIGHT_UNITS || mempoolBlocks.length === config.MEMPOOL.MEMPOOL_BLOCKS_AMOUNT) {
|
||||||
blockVSize += tx.vsize;
|
blockWeight += tx.weight;
|
||||||
blockSize += tx.size;
|
blockSize += tx.size;
|
||||||
transactions.push(tx);
|
transactions.push(tx);
|
||||||
} else {
|
} else {
|
||||||
mempoolBlocks.push(this.dataToMempoolBlocks(transactions, blockSize, blockVSize, mempoolBlocks.length));
|
mempoolBlocks.push(this.dataToMempoolBlocks(transactions, blockSize, blockWeight, mempoolBlocks.length));
|
||||||
blockVSize = tx.vsize;
|
blockWeight = tx.weight;
|
||||||
blockSize = tx.size;
|
blockSize = tx.size;
|
||||||
transactions = [tx];
|
transactions = [tx];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (transactions.length) {
|
if (transactions.length) {
|
||||||
mempoolBlocks.push(this.dataToMempoolBlocks(transactions, blockSize, blockVSize, mempoolBlocks.length));
|
mempoolBlocks.push(this.dataToMempoolBlocks(transactions, blockSize, blockWeight, mempoolBlocks.length));
|
||||||
}
|
}
|
||||||
return mempoolBlocks;
|
return mempoolBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private dataToMempoolBlocks(transactions: TransactionExtended[],
|
private dataToMempoolBlocks(transactions: TransactionExtended[],
|
||||||
blockSize: number, blockVSize: number, blocksIndex: number): MempoolBlockWithTransactions {
|
blockSize: number, blockWeight: number, blocksIndex: number): MempoolBlockWithTransactions {
|
||||||
let rangeLength = 4;
|
let rangeLength = 4;
|
||||||
if (blocksIndex === 0) {
|
if (blocksIndex === 0) {
|
||||||
rangeLength = 8;
|
rangeLength = 8;
|
||||||
@@ -106,7 +105,7 @@ class MempoolBlocks {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
blockSize: blockSize,
|
blockSize: blockSize,
|
||||||
blockVSize: blockVSize,
|
blockVSize: blockWeight / 4,
|
||||||
nTx: transactions.length,
|
nTx: transactions.length,
|
||||||
totalFees: transactions.reduce((acc, cur) => acc + cur.fee, 0),
|
totalFees: transactions.reduce((acc, cur) => acc + cur.fee, 0),
|
||||||
medianFee: Common.percentile(transactions.map((tx) => tx.effectiveFeePerVsize), config.MEMPOOL.RECOMMENDED_FEE_PERCENTILE),
|
medianFee: Common.percentile(transactions.map((tx) => tx.effectiveFeePerVsize), config.MEMPOOL.RECOMMENDED_FEE_PERCENTILE),
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class Mempool {
|
|||||||
}
|
}
|
||||||
newTransactions.push(transaction);
|
newTransactions.push(transaction);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error finding transaction in mempool: ' + e.message || e);
|
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ class Statistics {
|
|||||||
connection.release();
|
connection.release();
|
||||||
return result.insertId;
|
return result.insertId;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$create() error' + e.message || e);
|
logger.err('$create() error' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ class Statistics {
|
|||||||
return this.mapStatisticToOptimizedStatistic([rows[0]])[0];
|
return this.mapStatisticToOptimizedStatistic([rows[0]])[0];
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$list2H() error' + e.message || e);
|
logger.err('$list2H() error' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ class Statistics {
|
|||||||
connection.release();
|
connection.release();
|
||||||
return this.mapStatisticToOptimizedStatistic(rows);
|
return this.mapStatisticToOptimizedStatistic(rows);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$list2H() error' + e.message || e);
|
logger.err('$list2H() error' + (e instanceof Error ? e.message : e));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -338,7 +338,7 @@ class Statistics {
|
|||||||
connection.release();
|
connection.release();
|
||||||
return this.mapStatisticToOptimizedStatistic(rows);
|
return this.mapStatisticToOptimizedStatistic(rows);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$list24h() error' + e.message || e);
|
logger.err('$list24h() error' + (e instanceof Error ? e.message : e));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,7 +351,7 @@ class Statistics {
|
|||||||
connection.release();
|
connection.release();
|
||||||
return this.mapStatisticToOptimizedStatistic(rows);
|
return this.mapStatisticToOptimizedStatistic(rows);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$list1W() error' + e);
|
logger.err('$list1W() error' + (e instanceof Error ? e.message : e));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ class Statistics {
|
|||||||
connection.release();
|
connection.release();
|
||||||
return this.mapStatisticToOptimizedStatistic(rows);
|
return this.mapStatisticToOptimizedStatistic(rows);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$list1M() error' + e);
|
logger.err('$list1M() error' + (e instanceof Error ? e.message : e));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,7 +377,7 @@ class Statistics {
|
|||||||
connection.release();
|
connection.release();
|
||||||
return this.mapStatisticToOptimizedStatistic(rows);
|
return this.mapStatisticToOptimizedStatistic(rows);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$list3M() error' + e);
|
logger.err('$list3M() error' + (e instanceof Error ? e.message : e));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,7 +390,7 @@ class Statistics {
|
|||||||
connection.release();
|
connection.release();
|
||||||
return this.mapStatisticToOptimizedStatistic(rows);
|
return this.mapStatisticToOptimizedStatistic(rows);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$list6M() error' + e);
|
logger.err('$list6M() error' + (e instanceof Error ? e.message : e));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -403,7 +403,7 @@ class Statistics {
|
|||||||
connection.release();
|
connection.release();
|
||||||
return this.mapStatisticToOptimizedStatistic(rows);
|
return this.mapStatisticToOptimizedStatistic(rows);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('$list6M() error' + e);
|
logger.err('$list6M() error' + (e instanceof Error ? e.message : e));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import bitcoinApi from './bitcoin/bitcoin-api-factory';
|
import bitcoinApi from './bitcoin/bitcoin-api-factory';
|
||||||
import logger from '../logger';
|
|
||||||
import { TransactionExtended, TransactionMinerInfo } from '../mempool.interfaces';
|
import { TransactionExtended, TransactionMinerInfo } from '../mempool.interfaces';
|
||||||
import { IEsploraApi } from './bitcoin/esplora-api.interface';
|
import { IEsploraApi } from './bitcoin/esplora-api.interface';
|
||||||
|
import config from '../config';
|
||||||
|
|
||||||
class TransactionUtils {
|
class TransactionUtils {
|
||||||
constructor() { }
|
constructor() { }
|
||||||
@@ -31,7 +31,7 @@ class TransactionUtils {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return transaction;
|
return transaction;
|
||||||
}
|
}
|
||||||
const feePerVbytes = Math.max(1, (transaction.fee || 0) / (transaction.weight / 4));
|
const feePerVbytes = Math.max(config.MEMPOOL.NETWORK === 'liquid' ? 0.1 : 1, (transaction.fee || 0) / (transaction.weight / 4));
|
||||||
const transactionExtended: TransactionExtended = Object.assign({
|
const transactionExtended: TransactionExtended = Object.assign({
|
||||||
vsize: Math.round(transaction.weight / 4),
|
vsize: Math.round(transaction.weight / 4),
|
||||||
feePerVsize: feePerVbytes,
|
feePerVsize: feePerVbytes,
|
||||||
|
|||||||
@@ -53,18 +53,25 @@ class WebsocketHandler {
|
|||||||
if (parsedMessage['watch-mempool']) {
|
if (parsedMessage['watch-mempool']) {
|
||||||
const tx = memPool.getMempool()[client['track-tx']];
|
const tx = memPool.getMempool()[client['track-tx']];
|
||||||
if (tx) {
|
if (tx) {
|
||||||
if (config.MEMPOOL.BACKEND !== 'esplora') {
|
if (config.MEMPOOL.BACKEND === 'esplora') {
|
||||||
|
response['tx'] = tx;
|
||||||
|
} else {
|
||||||
|
// tx.prevouts is missing from transactions when in bitcoind mode
|
||||||
try {
|
try {
|
||||||
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
|
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
|
||||||
response['tx'] = fullTx;
|
response['tx'] = fullTx;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error finding transaction in mempool: ' + e.message || e);
|
logger.debug('Error finding transaction: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
response['tx'] = tx;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
client['track-mempool-tx'] = parsedMessage['track-tx'];
|
try {
|
||||||
|
const fullTx = await transactionUtils.$getTransactionExtended(client['track-tx'], true);
|
||||||
|
response['tx'] = fullTx;
|
||||||
|
} catch (e) {
|
||||||
|
logger.debug('Error finding transaction. ' + (e instanceof Error ? e.message : e));
|
||||||
|
client['track-mempool-tx'] = parsedMessage['track-tx'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -73,9 +80,13 @@ class WebsocketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parsedMessage && parsedMessage['track-address']) {
|
if (parsedMessage && parsedMessage['track-address']) {
|
||||||
if (/^([a-km-zA-HJ-NP-Z1-9]{26,35}|[a-km-zA-HJ-NP-Z1-9]{80}|[a-z]{2,5}1[ac-hj-np-z02-9]{8,87})$/
|
if (/^([a-km-zA-HJ-NP-Z1-9]{26,35}|[a-km-zA-HJ-NP-Z1-9]{80}|[a-z]{2,5}1[ac-hj-np-z02-9]{8,100}|[A-Z]{2,5}1[AC-HJ-NP-Z02-9]{8,100})$/
|
||||||
.test(parsedMessage['track-address'])) {
|
.test(parsedMessage['track-address'])) {
|
||||||
client['track-address'] = parsedMessage['track-address'];
|
let matchedAddress = parsedMessage['track-address'];
|
||||||
|
if (/^[A-Z]{2,5}1[AC-HJ-NP-Z02-9]{8,100}$/.test(parsedMessage['track-address'])) {
|
||||||
|
matchedAddress = matchedAddress.toLowerCase();
|
||||||
|
}
|
||||||
|
client['track-address'] = matchedAddress;
|
||||||
} else {
|
} else {
|
||||||
client['track-address'] = null;
|
client['track-address'] = null;
|
||||||
}
|
}
|
||||||
@@ -90,7 +101,7 @@ class WebsocketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parsedMessage.action === 'init') {
|
if (parsedMessage.action === 'init') {
|
||||||
const _blocks = blocks.getBlocks().slice(-8);
|
const _blocks = blocks.getBlocks().slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT);
|
||||||
if (!_blocks) {
|
if (!_blocks) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -117,7 +128,7 @@ class WebsocketHandler {
|
|||||||
client.send(JSON.stringify(response));
|
client.send(JSON.stringify(response));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error parsing websocket message: ' + e.message || e);
|
logger.debug('Error parsing websocket message: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -166,12 +177,13 @@ class WebsocketHandler {
|
|||||||
|
|
||||||
getInitData(_blocks?: BlockExtended[]) {
|
getInitData(_blocks?: BlockExtended[]) {
|
||||||
if (!_blocks) {
|
if (!_blocks) {
|
||||||
_blocks = blocks.getBlocks().slice(-8);
|
_blocks = blocks.getBlocks().slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
'mempoolInfo': memPool.getMempoolInfo(),
|
'mempoolInfo': memPool.getMempoolInfo(),
|
||||||
'vBytesPerSecond': memPool.getVBytesPerSecond(),
|
'vBytesPerSecond': memPool.getVBytesPerSecond(),
|
||||||
'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(),
|
'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(),
|
||||||
|
'previousRetarget': blocks.getPreviousDifficultyRetarget(),
|
||||||
'blocks': _blocks,
|
'blocks': _blocks,
|
||||||
'conversions': fiatConversion.getConversionRates(),
|
'conversions': fiatConversion.getConversionRates(),
|
||||||
'mempool-blocks': mempoolBlocks.getMempoolBlocks(),
|
'mempool-blocks': mempoolBlocks.getMempoolBlocks(),
|
||||||
@@ -244,7 +256,7 @@ class WebsocketHandler {
|
|||||||
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
|
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
|
||||||
response['tx'] = fullTx;
|
response['tx'] = fullTx;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error finding transaction in mempool: ' + e.message || e);
|
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response['tx'] = tx;
|
response['tx'] = tx;
|
||||||
@@ -264,7 +276,7 @@ class WebsocketHandler {
|
|||||||
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
|
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
|
||||||
foundTransactions.push(fullTx);
|
foundTransactions.push(fullTx);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error finding transaction in mempool: ' + e.message || e);
|
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foundTransactions.push(tx);
|
foundTransactions.push(tx);
|
||||||
@@ -278,7 +290,7 @@ class WebsocketHandler {
|
|||||||
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
|
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
|
||||||
foundTransactions.push(fullTx);
|
foundTransactions.push(fullTx);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error finding transaction in mempool: ' + e.message || e);
|
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foundTransactions.push(tx);
|
foundTransactions.push(tx);
|
||||||
@@ -329,7 +341,7 @@ class WebsocketHandler {
|
|||||||
const fullTx = await transactionUtils.$getTransactionExtended(rbfTransaction, true);
|
const fullTx = await transactionUtils.$getTransactionExtended(rbfTransaction, true);
|
||||||
response['rbfTransaction'] = fullTx;
|
response['rbfTransaction'] = fullTx;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('Error finding transaction in mempool: ' + e.message || e);
|
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response['rbfTransaction'] = rbfTx;
|
response['rbfTransaction'] = rbfTx;
|
||||||
@@ -384,6 +396,7 @@ class WebsocketHandler {
|
|||||||
'block': block,
|
'block': block,
|
||||||
'mempoolInfo': memPool.getMempoolInfo(),
|
'mempoolInfo': memPool.getMempoolInfo(),
|
||||||
'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(),
|
'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(),
|
||||||
|
'previousRetarget': blocks.getPreviousDifficultyRetarget(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mBlocks && client['want-mempool-blocks']) {
|
if (mBlocks && client['want-mempool-blocks']) {
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ interface IConfig {
|
|||||||
CACHE_DIR: string;
|
CACHE_DIR: string;
|
||||||
CLEAR_PROTECTION_MINUTES: number;
|
CLEAR_PROTECTION_MINUTES: number;
|
||||||
RECOMMENDED_FEE_PERCENTILE: number;
|
RECOMMENDED_FEE_PERCENTILE: number;
|
||||||
|
BLOCK_WEIGHT_UNITS: number;
|
||||||
|
INITIAL_BLOCKS_AMOUNT: number;
|
||||||
|
MEMPOOL_BLOCKS_AMOUNT: number;
|
||||||
|
PRICE_FEED_UPDATE_INTERVAL: number;
|
||||||
};
|
};
|
||||||
ESPLORA: {
|
ESPLORA: {
|
||||||
REST_API_URL: string;
|
REST_API_URL: string;
|
||||||
@@ -69,6 +73,10 @@ const defaults: IConfig = {
|
|||||||
'CACHE_DIR': './cache',
|
'CACHE_DIR': './cache',
|
||||||
'CLEAR_PROTECTION_MINUTES': 20,
|
'CLEAR_PROTECTION_MINUTES': 20,
|
||||||
'RECOMMENDED_FEE_PERCENTILE': 50,
|
'RECOMMENDED_FEE_PERCENTILE': 50,
|
||||||
|
'BLOCK_WEIGHT_UNITS': 4000000,
|
||||||
|
'INITIAL_BLOCKS_AMOUNT': 8,
|
||||||
|
'MEMPOOL_BLOCKS_AMOUNT': 8,
|
||||||
|
'PRICE_FEED_UPDATE_INTERVAL': 3600,
|
||||||
},
|
},
|
||||||
'ESPLORA': {
|
'ESPLORA': {
|
||||||
'REST_API_URL': 'http://127.0.0.1:3000',
|
'REST_API_URL': 'http://127.0.0.1:3000',
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export async function checkDbConnection() {
|
|||||||
logger.info('Database connection established.');
|
logger.info('Database connection established.');
|
||||||
connection.release();
|
connection.release();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('Could not connect to database: ' + e.message || e);
|
logger.err('Could not connect to database: ' + (e instanceof Error ? e.message : e));
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class Server {
|
|||||||
try {
|
try {
|
||||||
await memPool.$updateMemPoolInfo();
|
await memPool.$updateMemPoolInfo();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = `updateMempoolInfo: ${(e.message || e)}`;
|
const msg = `updateMempoolInfo: ${(e instanceof Error ? e.message : e)}`;
|
||||||
if (config.CORE_RPC_MINFEE.ENABLED) {
|
if (config.CORE_RPC_MINFEE.ENABLED) {
|
||||||
logger.warn(msg);
|
logger.warn(msg);
|
||||||
} else {
|
} else {
|
||||||
@@ -123,7 +123,7 @@ class Server {
|
|||||||
setTimeout(this.runMainUpdateLoop.bind(this), config.MEMPOOL.POLL_RATE_MS);
|
setTimeout(this.runMainUpdateLoop.bind(this), config.MEMPOOL.POLL_RATE_MS);
|
||||||
this.currentBackendRetryInterval = 5;
|
this.currentBackendRetryInterval = 5;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const loggerMsg = `runMainLoop error: ${(e.message || e)}. Retrying in ${this.currentBackendRetryInterval} sec.`;
|
const loggerMsg = `runMainLoop error: ${(e instanceof Error ? e.message : e)}. Retrying in ${this.currentBackendRetryInterval} sec.`;
|
||||||
if (this.currentBackendRetryInterval > 5) {
|
if (this.currentBackendRetryInterval > 5) {
|
||||||
logger.warn(loggerMsg);
|
logger.warn(loggerMsg);
|
||||||
mempool.setOutOfSync();
|
mempool.setOutOfSync();
|
||||||
@@ -153,10 +153,12 @@ class Server {
|
|||||||
this.app
|
this.app
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'transaction-times', routes.getTransactionTimes)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'transaction-times', routes.getTransactionTimes)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'cpfp/:txId', routes.getCpfpInfo)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'cpfp/:txId', routes.getCpfpInfo)
|
||||||
|
.get(config.MEMPOOL.API_URL_PREFIX + 'difficulty-adjustment', routes.getDifficultyChange)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/recommended', routes.getRecommendedFees)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/recommended', routes.getRecommendedFees)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/mempool-blocks', routes.getMempoolBlocks)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/mempool-blocks', routes.getMempoolBlocks)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'backend-info', routes.getBackendInfo)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'backend-info', routes.getBackendInfo)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'init-data', routes.getInitData)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'init-data', routes.getInitData)
|
||||||
|
.get(config.MEMPOOL.API_URL_PREFIX + 'validate-address/:address', routes.validateAddress)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'donations', async (req, res) => {
|
.get(config.MEMPOOL.API_URL_PREFIX + 'donations', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get('https://mempool.space/api/v1/donations', { responseType: 'stream', timeout: 10000 });
|
const response = await axios.get('https://mempool.space/api/v1/donations', { responseType: 'stream', timeout: 10000 });
|
||||||
@@ -234,9 +236,11 @@ class Server {
|
|||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'mempool/txids', routes.getMempoolTxIds)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'mempool/txids', routes.getMempoolTxIds)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'mempool/recent', routes.getRecentMempoolTransactions)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'mempool/recent', routes.getRecentMempoolTransactions)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId', routes.getTransaction)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId', routes.getTransaction)
|
||||||
|
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/hex', routes.getRawTransaction)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/status', routes.getTransactionStatus)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/status', routes.getTransactionStatus)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/outspends', routes.getTransactionOutspends)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/outspends', routes.getTransactionOutspends)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash', routes.getBlock)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash', routes.getBlock)
|
||||||
|
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/header', routes.getBlockHeader)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks', routes.getBlocks)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks', routes.getBlocks)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks/:height', routes.getBlocks)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks/:height', routes.getBlocks)
|
||||||
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks/tip/height', routes.getBlockTipHeight)
|
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks/tip/height', routes.getBlockTipHeight)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import transactionUtils from './api/transaction-utils';
|
|||||||
import blocks from './api/blocks';
|
import blocks from './api/blocks';
|
||||||
import loadingIndicators from './api/loading-indicators';
|
import loadingIndicators from './api/loading-indicators';
|
||||||
import { Common } from './api/common';
|
import { Common } from './api/common';
|
||||||
|
import bitcoinBaseApi from './api/bitcoin/bitcoin-base.api';
|
||||||
|
|
||||||
class Routes {
|
class Routes {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
@@ -55,7 +56,7 @@ class Routes {
|
|||||||
const result = websocketHandler.getInitData();
|
const result = websocketHandler.getInitData();
|
||||||
res.json(result);
|
res.json(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e.message);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ class Routes {
|
|||||||
const result = mempoolBlocks.getMempoolBlocks();
|
const result = mempoolBlocks.getMempoolBlocks();
|
||||||
res.json(result);
|
res.json(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e.message);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,10 +478,24 @@ class Routes {
|
|||||||
res.json(transaction);
|
res.json(transaction);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let statusCode = 500;
|
let statusCode = 500;
|
||||||
if (e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
|
if (e instanceof Error && e instanceof Error && e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
|
||||||
statusCode = 404;
|
statusCode = 404;
|
||||||
}
|
}
|
||||||
res.status(statusCode).send(e.message || e);
|
res.status(statusCode).send(e instanceof Error ? e.message : e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getRawTransaction(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
|
const transaction: IEsploraApi.Transaction = await bitcoinApi.$getRawTransaction(req.params.txId, true);
|
||||||
|
res.setHeader('content-type', 'text/plain');
|
||||||
|
res.send(transaction.hex);
|
||||||
|
} catch (e) {
|
||||||
|
let statusCode = 500;
|
||||||
|
if (e instanceof Error && e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
|
||||||
|
statusCode = 404;
|
||||||
|
}
|
||||||
|
res.status(statusCode).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,10 +505,10 @@ class Routes {
|
|||||||
res.json(transaction.status);
|
res.json(transaction.status);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
let statusCode = 500;
|
let statusCode = 500;
|
||||||
if (e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
|
if (e instanceof Error && e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
|
||||||
statusCode = 404;
|
statusCode = 404;
|
||||||
}
|
}
|
||||||
res.status(statusCode).send(e.message || e);
|
res.status(statusCode).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,7 +517,17 @@ class Routes {
|
|||||||
const result = await bitcoinApi.$getBlock(req.params.hash);
|
const result = await bitcoinApi.$getBlock(req.params.hash);
|
||||||
res.json(result);
|
res.json(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getBlockHeader(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
|
const blockHeader = await bitcoinApi.$getBlockHeader(req.params.hash);
|
||||||
|
res.setHeader('content-type', 'text/plain');
|
||||||
|
res.send(blockHeader);
|
||||||
|
} catch (e) {
|
||||||
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,7 +564,7 @@ class Routes {
|
|||||||
res.json(returnBlocks);
|
res.json(returnBlocks);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
loadingIndicators.setProgress('blocks', 100);
|
loadingIndicators.setProgress('blocks', 100);
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,13 +583,13 @@ class Routes {
|
|||||||
transactions.push(transaction);
|
transactions.push(transaction);
|
||||||
loadingIndicators.setProgress('blocktxs-' + req.params.hash, (i + 1) / endIndex * 100);
|
loadingIndicators.setProgress('blocktxs-' + req.params.hash, (i + 1) / endIndex * 100);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.debug('getBlockTransactions error: ' + e.message || e);
|
logger.debug('getBlockTransactions error: ' + (e instanceof Error ? e.message : e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.json(transactions);
|
res.json(transactions);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
loadingIndicators.setProgress('blocktxs-' + req.params.hash, 100);
|
loadingIndicators.setProgress('blocktxs-' + req.params.hash, 100);
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -573,7 +598,7 @@ class Routes {
|
|||||||
const blockHash = await bitcoinApi.$getBlockHash(parseInt(req.params.height, 10));
|
const blockHash = await bitcoinApi.$getBlockHash(parseInt(req.params.height, 10));
|
||||||
res.send(blockHash);
|
res.send(blockHash);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,10 +612,10 @@ class Routes {
|
|||||||
const addressData = await bitcoinApi.$getAddress(req.params.address);
|
const addressData = await bitcoinApi.$getAddress(req.params.address);
|
||||||
res.json(addressData);
|
res.json(addressData);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message && e.message.indexOf('exceeds') > 0) {
|
if (e instanceof Error && e.message && e.message.indexOf('exceeds') > 0) {
|
||||||
return res.status(413).send(e.message);
|
return res.status(413).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,10 +629,10 @@ class Routes {
|
|||||||
const transactions = await bitcoinApi.$getAddressTransactions(req.params.address, req.params.txId);
|
const transactions = await bitcoinApi.$getAddressTransactions(req.params.address, req.params.txId);
|
||||||
res.json(transactions);
|
res.json(transactions);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message && e.message.indexOf('exceeds') > 0) {
|
if (e instanceof Error && e.message && e.message.indexOf('exceeds') > 0) {
|
||||||
return res.status(413).send(e.message);
|
return res.status(413).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,7 +645,7 @@ class Routes {
|
|||||||
const blockHash = await bitcoinApi.$getAddressPrefix(req.params.prefix);
|
const blockHash = await bitcoinApi.$getAddressPrefix(req.params.prefix);
|
||||||
res.send(blockHash);
|
res.send(blockHash);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,7 +666,7 @@ class Routes {
|
|||||||
const rawMempool = await bitcoinApi.$getRawMempool();
|
const rawMempool = await bitcoinApi.$getRawMempool();
|
||||||
res.send(rawMempool);
|
res.send(rawMempool);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,7 +675,7 @@ class Routes {
|
|||||||
const result = await bitcoinApi.$getBlockHeightTip();
|
const result = await bitcoinApi.$getBlockHeightTip();
|
||||||
res.json(result);
|
res.json(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,13 +684,76 @@ class Routes {
|
|||||||
const result = await bitcoinApi.$getTxIdsForBlock(req.params.hash);
|
const result = await bitcoinApi.$getTxIdsForBlock(req.params.hash);
|
||||||
res.json(result);
|
res.json(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e.message || e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async validateAddress(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
|
const result = await bitcoinBaseApi.$validateAddress(req.params.address);
|
||||||
|
res.json(result);
|
||||||
|
} catch (e) {
|
||||||
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTransactionOutspends(req: Request, res: Response) {
|
public getTransactionOutspends(req: Request, res: Response) {
|
||||||
res.status(501).send('Not implemented');
|
res.status(501).send('Not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getDifficultyChange(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
|
const DATime = blocks.getLastDifficultyAdjustmentTime();
|
||||||
|
const previousRetarget = blocks.getPreviousDifficultyRetarget();
|
||||||
|
const blockHeight = blocks.getCurrentBlockHeight();
|
||||||
|
|
||||||
|
const now = new Date().getTime() / 1000;
|
||||||
|
const diff = now - DATime;
|
||||||
|
const blocksInEpoch = blockHeight % 2016;
|
||||||
|
const progressPercent = (blocksInEpoch >= 0) ? blocksInEpoch / 2016 * 100 : 100;
|
||||||
|
const remainingBlocks = 2016 - blocksInEpoch;
|
||||||
|
const nextRetargetHeight = blockHeight + remainingBlocks;
|
||||||
|
|
||||||
|
let difficultyChange = 0;
|
||||||
|
if (blocksInEpoch > 0) {
|
||||||
|
difficultyChange = (600 / (diff / blocksInEpoch ) - 1) * 100;
|
||||||
|
}
|
||||||
|
if (difficultyChange > 300) {
|
||||||
|
difficultyChange = 300;
|
||||||
|
}
|
||||||
|
if (difficultyChange < -75) {
|
||||||
|
difficultyChange = -75;
|
||||||
|
}
|
||||||
|
|
||||||
|
const timeAvgDiff = difficultyChange * 0.1;
|
||||||
|
|
||||||
|
let timeAvgMins = 10;
|
||||||
|
if (timeAvgDiff > 0) {
|
||||||
|
timeAvgMins -= Math.abs(timeAvgDiff);
|
||||||
|
} else {
|
||||||
|
timeAvgMins += Math.abs(timeAvgDiff);
|
||||||
|
}
|
||||||
|
|
||||||
|
const timeAvg = timeAvgMins * 60;
|
||||||
|
const remainingTime = remainingBlocks * timeAvg;
|
||||||
|
const estimatedRetargetDate = remainingTime + now;
|
||||||
|
|
||||||
|
const result = {
|
||||||
|
progressPercent,
|
||||||
|
difficultyChange,
|
||||||
|
estimatedRetargetDate,
|
||||||
|
remainingBlocks,
|
||||||
|
remainingTime,
|
||||||
|
previousRetarget,
|
||||||
|
nextRetargetHeight,
|
||||||
|
timeAvg,
|
||||||
|
};
|
||||||
|
res.json(result);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new Routes();
|
export default new Routes();
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ COPY . .
|
|||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y build-essential python3 pkg-config
|
RUN apt-get install -y build-essential python3 pkg-config
|
||||||
RUN npm ci --production
|
RUN npm install
|
||||||
RUN npm i typescript
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:12-buster-slim
|
FROM node:12-buster-slim
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ FROM node:12-buster-slim AS builder
|
|||||||
|
|
||||||
ARG commitHash
|
ARG commitHash
|
||||||
ENV DOCKER_COMMIT_HASH=${commitHash}
|
ENV DOCKER_COMMIT_HASH=${commitHash}
|
||||||
|
ENV CYPRESS_INSTALL_BINARY=0
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
18
docker/scripts/get_image_digest.sh
Executable file
18
docker/scripts/get_image_digest.sh
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
VERSION=$1
|
||||||
|
IMAGE=""
|
||||||
|
|
||||||
|
if [ -z "${VERSION}" ]; then
|
||||||
|
echo "no version provided (i.e, v2.2.0), using latest tag"
|
||||||
|
VERSION="latest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for package in frontend backend; do
|
||||||
|
PACKAGE=mempool/"$package"
|
||||||
|
IMAGE="$PACKAGE":"$VERSION"
|
||||||
|
HASH=`docker pull $IMAGE > /dev/null && docker inspect $IMAGE | sed -n '/RepoDigests/{n;p;}' | grep -o '[0-9a-f]\{64\}'`
|
||||||
|
if [ -n "${HASH}" ]; then
|
||||||
|
echo "$IMAGE"@sha256:"$HASH"
|
||||||
|
fi
|
||||||
|
done
|
||||||
3
frontend/.gitignore
vendored
3
frontend/.gitignore
vendored
@@ -59,3 +59,6 @@ generated-config.js
|
|||||||
cypress/videos
|
cypress/videos
|
||||||
cypress/screenshots
|
cypress/screenshots
|
||||||
|
|
||||||
|
# Base index
|
||||||
|
src/index.html
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"cli": {
|
||||||
|
"analytics": false
|
||||||
|
},
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"newProjectRoot": "projects",
|
"newProjectRoot": "projects",
|
||||||
"projects": {
|
"projects": {
|
||||||
@@ -23,6 +26,10 @@
|
|||||||
"translation": "src/locale/messages.ar.xlf",
|
"translation": "src/locale/messages.ar.xlf",
|
||||||
"baseHref": "/ar/"
|
"baseHref": "/ar/"
|
||||||
},
|
},
|
||||||
|
"ca": {
|
||||||
|
"translation": "src/locale/messages.ca.xlf",
|
||||||
|
"baseHref": "/ca/"
|
||||||
|
},
|
||||||
"cs": {
|
"cs": {
|
||||||
"translation": "src/locale/messages.cs.xlf",
|
"translation": "src/locale/messages.cs.xlf",
|
||||||
"baseHref": "/cs/"
|
"baseHref": "/cs/"
|
||||||
@@ -114,6 +121,10 @@
|
|||||||
"ru": {
|
"ru": {
|
||||||
"translation": "src/locale/messages.ru.xlf",
|
"translation": "src/locale/messages.ru.xlf",
|
||||||
"baseHref": "/ru/"
|
"baseHref": "/ru/"
|
||||||
|
},
|
||||||
|
"hi": {
|
||||||
|
"translation": "src/locale/messages.hi.xlf",
|
||||||
|
"baseHref": "/hi/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -189,10 +200,10 @@
|
|||||||
"verbose": true
|
"verbose": true
|
||||||
},
|
},
|
||||||
"local-prod": {
|
"local-prod": {
|
||||||
"proxyConfig": "proxy.prod.conf.json",
|
"proxyConfig": "proxy.conf.js",
|
||||||
"disableHostCheck": true,
|
"disableHostCheck": true,
|
||||||
"host": "0.0.0.0",
|
"host": "0.0.0.0",
|
||||||
"verbose": true
|
"verbose": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
{
|
{
|
||||||
|
"projectId": "ry4br7",
|
||||||
"integrationFolder": "cypress/integration",
|
"integrationFolder": "cypress/integration",
|
||||||
"supportFile": "cypress/support/index.ts",
|
"supportFile": "cypress/support/index.ts",
|
||||||
"videosFolder": "cypress/videos",
|
"videosFolder": "cypress/videos",
|
||||||
"screenshotsFolder": "cypress/screenshots",
|
"screenshotsFolder": "cypress/screenshots",
|
||||||
"pluginsFile": "cypress/plugins/index.js",
|
"pluginsFile": "cypress/plugins/index.js",
|
||||||
"fixturesFolder": "cypress/fixtures",
|
"fixturesFolder": "cypress/fixtures",
|
||||||
"baseUrl": "http://localhost:4200"
|
"baseUrl": "http://localhost:4200",
|
||||||
|
"video": false,
|
||||||
|
"retries": {
|
||||||
|
"runMode": 3,
|
||||||
|
"openMode": 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
1
frontend/cypress/fixtures/mainnet_live2hchart.json
Normal file
1
frontend/cypress/fixtures/mainnet_live2hchart.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"live-2h-chart":{"id":1319298,"added":"2021-07-23T18:27:34.000Z","unconfirmed_transactions":546,"tx_per_second":3.93333,"vbytes_per_second":1926,"mempool_byte_weight":1106656,"total_fee":6198583,"vsizes":[255,18128,43701,58534,17144,5532,4483,1759,2394,1089,1683,7409,751,101010,1151,592,1497,703,1369,4747,800,1221,0,0,712,0,0,0,0,0,0,0,0,0,0,0,0,0]}}
|
||||||
1
frontend/cypress/fixtures/mainnet_mempoolInfo.json
Normal file
1
frontend/cypress/fixtures/mainnet_mempoolInfo.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,5 +1,7 @@
|
|||||||
describe('Bisq', () => {
|
describe('Bisq', () => {
|
||||||
|
let baseModule;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'bisq') ? '' : '/bisq';
|
||||||
|
|
||||||
cy.intercept('/sockjs-node/info*').as('socket');
|
cy.intercept('/sockjs-node/info*').as('socket');
|
||||||
cy.intercept('/bisq/api/markets/hloc?market=btc_usd&interval=day').as('hloc');
|
cy.intercept('/bisq/api/markets/hloc?market=btc_usd&interval=day').as('hloc');
|
||||||
@@ -10,42 +12,77 @@ describe('Bisq', () => {
|
|||||||
cy.intercept('/bisq/api/txs/*/*').as('txs');
|
cy.intercept('/bisq/api/txs/*/*').as('txs');
|
||||||
cy.intercept('/bisq/api/blocks/*/*').as('blocks');
|
cy.intercept('/bisq/api/blocks/*/*').as('blocks');
|
||||||
cy.intercept('/bisq/api/stats').as('stats');
|
cy.intercept('/bisq/api/stats').as('stats');
|
||||||
});
|
|
||||||
it('loads the dashboard', () => {
|
Cypress.Commands.add('waitForDashboard', () => {
|
||||||
cy.visit('/bisq');
|
cy.wait('@socket');
|
||||||
|
cy.wait('@hloc');
|
||||||
cy.wait('@socket');
|
cy.wait('@ticker');
|
||||||
cy.wait('@hloc');
|
cy.wait('@markets');
|
||||||
cy.wait('@ticker');
|
cy.wait('@7d');
|
||||||
cy.wait('@markets');
|
cy.wait('@trades');
|
||||||
cy.wait('@7d');
|
});
|
||||||
cy.wait('@trades');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('loads the transactions screen', () => {
|
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'liquid') {
|
||||||
cy.visit('/bisq');
|
|
||||||
cy.get('li:nth-of-type(2) > a').click().then(() => {
|
it('loads the dashboard', () => {
|
||||||
cy.wait('@txs');
|
cy.visit(`${baseModule}`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
it('loads the blocks screen', () => {
|
|
||||||
cy.visit('/bisq');
|
|
||||||
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
|
||||||
cy.wait('@blocks');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('loads the stats screen', () => {
|
|
||||||
cy.visit('/bisq');
|
|
||||||
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
|
||||||
cy.wait('@stats');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the api screen', () => {
|
|
||||||
cy.visit('/bisq');
|
|
||||||
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
|
||||||
|
|
||||||
|
it('loads the transactions screen', () => {
|
||||||
|
cy.visit(`${baseModule}`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(2) > a').click().then(() => {
|
||||||
|
cy.get('.table > tr').should('have.length', 50);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
it('loads the blocks screen', () => {
|
||||||
|
cy.visit(`${baseModule}`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
||||||
|
cy.wait('@blocks');
|
||||||
|
cy.get('tbody tr').should('have.length', 10);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the stats screen', () => {
|
||||||
|
cy.visit(`${baseModule}`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
||||||
|
cy.wait('@stats');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the api screen', () => {
|
||||||
|
cy.visit(`${baseModule}`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
||||||
|
cy.get('.card').should('have.length.at.least', 1);
|
||||||
|
cy.get('.card').first().click();
|
||||||
|
cy.get('.card-body');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows blocks pagination with 5 pages (desktop)', () => {
|
||||||
|
cy.viewport(760, 800);
|
||||||
|
cy.visit(`${baseModule}/blocks`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('tbody tr').should('have.length', 10);
|
||||||
|
// 5 pages + 4 buttons = 9 buttons
|
||||||
|
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows blocks pagination with 3 pages (mobile)', () => {
|
||||||
|
cy.viewport(669, 800);
|
||||||
|
cy.visit(`${baseModule}/blocks`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('tbody tr').should('have.length', 10);
|
||||||
|
// 3 pages + 4 buttons = 7 buttons
|
||||||
|
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
it.skip("Tests cannot be run on the selected BASE_MODULE");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,81 +1,147 @@
|
|||||||
describe('Liquid', () => {
|
describe('Liquid', () => {
|
||||||
|
let baseModule;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// TODO: Fix ng serve to deliver these files
|
baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'liquid') ? '' : '/liquid';
|
||||||
cy.fixture('assets.minimal').then((json) => {
|
|
||||||
cy.intercept('/resources/assets.minimal.json', json);
|
cy.intercept('/liquid/api/block/**').as('block');
|
||||||
|
cy.intercept('/liquid/api/blocks/').as('blocks');
|
||||||
|
cy.intercept('/liquid/api/tx/**/outspends').as('outspends');
|
||||||
|
cy.intercept('/liquid/api/block/**/txs/**').as('block-txs');
|
||||||
|
cy.intercept('/resources/pools.json').as('pools');
|
||||||
|
|
||||||
|
Cypress.Commands.add('waitForBlockData', () => {
|
||||||
|
cy.wait('@socket');
|
||||||
|
cy.wait('@block');
|
||||||
|
cy.wait('@outspends');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'bisq') {
|
||||||
|
|
||||||
|
it('loads the dashboard', () => {
|
||||||
|
cy.visit(`${baseModule}`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.fixture('assets').then((json) => {
|
it('loads the blocks page', () => {
|
||||||
cy.intercept('/resources/assets.json', json);
|
cy.visit(`${baseModule}/blocks`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the dashboard', () => {
|
it('loads a specific block page', () => {
|
||||||
cy.visit('/liquid');
|
cy.visit(`${baseModule}/block/7e1369a23a5ab861e7bdede2aadcccae4ea873ffd9caf11c7c5541eb5bcdff54`);
|
||||||
});
|
cy.waitForSkeletonGone();
|
||||||
|
|
||||||
it('loads the blocks page', () => {
|
|
||||||
cy.visit('/liquid/blocks');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('loads a specific block page', () => {
|
|
||||||
cy.visit('/liquid/blocks');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the graphs page', () => {
|
|
||||||
cy.visit('/liquid/graphs');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the tv page - desktop', () => {
|
|
||||||
cy.visit('/liquid');
|
|
||||||
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
|
||||||
cy.wait(1000);
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the graphs page - mobile', () => {
|
it('loads the graphs page', () => {
|
||||||
cy.visit('/liquid');
|
cy.visit(`${baseModule}/graphs`);
|
||||||
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
cy.waitForSkeletonGone();
|
||||||
cy.viewport('iphone-6');
|
|
||||||
cy.wait(1000);
|
|
||||||
// TODO: Should we really support TV Mode in Mobile for Bisq?
|
|
||||||
// cy.get('.tv-only').should('be.visible')
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('assets', () => {
|
it('loads the tv page - desktop', () => {
|
||||||
it('shows the assets screen', () => {
|
cy.visit(`${baseModule}`);
|
||||||
cy.visit('/liquid');
|
cy.waitForSkeletonGone();
|
||||||
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
||||||
cy.get('table tr').should('have.length', 5);
|
cy.wait(1000);
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('allows searching assets', () => {
|
|
||||||
cy.visit('/liquid');
|
|
||||||
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
|
||||||
cy.get('.container-xl input').click().type('Liquid Bitcoin').then(() => {
|
|
||||||
cy.get('table tr').should('have.length', 1);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('shows a specific asset ID', () => {
|
it('loads the graphs page - mobile', () => {
|
||||||
cy.visit('/liquid');
|
cy.visit(`${baseModule}`)
|
||||||
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
cy.waitForSkeletonGone();
|
||||||
cy.get('.container-xl input').click().type('Liquid CAD').then(() => {
|
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
||||||
cy.get('table tr td:nth-of-type(4) a').click();
|
cy.viewport('iphone-6');
|
||||||
|
cy.wait(1000);
|
||||||
|
cy.get('.tv-only').should('not.exist');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('shows a specific asset issuance TX', () => {
|
describe('assets', () => {
|
||||||
cy.visit('/liquid');
|
it('shows the assets screen', () => {
|
||||||
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
cy.visit(`${baseModule}/assets`);
|
||||||
cy.get('.container-xl input').click().type('Liquid CAD').then(() => {
|
cy.waitForSkeletonGone();
|
||||||
cy.get('table tr td:nth-of-type(5) a').click();
|
cy.get('table tr').should('have.length.at.least', 5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('allows searching assets', () => {
|
||||||
|
cy.visit(`${baseModule}/assets`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.container-xl input').click().type('Liquid Bitcoin').then(() => {
|
||||||
|
cy.get('table tr').should('have.length', 1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows a specific asset ID', () => {
|
||||||
|
cy.visit(`${baseModule}/assets`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.container-xl input').click().type('Liquid AUD').then(() => {
|
||||||
|
cy.get('table tr td:nth-of-type(1) a').click();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
|
||||||
|
describe('unblinded TX', () => {
|
||||||
|
|
||||||
|
it('should not show an unblinding error message for regular txs', () => {
|
||||||
|
cy.visit(`${baseModule}/tx/82a479043ec3841e0d3f829afc8df4f0e2bbd675a13f013ea611b2fde0027d45`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.error-unblinded' ).should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('show unblinded TX', () => {
|
||||||
|
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('#table-tx-vin tr').should('have.class', 'assetBox');
|
||||||
|
cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('show empty unblinded TX', () => {
|
||||||
|
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('#table-tx-vin tr').should('have.class', '');
|
||||||
|
cy.get('#table-tx-vout tr').should('have.class', '');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('show invalid unblinded TX hex', () => {
|
||||||
|
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=123`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('#table-tx-vin tr').should('have.class', '');
|
||||||
|
cy.get('#table-tx-vout tr').should('have.class', '');
|
||||||
|
cy.get('.error-unblinded' ).contains('Error: Invalid blinding data (invalid hex)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('show first unblinded vout', () => {
|
||||||
|
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('#table-tx-vout tr:first-child()').should('have.class', 'assetBox');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('show second unblinded vout', () => {
|
||||||
|
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`);
|
||||||
|
cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('show invalid error unblinded TX', () => {
|
||||||
|
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3c`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
|
||||||
|
cy.get('.error-unblinded' ).contains('Error: Invalid blinding data.');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows asset peg in/out and burn transactions', () => {
|
||||||
|
cy.visit(`${baseModule}/asset/6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('#table-tx-vout tr').not('.assetBox');
|
||||||
|
cy.get('#table-tx-vin tr').not('.assetBox');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('prevents regressing issue #644', () => {
|
||||||
|
cy.visit(`${baseModule}/tx/393b890966f305e7c440fcfb12a13f51a7a9011cc59ff5f14f6f93214261bd82`);
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
it.skip("Tests cannot be run on the selected BASE_MODULE");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,97 +1,368 @@
|
|||||||
|
import { emitMempoolInfo, dropWebSocket } from "../../support/websocket";
|
||||||
|
|
||||||
describe('Mainnet', () => {
|
describe('Mainnet', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
//cy.intercept('/sockjs-node/info*').as('socket');
|
||||||
cy.intercept('/api/block-height/*').as('block-height');
|
cy.intercept('/api/block-height/*').as('block-height');
|
||||||
cy.intercept('/api/block/*').as('block');
|
cy.intercept('/api/block/*').as('block');
|
||||||
cy.intercept('/api/block/*/txs/0').as('block-txs');
|
cy.intercept('/api/block/*/txs/0').as('block-txs');
|
||||||
cy.intercept('/api/tx/*/outspends').as('tx-outspends');
|
cy.intercept('/api/tx/*/outspends').as('tx-outspends');
|
||||||
|
cy.intercept('/resources/pools.json').as('pools');
|
||||||
|
|
||||||
// TODO: Fix ng serve to deliver this file
|
// Search Auto Complete
|
||||||
cy.fixture('pools').then((json) => {
|
cy.intercept('/api/address-prefix/1wiz').as('search-1wiz');
|
||||||
cy.intercept('/resources/pools.json', json);
|
cy.intercept('/api/address-prefix/1wizS').as('search-1wizS');
|
||||||
});
|
cy.intercept('/api/address-prefix/1wizSA').as('search-1wizSA');
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the dashboard', () => {
|
Cypress.Commands.add('waitForBlockData', () => {
|
||||||
cy.visit('/');
|
|
||||||
cy.wait(1000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the blocks screen', () => {
|
|
||||||
cy.visit('/');
|
|
||||||
cy.get('li:nth-of-type(2) > a').click().then(() => {
|
|
||||||
cy.wait(1000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the graphs screen', () => {
|
|
||||||
cy.visit('/');
|
|
||||||
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
|
||||||
cy.wait(1000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('tv mode', () => {
|
|
||||||
it('loads the tv screen - desktop', () => {
|
|
||||||
cy.viewport('macbook-16');
|
|
||||||
cy.visit('/');
|
|
||||||
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get('.tv-only').should('not.be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('loads the tv screen - mobile', () => {
|
|
||||||
cy.visit('/');
|
|
||||||
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
|
||||||
cy.viewport('iphone-6');
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get('.tv-only').should('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it('loads the api screen', () => {
|
|
||||||
cy.visit('/');
|
|
||||||
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
|
||||||
cy.wait(1000);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('blocks', () => {
|
|
||||||
it('shows empty blocks properly', () => {
|
|
||||||
cy.visit('/block/0000000000000000000bd14f744ef2e006e61c32214670de7eb891a5732ee775');
|
|
||||||
cy.get('h2').invoke('text').should('equal', '1 transaction');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('expands and collapses the block details', () => {
|
|
||||||
cy.visit('/block/0');
|
|
||||||
cy.wait('@tx-outspends');
|
cy.wait('@tx-outspends');
|
||||||
cy.get('.btn.btn-outline-info').click().then(() => {
|
cy.wait('@pools');
|
||||||
cy.get('#details').should('be.visible');
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.get('.btn.btn-outline-info').click().then(() => {
|
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
|
||||||
cy.get('#details').should('not.be.visible');
|
|
||||||
|
it('loads the status screen', () => {
|
||||||
|
cy.visit('/status');
|
||||||
|
cy.get('#mempool-block-0').should('be.visible');
|
||||||
|
cy.get('[id^="bitcoin-block-"]').should('have.length', 8);
|
||||||
|
cy.get('.footer').should('be.visible');
|
||||||
|
cy.get('.row > :nth-child(1)').invoke('text').then((text) => {
|
||||||
|
expect(text).to.match(/Tx vBytes per second:.* vB\/s/);
|
||||||
|
});
|
||||||
|
cy.get('.row > :nth-child(2)').invoke('text').then((text) => {
|
||||||
|
expect(text).to.match(/Unconfirmed:(.*)/);
|
||||||
|
});
|
||||||
|
cy.get('.row > :nth-child(3)').invoke('text').then((text) => {
|
||||||
|
expect(text).to.match(/Mempool size:(.*) (kB|MB) \((\d+) (block|blocks)\)/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows blocks with no pagination', () => {
|
it('loads dashboard, drop websocket and reconnect', () => {
|
||||||
cy.visit('/block/00000000000000000001ba40caf1ad4cec0ceb77692662315c151953bfd7c4c4');
|
cy.viewport('macbook-16');
|
||||||
cy.get('h2').invoke('text').should('equal', '19 transactions');
|
cy.mockMempoolSocket();
|
||||||
cy.get('ul.pagination').first().children().should('have.length', 5);
|
cy.visit('/');
|
||||||
|
cy.get('.badge').should('not.exist');
|
||||||
|
dropWebSocket();
|
||||||
|
cy.get('.badge').should('be.visible');
|
||||||
|
cy.get('.badge', {timeout: 25000}).should('not.exist');
|
||||||
|
emitMempoolInfo({
|
||||||
|
'params': {
|
||||||
|
loaded: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist');
|
||||||
|
cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist');
|
||||||
|
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('supports pagination on the block screen', () => {
|
it('loads the dashboard', () => {
|
||||||
// 41 txs
|
cy.visit('/');
|
||||||
cy.visit('/block/00000000000000000009f9b7b0f63ad50053ad12ec3b7f5ca951332f134f83d8');
|
cy.waitForSkeletonGone();
|
||||||
cy.get('.header-bg.box > a').invoke('text').then((text1) => {
|
});
|
||||||
cy.get('.active + li').first().click().then(() => {
|
|
||||||
cy.get('.header-bg.box > a').invoke('text').then((text2) => {
|
describe('search', () => {
|
||||||
expect(text1).not.to.eq(text2);
|
it('allows searching for partial Bitcoin addresses', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.get('.search-box-container > .form-control').type('1wiz').then(() => {
|
||||||
|
cy.wait('@search-1wiz');
|
||||||
|
cy.get('ngb-typeahead-window button.dropdown-item').should('have.length', 10);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('.search-box-container > .form-control').type('S').then(() => {
|
||||||
|
cy.wait('@search-1wizS');
|
||||||
|
cy.get('ngb-typeahead-window button.dropdown-item').should('have.length', 5);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('.search-box-container > .form-control').type('A').then(() => {
|
||||||
|
cy.wait('@search-1wizSA');
|
||||||
|
cy.get('ngb-typeahead-window button.dropdown-item').should('have.length', 1)
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('ngb-typeahead-window button.dropdown-item.active').click().then(() => {
|
||||||
|
cy.url().should('include', '/address/1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.text-center').should('not.have.text', 'Invalid Bitcoin address');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
['BC1PQYQSZQ', 'bc1PqYqSzQ'].forEach((searchTerm) => {
|
||||||
|
it(`allows searching for partial case insensitive bc1 addresses: ${searchTerm}`, () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.get('.search-box-container > .form-control').type(searchTerm).then(() => {
|
||||||
|
cy.get('ngb-typeahead-window button.dropdown-item').should('have.length', 1);
|
||||||
|
cy.get('ngb-typeahead-window button.dropdown-item.active').click().then(() => {
|
||||||
|
cy.url().should('include', '/address/bc1pqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs3wf0qm');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.text-center').should('not.have.text', 'Invalid Bitcoin address');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
describe('blocks navigation', () => {
|
||||||
|
|
||||||
|
describe('keyboard events', () => {
|
||||||
|
it('loads first blockchain blocks visible and keypress arrow right', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.blockchain-blocks-0 > a').click().then(() => {
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
cy.document().right();
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads first blockchain blocks visible and keypress arrow left', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.blockchain-blocks-0 > a').click().then(() => {
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.document().left();
|
||||||
|
cy.get('.title-block h1').invoke('text').should('equal', 'Next block');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads last blockchain blocks and keypress arrow right', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.blockchain-blocks-4 > a').click().then(() => {
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
|
||||||
|
// block 6
|
||||||
|
cy.document().right();
|
||||||
|
cy.wait(5000);
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
|
||||||
|
// block 7
|
||||||
|
cy.document().right();
|
||||||
|
cy.wait(5000);
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
|
||||||
|
// block 8 - last visible block
|
||||||
|
cy.document().right();
|
||||||
|
cy.wait(5000);
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
|
||||||
|
// block 9 - not visible at the blochchain blocks visible block
|
||||||
|
cy.document().right();
|
||||||
|
cy.wait(5000);
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads genesis block and keypress arrow right', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/block/0');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
|
||||||
|
cy.document().right();
|
||||||
|
cy.wait(5000);
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads genesis block and keypress arrow left', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/block/0');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
|
||||||
|
cy.document().left();
|
||||||
|
cy.wait(5000);
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('mouse events', () => {
|
||||||
|
it('loads first blockchain blocks visible and click on the arrow right', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.blockchain-blocks-0 > a').click().then(() => {
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').click().then(() => {
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads genesis block and click on the arrow left', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/block/0');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').click().then(() => {
|
||||||
|
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('loads skeleton when changes between networks', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
|
||||||
|
cy.changeNetwork("testnet");
|
||||||
|
cy.changeNetwork("signet");
|
||||||
|
cy.changeNetwork("liquid");
|
||||||
|
cy.changeNetwork("mainnet");
|
||||||
|
cy.changeNetwork("bisq");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the dashboard with the skeleton blocks', () => {
|
||||||
|
cy.mockMempoolSocket();
|
||||||
|
cy.visit("/");
|
||||||
|
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get('#mempool-block-0').should('be.visible');
|
||||||
|
cy.get('#mempool-block-1').should('be.visible');
|
||||||
|
cy.get('#mempool-block-2').should('be.visible');
|
||||||
|
|
||||||
|
emitMempoolInfo({
|
||||||
|
'params': {
|
||||||
|
loaded: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist');
|
||||||
|
cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist');
|
||||||
|
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the blocks screen', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(2) > a').click().then(() => {
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the graphs screen', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the tv screen - desktop', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.get('.chart-holder');
|
||||||
|
cy.get('.blockchain-wrapper').should('be.visible');
|
||||||
|
cy.get('#mempool-block-0').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the tv screen - mobile', () => {
|
||||||
|
cy.viewport('iphone-6');
|
||||||
|
cy.visit('/tv');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.chart-holder');
|
||||||
|
cy.get('.blockchain-wrapper').should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the api screen', () => {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('blocks', () => {
|
||||||
|
it('shows empty blocks properly', () => {
|
||||||
|
cy.visit('/block/0000000000000000000bd14f744ef2e006e61c32214670de7eb891a5732ee775');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
cy.get('h2').invoke('text').should('equal', '1 transaction');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('expands and collapses the block details', () => {
|
||||||
|
cy.visit('/block/0');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
cy.get('.btn.btn-outline-info').click().then(() => {
|
||||||
|
cy.get('#details').should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('.btn.btn-outline-info').click().then(() => {
|
||||||
|
cy.get('#details').should('not.be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('shows blocks with no pagination', () => {
|
||||||
|
cy.visit('/block/00000000000000000001ba40caf1ad4cec0ceb77692662315c151953bfd7c4c4');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
cy.get('.block-tx-title h2').invoke('text').should('equal', '19 transactions');
|
||||||
|
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('supports pagination on the block screen', () => {
|
||||||
|
// 41 txs
|
||||||
|
cy.visit('/block/00000000000000000009f9b7b0f63ad50053ad12ec3b7f5ca951332f134f83d8');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.pagination-container a').invoke('text').then((text1) => {
|
||||||
|
cy.get('.active + li').first().click().then(() => {
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
cy.get('.header-bg.box > a').invoke('text').then((text2) => {
|
||||||
|
expect(text1).not.to.eq(text2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows blocks pagination with 5 pages (desktop)', () => {
|
||||||
|
cy.viewport(760, 800);
|
||||||
|
cy.visit('/block/000000000000000000049281946d26fcba7d99fdabc1feac524bc3a7003d69b3').then(() => {
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 5 pages + 4 buttons = 9 buttons
|
||||||
|
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows blocks pagination with 3 pages (mobile)', () => {
|
||||||
|
cy.viewport(669, 800);
|
||||||
|
cy.visit('/block/000000000000000000049281946d26fcba7d99fdabc1feac524bc3a7003d69b3').then(() => {
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3 pages + 4 buttons = 7 buttons
|
||||||
|
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
it.skip("Tests cannot be run on the selected BASE_MODULE");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,10 +1,131 @@
|
|||||||
|
import { emitMempoolInfo } from "../../support/websocket";
|
||||||
|
|
||||||
describe('Signet', () => {
|
describe('Signet', () => {
|
||||||
it('loads the dashboard', () => {
|
beforeEach(() => {
|
||||||
cy.visit('/signet');
|
cy.intercept('/api/block-height/*').as('block-height');
|
||||||
});
|
cy.intercept('/api/block/*').as('block');
|
||||||
|
cy.intercept('/api/block/*/txs/0').as('block-txs');
|
||||||
it.skip('loads all the pages properly', () => {
|
cy.intercept('/api/tx/*/outspends').as('tx-outspends');
|
||||||
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
|
||||||
|
it('loads the dashboard', () => {
|
||||||
|
cy.visit('/signet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the dashboard with the skeleton blocks', () => {
|
||||||
|
cy.mockMempoolSocket();
|
||||||
|
cy.visit("/signet");
|
||||||
|
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get('#mempool-block-0').should('be.visible');
|
||||||
|
cy.get('#mempool-block-1').should('be.visible');
|
||||||
|
cy.get('#mempool-block-2').should('be.visible');
|
||||||
|
|
||||||
|
emitMempoolInfo({
|
||||||
|
'params': {
|
||||||
|
"network": "signet"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist');
|
||||||
|
cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist');
|
||||||
|
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the blocks screen', () => {
|
||||||
|
cy.visit('/signet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(2) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the graphs screen', () => {
|
||||||
|
cy.visit('/signet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('tv mode', () => {
|
||||||
|
it('loads the tv screen - desktop', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/signet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
||||||
|
cy.get('.chart-holder').should('be.visible');
|
||||||
|
cy.get('#mempool-block-0').should('be.visible');
|
||||||
|
cy.get('.tv-only').should('not.exist');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the tv screen - mobile', () => {
|
||||||
|
cy.visit('/signet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
||||||
|
cy.viewport('iphone-8');
|
||||||
|
cy.get('.chart-holder').should('be.visible');
|
||||||
|
//TODO: Remove comment when the bug is fixed
|
||||||
|
//cy.get('#mempool-block-0').should('be.visible');
|
||||||
|
cy.get('.tv-only').should('not.exist');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('loads the api screen', () => {
|
||||||
|
cy.visit('/signet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('blocks', () => {
|
||||||
|
it('shows empty blocks properly', () => {
|
||||||
|
cy.visit('/signet/block/00000133d54e4589f6436703b067ec23209e0a21b8a9b12f57d0592fd85f7a42');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('h2').invoke('text').should('equal', '1 transaction');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('expands and collapses the block details', () => {
|
||||||
|
cy.visit('/signet/block/0');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.btn.btn-outline-info').click().then(() => {
|
||||||
|
cy.get('#details').should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('.btn.btn-outline-info').click().then(() => {
|
||||||
|
cy.get('#details').should('not.be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows blocks with no pagination', () => {
|
||||||
|
cy.visit('/signet/block/00000078f920a96a69089877b934ce7fd009ab55e3170920a021262cb258e7cc');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('h2').invoke('text').should('equal', '13 transactions');
|
||||||
|
cy.get('ul.pagination').first().children().should('have.length', 5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('supports pagination on the block screen', () => {
|
||||||
|
// 43 txs
|
||||||
|
cy.visit('/signet/block/00000094bd52f73bdbfc4bece3a94c21fec2dc968cd54210496e69e4059d66a6');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.header-bg.box > a').invoke('text').then((text1) => {
|
||||||
|
cy.get('.active + li').first().click().then(() => {
|
||||||
|
cy.get('.header-bg.box > a').invoke('text').then((text2) => {
|
||||||
|
expect(text1).not.to.eq(text2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
it.skip("Tests cannot be run on the selected BASE_MODULE");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,9 +1,128 @@
|
|||||||
|
import { confirmAddress, emitMempoolInfo, sendWsMock, showNewTx, startTrackingAddress } from "../../support/websocket";
|
||||||
|
|
||||||
describe('Testnet', () => {
|
describe('Testnet', () => {
|
||||||
it('loads the dashboard', () => {
|
beforeEach(() => {
|
||||||
cy.visit('/testnet');
|
cy.intercept('/api/block-height/*').as('block-height');
|
||||||
});
|
cy.intercept('/api/block/*').as('block');
|
||||||
|
cy.intercept('/api/block/*/txs/0').as('block-txs');
|
||||||
it.skip('loads all the pages properly', () => {
|
cy.intercept('/api/tx/*/outspends').as('tx-outspends');
|
||||||
|
});
|
||||||
});
|
|
||||||
|
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
|
||||||
|
|
||||||
|
it('loads the dashboard', () => {
|
||||||
|
cy.visit('/testnet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the dashboard with the skeleton blocks', () => {
|
||||||
|
cy.mockMempoolSocket();
|
||||||
|
cy.visit("/testnet");
|
||||||
|
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');
|
||||||
|
cy.get('#mempool-block-0').should('be.visible');
|
||||||
|
cy.get('#mempool-block-1').should('be.visible');
|
||||||
|
cy.get('#mempool-block-2').should('be.visible');
|
||||||
|
|
||||||
|
emitMempoolInfo({
|
||||||
|
'params': {
|
||||||
|
loaded: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist');
|
||||||
|
cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist');
|
||||||
|
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the blocks screen', () => {
|
||||||
|
cy.visit('/testnet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(2) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the graphs screen', () => {
|
||||||
|
cy.visit('/testnet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(3) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('tv mode', () => {
|
||||||
|
it('loads the tv screen - desktop', () => {
|
||||||
|
cy.viewport('macbook-16');
|
||||||
|
cy.visit('/testnet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
cy.get('.tv-only').should('not.exist');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads the tv screen - mobile', () => {
|
||||||
|
cy.visit('/testnet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(4) > a').click().then(() => {
|
||||||
|
cy.viewport('iphone-6');
|
||||||
|
cy.wait(1000);
|
||||||
|
cy.get('.tv-only').should('not.exist');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('loads the api screen', () => {
|
||||||
|
cy.visit('/testnet');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('li:nth-of-type(5) > a').click().then(() => {
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('blocks', () => {
|
||||||
|
it('shows empty blocks properly', () => {
|
||||||
|
cy.visit('/testnet/block/0');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('h2').invoke('text').should('equal', '1 transaction');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('expands and collapses the block details', () => {
|
||||||
|
cy.visit('/testnet/block/0');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.btn.btn-outline-info').click().then(() => {
|
||||||
|
cy.get('#details').should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('.btn.btn-outline-info').click().then(() => {
|
||||||
|
cy.get('#details').should('not.be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows blocks with no pagination', () => {
|
||||||
|
cy.visit('/testnet/block/000000000000002f8ce27716e74ecc7ad9f7b5101fed12d09e28bb721b9460ea');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('h2').invoke('text').should('equal', '11 transactions');
|
||||||
|
cy.get('ul.pagination').first().children().should('have.length', 5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('supports pagination on the block screen', () => {
|
||||||
|
// 48 txs
|
||||||
|
cy.visit('/testnet/block/000000000000002ca3878ebd98b313a1c2d531f2e70a6575d232ca7564dea7a9');
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
cy.get('.header-bg.box > a').invoke('text').then((text1) => {
|
||||||
|
cy.get('.active + li').first().click().then(() => {
|
||||||
|
cy.get('.header-bg.box > a').invoke('text').then((text2) => {
|
||||||
|
expect(text1).not.to.eq(text2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
it.skip("Tests cannot be run on the selected BASE_MODULE");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
63
frontend/cypress/support/PageIdleDetector.ts
Normal file
63
frontend/cypress/support/PageIdleDetector.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
// source: chrisp_68 @ https://stackoverflow.com/questions/50525143/how-do-you-reliably-wait-for-page-idle-in-cypress-io-test
|
||||||
|
export class PageIdleDetector
|
||||||
|
{
|
||||||
|
defaultOptions: Object = { timeout: 60000 };
|
||||||
|
|
||||||
|
public WaitForPageToBeIdle(): void
|
||||||
|
{
|
||||||
|
this.WaitForPageToLoad();
|
||||||
|
this.WaitForAngularRequestsToComplete();
|
||||||
|
this.WaitForAngularDigestCycleToComplete();
|
||||||
|
this.WaitForAnimationsToStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public WaitForPageToLoad(options: Object = this.defaultOptions): void
|
||||||
|
{
|
||||||
|
cy.document(options).should((myDocument: any) =>
|
||||||
|
{
|
||||||
|
expect(myDocument.readyState, "WaitForPageToLoad").to.be.oneOf(["interactive", "complete"]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public WaitForAngularRequestsToComplete(options: Object = this.defaultOptions): void
|
||||||
|
{
|
||||||
|
cy.window(options).should((myWindow: any) =>
|
||||||
|
{
|
||||||
|
if (!!myWindow.angular)
|
||||||
|
{
|
||||||
|
expect(this.NumberOfPendingAngularRequests(myWindow), "WaitForAngularRequestsToComplete").to.have.length(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public WaitForAngularDigestCycleToComplete(options: Object = this.defaultOptions): void
|
||||||
|
{
|
||||||
|
cy.window(options).should((myWindow: any) =>
|
||||||
|
{
|
||||||
|
if (!!myWindow.angular)
|
||||||
|
{
|
||||||
|
expect(this.AngularRootScopePhase(myWindow), "WaitForAngularDigestCycleToComplete").to.be.null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public WaitForAnimationsToStop(options: Object = this.defaultOptions): void
|
||||||
|
{
|
||||||
|
cy.get(":animated", options).should("not.exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
private getInjector(myWindow: any)
|
||||||
|
{
|
||||||
|
return myWindow.angular.element(myWindow.document.body).injector();
|
||||||
|
}
|
||||||
|
|
||||||
|
private NumberOfPendingAngularRequests(myWindow: any)
|
||||||
|
{
|
||||||
|
return this.getInjector(myWindow).get('$http').pendingRequests;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AngularRootScopePhase(myWindow: any)
|
||||||
|
{
|
||||||
|
return this.getInjector(myWindow).get("$rootScope").$$phase;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,4 +42,106 @@
|
|||||||
// -- This will overwrite an existing command --
|
// -- This will overwrite an existing command --
|
||||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
import 'cypress-wait-until';
|
import 'cypress-wait-until';
|
||||||
|
import { PageIdleDetector } from './PageIdleDetector';
|
||||||
|
import { mockWebSocket } from './websocket';
|
||||||
|
|
||||||
|
/* global Cypress */
|
||||||
|
const codes = {
|
||||||
|
ArrowLeft: 37,
|
||||||
|
ArrowUp: 38,
|
||||||
|
ArrowRight: 39,
|
||||||
|
ArrowDown: 40
|
||||||
|
}
|
||||||
|
|
||||||
|
Cypress.Commands.add('waitForSkeletonGone', () => {
|
||||||
|
cy.waitUntil(() => {
|
||||||
|
return Cypress.$('.skeleton-loader').length === 0;
|
||||||
|
}, { verbose: true, description: "waitForSkeletonGone", errorMsg: "skeleton loaders never went away", timeout: 15000, interval: 50});
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add(
|
||||||
|
"waitForPageIdle",
|
||||||
|
() => {
|
||||||
|
console.warn("Waiting for page idle state");
|
||||||
|
const pageIdleDetector = new PageIdleDetector();
|
||||||
|
pageIdleDetector.WaitForPageToBeIdle();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Cypress.Commands.add('mockMempoolSocket', () => {
|
||||||
|
mockWebSocket();
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('changeNetwork', (network: "testnet"|"signet"|"liquid"|"bisq"|"mainnet" ) => {
|
||||||
|
cy.get('.dropdown-toggle').click().then(() => {
|
||||||
|
cy.get(`.${network}`).click().then(() => {
|
||||||
|
cy.waitForPageIdle();
|
||||||
|
if(network !== 'bisq'){
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// https://github.com/bahmutov/cypress-arrows/blob/8f0303842a343550fbeaf01528d01d1ff213b70c/src/index.js
|
||||||
|
function keydownCommand ($el, key) {
|
||||||
|
const message = `sending the "${key}" keydown event`
|
||||||
|
const log = Cypress.log({
|
||||||
|
name: `keydown: ${key}`,
|
||||||
|
message: message,
|
||||||
|
consoleProps: function () {
|
||||||
|
return {
|
||||||
|
Subject: $el
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const e = $el.createEvent('KeyboardEvent')
|
||||||
|
|
||||||
|
Object.defineProperty(e, 'key', {
|
||||||
|
get: function () {
|
||||||
|
return key
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
Object.defineProperty(e, 'keyCode', {
|
||||||
|
get: function () {
|
||||||
|
return this.keyCodeVal
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Object.defineProperty(e, 'which', {
|
||||||
|
get: function () {
|
||||||
|
return this.keyCodeVal
|
||||||
|
}
|
||||||
|
})
|
||||||
|
var metaKey = false
|
||||||
|
|
||||||
|
Object.defineProperty(e, 'metaKey', {
|
||||||
|
get: function () {
|
||||||
|
return metaKey
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
Object.defineProperty(e, 'shiftKey', {
|
||||||
|
get: function () {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
e.keyCodeVal = codes[key]
|
||||||
|
|
||||||
|
e.initKeyboardEvent('keydown', true, true,
|
||||||
|
$el.defaultView, false, false, false, false, e.keyCodeVal, e.keyCodeVal)
|
||||||
|
|
||||||
|
$el.dispatchEvent(e)
|
||||||
|
log.snapshot().end()
|
||||||
|
return $el
|
||||||
|
}
|
||||||
|
|
||||||
|
Cypress.Commands.add('keydown', { prevSubject: "dom" }, keydownCommand)
|
||||||
|
Cypress.Commands.add('left', { prevSubject: "dom" }, $el => keydownCommand($el, 'ArrowLeft'))
|
||||||
|
Cypress.Commands.add('right', { prevSubject: "dom" }, $el => keydownCommand($el, 'ArrowRight'))
|
||||||
|
Cypress.Commands.add('up', { prevSubject: "dom" }, $el => keydownCommand($el, 'ArrowUp'))
|
||||||
|
Cypress.Commands.add('down', { prevSubject: "dom" }, $el => keydownCommand($el, 'ArrowDown'))
|
||||||
10
frontend/cypress/support/index.d.ts
vendored
Normal file
10
frontend/cypress/support/index.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
declare namespace Cypress {
|
||||||
|
interface Chainable<Subject> {
|
||||||
|
waitForSkeletonGone(): Chainable<any>
|
||||||
|
waitForPageIdle(): Chainable<any>
|
||||||
|
mockMempoolSocket(): Chainable<any>
|
||||||
|
changeNetwork(network: "testnet"|"signet"|"liquid"|"bisq"|"mainnet"): Chainable<any>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,3 +15,6 @@
|
|||||||
|
|
||||||
// When a command from ./commands is ready to use, import with `import './commands'` syntax
|
// When a command from ./commands is ready to use, import with `import './commands'` syntax
|
||||||
import './commands';
|
import './commands';
|
||||||
|
import failOnConsoleError from 'cypress-fail-on-console-error';
|
||||||
|
|
||||||
|
failOnConsoleError();
|
||||||
92
frontend/cypress/support/websocket.ts
Normal file
92
frontend/cypress/support/websocket.ts
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import { v4 as uuid } from 'uuid';
|
||||||
|
import { WebSocket, Server } from 'mock-socket';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
mockServer: Server;
|
||||||
|
mockSocket: WebSocket;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mocks: { [key: string]: { server: Server; websocket: WebSocket } } = {};
|
||||||
|
|
||||||
|
const cleanupMock = (url: string) => {
|
||||||
|
if (mocks[url]) {
|
||||||
|
mocks[url].websocket.close();
|
||||||
|
mocks[url].server.stop();
|
||||||
|
delete mocks[url];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const createMock = (url: string) => {
|
||||||
|
cleanupMock(url);
|
||||||
|
const server = new Server(url);
|
||||||
|
const websocket = new WebSocket(url);
|
||||||
|
mocks[url] = { server, websocket };
|
||||||
|
|
||||||
|
return mocks[url];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const mockWebSocket = () => {
|
||||||
|
cy.on('window:before:load', (win) => {
|
||||||
|
const winWebSocket = win.WebSocket;
|
||||||
|
cy.stub(win, 'WebSocket').callsFake((url) => {
|
||||||
|
console.log(url);
|
||||||
|
if ((new URL(url).pathname.indexOf('/sockjs-node/') !== 0)) {
|
||||||
|
const { server, websocket } = createMock(url);
|
||||||
|
|
||||||
|
win.mockServer = server;
|
||||||
|
win.mockServer.on('connection', (socket) => {
|
||||||
|
win.mockSocket = socket;
|
||||||
|
win.mockSocket.send('{"action":"init"}');
|
||||||
|
});
|
||||||
|
|
||||||
|
win.mockServer.on('message', (message) => {
|
||||||
|
console.log(message);
|
||||||
|
});
|
||||||
|
|
||||||
|
return websocket;
|
||||||
|
} else {
|
||||||
|
return new winWebSocket(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.on('window:before:unload', () => {
|
||||||
|
for (const url in mocks) {
|
||||||
|
cleanupMock(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const emitMempoolInfo = ({
|
||||||
|
params
|
||||||
|
}: { params?: any } = {}) => {
|
||||||
|
cy.window().then((win) => {
|
||||||
|
//TODO: Refactor to take into account different parameterized mocking scenarios
|
||||||
|
switch (params.network) {
|
||||||
|
//TODO: Use network specific mocks
|
||||||
|
case "signet":
|
||||||
|
case "testnet":
|
||||||
|
default:
|
||||||
|
win.mockSocket.send('{"action":"init"}');
|
||||||
|
win.mockSocket.send('{"action":"want","data":["blocks","stats","mempool-blocks","live-2h-chart"]}');
|
||||||
|
win.mockSocket.send('{"conversions":{"USD":32365.338815782445}}');
|
||||||
|
cy.readFile('cypress/fixtures/mainnet_live2hchart.json', 'ascii').then((fixture) => {
|
||||||
|
win.mockSocket.send(JSON.stringify(fixture));
|
||||||
|
});
|
||||||
|
cy.readFile('cypress/fixtures/mainnet_mempoolInfo.json', 'ascii').then((fixture) => {
|
||||||
|
win.mockSocket.send(JSON.stringify(fixture));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cy.waitForSkeletonGone();
|
||||||
|
return cy.get('#mempool-block-0');
|
||||||
|
};
|
||||||
|
|
||||||
|
export const dropWebSocket = (() => {
|
||||||
|
cy.window().then((win) => {
|
||||||
|
win.mockServer.simulate("error");
|
||||||
|
});
|
||||||
|
return cy.wait(500);
|
||||||
|
});
|
||||||
@@ -2,7 +2,9 @@
|
|||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"include": ["**/*.ts"],
|
"include": ["**/*.ts"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"sourceMap": false,
|
"types": ["cypress"],
|
||||||
"types": ["cypress"]
|
"lib": ["es2015", "dom"],
|
||||||
|
"allowJs": true,
|
||||||
|
"noEmit": true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,16 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const indexFilePath = configContent.BASE_MODULE ? 'src/index.' + configContent.BASE_MODULE + '.html' : 'src/index.mempool.html';
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.copyFileSync(indexFilePath, 'src/index.html');
|
||||||
|
console.log('Copied ' + indexFilePath + ' to src/index.html');
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error copying the index file');
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const packageJson = fs.readFileSync('package.json');
|
const packageJson = fs.readFileSync('package.json');
|
||||||
packetJsonVersion = JSON.parse(packageJson).version;
|
packetJsonVersion = JSON.parse(packageJson).version;
|
||||||
|
|||||||
@@ -8,5 +8,8 @@
|
|||||||
"KEEP_BLOCKS_AMOUNT": 8,
|
"KEEP_BLOCKS_AMOUNT": 8,
|
||||||
"NGINX_PROTOCOL": "http",
|
"NGINX_PROTOCOL": "http",
|
||||||
"NGINX_HOSTNAME": "127.0.0.1",
|
"NGINX_HOSTNAME": "127.0.0.1",
|
||||||
"NGINX_PORT": "80"
|
"NGINX_PORT": "80",
|
||||||
|
"MEMPOOL_BLOCKS_AMOUNT": 8,
|
||||||
|
"BLOCK_WEIGHT_UNITS": 4000000,
|
||||||
|
"BASE_MODULE": "mempool"
|
||||||
}
|
}
|
||||||
|
|||||||
3260
frontend/package-lock.json
generated
3260
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mempool-frontend",
|
"name": "mempool-frontend",
|
||||||
"version": "2.2.0-dev",
|
"version": "2.2.2",
|
||||||
"description": "Bitcoin mempool visualizer and blockchain explorer backend",
|
"description": "Bitcoin mempool visualizer and blockchain explorer backend",
|
||||||
"license": "GNU Affero General Public License v3.0",
|
"license": "GNU Affero General Public License v3.0",
|
||||||
"homepage": "https://mempool.space",
|
"homepage": "https://mempool.space",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "./node_modules/@angular/cli/bin/ng",
|
"ng": "./node_modules/@angular/cli/bin/ng",
|
||||||
"tsc": "./node_modules/typescript/bin/tsc",
|
"tsc": "./node_modules/typescript/bin/tsc",
|
||||||
"i18n-extract-from-source": "./node_modules/@angular/cli/bin/ng xi18n --ivy --out-file ./src/locale/messages.xlf",
|
"i18n-extract-from-source": "./node_modules/@angular/cli/bin/ng extract-i18n --ivy --out-file ./src/locale/messages.xlf",
|
||||||
"i18n-pull-from-transifex": "tx pull -a --parallel --minimum-perc 1 --force",
|
"i18n-pull-from-transifex": "tx pull -a --parallel --minimum-perc 1 --force",
|
||||||
"serve": "npm run generate-config && ng serve -c local",
|
"serve": "npm run generate-config && ng serve -c local",
|
||||||
"serve:stg": "npm run generate-config && ng serve -c staging",
|
"serve:stg": "npm run generate-config && ng serve -c staging",
|
||||||
@@ -37,13 +37,20 @@
|
|||||||
"build-mempool.js": "tsc | browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index.js --standalone mempoolJS > ./dist/mempool/browser/en-US/mempool.js",
|
"build-mempool.js": "tsc | browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index.js --standalone mempoolJS > ./dist/mempool/browser/en-US/mempool.js",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
"e2e": "ng e2e",
|
"e2e": "npm run generate-config && ng e2e",
|
||||||
|
"e2e:ci": "npm run cypress:run:ci",
|
||||||
|
"config:defaults:mempool": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=mempool && npm run generate-config",
|
||||||
|
"config:defaults:liquid": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=liquid && npm run generate-config",
|
||||||
|
"config:defaults:bisq": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=bisq && npm run generate-config",
|
||||||
"dev:ssr": "npm run generate-config && ng run mempool:serve-ssr",
|
"dev:ssr": "npm run generate-config && ng run mempool:serve-ssr",
|
||||||
"serve:ssr": "node server.run.js",
|
"serve:ssr": "node server.run.js",
|
||||||
"build:ssr": "npm run build && ng run mempool:server:production && ./node_modules/typescript/bin/tsc server.run.ts",
|
"build:ssr": "npm run build && ng run mempool:server:production && ./node_modules/typescript/bin/tsc server.run.ts",
|
||||||
"prerender": "ng run mempool:prerender",
|
"prerender": "ng run mempool:prerender",
|
||||||
"cypress:open": "concurrently \"ng serve -c local-prod\" \"cypress open\" --kill-others",
|
"cypress:open": "cypress open",
|
||||||
"cypress:run": "concurrently \"ng serve -c local-prod\" \"cypress run\" --kill-others"
|
"cypress:run": "cypress run",
|
||||||
|
"cypress:run:record": "cypress run --record",
|
||||||
|
"cypress:open:ci": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 && npm run generate-config && start-server-and-test serve:local-prod 4200 cypress:open",
|
||||||
|
"cypress:run:ci": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 && npm run generate-config && start-server-and-test serve:local-prod 4200 cypress:run:record"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~11.2.8",
|
"@angular/animations": "~11.2.8",
|
||||||
@@ -61,7 +68,7 @@
|
|||||||
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
||||||
"@mempool/chartist": "^0.11.4",
|
"@mempool/chartist": "^0.11.4",
|
||||||
"@mempool/mempool.js": "^2.2.2",
|
"@mempool/mempool.js": "^2.2.4",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^7.0.0",
|
"@ng-bootstrap/ng-bootstrap": "^7.0.0",
|
||||||
"@nguniversal/express-engine": "11.2.1",
|
"@nguniversal/express-engine": "11.2.1",
|
||||||
"@types/qrcode": "^1.3.4",
|
"@types/qrcode": "^1.3.4",
|
||||||
@@ -85,15 +92,12 @@
|
|||||||
"@angular/cli": "~11.2.7",
|
"@angular/cli": "~11.2.7",
|
||||||
"@angular/compiler-cli": "~11.2.8",
|
"@angular/compiler-cli": "~11.2.8",
|
||||||
"@angular/language-service": "~11.2.8",
|
"@angular/language-service": "~11.2.8",
|
||||||
"@cypress/schematic": "^1.3.0",
|
|
||||||
"@nguniversal/builders": "^11.2.1",
|
"@nguniversal/builders": "^11.2.1",
|
||||||
"@types/express": "^4.17.0",
|
"@types/express": "^4.17.0",
|
||||||
"@types/jasmine": "~3.6.0",
|
"@types/jasmine": "~3.6.0",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
"@types/node": "^12.11.1",
|
"@types/node": "^12.11.1",
|
||||||
"codelyzer": "^6.0.1",
|
"codelyzer": "^6.0.1",
|
||||||
"concurrently": "^6.2.0",
|
|
||||||
"cypress-wait-until": "^1.7.1",
|
|
||||||
"http-proxy-middleware": "^1.0.5",
|
"http-proxy-middleware": "^1.0.5",
|
||||||
"jasmine-core": "~3.6.0",
|
"jasmine-core": "~3.6.0",
|
||||||
"jasmine-spec-reporter": "~5.0.0",
|
"jasmine-spec-reporter": "~5.0.0",
|
||||||
@@ -107,6 +111,11 @@
|
|||||||
"typescript": "~4.1.5"
|
"typescript": "~4.1.5"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"cypress": "^7.4.0"
|
"@cypress/schematic": "^1.3.0",
|
||||||
|
"cypress": "^8.3.1",
|
||||||
|
"cypress-fail-on-console-error": "^2.1.0",
|
||||||
|
"cypress-wait-until": "^1.7.1",
|
||||||
|
"mock-socket": "^9.0.3",
|
||||||
|
"start-server-and-test": "^1.12.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
64
frontend/proxy.conf.js
Normal file
64
frontend/proxy.conf.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
let PROXY_CONFIG;
|
||||||
|
let configContent;
|
||||||
|
|
||||||
|
const CONFIG_FILE_NAME = 'mempool-frontend-config.json';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const rawConfig = fs.readFileSync(CONFIG_FILE_NAME);
|
||||||
|
configContent = JSON.parse(rawConfig);
|
||||||
|
console.log(`${CONFIG_FILE_NAME} file found, using provided config`);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
if (e.code !== 'ENOENT') {
|
||||||
|
throw new Error(e);
|
||||||
|
} else {
|
||||||
|
console.log(`${CONFIG_FILE_NAME} file not found, using default config`);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PROXY_CONFIG = [
|
||||||
|
{
|
||||||
|
context: ['*',
|
||||||
|
'/api/**', '!/api/v1/ws',
|
||||||
|
'!/bisq', '!/bisq/**', '!/bisq/',
|
||||||
|
'!/liquid', '!/liquid/**', '!/liquid/',
|
||||||
|
'/testnet/api/**', '/signet/api/**'
|
||||||
|
],
|
||||||
|
target: "https://mempool.space",
|
||||||
|
ws: true,
|
||||||
|
secure: false,
|
||||||
|
changeOrigin: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
context: ['/api/v1/ws'],
|
||||||
|
target: "https://mempool.space",
|
||||||
|
ws: true,
|
||||||
|
secure: false,
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
context: ['/api/bisq**', '/bisq/api/**'],
|
||||||
|
target: "https://bisq.markets",
|
||||||
|
pathRewrite: {
|
||||||
|
"^/api/bisq/": "/bisq/api"
|
||||||
|
},
|
||||||
|
ws: true,
|
||||||
|
secure: false,
|
||||||
|
changeOrigin: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
context: ['/api/liquid**', '/liquid/api/**'],
|
||||||
|
target: "https://liquid.network",
|
||||||
|
pathRewrite: {
|
||||||
|
"^/api/liquid/": "/liquid/api"
|
||||||
|
},
|
||||||
|
ws: true,
|
||||||
|
secure: false,
|
||||||
|
changeOrigin: true
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
module.exports = PROXY_CONFIG;
|
||||||
@@ -67,11 +67,18 @@
|
|||||||
"^/liquid/api": "/api/v1/ws"
|
"^/liquid/api": "/api/v1/ws"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/liquid/api/": {
|
"/liquid/api/v1/": {
|
||||||
"target": "http://localhost:50001/",
|
"target": "http://localhost:8999/",
|
||||||
"secure": false,
|
"secure": false,
|
||||||
"pathRewrite": {
|
"pathRewrite": {
|
||||||
"^/liquid/api/": ""
|
"^/liquid/api/": "/api/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/liquid/api/": {
|
||||||
|
"target": "http://localhost:8999/",
|
||||||
|
"secure": false,
|
||||||
|
"pathRewrite": {
|
||||||
|
"^/liquid/api/": "/api/v1/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/bisq/api/": {
|
"/bisq/api/": {
|
||||||
|
|||||||
@@ -4,14 +4,11 @@
|
|||||||
"secure": false,
|
"secure": false,
|
||||||
"ws": true
|
"ws": true
|
||||||
},
|
},
|
||||||
"/api/*": {
|
"/api": {
|
||||||
"target": "https://mempool.space",
|
"target": "https://mempool.space",
|
||||||
"secure": false,
|
"secure": false,
|
||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
"logLevel": "debug",
|
"logLevel": "debug",
|
||||||
"pathRewrite": {
|
|
||||||
"^/api": "https://mempool.space/api"
|
|
||||||
},
|
|
||||||
"timeout": 3600000
|
"timeout": 3600000
|
||||||
},
|
},
|
||||||
"/testnet/api/v1/ws": {
|
"/testnet/api/v1/ws": {
|
||||||
@@ -23,7 +20,7 @@
|
|||||||
"^/testnet/api": "/api/v1/ws"
|
"^/testnet/api": "/api/v1/ws"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/testnet/api/*": {
|
"/testnet/api": {
|
||||||
"target": "https://mempool.space",
|
"target": "https://mempool.space",
|
||||||
"secure": true,
|
"secure": true,
|
||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
@@ -42,7 +39,7 @@
|
|||||||
"^/signet/api": "/api/v1/ws"
|
"^/signet/api": "/api/v1/ws"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/signet/api/*": {
|
"/signet/api": {
|
||||||
"target": "https://mempool.space",
|
"target": "https://mempool.space",
|
||||||
"secure": true,
|
"secure": true,
|
||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
@@ -61,7 +58,7 @@
|
|||||||
"^/bisq/api": "/api/v1/ws"
|
"^/bisq/api": "/api/v1/ws"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/bisq/api/*": {
|
"/bisq/api": {
|
||||||
"target": "https://mempool.space/bisq",
|
"target": "https://mempool.space/bisq",
|
||||||
"secure": false,
|
"secure": false,
|
||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
@@ -75,7 +72,7 @@
|
|||||||
"secure": false,
|
"secure": false,
|
||||||
"ws": true
|
"ws": true
|
||||||
},
|
},
|
||||||
"/liquid/api/*": {
|
"/liquid/api": {
|
||||||
"target": "https://mempool.space",
|
"target": "https://mempool.space",
|
||||||
"secure": false,
|
"secure": false,
|
||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
"secure": false,
|
"secure": false,
|
||||||
"changeOrigin": true,
|
"changeOrigin": true,
|
||||||
"pathRewrite": {
|
"pathRewrite": {
|
||||||
"^/liquid/api/": "/api/v1/liquid/"
|
"^/liquid/api/": "/api/liquid/"
|
||||||
},
|
},
|
||||||
"timeout": 3600000
|
"timeout": 3600000
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,8 +16,11 @@ import { DashboardComponent } from './dashboard/dashboard.component';
|
|||||||
import { LatestBlocksComponent } from './components/latest-blocks/latest-blocks.component';
|
import { LatestBlocksComponent } from './components/latest-blocks/latest-blocks.component';
|
||||||
import { ApiDocsComponent } from './components/api-docs/api-docs.component';
|
import { ApiDocsComponent } from './components/api-docs/api-docs.component';
|
||||||
import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component';
|
import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component';
|
||||||
|
import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component';
|
||||||
|
import { TrademarkPolicyComponent } from './components/trademark-policy/trademark-policy.component';
|
||||||
import { BisqMasterPageComponent } from './components/bisq-master-page/bisq-master-page.component';
|
import { BisqMasterPageComponent } from './components/bisq-master-page/bisq-master-page.component';
|
||||||
import { SponsorComponent } from './components/sponsor/sponsor.component';
|
import { SponsorComponent } from './components/sponsor/sponsor.component';
|
||||||
|
import { LiquidMasterPageComponent } from './components/liquid-master-page/liquid-master-page.component';
|
||||||
|
|
||||||
let routes: Routes = [
|
let routes: Routes = [
|
||||||
{
|
{
|
||||||
@@ -66,6 +69,14 @@ let routes: Routes = [
|
|||||||
path: 'terms-of-service',
|
path: 'terms-of-service',
|
||||||
component: TermsOfServiceComponent
|
component: TermsOfServiceComponent
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'privacy-policy',
|
||||||
|
component: PrivacyPolicyComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'trademark-policy',
|
||||||
|
component: TrademarkPolicyComponent
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'address/:id',
|
path: 'address/:id',
|
||||||
children: [],
|
children: [],
|
||||||
@@ -293,7 +304,7 @@ const browserWindow = window || {};
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const browserWindowEnv = browserWindow.__env || {};
|
const browserWindowEnv = browserWindow.__env || {};
|
||||||
|
|
||||||
if (browserWindowEnv && browserWindowEnv.OFFICIAL_BISQ_MARKETS) {
|
if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'bisq') {
|
||||||
routes = [{
|
routes = [{
|
||||||
path: '',
|
path: '',
|
||||||
component: BisqMasterPageComponent,
|
component: BisqMasterPageComponent,
|
||||||
@@ -301,6 +312,93 @@ if (browserWindowEnv && browserWindowEnv.OFFICIAL_BISQ_MARKETS) {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'liquid') {
|
||||||
|
routes = [{
|
||||||
|
path: '',
|
||||||
|
component: LiquidMasterPageComponent,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: StartComponent,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: DashboardComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'tx/:id',
|
||||||
|
component: TransactionComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'block/:id',
|
||||||
|
component: BlockComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'mempool-block/:id',
|
||||||
|
component: MempoolBlockComponent
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'blocks',
|
||||||
|
component: LatestBlocksComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'graphs',
|
||||||
|
component: StatisticsComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'address/:id',
|
||||||
|
component: AddressComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'asset/:id',
|
||||||
|
component: AssetComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'assets',
|
||||||
|
component: AssetsComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'api',
|
||||||
|
component: ApiDocsComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'about',
|
||||||
|
component: AboutComponent,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'terms-of-service',
|
||||||
|
component: TermsOfServiceComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'privacy-policy',
|
||||||
|
component: PrivacyPolicyComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'trademark-policy',
|
||||||
|
component: TrademarkPolicyComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'sponsor',
|
||||||
|
component: SponsorComponent,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'tv',
|
||||||
|
component: TelevisionComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'status',
|
||||||
|
component: StatusViewComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '**',
|
||||||
|
redirectTo: ''
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes, {
|
imports: [RouterModule.forRoot(routes, {
|
||||||
initialNavigation: 'enabled',
|
initialNavigation: 'enabled',
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const languages: Language[] = [
|
|||||||
{ code: 'ar', name: 'العربية' }, // Arabic
|
{ code: 'ar', name: 'العربية' }, // Arabic
|
||||||
// { code: 'bg', name: 'Български' }, // Bulgarian
|
// { code: 'bg', name: 'Български' }, // Bulgarian
|
||||||
// { code: 'bs', name: 'Bosanski' }, // Bosnian
|
// { code: 'bs', name: 'Bosanski' }, // Bosnian
|
||||||
// { code: 'ca', name: 'Català' }, // Catalan
|
{ code: 'ca', name: 'Català' }, // Catalan
|
||||||
{ code: 'cs', name: 'Čeština' }, // Czech
|
{ code: 'cs', name: 'Čeština' }, // Czech
|
||||||
// { code: 'da', name: 'Dansk' }, // Danish
|
// { code: 'da', name: 'Dansk' }, // Danish
|
||||||
{ code: 'de', name: 'Deutsch' }, // German
|
{ code: 'de', name: 'Deutsch' }, // German
|
||||||
@@ -59,6 +59,7 @@ export const languages: Language[] = [
|
|||||||
{ code: 'ko', name: '한국어' }, // Korean
|
{ code: 'ko', name: '한국어' }, // Korean
|
||||||
// { code: 'hr', name: 'Hrvatski' }, // Croatian
|
// { code: 'hr', name: 'Hrvatski' }, // Croatian
|
||||||
// { code: 'id', name: 'Bahasa Indonesia' },// Indonesian
|
// { code: 'id', name: 'Bahasa Indonesia' },// Indonesian
|
||||||
|
{ code: 'hi', name: 'हिन्दी' }, // Hindi
|
||||||
{ code: 'it', name: 'Italiano' }, // Italian
|
{ code: 'it', name: 'Italiano' }, // Italian
|
||||||
{ code: 'he', name: 'עברית' }, // Hebrew
|
{ code: 'he', name: 'עברית' }, // Hebrew
|
||||||
{ code: 'ka', name: 'ქართული' }, // Georgian
|
{ code: 'ka', name: 'ქართული' }, // Georgian
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { AddressLabelsComponent } from './components/address-labels/address-labe
|
|||||||
import { MempoolBlocksComponent } from './components/mempool-blocks/mempool-blocks.component';
|
import { MempoolBlocksComponent } from './components/mempool-blocks/mempool-blocks.component';
|
||||||
import { MasterPageComponent } from './components/master-page/master-page.component';
|
import { MasterPageComponent } from './components/master-page/master-page.component';
|
||||||
import { BisqMasterPageComponent } from './components/bisq-master-page/bisq-master-page.component';
|
import { BisqMasterPageComponent } from './components/bisq-master-page/bisq-master-page.component';
|
||||||
|
import { LiquidMasterPageComponent } from './components/liquid-master-page/liquid-master-page.component';
|
||||||
import { AboutComponent } from './components/about/about.component';
|
import { AboutComponent } from './components/about/about.component';
|
||||||
import { TelevisionComponent } from './components/television/television.component';
|
import { TelevisionComponent } from './components/television/television.component';
|
||||||
import { StatisticsComponent } from './components/statistics/statistics.component';
|
import { StatisticsComponent } from './components/statistics/statistics.component';
|
||||||
@@ -32,7 +33,7 @@ import { FooterComponent } from './components/footer/footer.component';
|
|||||||
import { AudioService } from './services/audio.service';
|
import { AudioService } from './services/audio.service';
|
||||||
import { MempoolBlockComponent } from './components/mempool-block/mempool-block.component';
|
import { MempoolBlockComponent } from './components/mempool-block/mempool-block.component';
|
||||||
import { FeeDistributionGraphComponent } from './components/fee-distribution-graph/fee-distribution-graph.component';
|
import { FeeDistributionGraphComponent } from './components/fee-distribution-graph/fee-distribution-graph.component';
|
||||||
import { TimespanComponent } from './components/timespan/timespan.component';
|
import { TimeSpanComponent } from './components/time-span/time-span.component';
|
||||||
import { SeoService } from './services/seo.service';
|
import { SeoService } from './services/seo.service';
|
||||||
import { MempoolGraphComponent } from './components/mempool-graph/mempool-graph.component';
|
import { MempoolGraphComponent } from './components/mempool-graph/mempool-graph.component';
|
||||||
import { AssetComponent } from './components/asset/asset.component';
|
import { AssetComponent } from './components/asset/asset.component';
|
||||||
@@ -44,11 +45,13 @@ import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
|
|||||||
import { FeesBoxComponent } from './components/fees-box/fees-box.component';
|
import { FeesBoxComponent } from './components/fees-box/fees-box.component';
|
||||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||||
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
|
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
|
||||||
import { faAngleDown, faAngleUp, faBolt, faChartArea, faCogs, faCubes, faDatabase, faExchangeAlt, faInfoCircle,
|
import { faAngleDown, faAngleUp, faAngleRight, faAngleLeft, faBolt, faChartArea, faCogs, faCubes, faDatabase, faExchangeAlt, faInfoCircle,
|
||||||
faLink, faList, faSearch, faTachometerAlt, faThList, faTint, faTv, faAngleDoubleDown, faAngleDoubleUp, faChevronDown, faFileAlt, faRedoAlt } from '@fortawesome/free-solid-svg-icons';
|
faLink, faList, faSearch, faCaretUp, faCaretDown, faTachometerAlt, faThList, faTint, faTv, faAngleDoubleDown, faSortUp, faAngleDoubleUp, faChevronDown, faFileAlt, faRedoAlt, faArrowAltCircleRight, faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { ApiDocsComponent } from './components/api-docs/api-docs.component';
|
import { ApiDocsComponent } from './components/api-docs/api-docs.component';
|
||||||
import { CodeTemplateComponent } from './components/api-docs/code-template.component';
|
import { CodeTemplateComponent } from './components/api-docs/code-template.component';
|
||||||
import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component';
|
import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component';
|
||||||
|
import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component';
|
||||||
|
import { TrademarkPolicyComponent } from './components/trademark-policy/trademark-policy.component';
|
||||||
import { StorageService } from './services/storage.service';
|
import { StorageService } from './services/storage.service';
|
||||||
import { HttpCacheInterceptor } from './services/http-cache.interceptor';
|
import { HttpCacheInterceptor } from './services/http-cache.interceptor';
|
||||||
import { SponsorComponent } from './components/sponsor/sponsor.component';
|
import { SponsorComponent } from './components/sponsor/sponsor.component';
|
||||||
@@ -59,6 +62,7 @@ import { SponsorComponent } from './components/sponsor/sponsor.component';
|
|||||||
AboutComponent,
|
AboutComponent,
|
||||||
MasterPageComponent,
|
MasterPageComponent,
|
||||||
BisqMasterPageComponent,
|
BisqMasterPageComponent,
|
||||||
|
LiquidMasterPageComponent,
|
||||||
TelevisionComponent,
|
TelevisionComponent,
|
||||||
BlockchainComponent,
|
BlockchainComponent,
|
||||||
StartComponent,
|
StartComponent,
|
||||||
@@ -71,7 +75,7 @@ import { SponsorComponent } from './components/sponsor/sponsor.component';
|
|||||||
AmountComponent,
|
AmountComponent,
|
||||||
LatestBlocksComponent,
|
LatestBlocksComponent,
|
||||||
SearchFormComponent,
|
SearchFormComponent,
|
||||||
TimespanComponent,
|
TimeSpanComponent,
|
||||||
AddressLabelsComponent,
|
AddressLabelsComponent,
|
||||||
MempoolBlocksComponent,
|
MempoolBlocksComponent,
|
||||||
ChartistComponent,
|
ChartistComponent,
|
||||||
@@ -88,6 +92,8 @@ import { SponsorComponent } from './components/sponsor/sponsor.component';
|
|||||||
ApiDocsComponent,
|
ApiDocsComponent,
|
||||||
CodeTemplateComponent,
|
CodeTemplateComponent,
|
||||||
TermsOfServiceComponent,
|
TermsOfServiceComponent,
|
||||||
|
PrivacyPolicyComponent,
|
||||||
|
TrademarkPolicyComponent,
|
||||||
SponsorComponent,
|
SponsorComponent,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
@@ -136,5 +142,12 @@ export class AppModule {
|
|||||||
library.addIcons(faChevronDown);
|
library.addIcons(faChevronDown);
|
||||||
library.addIcons(faFileAlt);
|
library.addIcons(faFileAlt);
|
||||||
library.addIcons(faRedoAlt);
|
library.addIcons(faRedoAlt);
|
||||||
|
library.addIcons(faArrowAltCircleRight);
|
||||||
|
library.addIcons(faExternalLinkAlt);
|
||||||
|
library.addIcons(faSortUp);
|
||||||
|
library.addIcons(faCaretUp);
|
||||||
|
library.addIcons(faCaretDown);
|
||||||
|
library.addIcons(faAngleRight);
|
||||||
|
library.addIcons(faAngleLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,15 +20,13 @@
|
|||||||
<th i18n="Asset ticker header">Ticker</th>
|
<th i18n="Asset ticker header">Ticker</th>
|
||||||
<th class="d-none d-md-block" i18n="Asset Issuer Domain header">Issuer domain</th>
|
<th class="d-none d-md-block" i18n="Asset Issuer Domain header">Issuer domain</th>
|
||||||
<th i18n="Asset ID header">Asset ID</th>
|
<th i18n="Asset ID header">Asset ID</th>
|
||||||
<th class="d-none d-lg-block" i18n="Asset issuance transaction header">Issuance TX</th>
|
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let asset of filteredAssets; trackBy: trackByAsset">
|
<tr *ngFor="let asset of filteredAssets; trackBy: trackByAsset">
|
||||||
<td class="td-name">{{ asset.name }}</td>
|
<td class="td-name"><a [routerLink]="['/asset/' | relativeUrl, asset.asset_id]">{{ asset.name }}</a></td>
|
||||||
<td>{{ asset.ticker }}</td>
|
<td>{{ asset.ticker }}</td>
|
||||||
<td class="d-none d-md-block"><a *ngIf="asset.entity" target="_blank" href="{{ 'http://' + asset.entity.domain }}">{{ asset.entity.domain }}</a></td>
|
<td class="d-none d-md-block">{{ asset.entity && asset.entity.domain }}</td>
|
||||||
<td><a [routerLink]="['/asset/' | relativeUrl, asset.asset_id]">{{ asset.asset_id | shortenString : 13 }}</a> <app-clipboard class="d-none d-sm-inline-block" [text]="asset.asset_id"></app-clipboard></td>
|
<td><a [routerLink]="['/asset/' | relativeUrl, asset.asset_id]">{{ asset.asset_id | shortenString : 13 }}</a> <app-clipboard class="d-none d-sm-inline-block" [text]="asset.asset_id"></app-clipboard></td>
|
||||||
<td class="d-none d-lg-block"><ng-template [ngIf]="asset.issuance_txin"><a [routerLink]="['/tx/' | relativeUrl, asset.issuance_txin.txid]">{{ asset.issuance_txin.txid | shortenString : 13 }}</a> <app-clipboard class="d-none d-sm-inline-block" [text]="asset.issuance_txin.txid"></app-clipboard></ng-template></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -47,15 +45,13 @@
|
|||||||
<th i18n="Asset ticker header">Ticker</th>
|
<th i18n="Asset ticker header">Ticker</th>
|
||||||
<th i18n="Asset Issuer Domain header">Issuer domain</th>
|
<th i18n="Asset Issuer Domain header">Issuer domain</th>
|
||||||
<th i18n="Asset ID header">Asset ID</th>
|
<th i18n="Asset ID header">Asset ID</th>
|
||||||
<th i18n="Asset issuance transaction header">Issuance TX</th>
|
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let dummy of [0,0,0]">
|
<tr *ngFor="let dummy of [0,0,0,0,0,0,0,0,0,0]">
|
||||||
<td><span class="skeleton-loader"></span></td>
|
<td><span class="skeleton-loader"></span></td>
|
||||||
<td><span class="skeleton-loader"></span></td>
|
<td><span class="skeleton-loader"></span></td>
|
||||||
<td class="d-none d-md-block"><span class="skeleton-loader"></span></td>
|
<td class="d-none d-md-block"><span class="skeleton-loader"></span></td>
|
||||||
<td><span class="skeleton-loader"></span></td>
|
<td><span class="skeleton-loader"></span></td>
|
||||||
<td class="d-none d-lg-block"><span class="skeleton-loader"></span></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export class AssetsComponent implements OnInit {
|
|||||||
const start = (this.page - 1) * this.itemsPerPage;
|
const start = (this.page - 1) * this.itemsPerPage;
|
||||||
if (searchText.length ) {
|
if (searchText.length ) {
|
||||||
const filteredAssets = this.assetsCache.filter((asset) => asset.name.toLowerCase().indexOf(searchText.toLowerCase()) > -1
|
const filteredAssets = this.assetsCache.filter((asset) => asset.name.toLowerCase().indexOf(searchText.toLowerCase()) > -1
|
||||||
|| asset.ticker.toLowerCase().indexOf(searchText.toLowerCase()) > -1);
|
|| (asset.ticker || '').toLowerCase().indexOf(searchText.toLowerCase()) > -1);
|
||||||
this.assets = filteredAssets;
|
this.assets = filteredAssets;
|
||||||
return filteredAssets.slice(start, this.itemsPerPage + start);
|
return filteredAssets.slice(start, this.itemsPerPage + start);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="container-xl">
|
<div class="container-xl" (window:resize)="onResize($event)">
|
||||||
<h1 style="float: left;" i18n="Bisq blocks header">BSQ Blocks</h1>
|
<h1 style="float: left;" i18n="Bisq blocks header">BSQ Blocks</h1>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@@ -26,9 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div class="pagination">
|
<ngb-pagination *ngIf="blocks.value" class="pagination-container" [size]="paginationSize" [collectionSize]="blocks.value[1]" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="paginationMaxSize" [boundaryLinks]="true" [ellipses]="false"></ngb-pagination>
|
||||||
<ngb-pagination *ngIf="blocks.value" [size]="paginationSize" [collectionSize]="blocks.value[1]" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="paginationMaxSize" [boundaryLinks]="true"></ngb-pagination>
|
|
||||||
</div>
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
.pagination {
|
.pagination-container {
|
||||||
overflow: hidden;
|
float: none;
|
||||||
|
margin-bottom: 200px;
|
||||||
|
@media(min-width: 400px){
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.container-xl {
|
||||||
|
padding-bottom: 110px;
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ export class BisqBlocksComponent implements OnInit {
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
paginationSize: 'sm' | 'lg' = 'md';
|
paginationSize: 'sm' | 'lg' = 'md';
|
||||||
paginationMaxSize = 4;
|
paginationMaxSize = 5;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private websocketService: WebsocketService,
|
private websocketService: WebsocketService,
|
||||||
@@ -38,7 +38,7 @@ export class BisqBlocksComponent implements OnInit {
|
|||||||
this.seoService.setTitle($localize`:@@8a7b4bd44c0ac71b2e72de0398b303257f7d2f54:Blocks`);
|
this.seoService.setTitle($localize`:@@8a7b4bd44c0ac71b2e72de0398b303257f7d2f54:Blocks`);
|
||||||
this.itemsPerPage = Math.max(Math.round(this.contentSpace / this.fiveItemsPxSize) * 5, 10);
|
this.itemsPerPage = Math.max(Math.round(this.contentSpace / this.fiveItemsPxSize) * 5, 10);
|
||||||
this.loadingItems = Array(this.itemsPerPage);
|
this.loadingItems = Array(this.itemsPerPage);
|
||||||
if (document.body.clientWidth < 768) {
|
if (document.body.clientWidth < 670) {
|
||||||
this.paginationSize = 'sm';
|
this.paginationSize = 'sm';
|
||||||
this.paginationMaxSize = 3;
|
this.paginationMaxSize = 3;
|
||||||
}
|
}
|
||||||
@@ -83,4 +83,8 @@ export class BisqBlocksComponent implements OnInit {
|
|||||||
queryParamsHandling: 'merge',
|
queryParamsHandling: 'merge',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onResize(event: any) {
|
||||||
|
this.paginationMaxSize = event.target.innerWidth < 670 ? 3 : 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<div class="container-info">
|
<div class="container-info">
|
||||||
<h1>
|
<h1>
|
||||||
<ng-template [ngIf]="stateService.env.OFFICIAL_BISQ_MARKETS" [ngIfElse]="nonOfficialMarkets" i18n="Bisq All Markets">Markets</ng-template>
|
<ng-template [ngIf]="stateService.env.BASE_MODULE === 'bisq'" [ngIfElse]="nonOfficialMarkets" i18n="Bisq All Markets">Markets</ng-template>
|
||||||
<ng-template #nonOfficialMarkets i18n="Bisq Bitcoin Markets">Bitcoin Markets</ng-template>
|
<ng-template #nonOfficialMarkets i18n="Bisq Bitcoin Markets">Bitcoin Markets</ng-template>
|
||||||
</h1>
|
</h1>
|
||||||
<ng-container *ngIf="{ value: (tickers$ | async) } as tickers">
|
<ng-container *ngIf="{ value: (tickers$ | async) } as tickers">
|
||||||
|
|||||||
@@ -17,19 +17,6 @@
|
|||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
|
||||||
overflow: scroll;
|
|
||||||
-ms-overflow-style: none;
|
|
||||||
scrollbar-width: none;
|
|
||||||
font-size: 13px;
|
|
||||||
@media(min-width: 576px){
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
&::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-info{
|
.container-info{
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ export class BisqDashboardComponent implements OnInit {
|
|||||||
const newTickers = [];
|
const newTickers = [];
|
||||||
for (const t in tickers) {
|
for (const t in tickers) {
|
||||||
|
|
||||||
if (!this.stateService.env.OFFICIAL_BISQ_MARKETS) {
|
if (this.stateService.env.BASE_MODULE !== 'bisq') {
|
||||||
const pair = t.split('_');
|
const pair = t.split('_');
|
||||||
if (pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1) {
|
if (pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1) {
|
||||||
continue;
|
continue;
|
||||||
@@ -106,7 +106,7 @@ export class BisqDashboardComponent implements OnInit {
|
|||||||
])
|
])
|
||||||
.pipe(
|
.pipe(
|
||||||
map(([trades, markets]) => {
|
map(([trades, markets]) => {
|
||||||
if (!this.stateService.env.OFFICIAL_BISQ_MARKETS) {
|
if (this.stateService.env.BASE_MODULE !== 'bisq') {
|
||||||
trades = trades.filter((trade) => {
|
trades = trades.filter((trade) => {
|
||||||
const pair = trade.market.split('_');
|
const pair = trade.market.split('_');
|
||||||
return !(pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1);
|
return !(pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title text-center">
|
<h5 class="card-title text-center">
|
||||||
<ng-template [ngIf]="stateService.env.OFFICIAL_BISQ_MARKETS" [ngIfElse]="nonOfficialMarkets" i18n="Bisq All Markets">Markets</ng-template>
|
<ng-template [ngIf]="stateService.env.BASE_MODULE === 'bisq'" [ngIfElse]="nonOfficialMarkets" i18n="Bisq All Markets">Markets</ng-template>
|
||||||
<ng-template #nonOfficialMarkets i18n="Bisq Bitcoin Markets">Bitcoin Markets</ng-template>
|
<ng-template #nonOfficialMarkets i18n="Bisq Bitcoin Markets">Bitcoin Markets</ng-template>
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<app-language-selector *ngIf="!stateService.env.OFFICIAL_BISQ_MARKETS"></app-language-selector>
|
<app-language-selector *ngIf="stateService.env.BASE_MODULE !== 'bisq'"></app-language-selector>
|
||||||
|
|
||||||
<div class="text-small text-center mt-3">
|
<div class="text-small text-center mt-3">
|
||||||
<a [routerLink]="['/terms-of-service']" i18n="shared.terms-of-service|Terms of Service">Terms of Service</a>
|
<a [routerLink]="['/terms-of-service']" i18n="shared.terms-of-service|Terms of Service">Terms of Service</a>
|
||||||
|
|||||||
@@ -18,15 +18,44 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
font-size: 13px;
|
overflow: scroll;
|
||||||
@media(min-width: 576px){
|
scrollbar-width: none;
|
||||||
font-size: 16px;
|
font-size: 13px;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@media(min-width: 576px){
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
thead th{
|
||||||
|
text-align: right;
|
||||||
|
&:first-child {
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
&::-webkit-scrollbar {
|
&:nth-child(3) {
|
||||||
|
display: none;
|
||||||
|
@media(min-width: 1100px){
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
td {
|
||||||
|
text-align: right;
|
||||||
|
&:first-child {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
&:nth-child(3) {
|
||||||
display: none;
|
display: none;
|
||||||
|
@media(min-width: 1100px){
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.chart-container {
|
.chart-container {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
@@ -41,44 +70,43 @@
|
|||||||
background-color: #1d1f31;
|
background-color: #1d1f31;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-title {
|
.card-title {
|
||||||
color: #4a68b9;
|
color: #4a68b9;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-block {
|
.info-block {
|
||||||
float: left;
|
float: left;
|
||||||
width: 350px;
|
width: 350px;
|
||||||
line-height: 25px;
|
line-height: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress {
|
.progress {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #2d3348;
|
background-color: #2d3348;
|
||||||
height: 1.1rem;
|
height: 1.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-warning {
|
.bg-warning {
|
||||||
background-color: #b58800 !important;
|
background-color: #b58800 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.skeleton-loader {
|
.skeleton-loader {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
&.shorter {
|
&.shorter {
|
||||||
max-width: 150px;
|
max-width: 150px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.more-padding {
|
.more-padding {
|
||||||
padding: 1.25rem 2rem 1.25rem 2rem;
|
padding: 1.25rem 2rem 1.25rem 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.graph-card {
|
.graph-card {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@media (min-width: 992px) {
|
@media (min-width: 992px) {
|
||||||
height: 385px;
|
height: 385px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ export class BisqMainDashboardComponent implements OnInit {
|
|||||||
const newTickers = [];
|
const newTickers = [];
|
||||||
for (const t in tickers) {
|
for (const t in tickers) {
|
||||||
|
|
||||||
if (!this.stateService.env.OFFICIAL_BISQ_MARKETS) {
|
if (this.stateService.env.BASE_MODULE !== 'bisq') {
|
||||||
const pair = t.split('_');
|
const pair = t.split('_');
|
||||||
if (pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1) {
|
if (pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1) {
|
||||||
continue;
|
continue;
|
||||||
@@ -114,7 +114,7 @@ export class BisqMainDashboardComponent implements OnInit {
|
|||||||
])
|
])
|
||||||
.pipe(
|
.pipe(
|
||||||
map(([trades, markets]) => {
|
map(([trades, markets]) => {
|
||||||
if (!this.stateService.env.OFFICIAL_BISQ_MARKETS) {
|
if (this.stateService.env.BASE_MODULE !== 'bisq') {
|
||||||
trades = trades.filter((trade) => {
|
trades = trades.filter((trade) => {
|
||||||
const pair = trade.market.split('_');
|
const pair = trade.market.split('_');
|
||||||
return !(pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1);
|
return !(pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1);
|
||||||
|
|||||||
@@ -1,12 +1,38 @@
|
|||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
-ms-overflow-style: none;
|
scrollbar-width: none;
|
||||||
scrollbar-width: none;
|
font-size: 13px;
|
||||||
font-size: 13px;
|
&::-webkit-scrollbar {
|
||||||
@media(min-width: 576px){
|
display: none;
|
||||||
font-size: 16px;
|
}
|
||||||
|
@media(min-width: 576px){
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
thead th{
|
||||||
|
text-align: right;
|
||||||
|
&:first-child{
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
&::-webkit-scrollbar {
|
&:nth-child(2) {
|
||||||
|
display: none;
|
||||||
|
@media(min-width: 1100px){
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
td {
|
||||||
|
text-align: right;
|
||||||
|
&:first-child{
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
&:nth-child(2) {
|
||||||
display: none;
|
display: none;
|
||||||
|
@media(min-width: 1100px){
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,98 +1,102 @@
|
|||||||
<div class="container-xl">
|
<div class="container-xl">
|
||||||
|
|
||||||
|
<div class="title-block">
|
||||||
<ng-template [ngIf]="!isLoading && !error">
|
<ng-template [ngIf]="!isLoading && !error">
|
||||||
|
|
||||||
<button *ngIf="(latestBlock$ | async) as latestBlock" type="button" class="btn btn-sm btn-success float-right">
|
<div>
|
||||||
<ng-container *ngTemplateOutlet="latestBlock.height - bisqTx.blockHeight + 1 == 1 ? confirmationSingular : confirmationPlural; context: {$implicit: latestBlock.height - bisqTx.blockHeight + 1}"></ng-container>
|
<div class="title">
|
||||||
<ng-template #confirmationSingular let-i i18n="shared.confirmation-count.singular|Transaction singular confirmation count">{{ i }} confirmation</ng-template>
|
<h1 i18n="shared.transaction">Transaction</h1>
|
||||||
<ng-template #confirmationPlural let-i i18n="shared.confirmation-count.plural|Transaction plural confirmation count">{{ i }} confirmations</ng-template>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
|
|
||||||
<h1 i18n="shared.transaction">Transaction</h1>
|
|
||||||
|
|
||||||
<div class="tx-link">
|
|
||||||
<a [routerLink]="['/bisq-tx' | relativeUrl, bisqTx.id]">
|
|
||||||
<span class="d-inline d-lg-none">{{ bisqTx.id | shortenString : 24 }}</span>
|
|
||||||
<span class="d-none d-lg-inline">{{ bisqTx.id }}</span>
|
|
||||||
</a>
|
|
||||||
<app-clipboard [text]="bisqTx.id"></app-clipboard>
|
|
||||||
</div>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
|
|
||||||
<div class="box transaction-container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm">
|
|
||||||
<table class="table table-borderless table-striped">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td i18n="transaction.timestamp|Transaction Timestamp">Timestamp</td>
|
|
||||||
<td>
|
|
||||||
{{ bisqTx.time | date:'yyyy-MM-dd HH:mm' }}
|
|
||||||
<div class="lg-inline">
|
|
||||||
<i class="symbol">(<app-time-since [time]="bisqTx.time / 1000" [fastRender]="true"></app-time-since>)</i>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="td-width" i18n="transaction.included-in-block|Transaction included in block">Included in block</td>
|
|
||||||
<td>
|
|
||||||
<a [routerLink]="['/block/' | relativeUrl, bisqTx.blockHash]" [state]="{ data: { blockHeight: bisqTx.blockHeight } }">{{ bisqTx.blockHeight }}</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="td-width" i18n="transaction.features|Transaction features">Features</td>
|
|
||||||
<td>
|
|
||||||
<app-tx-features *ngIf="tx; else loadingTx" [tx]="tx"></app-tx-features>
|
|
||||||
<ng-template #loadingTx>
|
|
||||||
<span class="skeleton-loader"></span>
|
|
||||||
</ng-template>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm">
|
|
||||||
<table class="table table-borderless table-striped">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td class="td-width" i18n="BSQ burnt amount">Burnt amount</td>
|
|
||||||
<td>
|
|
||||||
{{ bisqTx.burntFee / 100 | number: '1.2-2' }} <span class="symbol">BSQ</span> <span class="fiat"><app-bsq-amount [bsq]="bisqTx.burntFee" [forceFiat]="true" [green]="true"></app-bsq-amount></span>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td i18n="transaction.fee-per-vbyte|Transaction fee">Fee per vByte</td>
|
|
||||||
<td *ngIf="!isLoadingTx; else loadingTxFee">
|
|
||||||
{{ tx.fee / (tx.weight / 4) | number : '1.1-1' }} <span class="symbol">sat/vB</span>
|
|
||||||
|
|
||||||
<app-tx-fee-rating [tx]="tx"></app-tx-fee-rating>
|
|
||||||
</td>
|
|
||||||
<ng-template #loadingTxFee>
|
|
||||||
<td><span class="skeleton-loader"></span></td>
|
|
||||||
</ng-template>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="tx-link">
|
||||||
|
<a [routerLink]="['/bisq-tx' | relativeUrl, bisqTx.id]">
|
||||||
|
<span class="d-inline d-lg-none">{{ bisqTx.id | shortenString : 24 }}</span>
|
||||||
|
<span class="d-none d-lg-inline">{{ bisqTx.id }}</span>
|
||||||
|
</a>
|
||||||
|
<app-clipboard [text]="bisqTx.id"></app-clipboard>
|
||||||
|
</div>
|
||||||
|
<div class="container-buttons">
|
||||||
|
<button *ngIf="(latestBlock$ | async) as latestBlock" type="button" class="btn btn-sm btn-success float-right">
|
||||||
|
<ng-container *ngTemplateOutlet="latestBlock.height - bisqTx.blockHeight + 1 == 1 ? confirmationSingular : confirmationPlural; context: {$implicit: latestBlock.height - bisqTx.blockHeight + 1}"></ng-container>
|
||||||
|
<ng-template #confirmationSingular let-i i18n="shared.confirmation-count.singular|Transaction singular confirmation count">{{ i }} confirmation</ng-template>
|
||||||
|
<ng-template #confirmationPlural let-i i18n="shared.confirmation-count.plural|Transaction plural confirmation count">{{ i }} confirmations</ng-template>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
<div class="box transaction-container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm">
|
||||||
|
<table class="table table-borderless table-striped">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td i18n="transaction.timestamp|Transaction Timestamp">Timestamp</td>
|
||||||
|
<td>
|
||||||
|
{{ bisqTx.time | date:'yyyy-MM-dd HH:mm' }}
|
||||||
|
<div class="lg-inline">
|
||||||
|
<i class="symbol">(<app-time-since [time]="bisqTx.time / 1000" [fastRender]="true"></app-time-since>)</i>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="td-width" i18n="transaction.included-in-block|Transaction included in block">Included in block</td>
|
||||||
|
<td>
|
||||||
|
<a [routerLink]="['/block/' | relativeUrl, bisqTx.blockHash]" [state]="{ data: { blockHeight: bisqTx.blockHeight } }">{{ bisqTx.blockHeight }}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="td-width" i18n="transaction.features|Transaction features">Features</td>
|
||||||
|
<td>
|
||||||
|
<app-tx-features *ngIf="tx; else loadingTx" [tx]="tx"></app-tx-features>
|
||||||
|
<ng-template #loadingTx>
|
||||||
|
<span class="skeleton-loader"></span>
|
||||||
|
</ng-template>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm">
|
||||||
|
<table class="table table-borderless table-striped">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="td-width" i18n="BSQ burnt amount">Burnt amount</td>
|
||||||
|
<td>
|
||||||
|
{{ bisqTx.burntFee / 100 | number: '1.2-2' }} <span class="symbol">BSQ</span> <span class="fiat"><app-bsq-amount [bsq]="bisqTx.burntFee" [forceFiat]="true" [green]="true"></app-bsq-amount></span>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td i18n="transaction.fee-per-vbyte|Transaction fee">Fee per vByte</td>
|
||||||
|
<td *ngIf="!isLoadingTx; else loadingTxFee">
|
||||||
|
{{ tx.fee / (tx.weight / 4) | feeRounding }} <span class="symbol">sat/vB</span>
|
||||||
|
|
||||||
|
<app-tx-fee-rating [tx]="tx"></app-tx-fee-rating>
|
||||||
|
</td>
|
||||||
|
<ng-template #loadingTxFee>
|
||||||
|
<td><span class="skeleton-loader"></span></td>
|
||||||
|
</ng-template>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<h2 i18n="transaction.details">Details</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<app-bisq-transaction-details [tx]="bisqTx"></app-bisq-transaction-details>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<h2 i18n="transaction.inputs-and-outputs|Transaction inputs and outputs">Inputs & Outputs</h2>
|
||||||
|
|
||||||
|
<app-bisq-transfers [tx]="bisqTx"></app-bisq-transfers>
|
||||||
|
|
||||||
|
<br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<h2 i18n="transaction.details">Details</h2>
|
|
||||||
|
|
||||||
|
|
||||||
<app-bisq-transaction-details [tx]="bisqTx"></app-bisq-transaction-details>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<h2 i18n="transaction.inputs-and-outputs|Transaction inputs and outputs">Inputs & Outputs</h2>
|
|
||||||
|
|
||||||
<app-bisq-transfers [tx]="bisqTx"></app-bisq-transfers>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template [ngIf="isLoading && !error">
|
<ng-template [ngIf="isLoading && !error">
|
||||||
|
|||||||
@@ -1,126 +1 @@
|
|||||||
.adjust-btn-padding {
|
@import "./../../components/transaction/transaction.component.scss";
|
||||||
padding: 0.55rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title-block {
|
|
||||||
padding-top: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 767.98px) {
|
|
||||||
.mobile-bottomcol {
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.td-width {
|
|
||||||
width: 150px;
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
width: 175px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge {
|
|
||||||
position: relative;
|
|
||||||
top: -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-small-height {
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow-green {
|
|
||||||
color: #1a9436;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow-red {
|
|
||||||
color: #dc3545;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-success {
|
|
||||||
float: right;
|
|
||||||
margin-bottom: 0px;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tx-link {
|
|
||||||
display: block;
|
|
||||||
width: auto;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
margin-left: 2px;
|
|
||||||
margin-top: 40px;
|
|
||||||
position: absolute;
|
|
||||||
@media (min-width: 700px) {
|
|
||||||
margin-top: 14px;
|
|
||||||
margin-left: 10px;
|
|
||||||
position: relative;
|
|
||||||
text-align: left;
|
|
||||||
width: 100%;
|
|
||||||
top: 14px;
|
|
||||||
left: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-xl {
|
|
||||||
margin-bottom: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row{
|
|
||||||
flex-direction: column;
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 767.98px) {
|
|
||||||
.mobile-bottomcol {
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
.details-table td:first-child {
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.fiat {
|
|
||||||
display: block;
|
|
||||||
font-size: 13px;
|
|
||||||
@media (min-width: 576px){
|
|
||||||
display: inline-block;
|
|
||||||
margin-left: 15px;
|
|
||||||
font-size: 14px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
h1{
|
|
||||||
font-size: 1.75rem;
|
|
||||||
margin-top: 2px;
|
|
||||||
margin-bottom: 0;
|
|
||||||
float: left;
|
|
||||||
padding-bottom: 40px;
|
|
||||||
@media (min-width: 375px){
|
|
||||||
margin-top: 0px;
|
|
||||||
font-size: 2rem;
|
|
||||||
}
|
|
||||||
@media (min-width: 768px){
|
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.transaction-container {
|
|
||||||
font-size: 14px;
|
|
||||||
@media (min-width: 576px){
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
tr td {
|
|
||||||
&:last-child{
|
|
||||||
text-align: right;
|
|
||||||
@media (min-width: 768px){
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -85,7 +85,11 @@ export class BisqTransactionComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tx.version) {
|
if (tx.version) {
|
||||||
this.router.navigate(['/tx/', this.txId], { state: { data: tx, bsqTx: true }});
|
if (this.stateService.env.BASE_MODULE === 'bisq') {
|
||||||
|
window.location.replace('https://mempool.space/tx/' + this.txId);
|
||||||
|
} else {
|
||||||
|
this.router.navigate(['/tx/', this.txId], { state: { data: tx, bsqTx: true }});
|
||||||
|
}
|
||||||
return of(null);
|
return of(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="container-xl">
|
<div class="container-xl" (window:resize)="onResize($event)">
|
||||||
<h1 style="float: left;" i18n>BSQ Transactions</h1>
|
<h1 style="float: left;" i18n>BSQ Transactions</h1>
|
||||||
|
|
||||||
<div class="d-block float-right">
|
<div class="d-block float-right">
|
||||||
@@ -44,9 +44,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<div class="pagination">
|
<ngb-pagination class="pagination-container" *ngIf="transactions.value" [collectionSize]="transactions.value[1]" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="paginationMaxSize" [boundaryLinks]="true" [ellipses]="false"></ngb-pagination>
|
||||||
<ngb-pagination *ngIf="transactions.value" [size]="paginationSize" [collectionSize]="transactions.value[1]" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="paginationMaxSize" [boundaryLinks]="true"></ngb-pagination>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,13 +8,16 @@ label {
|
|||||||
left: inherit;
|
left: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination {
|
.pagination-container {
|
||||||
overflow: hidden;
|
float: none;
|
||||||
|
@media(min-width: 400px){
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h1{
|
.container-xl {
|
||||||
font-size: 1.5rem;
|
padding-bottom: 60px;
|
||||||
@media(min-width: 375px){
|
@media(min-width: 400px){
|
||||||
font-size: 2rem;
|
padding-bottom: 100px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ export class BisqTransactionsComponent implements OnInit {
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
paginationSize: 'sm' | 'lg' = 'md';
|
paginationSize: 'sm' | 'lg' = 'md';
|
||||||
paginationMaxSize = 4;
|
paginationMaxSize = 5;
|
||||||
|
|
||||||
txTypes = ['ASSET_LISTING_FEE', 'BLIND_VOTE', 'COMPENSATION_REQUEST', 'GENESIS', 'LOCKUP', 'PAY_TRADE_FEE',
|
txTypes = ['ASSET_LISTING_FEE', 'BLIND_VOTE', 'COMPENSATION_REQUEST', 'GENESIS', 'LOCKUP', 'PAY_TRADE_FEE',
|
||||||
'PROOF_OF_BURN', 'PROPOSAL', 'REIMBURSEMENT_REQUEST', 'TRANSFER_BSQ', 'UNLOCK', 'VOTE_REVEAL', 'IRREGULAR'];
|
'PROOF_OF_BURN', 'PROPOSAL', 'REIMBURSEMENT_REQUEST', 'TRANSFER_BSQ', 'UNLOCK', 'VOTE_REVEAL', 'IRREGULAR'];
|
||||||
@@ -85,7 +85,7 @@ export class BisqTransactionsComponent implements OnInit {
|
|||||||
|
|
||||||
this.loadingItems = Array(this.itemsPerPage);
|
this.loadingItems = Array(this.itemsPerPage);
|
||||||
|
|
||||||
if (document.body.clientWidth < 768) {
|
if (document.body.clientWidth < 670) {
|
||||||
this.paginationSize = 'sm';
|
this.paginationSize = 'sm';
|
||||||
this.paginationMaxSize = 3;
|
this.paginationMaxSize = 3;
|
||||||
}
|
}
|
||||||
@@ -168,4 +168,8 @@ export class BisqTransactionsComponent implements OnInit {
|
|||||||
trackByFn(index: number) {
|
trackByFn(index: number) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onResize(event: any) {
|
||||||
|
this.paginationMaxSize = event.target.innerWidth < 670 ? 3 : 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
<tr *ngIf="input.isVerified">
|
<tr *ngIf="input.isVerified">
|
||||||
<td class="arrow-td">
|
<td class="arrow-td">
|
||||||
<ng-template [ngIf]="input.spendingTxId === null" [ngIfElse]="hasPreoutput">
|
<ng-template [ngIf]="input.spendingTxId === null" [ngIfElse]="hasPreoutput">
|
||||||
<i class="arrow grey"></i>
|
<span class="grey">
|
||||||
|
<fa-icon [icon]="['fas', 'arrow-alt-circle-right']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</span>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ng-template #hasPreoutput>
|
<ng-template #hasPreoutput>
|
||||||
<a [routerLink]="['/tx/' | relativeUrl, input.spendingTxId]">
|
<a [routerLink]="['/tx/' | relativeUrl, input.spendingTxId]" class="red">
|
||||||
<i class="arrow red"></i>
|
<fa-icon [icon]="['fas', 'arrow-alt-circle-right']" [fixedWidth]="true"></fa-icon>
|
||||||
</a>
|
</a>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</td>
|
</td>
|
||||||
@@ -44,10 +46,14 @@
|
|||||||
<td class="text-right nowrap">
|
<td class="text-right nowrap">
|
||||||
<app-bsq-amount [bsq]="output.bsqAmount"></app-bsq-amount>
|
<app-bsq-amount [bsq]="output.bsqAmount"></app-bsq-amount>
|
||||||
</td>
|
</td>
|
||||||
<td class="pl-1 arrow-td">
|
<td class="arrow-td">
|
||||||
<i *ngIf="!output.spentInfo; else spent" class="arrow green"></i>
|
<span *ngIf="!output.spentInfo; else spent" class="green">
|
||||||
|
<fa-icon [icon]="['fas', 'arrow-alt-circle-right']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</span>
|
||||||
<ng-template #spent>
|
<ng-template #spent>
|
||||||
<a [routerLink]="['/tx/' | relativeUrl, output.spentInfo.txId]"><i class="arrow red"></i></a>
|
<a [routerLink]="['/tx/' | relativeUrl, output.spentInfo.txId]" class="red">
|
||||||
|
<fa-icon [icon]="['fas', 'arrow-alt-circle-right']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</a>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,62 +1,26 @@
|
|||||||
|
|
||||||
.arrow-td {
|
.arrow-td {
|
||||||
width: 22px;
|
width: 20px;
|
||||||
}
|
}
|
||||||
|
.green, .grey, .red {
|
||||||
.arrow {
|
font-size: 16px;
|
||||||
display: inline-block!important;
|
top: -2px;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 14px;
|
@media( min-width: 576px){
|
||||||
height: 22px;
|
font-size: 19px;
|
||||||
box-sizing: content-box
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow:before {
|
.green {
|
||||||
position: absolute;
|
color:#28a745;
|
||||||
content: '';
|
|
||||||
margin: auto;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: calc(-1*30px/3);
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
border-top: 6.66px solid transparent;
|
|
||||||
border-bottom: 6.66px solid transparent
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow:after {
|
.red {
|
||||||
position: absolute;
|
color:#dc3545;
|
||||||
content: '';
|
|
||||||
margin: auto;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: calc(30px/6);
|
|
||||||
width: calc(30px/3);
|
|
||||||
height: calc(20px/3);
|
|
||||||
background: rgba(0, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow.green:before {
|
.grey {
|
||||||
border-left: 10px solid #28a745;
|
color:#6c757d;
|
||||||
}
|
|
||||||
.arrow.green:after {
|
|
||||||
background-color:#28a745;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow.red:before {
|
|
||||||
border-left: 10px solid #dc3545;
|
|
||||||
}
|
|
||||||
.arrow.red:after {
|
|
||||||
background-color:#dc3545;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow.grey:before {
|
|
||||||
border-left: 10px solid #6c757d;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow.grey:after {
|
|
||||||
background-color:#6c757d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 767.98px) {
|
@media (max-width: 767.98px) {
|
||||||
|
|||||||
@@ -8,10 +8,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="about-text">
|
<div class="about-text" *ngIf="stateService.env.BASE_MODULE === 'mempool'; else marginBox">
|
||||||
<h5><ng-container i18n="about.about-the-project">The Mempool Open Source Project</ng-container> ™</h5>
|
<h5><ng-container i18n="about.about-the-project">The Mempool Open Source Project</ng-container><ng-template [ngIf]="locale.substr(0, 2) === 'en'"> ™</ng-template></h5>
|
||||||
<p i18n>Building a mempool and blockchain explorer for the Bitcoin community, focusing on the transaction fee market and multi-layer ecosystem, without any advertising, altcoins, or third-party trackers.</p>
|
<p i18n>Building a mempool and blockchain explorer for the Bitcoin community, focusing on the transaction fee market and multi-layer ecosystem, without any advertising, altcoins, or third-party trackers.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<ng-template #marginBox>
|
||||||
|
<div class="no-about-margin"></div>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
<div class="social-icons">
|
<div class="social-icons">
|
||||||
<a target="_blank" href="https://github.com/mempool/mempool">
|
<a target="_blank" href="https://github.com/mempool/mempool">
|
||||||
@@ -43,6 +46,14 @@
|
|||||||
<img class="image" src="/resources/profile/exodus.svg" />
|
<img class="image" src="/resources/profile/exodus.svg" />
|
||||||
<span>Exodus</span>
|
<span>Exodus</span>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="https://foundrydigital.com/" target="_blank" title="Foundry">
|
||||||
|
<img class="image" src="/resources/profile/foundry.svg" />
|
||||||
|
<span>Foundry</span>
|
||||||
|
</a>
|
||||||
|
<a href="https://unchained-capital.com/" target="_blank" title="Unchained">
|
||||||
|
<img class="image" src="/resources/profile/unchained.svg" />
|
||||||
|
<span>Unchained</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -115,6 +126,10 @@
|
|||||||
<img class="image" src="/resources/profile/blixt.png" />
|
<img class="image" src="/resources/profile/blixt.png" />
|
||||||
<span>Blixt</span>
|
<span>Blixt</span>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="https://github.com/vulpemventures/marina" target="_blank" title="Marina Wallet">
|
||||||
|
<img class="image" src="/resources/profile/marina.svg" />
|
||||||
|
<span>Marina</span>
|
||||||
|
</a>
|
||||||
<a href="https://github.com/Satpile/satpile" target="_blank" title="Satpile Watch-Only Wallet">
|
<a href="https://github.com/Satpile/satpile" target="_blank" title="Satpile Watch-Only Wallet">
|
||||||
<img class="image" src="/resources/profile/satpile.jpg" />
|
<img class="image" src="/resources/profile/satpile.jpg" />
|
||||||
<span>Satpile</span>
|
<span>Satpile</span>
|
||||||
@@ -175,25 +190,31 @@
|
|||||||
|
|
||||||
<div class="copyright">
|
<div class="copyright">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
Copyright (c) 2019-2021<br />
|
Copyright © 2019-2021<br>
|
||||||
The Mempool Open Source Project
|
The Mempool Open Source Project
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
This program is free software; you can redistribute it and/or modify it under the terms of (at your option) either:<br>
|
<a href="https://github.com/mempool/mempool">The Mempool Open Source Project</a> is free software; you can redistribute it and/or modify it under the terms of (at your option) either:<br>
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
1) the <a href="https://www.gnu.org/licenses/agpl-3.0-standalone.html">GNU Affero General Public License</a> as published by the Free Software Foundation, either version 3 of the License or any later version approved by a proxy statement published on <https://mempool.space/about>; or<br>
|
1) the <a href="https://www.gnu.org/licenses/agpl-3.0-standalone.html">GNU Affero General Public License</a> as published by the Free Software Foundation, either version 3 of the License or any later version approved by a proxy statement published on <https://mempool.space/about>; or<br>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
2) the <a href="https://www.gnu.org/licenses/gpl-3.0-standalone.html">GNU General Public License</a> as published by the Free Software Foundation, either version 3 of the License or any later version approved by a proxy statement published on <https://mempool.space/about>.<br>
|
2) the <a href="https://www.gnu.org/licenses/gpl-3.0-standalone.html">GNU General Public License</a> as published by the Free Software Foundation, either version 3 of the License or any later version approved by a proxy statement published on <https://mempool.space/about>.<br>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the full license terms for more details.<br>
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the full license terms for more details.<br>
|
||||||
</p>
|
</p>
|
||||||
|
<div class="title">
|
||||||
|
Trademark Notice<br>
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
mempool.space™, The Mempool Open Source Project™, and the Mempool block logo are trademarks of Mempool Space K.K. in Japan.
|
The Mempool Open Source Project™, mempool.space™, the mempool logo™, the mempool.space logos™, the mempool square logo™, and the mempool blocks logo™ are either registered trademarks or trademarks of Mempool Space K.K in Japan, the United States, and/or other countries.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
While our software is available under an open source software license, the copyright license does not include an implied right or license to use our trademarks. See our <a href="https://mempool.space/trademark-policy">Trademark Policy and Guidelines</a> for more details, published on <https://mempool.space/trademark-policy>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -176,4 +176,8 @@
|
|||||||
.footer-version {
|
.footer-version {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-about-margin {
|
||||||
|
height: 10px;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Inject, LOCALE_ID, OnInit } from '@angular/core';
|
||||||
import { WebsocketService } from '../../services/websocket.service';
|
import { WebsocketService } from '../../services/websocket.service';
|
||||||
import { SeoService } from 'src/app/services/seo.service';
|
import { SeoService } from 'src/app/services/seo.service';
|
||||||
import { StateService } from 'src/app/services/state.service';
|
import { StateService } from 'src/app/services/state.service';
|
||||||
@@ -25,9 +25,10 @@ export class AboutComponent implements OnInit {
|
|||||||
constructor(
|
constructor(
|
||||||
private websocketService: WebsocketService,
|
private websocketService: WebsocketService,
|
||||||
private seoService: SeoService,
|
private seoService: SeoService,
|
||||||
private stateService: StateService,
|
public stateService: StateService,
|
||||||
private apiService: ApiService,
|
private apiService: ApiService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
@Inject(LOCALE_ID) public locale: string,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -40,7 +41,7 @@ export class AboutComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sponsor() {
|
sponsor() {
|
||||||
if (this.officialMempoolSpace) {
|
if (this.officialMempoolSpace && this.stateService.env.BASE_MODULE === 'mempool') {
|
||||||
this.router.navigateByUrl('/sponsor');
|
this.router.navigateByUrl('/sponsor');
|
||||||
} else {
|
} else {
|
||||||
this.showNavigateToSponsor = true;
|
this.showNavigateToSponsor = true;
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
<div class="col-md">
|
<div class="col-md">
|
||||||
<table class="table table-borderless table-striped">
|
<table class="table table-borderless table-striped">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr *ngIf="addressInfo && addressInfo.unconfidential">
|
||||||
|
<td i18n="address.unconfidential">Unconfidential</td>
|
||||||
|
<td><a [routerLink]="['/address/' | relativeUrl, addressInfo.unconfidential]">{{ addressInfo.unconfidential }}</a> <app-clipboard [text]="addressInfo.unconfidential"></app-clipboard></td>
|
||||||
|
</tr>
|
||||||
<ng-template [ngIf]="!address.electrum">
|
<ng-template [ngIf]="!address.electrum">
|
||||||
<tr>
|
<tr>
|
||||||
<td i18n="address.total-received">Total received</td>
|
<td i18n="address.total-received">Total received</td>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { AudioService } from 'src/app/services/audio.service';
|
|||||||
import { ApiService } from 'src/app/services/api.service';
|
import { ApiService } from 'src/app/services/api.service';
|
||||||
import { of, merge, Subscription, Observable } from 'rxjs';
|
import { of, merge, Subscription, Observable } from 'rxjs';
|
||||||
import { SeoService } from 'src/app/services/seo.service';
|
import { SeoService } from 'src/app/services/seo.service';
|
||||||
|
import { AddressInformation } from 'src/app/interfaces/node-api.interface';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-address',
|
selector: 'app-address',
|
||||||
@@ -27,6 +28,7 @@ export class AddressComponent implements OnInit, OnDestroy {
|
|||||||
error: any;
|
error: any;
|
||||||
mainSubscription: Subscription;
|
mainSubscription: Subscription;
|
||||||
addressLoadingStatus$: Observable<number>;
|
addressLoadingStatus$: Observable<number>;
|
||||||
|
addressInfo: null | AddressInformation = null;
|
||||||
|
|
||||||
totalConfirmedTxCount = 0;
|
totalConfirmedTxCount = 0;
|
||||||
loadedConfirmedTxCount = 0;
|
loadedConfirmedTxCount = 0;
|
||||||
@@ -67,8 +69,12 @@ export class AddressComponent implements OnInit, OnDestroy {
|
|||||||
this.address = null;
|
this.address = null;
|
||||||
this.isLoadingTransactions = true;
|
this.isLoadingTransactions = true;
|
||||||
this.transactions = null;
|
this.transactions = null;
|
||||||
|
this.addressInfo = null;
|
||||||
document.body.scrollTo(0, 0);
|
document.body.scrollTo(0, 0);
|
||||||
this.addressString = params.get('id') || '';
|
this.addressString = params.get('id') || '';
|
||||||
|
if (/^[A-Z]{2,5}1[AC-HJ-NP-Z02-9]{8,100}$/.test(this.addressString)) {
|
||||||
|
this.addressString = this.addressString.toLowerCase();
|
||||||
|
}
|
||||||
this.seoService.setTitle($localize`:@@address.component.browser-title:Address: ${this.addressString}:INTERPOLATION:`);
|
this.seoService.setTitle($localize`:@@address.component.browser-title:Address: ${this.addressString}:INTERPOLATION:`);
|
||||||
|
|
||||||
return merge(
|
return merge(
|
||||||
@@ -92,10 +98,20 @@ export class AddressComponent implements OnInit, OnDestroy {
|
|||||||
)
|
)
|
||||||
.pipe(
|
.pipe(
|
||||||
filter((address) => !!address),
|
filter((address) => !!address),
|
||||||
|
tap((address: Address) => {
|
||||||
|
if (this.stateService.network === 'liquid' && /^([m-zA-HJ-NP-Z1-9]{26,35}|[a-z]{2,5}1[ac-hj-np-z02-9]{8,100}|[a-km-zA-HJ-NP-Z1-9]{80})$/.test(address.address)) {
|
||||||
|
this.apiService.validateAddress$(address.address)
|
||||||
|
.subscribe((addressInfo) => {
|
||||||
|
this.addressInfo = addressInfo;
|
||||||
|
this.websocketService.startTrackAddress(addressInfo.unconfidential);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.websocketService.startTrackAddress(address.address);
|
||||||
|
}
|
||||||
|
}),
|
||||||
switchMap((address) => {
|
switchMap((address) => {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.updateChainStats();
|
this.updateChainStats();
|
||||||
this.websocketService.startTrackAddress(address.address);
|
|
||||||
this.isLoadingAddress = false;
|
this.isLoadingAddress = false;
|
||||||
this.isLoadingTransactions = true;
|
this.isLoadingTransactions = true;
|
||||||
return this.electrsApiService.getAddressTransactions$(address.address);
|
return this.electrsApiService.getAddressTransactions$(address.address);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, OnInit, Input, ChangeDetectionStrategy } from '@angular/core';
|
import { Component, OnInit, OnDestroy, Input, ChangeDetectionStrategy } from '@angular/core';
|
||||||
import { StateService } from '../../services/state.service';
|
import { StateService } from '../../services/state.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, Subscription } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-amount',
|
selector: 'app-amount',
|
||||||
@@ -8,11 +8,13 @@ import { Observable } from 'rxjs';
|
|||||||
styleUrls: ['./amount.component.scss'],
|
styleUrls: ['./amount.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class AmountComponent implements OnInit {
|
export class AmountComponent implements OnInit, OnDestroy {
|
||||||
conversions$: Observable<any>;
|
conversions$: Observable<any>;
|
||||||
viewFiat$: Observable<boolean>;
|
viewFiat$: Observable<boolean>;
|
||||||
network = '';
|
network = '';
|
||||||
|
|
||||||
|
stateSubscription: Subscription;
|
||||||
|
|
||||||
@Input() satoshis: number;
|
@Input() satoshis: number;
|
||||||
@Input() digitsInfo = '1.8-8';
|
@Input() digitsInfo = '1.8-8';
|
||||||
@Input() noFiat = false;
|
@Input() noFiat = false;
|
||||||
@@ -24,7 +26,13 @@ export class AmountComponent implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.viewFiat$ = this.stateService.viewFiat$.asObservable();
|
this.viewFiat$ = this.stateService.viewFiat$.asObservable();
|
||||||
this.conversions$ = this.stateService.conversions$.asObservable();
|
this.conversions$ = this.stateService.conversions$.asObservable();
|
||||||
this.stateService.networkChanged$.subscribe((network) => this.network = network);
|
this.stateSubscription = this.stateService.networkChanged$.subscribe((network) => this.network = network);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
if (this.stateSubscription) {
|
||||||
|
this.stateSubscription.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -69,4 +69,8 @@ li.nav-item {
|
|||||||
}
|
}
|
||||||
.websocket {
|
.websocket {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty {
|
||||||
|
padding: 15px;
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,39 +1,39 @@
|
|||||||
<div class="code">
|
<div class="code">
|
||||||
<ul ngbNav #navCodeTemplate="ngbNav" class="nav-tabs code-tab">
|
<ul ngbNav #navCodeTemplate="ngbNav" class="nav-tabs code-tab">
|
||||||
<li ngbNavItem *ngIf="code.codeSample.curl">
|
<li ngbNavItem *ngIf="code.codeTemplate.curl && method !== 'websocket'">
|
||||||
<a ngbNavLink>cURL</a>
|
<a ngbNavLink>cURL</a>
|
||||||
<ng-template ngbNavContent>
|
<ng-template ngbNavContent>
|
||||||
<div class="subtitle"><ng-container i18n="API Docs code example">Code Example</ng-container> <app-clipboard [text]="wrapCurl(code.codeSample.curl)"></app-clipboard></div>
|
<div class="subtitle"><ng-container i18n="API Docs code example">Code Example</ng-container> <app-clipboard [text]="wrapCurlTemplate(code)"></app-clipboard></div>
|
||||||
<pre><code [innerText]="wrapCurl(code.codeSample.curl)"></code></pre>
|
<pre><code [innerText]="wrapCurlTemplate(code)"></code></pre>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</li>
|
</li>
|
||||||
<li ngbNavItem>
|
<li ngbNavItem>
|
||||||
<a ngbNavLink>CommonJS</a>
|
<a ngbNavLink>CommonJS</a>
|
||||||
<ng-template ngbNavContent>
|
<ng-template ngbNavContent>
|
||||||
<div class="subtitle"><ng-container i18n="API Docs code example">Code Example</ng-container> <app-clipboard [text]="wrapCommonJS(code.codeSample.commonJS)"></app-clipboard></div>
|
<div class="subtitle"><ng-container i18n="API Docs code example">Code Example</ng-container> <app-clipboard [text]="wrapCommonJS(code)"></app-clipboard></div>
|
||||||
<div class="links">
|
<div class="links">
|
||||||
<a href="https://github.com/mempool/mempool.js">github repository</a>
|
<a [href]="npmGithubLink()" target="_blank">github repository</a>
|
||||||
</div>
|
</div>
|
||||||
<pre><code [innerText]="wrapCommonJS(code.codeSample.commonJS)"></code></pre>
|
<pre><code [innerText]="wrapCommonJS(code)"></code></pre>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</li>
|
</li>
|
||||||
<li ngbNavItem>
|
<li ngbNavItem>
|
||||||
<a ngbNavLink>ES Module</a>
|
<a ngbNavLink>ES Module</a>
|
||||||
<ng-template ngbNavContent>
|
<ng-template ngbNavContent>
|
||||||
<div class="subtitle"><ng-container i18n="API Docs install lib">Install Package</ng-container> <app-clipboard [text]="esModuleInstall"></app-clipboard></div>
|
<div class="subtitle"><ng-container i18n="API Docs install lib">Install Package</ng-container> <app-clipboard [text]="wrapImportTemplate()"></app-clipboard></div>
|
||||||
<div class="links">
|
<div class="links">
|
||||||
<a href="https://github.com/mempool/mempool.js">github repository</a>
|
<a [href]="npmGithubLink()" target="_blank">github repository</a>
|
||||||
<a href="https://www.npmjs.org/package/@mempool/mempool.js">npm package</a>
|
<a [href]="npmModuleLink()" target="_blank">npm package</a>
|
||||||
</div>
|
</div>
|
||||||
<pre><code [innerText]="esModuleInstall"></code></pre>
|
<pre><code [innerText]="wrapImportTemplate()"></code></pre>
|
||||||
<div class="subtitle"><ng-container i18n="API Docs code example">Code Example</ng-container> <app-clipboard [text]="wrapESmodule(code.codeSample.esModule)"></app-clipboard></div>
|
<div class="subtitle"><ng-container i18n="API Docs code example">Code Example</ng-container> <app-clipboard [text]="wrapEsModule(code)"></app-clipboard></div>
|
||||||
<pre><code [innerText]="wrapESmodule(code.codeSample.esModule)"></code></pre>
|
<pre><code [innerText]="wrapEsModule(code)"></code></pre>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div [ngbNavOutlet]="navCodeTemplate"></div>
|
<div [ngbNavOutlet]="navCodeTemplate"></div>
|
||||||
<div *ngIf="code.responseSample" class="response">
|
<div *ngIf="code.codeTemplate && wrapResponse(code) !== ''" class="response">
|
||||||
<div class="subtitle"><ng-container i18n="API Docs API response">Response</ng-container> <app-clipboard [text]="code.responseSample"></app-clipboard></div>
|
<div class="subtitle"><ng-container i18n="API Docs API response">Response</ng-container> <app-clipboard [text]="wrapResponse(code)"></app-clipboard></div>
|
||||||
<pre><code [innerText]="code.responseSample"></code></pre>
|
<pre><code [innerText]="wrapResponse(code)"></code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ li.nav-item {
|
|||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.difficulty {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
.links {
|
.links {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
a {
|
a {
|
||||||
@@ -87,5 +91,7 @@ pre {
|
|||||||
padding: 30px;
|
padding: 30px;
|
||||||
code{
|
code{
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
white-space: break-spaces;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,69 +1,189 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { Env, StateService } from 'src/app/services/state.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-code-template',
|
selector: 'app-code-template',
|
||||||
templateUrl: './code-template.component.html',
|
templateUrl: './code-template.component.html',
|
||||||
styleUrls: ['./code-template.component.scss']
|
styleUrls: ['./code-template.component.scss']
|
||||||
})
|
})
|
||||||
export class CodeTemplateComponent {
|
export class CodeTemplateComponent implements OnInit {
|
||||||
@Input() network: string;
|
@Input() network: string;
|
||||||
@Input() code: {
|
@Input() code: any;
|
||||||
codeSample: {
|
@Input() hostname: string;
|
||||||
esModule: string;
|
@Input() method: 'get' | 'post' | 'websocket' = 'get';
|
||||||
commonJS: string;
|
env: Env;
|
||||||
curl: string;
|
|
||||||
},
|
|
||||||
responseSample: string;
|
|
||||||
};
|
|
||||||
hostname = document.location.hostname;
|
|
||||||
esModuleInstall = `# npm
|
|
||||||
npm install @mempool/mempool.js --save
|
|
||||||
|
|
||||||
# yarn
|
|
||||||
yarn add @mempool/mempool.js`;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private stateService: StateService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
normalizeCodeHostname(code: string) {
|
ngOnInit(): void {
|
||||||
let codeText: string;
|
this.env = this.stateService.env;
|
||||||
if (this.network === 'bisq' || this.network === 'liquid'){
|
}
|
||||||
codeText = code.replace('%{1}', this.network);
|
|
||||||
}else{
|
npmGithubLink(){
|
||||||
codeText = code.replace('%{1}', 'bitcoin');
|
let npmLink = `https://github.com/mempool/mempool.js`;
|
||||||
|
if (this.network === 'bisq') {
|
||||||
|
npmLink = `https://github.com/mempool/mempool.js/tree/main/npm-bisq-js`;
|
||||||
|
}
|
||||||
|
if (this.network === 'liquid') {
|
||||||
|
npmLink = `https://github.com/mempool/mempool.js/tree/main/npm-liquid-js`;
|
||||||
|
}
|
||||||
|
return npmLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
npmModuleLink() {
|
||||||
|
let npmLink = `https://www.npmjs.org/package/@mempool/mempool.js`;
|
||||||
|
if (this.network === 'bisq') {
|
||||||
|
npmLink = `https://www.npmjs.org/package/@mempool/bisq.js`;
|
||||||
|
}
|
||||||
|
if (this.network === 'liquid') {
|
||||||
|
npmLink = `https://www.npmjs.org/package/@mempool/liquid.js`;
|
||||||
|
}
|
||||||
|
return npmLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
normalizeHostsESModule(codeText: string) {
|
||||||
|
if (this.env.BASE_MODULE === 'mempool') {
|
||||||
|
if (['liquid', 'bisq'].includes(this.network)) {
|
||||||
|
codeText = codeText.replace('%{0}', this.network);
|
||||||
|
} else {
|
||||||
|
codeText = codeText.replace('%{0}', 'bitcoin');
|
||||||
|
}
|
||||||
|
if(['', 'main', 'liquid', 'bisq'].includes(this.network)) {
|
||||||
|
codeText = codeText.replace('mempoolJS();', `mempoolJS({
|
||||||
|
hostname: '${document.location.hostname}'
|
||||||
|
});`);
|
||||||
|
} else {
|
||||||
|
codeText = codeText.replace('mempoolJS();', `mempoolJS({
|
||||||
|
hostname: '${document.location.hostname}',
|
||||||
|
network: '${this.network}'
|
||||||
|
});`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.env.BASE_MODULE === 'bisq') {
|
||||||
|
codeText = codeText.replace('} = mempoolJS();', ` = bisqJS();`);
|
||||||
|
codeText = codeText.replace('{ %{0}: ', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.env.BASE_MODULE === 'liquid') {
|
||||||
|
codeText = codeText.replace('} = mempoolJS();', ` = liquidJS();`);
|
||||||
|
codeText = codeText.replace('{ %{0}: ', '');
|
||||||
}
|
}
|
||||||
return codeText;
|
return codeText;
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapESmodule(code: string) {
|
normalizeHostsCommonJS(codeText: string) {
|
||||||
let codeText = this.normalizeCodeHostname(code);
|
if (this.env.BASE_MODULE === 'mempool') {
|
||||||
|
if (['liquid', 'bisq'].includes(this.network)) {
|
||||||
if (this.network && this.network !== 'mainnet') {
|
codeText = codeText.replace('%{0}', this.network);
|
||||||
codeText = codeText.replace('mempoolJS();', `mempoolJS({
|
} else {
|
||||||
hostname: '${this.hostname}/${this.network}'
|
codeText = codeText.replace('%{0}', 'bitcoin');
|
||||||
});` );
|
}
|
||||||
|
if(['', 'main', 'liquid', 'bisq'].includes(this.network)) {
|
||||||
|
codeText = codeText.replace('mempoolJS();', `mempoolJS({
|
||||||
|
hostname: '${document.location.hostname}'
|
||||||
|
});`);
|
||||||
|
} else {
|
||||||
|
codeText = codeText.replace('mempoolJS();', `mempoolJS({
|
||||||
|
hostname: '${document.location.hostname}',
|
||||||
|
network: '${this.network}'
|
||||||
|
});`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return `import mempoolJS from "@mempool/mempool.js";
|
if (this.env.BASE_MODULE === 'bisq') {
|
||||||
|
codeText = codeText.replace('} = mempoolJS();', ` = bisqJS();`);
|
||||||
|
codeText = codeText.replace('{ %{0}: ', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.env.BASE_MODULE === 'liquid') {
|
||||||
|
codeText = codeText.replace('} = mempoolJS();', ` = liquidJS();`);
|
||||||
|
codeText = codeText.replace('{ %{0}: ', '');
|
||||||
|
}
|
||||||
|
return codeText;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapEsModule(code: any) {
|
||||||
|
let codeText: string;
|
||||||
|
if (code.codeTemplate) {
|
||||||
|
codeText = this.normalizeHostsESModule(code.codeTemplate.esModule);
|
||||||
|
|
||||||
|
if(this.network === '' || this.network === 'main') {
|
||||||
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleMainnet.esModule);
|
||||||
|
}
|
||||||
|
if (this.network === 'testnet') {
|
||||||
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleTestnet.esModule);
|
||||||
|
}
|
||||||
|
if (this.network === 'signet') {
|
||||||
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleSignet.esModule);
|
||||||
|
}
|
||||||
|
if (this.network === 'liquid') {
|
||||||
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleLiquid.esModule);
|
||||||
|
}
|
||||||
|
if (this.network === 'bisq') {
|
||||||
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleBisq.esModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
let importText = `import mempoolJS from "@mempool/mempool.js";`;
|
||||||
|
if (this.env.BASE_MODULE === 'bisq') {
|
||||||
|
importText = `import bisqJS from "@mempool/bisq.js";`;
|
||||||
|
}
|
||||||
|
if (this.env.BASE_MODULE === 'liquid') {
|
||||||
|
importText = `import liquidJS from "@mempool/liquid.js";`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${importText}
|
||||||
|
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
${codeText}
|
${codeText}
|
||||||
};
|
};
|
||||||
init();`;
|
init();`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapCommonJS(code: string) {
|
wrapCommonJS(code: any) {
|
||||||
let codeText = this.normalizeCodeHostname(code);
|
let codeText: string;
|
||||||
|
if (code.codeTemplate) {
|
||||||
|
codeText = this.normalizeHostsCommonJS(code.codeTemplate.commonJS);
|
||||||
|
|
||||||
if (this.network && this.network !== 'mainnet') {
|
if(this.network === '' || this.network === 'main') {
|
||||||
codeText = codeText.replace('mempoolJS();', `mempoolJS({
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleMainnet.esModule);
|
||||||
hostname: '${this.hostname}/${this.network}'
|
}
|
||||||
});` );
|
if (this.network === 'testnet') {
|
||||||
}
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleTestnet.esModule);
|
||||||
return `<!DOCTYPE html>
|
}
|
||||||
|
if (this.network === 'signet') {
|
||||||
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleSignet.esModule);
|
||||||
|
}
|
||||||
|
if (this.network === 'liquid') {
|
||||||
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleLiquid.esModule);
|
||||||
|
}
|
||||||
|
if (this.network === 'bisq') {
|
||||||
|
codeText = this.replaceJSPlaceholder(codeText, code.codeSampleBisq.esModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
let importText = `<script src="https://mempool.space/mempool.js"></script>`;
|
||||||
|
if (this.env.BASE_MODULE === 'bisq') {
|
||||||
|
importText = `<script src="https://bisq.markets/bisq.js"></script>`;
|
||||||
|
}
|
||||||
|
if (this.env.BASE_MODULE === 'liquid') {
|
||||||
|
importText = `<script src="https://liquid.network/liquid.js"></script>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let resultHtml = '<pre id="result"></pre>';
|
||||||
|
if (this.method === 'websocket') {
|
||||||
|
resultHtml = `<pre id="result-blocks"></pre>
|
||||||
|
<pre id="result-mempool-info"></pre>
|
||||||
|
<pre id="result-transactions"></pre>
|
||||||
|
<pre id="result-mempool-blocks"></pre>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="https://mempool.space/mempool.js"></script>
|
${importText}
|
||||||
<script>
|
<script>
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
${codeText}
|
${codeText}
|
||||||
@@ -71,14 +191,112 @@ init();`;
|
|||||||
init();
|
init();
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body>
|
||||||
|
${resultHtml}
|
||||||
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
}
|
|
||||||
wrapCurl(code: string) {
|
|
||||||
if (this.network && this.network !== 'mainnet') {
|
|
||||||
return code.replace('mempool.space/', `mempool.space/${this.network}/`);
|
|
||||||
}
|
}
|
||||||
return code;
|
}
|
||||||
|
|
||||||
|
wrapImportTemplate() {
|
||||||
|
|
||||||
|
let importTemplate = `# npm
|
||||||
|
npm install @mempool/mempool.js --save
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn add @mempool/mempool.js`;
|
||||||
|
|
||||||
|
if (this.env.BASE_MODULE === 'bisq') {
|
||||||
|
importTemplate = `# npm
|
||||||
|
npm install @mempool/bisq.js --save
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn add @mempool/bisq.js`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.env.BASE_MODULE === 'liquid') {
|
||||||
|
importTemplate = `# npm
|
||||||
|
npm install @mempool/liquid.js --save
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn add @mempool/liquid.js`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return importTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapCurlTemplate(code: any) {
|
||||||
|
if (code.codeTemplate) {
|
||||||
|
if (this.network === 'testnet') {
|
||||||
|
return this.replaceCurlPlaceholder(code.codeTemplate.curl, code.codeSampleTestnet);
|
||||||
|
}
|
||||||
|
if (this.network === 'signet') {
|
||||||
|
return this.replaceCurlPlaceholder(code.codeTemplate.curl, code.codeSampleSignet);
|
||||||
|
}
|
||||||
|
if (this.network === 'liquid') {
|
||||||
|
return this.replaceCurlPlaceholder(code.codeTemplate.curl, code.codeSampleLiquid);
|
||||||
|
}
|
||||||
|
if (this.network === 'bisq') {
|
||||||
|
return this.replaceCurlPlaceholder(code.codeTemplate.curl, code.codeSampleBisq);
|
||||||
|
}
|
||||||
|
if (this.network === '' || this.network === 'main') {
|
||||||
|
return this.replaceCurlPlaceholder(code.codeTemplate.curl, code.codeSampleMainnet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wrapResponse(code: any) {
|
||||||
|
if (this.method === 'websocket') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (this.network === 'testnet') {
|
||||||
|
return code.codeSampleTestnet.response;
|
||||||
|
}
|
||||||
|
if (this.network === 'signet') {
|
||||||
|
return code.codeSampleSignet.response;
|
||||||
|
}
|
||||||
|
if (this.network === 'liquid') {
|
||||||
|
return code.codeSampleLiquid.response;
|
||||||
|
}
|
||||||
|
if (this.network === 'bisq') {
|
||||||
|
return code.codeSampleBisq.response;
|
||||||
|
}
|
||||||
|
return code.codeSampleMainnet.response;
|
||||||
|
}
|
||||||
|
|
||||||
|
replaceJSPlaceholder(text: string, code: any) {
|
||||||
|
for (let index = 0; index < code.length; index++) {
|
||||||
|
const textReplace = code[index];
|
||||||
|
const indexNumber = index + 1;
|
||||||
|
text = text.replace('%{' + indexNumber + '}', textReplace);
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
replaceCurlPlaceholder(curlText: any, code: any) {
|
||||||
|
let text = curlText;
|
||||||
|
for (let index = 0; index < code.curl.length; index++) {
|
||||||
|
const textReplace = code.curl[index];
|
||||||
|
const indexNumber = index + 1;
|
||||||
|
text = text.replace('%{' + indexNumber + '}', textReplace);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.env.BASE_MODULE === 'mempool') {
|
||||||
|
if (this.network === 'main' || this.network === '') {
|
||||||
|
if (this.method === 'post') {
|
||||||
|
return `curl POST -sSLd "${text}"`;
|
||||||
|
}
|
||||||
|
return `curl -sSL "${this.hostname}${text}"`;
|
||||||
|
}
|
||||||
|
if (this.method === 'post') {
|
||||||
|
text = text.replace('/api', `/${this.network}/api`);
|
||||||
|
return `curl POST -sSLd "${text}"`;
|
||||||
|
}
|
||||||
|
return `curl -sSL "${this.hostname}/${this.network}${text}"`;
|
||||||
|
}
|
||||||
|
if (this.env.BASE_MODULE !== 'mempool') {
|
||||||
|
return `curl -sSL "${this.hostname}${text}"`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
|
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
|
||||||
<a class="navbar-brand" [routerLink]="['/' | relativeUrl]" style="position: relative;">
|
<a class="navbar-brand" [routerLink]="['/' | relativeUrl]" style="position: relative;">
|
||||||
<ng-container *ngIf="{ val: connectionState$ | async } as connectionState">
|
<ng-container *ngIf="{ val: connectionState$ | async } as connectionState">
|
||||||
<img [src]="'./resources/bisq-markets.svg'" height="35" width="180" class="logo" [ngStyle]="{'opacity': connectionState.val === 2 ? 1 : 0.5 }">
|
<img src="./resources/bisq/bisq-markets-logo.png" height="35" width="140" class="logo" [ngStyle]="{'opacity': connectionState.val === 2 ? 1 : 0.5 }">
|
||||||
<div class="connection-badge">
|
<div class="connection-badge">
|
||||||
<div class="badge badge-warning" *ngIf="connectionState.val === 0" i18n="master-page.offline">Offline</div>
|
<div class="badge badge-warning" *ngIf="connectionState.val === 0" i18n="master-page.offline">Offline</div>
|
||||||
<div class="badge badge-warning" *ngIf="connectionState.val === 1" i18n="master-page.reconnecting">Reconnecting...</div>
|
<div class="badge badge-warning" *ngIf="connectionState.val === 1" i18n="master-page.reconnecting">Reconnecting...</div>
|
||||||
@@ -10,15 +10,42 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<div ngbDropdown (window:resize)="onResize($event)" class="dropdown-container" *ngIf="env.TESTNET_ENABLED || env.SIGNET_ENABLED || env.LIQUID_ENABLED || env.BISQ_ENABLED">
|
||||||
|
<button ngbDropdownToggle type="button" class="btn btn-secondary dropdown-toggle-split" aria-haspopup="true">
|
||||||
|
<img src="./resources/bisq-logo.png" style="width: 25px; height: 25px;" class="mr-1">
|
||||||
|
</button>
|
||||||
|
<div ngbDropdownMenu [ngClass]="{'dropdown-menu-right' : isMobile}">
|
||||||
|
<a href="https://mempool.space" ngbDropdownItem class="mainnet"><img src="./resources/bitcoin-logo.png" style="width: 30px;" class="mr-1"> Mainnet</a>
|
||||||
|
<a href="https://mempool.space/signet" ngbDropdownItem *ngIf="env.SIGNET_ENABLED" class="signet"><img src="./resources/signet-logo.png" style="width: 30px;" class="mr-1"> Signet</a>
|
||||||
|
<a href="https://mempool.space/testnet" ngbDropdownItem *ngIf="env.TESTNET_ENABLED" class="testnet"><img src="./resources/testnet-logo.png" style="width: 30px;" class="mr-1"> Testnet</a>
|
||||||
|
<h6 class="dropdown-header" i18n="master-page.layer2-networks-header">Layer 2 Networks</h6>
|
||||||
|
<button ngbDropdownItem class="mainnet active" routerLink="/"><img src="./resources/bisq-logo.png" style="width: 30px;" class="mr-1"> Bisq</button>
|
||||||
|
<a href="https://liquid.network" ngbDropdownItem *ngIf="env.LIQUID_ENABLED" class="liquid"><img src="./resources/liquid-logo.png" style="width: 30px;" class="mr-1"> Liquid</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="navbar-collapse" id="navbarCollapse">
|
<div class="navbar-collapse" id="navbarCollapse">
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
|
<li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
|
||||||
<a class="nav-link" [routerLink]="['/' | relativeUrl]" (click)="collapse()"><fa-icon [icon]="['fas', 'tachometer-alt']" [fixedWidth]="true" i18n-title="master-page.dashboard" title="Dashboard"></fa-icon></a>
|
<a class="nav-link" [routerLink]="['/' | relativeUrl]" (click)="collapse()"><fa-icon [icon]="['fas', 'tachometer-alt']" [fixedWidth]="true" i18n-title="master-page.dashboard" title="Dashboard"></fa-icon></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
|
||||||
|
<a class="nav-link" [routerLink]="['/transactions']" (click)="collapse()"><fa-icon [icon]="['fas', 'list']" [fixedWidth]="true" i18n-title="master-page.transactions" title="Transactions"></fa-icon></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" routerLinkActive="active">
|
||||||
|
<a class="nav-link" [routerLink]="['/blocks']" (click)="collapse()"><fa-icon [icon]="['fas', 'cubes']" [fixedWidth]="true" i18n-title="master-page.blocks" title="Blocks"></fa-icon></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" routerLinkActive="active">
|
||||||
|
<a class="nav-link" [routerLink]="['/stats']" (click)="collapse()"><fa-icon [icon]="['fas', 'file-alt']" [fixedWidth]="true" i18n-title="master-page.stats" title="Stats"></fa-icon></a>
|
||||||
|
</li>
|
||||||
<li class="nav-item mr-2" routerLinkActive="active">
|
<li class="nav-item mr-2" routerLinkActive="active">
|
||||||
<a class="nav-link" [routerLink]="['/api' | relativeUrl]" (click)="collapse()"><fa-icon [icon]="['fas', 'cogs']" [fixedWidth]="true" i18n-title="master-page.api" title="API"></fa-icon></a>
|
<a class="nav-link" [routerLink]="['/api' | relativeUrl]" (click)="collapse()"><fa-icon [icon]="['fas', 'cogs']" [fixedWidth]="true" i18n-title="master-page.api" title="API"></fa-icon></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item" routerLinkActive="active">
|
||||||
|
<a class="nav-link" [routerLink]="['/about']" (click)="collapse()"><fa-icon [icon]="['fas', 'info-circle']" [fixedWidth]="true" i18n-title="master-page.about" title="About"></fa-icon></a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<app-search-form class="search-form-container" location="top" (searchTriggered)="collapse()"></app-search-form>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -8,14 +8,16 @@ fa-icon {
|
|||||||
|
|
||||||
.navbar {
|
.navbar {
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
min-height: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.nav-item {
|
li.nav-item {
|
||||||
|
margin: auto 5px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.navbar {
|
.navbar {
|
||||||
padding: 0rem 2rem;
|
padding: 0rem 2rem;
|
||||||
}
|
}
|
||||||
@@ -26,17 +28,54 @@ li.nav-item {
|
|||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
li.nav-item {
|
li.nav-item {
|
||||||
|
margin: auto 0px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
li.nav-item a {
|
.navbar-nav {
|
||||||
color: #ffffff;
|
background: #212121;
|
||||||
|
bottom: 0;
|
||||||
|
box-shadow: 0px 0px 15px 0px #000;
|
||||||
|
flex-direction: row;
|
||||||
|
left: 0;
|
||||||
|
justify-content: center;
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
background: transparent;
|
||||||
|
box-shadow: none;
|
||||||
|
position: relative;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
font-size: 0.8em;
|
||||||
|
@media (min-width: 375px) {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-nav {
|
|
||||||
flex-direction: row;
|
.navbar-collapse {
|
||||||
justify-content: center;
|
flex-basis: auto;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
.navbar-collapse {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
.navbar-brand {
|
||||||
|
width: 140px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
@@ -81,5 +120,20 @@ nav {
|
|||||||
|
|
||||||
.dropdown-item {
|
.dropdown-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items:center;
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
.search-form-container {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 500px;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.navbar-dark .navbar-nav .nav-link {
|
||||||
|
color: #f1f1f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { StateService } from '../../services/state.service';
|
import { Env, StateService } from '../../services/state.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -10,16 +10,23 @@ import { Observable } from 'rxjs';
|
|||||||
export class BisqMasterPageComponent implements OnInit {
|
export class BisqMasterPageComponent implements OnInit {
|
||||||
connectionState$: Observable<number>;
|
connectionState$: Observable<number>;
|
||||||
navCollapsed = false;
|
navCollapsed = false;
|
||||||
|
env: Env;
|
||||||
|
isMobile = window.innerWidth <= 767.98;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.env = this.stateService.env;
|
||||||
this.connectionState$ = this.stateService.connectionState$;
|
this.connectionState$ = this.stateService.connectionState$;
|
||||||
}
|
}
|
||||||
|
|
||||||
collapse(): void {
|
collapse(): void {
|
||||||
this.navCollapsed = !this.navCollapsed;
|
this.navCollapsed = !this.navCollapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onResize(event: any) {
|
||||||
|
this.isMobile = window.innerWidth <= 767.98;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,39 @@
|
|||||||
<div class="container-xl">
|
<div class="container-xl" (window:resize)="onResize($event)">
|
||||||
|
|
||||||
<div class="title-block" id="block">
|
<div class="title-block" id="block">
|
||||||
<h1><ng-template [ngIf]="blockHeight === 0" i18n="block.genesis">Genesis </ng-template><ng-template [ngIf]="blockHeight" i18n="block.block">Block <a [routerLink]="['/block/' | relativeUrl, blockHash]">{{ blockHeight }}</a></ng-template></h1>
|
<h1>
|
||||||
|
<ng-template [ngIf]="blockHeight === 0" i18n="block.genesis">Genesis
|
||||||
|
<div class="next-previous-blocks">
|
||||||
|
<a *ngIf="showNextBlocklink" [routerLink]="['/block/' | relativeUrl, nextBlockHeight]" (click)="navigateToNextBlock()" i18n-ngbTooltip="Next Block" ngbTooltip="Next Block" placement="bottom">
|
||||||
|
<fa-icon [icon]="['fas', 'angle-left']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</a>
|
||||||
|
<a [routerLink]="['/block/' | relativeUrl, blockHash]">{{ blockHeight }}</a>
|
||||||
|
<span placement="bottom" class="disable">
|
||||||
|
<fa-icon [icon]="['fas', 'angle-right']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template [ngIf]="blockHeight" i18n="block.block"> Block
|
||||||
|
<div class="next-previous-blocks">
|
||||||
|
<a *ngIf="showNextBlocklink" [routerLink]="['/block/' | relativeUrl, nextBlockHeight]" (click)="navigateToNextBlock()" i18n-ngbTooltip="Next Block" ngbTooltip="Next Block" placement="bottom">
|
||||||
|
<fa-icon [icon]="['fas', 'angle-left']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</a>
|
||||||
|
<span *ngIf="!showNextBlocklink" placement="bottom" class="disable">
|
||||||
|
<fa-icon [icon]="['fas', 'angle-left']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</span>
|
||||||
|
<a [routerLink]="['/block/' | relativeUrl, blockHash]">{{ blockHeight }}</a>
|
||||||
|
<a *ngIf="showPreviousBlocklink && block" [routerLink]="['/block/' | relativeUrl, block.previousblockhash]" (click)="navigateToPreviousBlock()" i18n-ngbTooltip="Previous Block" ngbTooltip="Previous Block" placement="bottom">
|
||||||
|
<fa-icon [icon]="['fas', 'angle-right']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</a>
|
||||||
|
<span *ngIf="!showPreviousBlocklink" placement="bottom" class="disable">
|
||||||
|
<fa-icon [icon]="['fas', 'angle-right']" [fixedWidth]="true"></fa-icon>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="grow"></div>
|
||||||
|
|
||||||
<button [routerLink]="['/' | relativeUrl]" class="btn btn-sm">✕</button>
|
<button [routerLink]="['/' | relativeUrl]" class="btn btn-sm">✕</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -92,14 +124,14 @@
|
|||||||
<td class="td-width" i18n="transaction.version">Version</td>
|
<td class="td-width" i18n="transaction.version">Version</td>
|
||||||
<td>{{ block.version | decimal2hex }} <span *ngIf="displayTaprootStatus() && hasTaproot(block.version)" class="badge badge-success ml-1" >Taproot</span></td>
|
<td>{{ block.version | decimal2hex }} <span *ngIf="displayTaprootStatus() && hasTaproot(block.version)" class="badge badge-success ml-1" >Taproot</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td i18n="block.merkle-root">Merkle root</td>
|
|
||||||
<td><p class="break-all">{{ block.merkle_root }}</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr *ngIf="network !== 'liquid'">
|
<tr *ngIf="network !== 'liquid'">
|
||||||
<td i18n="block.bits">Bits</td>
|
<td i18n="block.bits">Bits</td>
|
||||||
<td>{{ block.bits | decimal2hex }}</td>
|
<td>{{ block.bits | decimal2hex }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td i18n="block.merkle-root">Merkle root</td>
|
||||||
|
<td><p class="break-all">{{ block.merkle_root }}</p></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -114,6 +146,10 @@
|
|||||||
<td i18n="block.nonce">Nonce</td>
|
<td i18n="block.nonce">Nonce</td>
|
||||||
<td>{{ block.nonce | decimal2hex }}</td>
|
<td>{{ block.nonce | decimal2hex }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td i18n="block.header">Block Header Hex</td>
|
||||||
|
<td><a target="_blank" href="{{ network === '' ? '' : '/' + network }}/api/block/{{block.id}}/header"><fa-icon [icon]="['fas', 'external-link-alt']" [fixedWidth]="true"></fa-icon></a></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -122,25 +158,24 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-right mt-3">
|
<div class="text-right mt-3">
|
||||||
<button type="button" class="btn btn-outline-info btn-sm" (click)="toggleShowDetails()" i18n="transaction.details|Transaction Details">Details</button>
|
<button type="button" class="btn btn-outline-info btn-sm btn-details" (click)="toggleShowDetails()" i18n="transaction.details|Transaction Details">Details</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<div #blockTxTitle id="block-tx-title" class="block-tx-title">
|
||||||
|
<h2>
|
||||||
<h2 class="float-left">
|
<ng-container *ngTemplateOutlet="block.tx_count === 1 ? transactionsSingular : transactionsPlural; context: {$implicit: block.tx_count | number}"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="block.tx_count === 1 ? transactionsSingular : transactionsPlural; context: {$implicit: block.tx_count | number}"></ng-container>
|
<ng-template #transactionsSingular let-i i18n="shared.transaction-count.singular">{{ i }} transaction</ng-template>
|
||||||
<ng-template #transactionsSingular let-i i18n="shared.transaction-count.singular">{{ i }} transaction</ng-template>
|
<ng-template #transactionsPlural let-i i18n="shared.transaction-count.plural">{{ i }} transactions</ng-template>
|
||||||
<ng-template #transactionsPlural let-i i18n="shared.transaction-count.plural">{{ i }} transactions</ng-template>
|
</h2>
|
||||||
</h2>
|
|
||||||
|
|
||||||
<ngb-pagination class="float-right" [collectionSize]="block.tx_count" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="paginationMaxSize" [boundaryLinks]="true"></ngb-pagination>
|
|
||||||
|
|
||||||
|
<ngb-pagination class="pagination-container" [collectionSize]="block.tx_count" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page, blockTxTitle)" [maxSize]="paginationMaxSize" [boundaryLinks]="true" [ellipses]="false"></ngb-pagination>
|
||||||
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
<app-transactions-list [transactions]="transactions"></app-transactions-list>
|
<app-transactions-list [transactions]="transactions"></app-transactions-list>
|
||||||
|
|
||||||
<ng-template [ngIf]="isLoadingTransactions">
|
<ng-template [ngIf]="isLoadingTransactions">
|
||||||
<div class="text-center mb-4">
|
<div class="text-center mb-4 mt-3">
|
||||||
|
|
||||||
<div class="header-bg box" style="padding: 10px; margin-bottom: 10px;">
|
<div class="header-bg box" style="padding: 10px; margin-bottom: 10px;">
|
||||||
<span class="skeleton-loader"></span>
|
<span class="skeleton-loader"></span>
|
||||||
@@ -167,8 +202,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
<ngb-pagination class="pagination-container float-right" [collectionSize]="block.tx_count" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page, blockTxTitle)" [maxSize]="paginationMaxSize" [boundaryLinks]="true" [ellipses]="false"></ngb-pagination>
|
||||||
<ngb-pagination class="float-right" [collectionSize]="block.tx_count" [rotate]="true" [pageSize]="itemsPerPage" [(page)]="page" (pageChange)="pageChange(page)" [maxSize]="paginationMaxSize" [boundaryLinks]="true"></ngb-pagination>
|
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ h1 {
|
|||||||
float: left;
|
float: left;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
a {
|
||||||
|
&:hover, &:focus{
|
||||||
|
text-decoration: none;;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.address-link {
|
.address-link {
|
||||||
@@ -71,4 +76,68 @@ h1 {
|
|||||||
.details-table td:first-child {
|
.details-table td:first-child {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-details {
|
||||||
|
position: relative;
|
||||||
|
top: 7px;
|
||||||
|
@media (min-width: 550px) {
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-tx-title {
|
||||||
|
padding-top: 10px;
|
||||||
|
display: block;
|
||||||
|
text-align: right;
|
||||||
|
margin-top: -30px;
|
||||||
|
@media (min-width: 550px) {
|
||||||
|
margin-top: 0px;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
line-height: 1.6;
|
||||||
|
margin: 0;
|
||||||
|
margin-bottom: -15px;
|
||||||
|
padding-right: 10px;
|
||||||
|
padding-top: 15px;
|
||||||
|
position: relative;
|
||||||
|
top: -22px;
|
||||||
|
width: auto;
|
||||||
|
@media (min-width: 550px) {
|
||||||
|
padding-top: 0px;
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
padding-top: 5px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.grow {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.next-previous-blocks {
|
||||||
|
font-size: 36px;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: bottom;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #1ad8f4;
|
||||||
|
&:hover, &:focus {
|
||||||
|
color: #09a3ba;
|
||||||
|
display: inline-block;
|
||||||
|
// transform: scale(1.2);
|
||||||
|
// transition: 150ms all ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.disable {
|
||||||
|
font-size: 36px;
|
||||||
|
color: #393e5c73;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
import { Component, OnInit, OnDestroy, ViewChild, ElementRef } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||||
import { ElectrsApiService } from '../../services/electrs-api.service';
|
import { ElectrsApiService } from '../../services/electrs-api.service';
|
||||||
@@ -18,14 +18,15 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
network = '';
|
network = '';
|
||||||
block: Block;
|
block: Block;
|
||||||
blockHeight: number;
|
blockHeight: number;
|
||||||
|
nextBlockHeight: number;
|
||||||
blockHash: string;
|
blockHash: string;
|
||||||
isLoadingBlock = true;
|
isLoadingBlock = true;
|
||||||
latestBlock: Block;
|
latestBlock: Block;
|
||||||
|
latestBlocks: Block[] = [];
|
||||||
transactions: Transaction[];
|
transactions: Transaction[];
|
||||||
isLoadingTransactions = true;
|
isLoadingTransactions = true;
|
||||||
error: any;
|
error: any;
|
||||||
blockSubsidy: number;
|
blockSubsidy: number;
|
||||||
subscription: Subscription;
|
|
||||||
fees: number;
|
fees: number;
|
||||||
paginationMaxSize: number;
|
paginationMaxSize: number;
|
||||||
coinbaseTx: Transaction;
|
coinbaseTx: Transaction;
|
||||||
@@ -33,6 +34,14 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
itemsPerPage: number;
|
itemsPerPage: number;
|
||||||
txsLoadingStatus$: Observable<number>;
|
txsLoadingStatus$: Observable<number>;
|
||||||
showDetails = false;
|
showDetails = false;
|
||||||
|
showPreviousBlocklink = true;
|
||||||
|
showNextBlocklink = true;
|
||||||
|
|
||||||
|
subscription: Subscription;
|
||||||
|
keyNavigationSubscription: Subscription;
|
||||||
|
blocksSubscription: Subscription;
|
||||||
|
networkChangedSubscription: Subscription;
|
||||||
|
queryParamsSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
@@ -46,7 +55,7 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.websocketService.want(['blocks', 'mempool-blocks']);
|
this.websocketService.want(['blocks', 'mempool-blocks']);
|
||||||
this.paginationMaxSize = window.matchMedia('(max-width: 700px)').matches ? 3 : 5;
|
this.paginationMaxSize = window.matchMedia('(max-width: 670px)').matches ? 3 : 5;
|
||||||
this.network = this.stateService.network;
|
this.network = this.stateService.network;
|
||||||
this.itemsPerPage = this.stateService.env.ITEMS_PER_PAGE;
|
this.itemsPerPage = this.stateService.env.ITEMS_PER_PAGE;
|
||||||
|
|
||||||
@@ -56,8 +65,20 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
map((indicators) => indicators['blocktxs-' + this.blockHash] !== undefined ? indicators['blocktxs-' + this.blockHash] : 0)
|
map((indicators) => indicators['blocktxs-' + this.blockHash] !== undefined ? indicators['blocktxs-' + this.blockHash] : 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.subscription = this.route.paramMap
|
this.blocksSubscription = this.stateService.blocks$
|
||||||
.pipe(
|
.subscribe(([block]) => {
|
||||||
|
this.latestBlock = block;
|
||||||
|
this.latestBlocks.unshift(block);
|
||||||
|
this.latestBlocks = this.latestBlocks.slice(0, this.stateService.env.KEEP_BLOCKS_AMOUNT);
|
||||||
|
this.setNextAndPreviousBlockLink();
|
||||||
|
|
||||||
|
if (block.id === this.blockHash) {
|
||||||
|
this.block = block;
|
||||||
|
this.fees = block.reward / 100000000 - this.blockSubsidy;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.subscription = this.route.paramMap.pipe(
|
||||||
switchMap((params: ParamMap) => {
|
switchMap((params: ParamMap) => {
|
||||||
const blockHash: string = params.get('id') || '';
|
const blockHash: string = params.get('id') || '';
|
||||||
this.block = undefined;
|
this.block = undefined;
|
||||||
@@ -85,7 +106,12 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
this.isLoadingBlock = true;
|
this.isLoadingBlock = true;
|
||||||
|
|
||||||
|
let blockInCache: Block;
|
||||||
if (isBlockHeight) {
|
if (isBlockHeight) {
|
||||||
|
blockInCache = this.latestBlocks.find((block) => block.height === parseInt(blockHash, 10));
|
||||||
|
if (blockInCache) {
|
||||||
|
return of(blockInCache);
|
||||||
|
}
|
||||||
return this.electrsApiService.getBlockHashFromHeight$(parseInt(blockHash, 10))
|
return this.electrsApiService.getBlockHashFromHeight$(parseInt(blockHash, 10))
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap((hash) => {
|
switchMap((hash) => {
|
||||||
@@ -97,12 +123,21 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockInCache = this.latestBlocks.find((block) => block.id === this.blockHash);
|
||||||
|
if (blockInCache) {
|
||||||
|
return of(blockInCache);
|
||||||
|
}
|
||||||
|
|
||||||
return this.electrsApiService.getBlock$(blockHash);
|
return this.electrsApiService.getBlock$(blockHash);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
tap((block: Block) => {
|
tap((block: Block) => {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.blockHeight = block.height;
|
this.blockHeight = block.height;
|
||||||
|
this.nextBlockHeight = block.height + 1;
|
||||||
|
this.setNextAndPreviousBlockLink();
|
||||||
|
|
||||||
this.seoService.setTitle($localize`:@@block.component.browser-title:Block ${block.height}:BLOCK_HEIGHT:: ${block.id}:BLOCK_ID:`);
|
this.seoService.setTitle($localize`:@@block.component.browser-title:Block ${block.height}:BLOCK_HEIGHT:: ${block.id}:BLOCK_ID:`);
|
||||||
this.isLoadingBlock = false;
|
this.isLoadingBlock = false;
|
||||||
if (block.coinbaseTx) {
|
if (block.coinbaseTx) {
|
||||||
@@ -140,24 +175,38 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
this.isLoadingBlock = false;
|
this.isLoadingBlock = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.stateService.blocks$
|
this.networkChangedSubscription = this.stateService.networkChanged$
|
||||||
.subscribe(([block]) => this.latestBlock = block);
|
|
||||||
|
|
||||||
this.stateService.networkChanged$
|
|
||||||
.subscribe((network) => this.network = network);
|
.subscribe((network) => this.network = network);
|
||||||
|
|
||||||
this.route.queryParams.subscribe((params) => {
|
this.queryParamsSubscription = this.route.queryParams.subscribe((params) => {
|
||||||
if (params.showDetails === 'true') {
|
if (params.showDetails === 'true') {
|
||||||
this.showDetails = true;
|
this.showDetails = true;
|
||||||
} else {
|
} else {
|
||||||
this.showDetails = false;
|
this.showDetails = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.keyNavigationSubscription = this.stateService.keyNavigation$.subscribe((event) => {
|
||||||
|
if (this.showPreviousBlocklink && event.key === 'ArrowRight' && this.nextBlockHeight - 2 >= 0) {
|
||||||
|
this.navigateToPreviousBlock();
|
||||||
|
}
|
||||||
|
if (event.key === 'ArrowLeft') {
|
||||||
|
if (this.showNextBlocklink) {
|
||||||
|
this.navigateToNextBlock();
|
||||||
|
} else {
|
||||||
|
this.router.navigate([(this.network && this.stateService.env.BASE_MODULE === 'mempool' ? '/' + this.network : '') + '/mempool-block/', '0']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.stateService.markBlock$.next({});
|
this.stateService.markBlock$.next({});
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
|
this.keyNavigationSubscription.unsubscribe();
|
||||||
|
this.blocksSubscription.unsubscribe();
|
||||||
|
this.networkChangedSubscription.unsubscribe();
|
||||||
|
this.queryParamsSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
setBlockSubsidy() {
|
setBlockSubsidy() {
|
||||||
@@ -173,15 +222,17 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pageChange(page: number) {
|
pageChange(page: number, target: HTMLElement) {
|
||||||
const start = (page - 1) * this.itemsPerPage;
|
const start = (page - 1) * this.itemsPerPage;
|
||||||
this.isLoadingTransactions = true;
|
this.isLoadingTransactions = true;
|
||||||
this.transactions = null;
|
this.transactions = null;
|
||||||
|
target.scrollIntoView(); // works for chrome
|
||||||
|
|
||||||
this.electrsApiService.getBlockTransactions$(this.block.id, start)
|
this.electrsApiService.getBlockTransactions$(this.block.id, start)
|
||||||
.subscribe((transactions) => {
|
.subscribe((transactions) => {
|
||||||
this.transactions = transactions;
|
this.transactions = transactions;
|
||||||
this.isLoadingTransactions = false;
|
this.isLoadingTransactions = false;
|
||||||
|
target.scrollIntoView(); // works for firefox
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,4 +267,38 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
return this.block && this.block.height > 681393 && (new Date().getTime() / 1000) < 1628640000;
|
return this.block && this.block.height > 681393 && (new Date().getTime() / 1000) < 1628640000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onResize(event: any) {
|
||||||
|
this.paginationMaxSize = event.target.innerWidth < 670 ? 3 : 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
navigateToPreviousBlock() {
|
||||||
|
if (!this.block) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const block = this.latestBlocks.find((b) => b.height === this.nextBlockHeight - 2);
|
||||||
|
this.router.navigate([(this.network && this.stateService.env.BASE_MODULE === 'mempool' ? '/' + this.network : '') + '/block/',
|
||||||
|
block ? block.id : this.block.previousblockhash], { state: { data: { block, blockHeight: this.nextBlockHeight - 2 } } });
|
||||||
|
}
|
||||||
|
|
||||||
|
navigateToNextBlock() {
|
||||||
|
const block = this.latestBlocks.find((b) => b.height === this.nextBlockHeight);
|
||||||
|
this.router.navigate([(this.network && this.stateService.env.BASE_MODULE === 'mempool' ? '/' + this.network : '') + '/block/',
|
||||||
|
block ? block.id : this.nextBlockHeight], { state: { data: { block, blockHeight: this.nextBlockHeight } } });
|
||||||
|
}
|
||||||
|
|
||||||
|
setNextAndPreviousBlockLink(){
|
||||||
|
if (this.latestBlock && this.blockHeight) {
|
||||||
|
if (this.blockHeight === 0){
|
||||||
|
this.showPreviousBlocklink = false;
|
||||||
|
} else {
|
||||||
|
this.showPreviousBlocklink = true;
|
||||||
|
}
|
||||||
|
if (this.latestBlock.height && this.latestBlock.height === this.blockHeight) {
|
||||||
|
this.showNextBlocklink = false;
|
||||||
|
} else {
|
||||||
|
this.showNextBlocklink = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user