Compare commits
24 Commits
v2.2.2-rc3
...
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 |
4
backend/package-lock.json
generated
4
backend/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mempool-backend",
|
"name": "mempool-backend",
|
||||||
"version": "2.2.2-dev",
|
"version": "2.2.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mempool-backend",
|
"name": "mempool-backend",
|
||||||
"version": "2.2.2-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.3",
|
"@mempool/bitcoin": "^3.0.3",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mempool-backend",
|
"name": "mempool-backend",
|
||||||
"version": "2.2.2-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",
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -60,13 +60,12 @@ class BitcoinApi implements AbstractBitcoinApi {
|
|||||||
return this.bitcoindClient.getBlock(hash, 0);
|
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> {
|
$getBlockHeader(hash: string): Promise<string> {
|
||||||
return this.bitcoindClient.getBlockHeader(hash,false);
|
return this.bitcoindClient.getBlockHeader(hash, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async $getBlock(hash: string): Promise<IEsploraApi.Block> {
|
async $getBlock(hash: string): Promise<IEsploraApi.Block> {
|
||||||
@@ -238,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ class BitcoinBaseApi {
|
|||||||
$getBlockchainInfo(): Promise<IBitcoinApi.BlockchainInfo> {
|
$getBlockchainInfo(): Promise<IBitcoinApi.BlockchainInfo> {
|
||||||
return this.bitcoindClient.getBlockchainInfo();
|
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 instanceof Error ? e.message : 'Error');
|
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 instanceof Error ? e.message : 'Error');
|
throw new Error(typeof e === 'string' ? e : 'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ class Server {
|
|||||||
.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 });
|
||||||
|
|||||||
@@ -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() {}
|
||||||
@@ -687,6 +688,15 @@ class Routes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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');
|
||||||
}
|
}
|
||||||
@@ -727,7 +737,7 @@ class Routes {
|
|||||||
const timeAvg = timeAvgMins * 60;
|
const timeAvg = timeAvgMins * 60;
|
||||||
const remainingTime = remainingBlocks * timeAvg;
|
const remainingTime = remainingBlocks * timeAvg;
|
||||||
const estimatedRetargetDate = remainingTime + now;
|
const estimatedRetargetDate = remainingTime + now;
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
progressPercent,
|
progressPercent,
|
||||||
difficultyChange,
|
difficultyChange,
|
||||||
@@ -737,7 +747,7 @@ class Routes {
|
|||||||
previousRetarget,
|
previousRetarget,
|
||||||
nextRetargetHeight,
|
nextRetargetHeight,
|
||||||
timeAvg,
|
timeAvg,
|
||||||
}
|
};
|
||||||
res.json(result);
|
res.json(result);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
140
frontend/package-lock.json
generated
140
frontend/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "mempool-frontend",
|
"name": "mempool-frontend",
|
||||||
"version": "2.2.2-dev",
|
"version": "2.2.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mempool-frontend",
|
"name": "mempool-frontend",
|
||||||
"version": "2.2.2-dev",
|
"version": "2.2.2",
|
||||||
"license": "GNU Affero General Public License v3.0",
|
"license": "GNU Affero General Public License v3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~11.2.8",
|
"@angular/animations": "~11.2.8",
|
||||||
@@ -2412,19 +2412,18 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@npmcli/git": {
|
"node_modules/@npmcli/git": {
|
||||||
"version": "2.0.6",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.1.0.tgz",
|
||||||
"integrity": "sha512-a1MnTfeRPBaKbFY07fd+6HugY1WAkKJzdiJvlRub/9o5xz2F/JtPacZZapx5zRJUQFIzSL677vmTSxEcDMrDbg==",
|
"integrity": "sha512-/hBFX/QG1b+N7PZBFs0bi+evgRZcK9nWBxQKZkGoXUT5hJSwl5c4d7y8/hm+NQZRPhQ67RzFaj5UM9YeyKoryw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@npmcli/promise-spawn": "^1.1.0",
|
"@npmcli/promise-spawn": "^1.3.2",
|
||||||
"lru-cache": "^6.0.0",
|
"lru-cache": "^6.0.0",
|
||||||
"mkdirp": "^1.0.3",
|
"mkdirp": "^1.0.4",
|
||||||
"npm-pick-manifest": "^6.0.0",
|
"npm-pick-manifest": "^6.1.1",
|
||||||
"promise-inflight": "^1.0.1",
|
"promise-inflight": "^1.0.1",
|
||||||
"promise-retry": "^2.0.1",
|
"promise-retry": "^2.0.1",
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.5",
|
||||||
"unique-filename": "^1.1.1",
|
|
||||||
"which": "^2.0.2"
|
"which": "^2.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -2434,6 +2433,18 @@
|
|||||||
"integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",
|
"integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@npmcli/git/node_modules/hosted-git-info": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"lru-cache": "^6.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@npmcli/git/node_modules/mkdirp": {
|
"node_modules/@npmcli/git/node_modules/mkdirp": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||||
@@ -2446,6 +2457,32 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@npmcli/git/node_modules/npm-package-arg": {
|
||||||
|
"version": "8.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz",
|
||||||
|
"integrity": "sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"hosted-git-info": "^4.0.1",
|
||||||
|
"semver": "^7.3.4",
|
||||||
|
"validate-npm-package-name": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@npmcli/git/node_modules/npm-pick-manifest": {
|
||||||
|
"version": "6.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-6.1.1.tgz",
|
||||||
|
"integrity": "sha512-dBsdBtORT84S8V8UTad1WlUyKIY9iMsAmqxHbLdeEeBNMLQDlDWWra3wYUx9EBEIiG/YwAy0XyNHDd2goAsfuA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"npm-install-checks": "^4.0.0",
|
||||||
|
"npm-normalize-package-bin": "^1.0.1",
|
||||||
|
"npm-package-arg": "^8.1.2",
|
||||||
|
"semver": "^7.3.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@npmcli/git/node_modules/promise-retry": {
|
"node_modules/@npmcli/git/node_modules/promise-retry": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz",
|
||||||
@@ -12864,9 +12901,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/path-parse": {
|
"node_modules/path-parse": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
|
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
|
||||||
},
|
},
|
||||||
"node_modules/path-platform": {
|
"node_modules/path-platform": {
|
||||||
"version": "0.11.15",
|
"version": "0.11.15",
|
||||||
@@ -16477,9 +16514,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "6.1.6",
|
"version": "6.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
|
||||||
"integrity": "sha512-oaWyu5dQbHaYcyZCTfyPpC+VmI62/OM2RTUYavTk1MDr1cwW5Boi3baeYQKiZbY2uSQJGr+iMOzb/JFxLrft+g==",
|
"integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chownr": "^2.0.0",
|
"chownr": "^2.0.0",
|
||||||
@@ -17489,9 +17526,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/url-parse": {
|
"node_modules/url-parse": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
|
||||||
"integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==",
|
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"querystringify": "^2.1.1",
|
"querystringify": "^2.1.1",
|
||||||
@@ -22008,19 +22045,18 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@npmcli/git": {
|
"@npmcli/git": {
|
||||||
"version": "2.0.6",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.1.0.tgz",
|
||||||
"integrity": "sha512-a1MnTfeRPBaKbFY07fd+6HugY1WAkKJzdiJvlRub/9o5xz2F/JtPacZZapx5zRJUQFIzSL677vmTSxEcDMrDbg==",
|
"integrity": "sha512-/hBFX/QG1b+N7PZBFs0bi+evgRZcK9nWBxQKZkGoXUT5hJSwl5c4d7y8/hm+NQZRPhQ67RzFaj5UM9YeyKoryw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@npmcli/promise-spawn": "^1.1.0",
|
"@npmcli/promise-spawn": "^1.3.2",
|
||||||
"lru-cache": "^6.0.0",
|
"lru-cache": "^6.0.0",
|
||||||
"mkdirp": "^1.0.3",
|
"mkdirp": "^1.0.4",
|
||||||
"npm-pick-manifest": "^6.0.0",
|
"npm-pick-manifest": "^6.1.1",
|
||||||
"promise-inflight": "^1.0.1",
|
"promise-inflight": "^1.0.1",
|
||||||
"promise-retry": "^2.0.1",
|
"promise-retry": "^2.0.1",
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.5",
|
||||||
"unique-filename": "^1.1.1",
|
|
||||||
"which": "^2.0.2"
|
"which": "^2.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -22030,12 +22066,44 @@
|
|||||||
"integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",
|
"integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"hosted-git-info": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"lru-cache": "^6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"npm-package-arg": {
|
||||||
|
"version": "8.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.1.5.tgz",
|
||||||
|
"integrity": "sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"hosted-git-info": "^4.0.1",
|
||||||
|
"semver": "^7.3.4",
|
||||||
|
"validate-npm-package-name": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"npm-pick-manifest": {
|
||||||
|
"version": "6.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-6.1.1.tgz",
|
||||||
|
"integrity": "sha512-dBsdBtORT84S8V8UTad1WlUyKIY9iMsAmqxHbLdeEeBNMLQDlDWWra3wYUx9EBEIiG/YwAy0XyNHDd2goAsfuA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"npm-install-checks": "^4.0.0",
|
||||||
|
"npm-normalize-package-bin": "^1.0.1",
|
||||||
|
"npm-package-arg": "^8.1.2",
|
||||||
|
"semver": "^7.3.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"promise-retry": {
|
"promise-retry": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz",
|
||||||
@@ -30884,9 +30952,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"path-parse": {
|
"path-parse": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
|
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
|
||||||
},
|
},
|
||||||
"path-platform": {
|
"path-platform": {
|
||||||
"version": "0.11.15",
|
"version": "0.11.15",
|
||||||
@@ -33897,9 +33965,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tar": {
|
"tar": {
|
||||||
"version": "6.1.6",
|
"version": "6.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz",
|
||||||
"integrity": "sha512-oaWyu5dQbHaYcyZCTfyPpC+VmI62/OM2RTUYavTk1MDr1cwW5Boi3baeYQKiZbY2uSQJGr+iMOzb/JFxLrft+g==",
|
"integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"chownr": "^2.0.0",
|
"chownr": "^2.0.0",
|
||||||
@@ -34741,9 +34809,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"url-parse": {
|
"url-parse": {
|
||||||
"version": "1.5.1",
|
"version": "1.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
|
||||||
"integrity": "sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==",
|
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"querystringify": "^2.1.1",
|
"querystringify": "^2.1.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mempool-frontend",
|
"name": "mempool-frontend",
|
||||||
"version": "2.2.2-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",
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,20 +1,20 @@
|
|||||||
<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]="npmGithubLink()" target="_blank">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>
|
||||||
@@ -26,14 +26,14 @@
|
|||||||
<a [href]="npmModuleLink()" target="_blank">npm package</a>
|
<a [href]="npmModuleLink()" target="_blank">npm package</a>
|
||||||
</div>
|
</div>
|
||||||
<pre><code [innerText]="wrapImportTemplate()"></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>
|
||||||
|
|||||||
@@ -1,32 +1,32 @@
|
|||||||
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() layer: string;
|
@Input() code: any;
|
||||||
@Input() code: {
|
@Input() hostname: string;
|
||||||
codeSample: {
|
@Input() method: 'get' | 'post' | 'websocket' = 'get';
|
||||||
esModule: string;
|
env: Env;
|
||||||
commonJS: string;
|
|
||||||
curl: string;
|
|
||||||
},
|
|
||||||
responseSample: string;
|
|
||||||
};
|
|
||||||
hostname = document.location.hostname;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private stateService: StateService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.env = this.stateService.env;
|
||||||
|
}
|
||||||
|
|
||||||
npmGithubLink(){
|
npmGithubLink(){
|
||||||
let npmLink = `https://github.com/mempool/mempool.js`;
|
let npmLink = `https://github.com/mempool/mempool.js`;
|
||||||
if (this.layer === 'bisq') {
|
if (this.network === 'bisq') {
|
||||||
npmLink = `https://github.com/mempool/mempool.js/tree/main/npm-bisq-js`;
|
npmLink = `https://github.com/mempool/mempool.js/tree/main/npm-bisq-js`;
|
||||||
}
|
}
|
||||||
if (this.layer === 'liquid') {
|
if (this.network === 'liquid') {
|
||||||
npmLink = `https://github.com/mempool/mempool.js/tree/main/npm-liquid-js`;
|
npmLink = `https://github.com/mempool/mempool.js/tree/main/npm-liquid-js`;
|
||||||
}
|
}
|
||||||
return npmLink;
|
return npmLink;
|
||||||
@@ -34,67 +34,153 @@ export class CodeTemplateComponent {
|
|||||||
|
|
||||||
npmModuleLink() {
|
npmModuleLink() {
|
||||||
let npmLink = `https://www.npmjs.org/package/@mempool/mempool.js`;
|
let npmLink = `https://www.npmjs.org/package/@mempool/mempool.js`;
|
||||||
if (this.layer === 'bisq') {
|
if (this.network === 'bisq') {
|
||||||
npmLink = `https://www.npmjs.org/package/@mempool/bisq.js`;
|
npmLink = `https://www.npmjs.org/package/@mempool/bisq.js`;
|
||||||
}
|
}
|
||||||
if (this.layer === 'liquid') {
|
if (this.network === 'liquid') {
|
||||||
npmLink = `https://www.npmjs.org/package/@mempool/liquid.js`;
|
npmLink = `https://www.npmjs.org/package/@mempool/liquid.js`;
|
||||||
}
|
}
|
||||||
return npmLink;
|
return npmLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
normalizeCodeHostname(code: string) {
|
normalizeHostsESModule(codeText: string) {
|
||||||
let codeText: string;
|
if (this.env.BASE_MODULE === 'mempool') {
|
||||||
if (this.network === 'bisq' || this.network === 'liquid'){
|
if (['liquid', 'bisq'].includes(this.network)) {
|
||||||
codeText = code.replace('%{1}', this.network);
|
codeText = codeText.replace('%{0}', this.network);
|
||||||
}else{
|
} else {
|
||||||
codeText = code.replace('%{1}', 'bitcoin');
|
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}'
|
||||||
|
});`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let importText = `import mempoolJS from "@mempool/mempool.js";`;
|
if (this.env.BASE_MODULE === 'bisq') {
|
||||||
if (this.layer === 'bisq') {
|
codeText = codeText.replace('} = mempoolJS();', ` = bisqJS();`);
|
||||||
importText = `import bisqJS from "@mempool/bisq.js";`;
|
codeText = codeText.replace('{ %{0}: ', '');
|
||||||
}
|
|
||||||
if (this.layer === 'liquid') {
|
|
||||||
importText = `import liquidJS from "@mempool/liquid.js";`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${importText}
|
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);
|
||||||
|
}
|
||||||
|
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>`;
|
let importText = `<script src="https://mempool.space/mempool.js"></script>`;
|
||||||
if (this.layer === 'bisq') {
|
if (this.env.BASE_MODULE === 'bisq') {
|
||||||
importText = `<script src="https://bisq.markets/bisq.js"></script>`;
|
importText = `<script src="https://bisq.markets/bisq.js"></script>`;
|
||||||
}
|
}
|
||||||
if (this.layer === 'liquid') {
|
if (this.env.BASE_MODULE === 'liquid') {
|
||||||
importText = `<script src="https://liquid.network/liquid.js"></script>`;
|
importText = `<script src="https://liquid.network/liquid.js"></script>`;
|
||||||
}
|
}
|
||||||
return `<!DOCTYPE html>
|
|
||||||
|
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>
|
||||||
${importText}
|
${importText}
|
||||||
@@ -105,14 +191,11 @@ 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() {
|
wrapImportTemplate() {
|
||||||
@@ -123,7 +206,7 @@ npm install @mempool/mempool.js --save
|
|||||||
# yarn
|
# yarn
|
||||||
yarn add @mempool/mempool.js`;
|
yarn add @mempool/mempool.js`;
|
||||||
|
|
||||||
if (this.layer === 'bisq') {
|
if (this.env.BASE_MODULE === 'bisq') {
|
||||||
importTemplate = `# npm
|
importTemplate = `# npm
|
||||||
npm install @mempool/bisq.js --save
|
npm install @mempool/bisq.js --save
|
||||||
|
|
||||||
@@ -131,7 +214,7 @@ npm install @mempool/bisq.js --save
|
|||||||
yarn add @mempool/bisq.js`;
|
yarn add @mempool/bisq.js`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.layer === 'liquid') {
|
if (this.env.BASE_MODULE === 'liquid') {
|
||||||
importTemplate = `# npm
|
importTemplate = `# npm
|
||||||
npm install @mempool/liquid.js --save
|
npm install @mempool/liquid.js --save
|
||||||
|
|
||||||
@@ -142,4 +225,78 @@ yarn add @mempool/liquid.js`;
|
|||||||
return importTemplate;
|
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}"`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class SearchFormComponent implements OnInit {
|
|||||||
searchForm: FormGroup;
|
searchForm: FormGroup;
|
||||||
@Output() searchTriggered = new EventEmitter();
|
@Output() searchTriggered = new EventEmitter();
|
||||||
|
|
||||||
regexAddress = /^([a-km-zA-HJ-NP-Z1-9]{26,35}|[a-km-zA-HJ-NP-Z1-9]{80}|[bB]?[a-z]{2,5}1[ac-hj-np-z02-9]{8,87})$/;
|
regexAddress = /^([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})$/;
|
||||||
regexBlockhash = /^[0]{8}[a-fA-F0-9]{56}$/;
|
regexBlockhash = /^[0]{8}[a-fA-F0-9]{56}$/;
|
||||||
regexTransaction = /^[a-fA-F0-9]{64}$/;
|
regexTransaction = /^[a-fA-F0-9]{64}$/;
|
||||||
regexBlockheight = /^[0-9]+$/;
|
regexBlockheight = /^[0-9]+$/;
|
||||||
|
|||||||
@@ -34,3 +34,16 @@ export interface DifficultyAdjustment {
|
|||||||
remainingBlocks: number;
|
remainingBlocks: number;
|
||||||
remainingTime: number;
|
remainingTime: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AddressInformation {
|
||||||
|
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
|
||||||
|
scriptPubKey: string; // (string) The hex-encoded scriptPubKey generated by the address
|
||||||
|
isscript: boolean; // (boolean) If the key is a script
|
||||||
|
iswitness: boolean; // (boolean) If the address is a witness
|
||||||
|
witness_version?: boolean; // (numeric, optional) The version number 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
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { CpfpInfo, OptimizedMempoolStats, DifficultyAdjustment } from '../interfaces/node-api.interface';
|
import { CpfpInfo, OptimizedMempoolStats, DifficultyAdjustment, AddressInformation } from '../interfaces/node-api.interface';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { StateService } from './state.service';
|
import { StateService } from './state.service';
|
||||||
import { WebsocketResponse } from '../interfaces/websocket.interface';
|
import { WebsocketResponse } from '../interfaces/websocket.interface';
|
||||||
@@ -96,4 +96,8 @@ export class ApiService {
|
|||||||
getDifficultyAdjustment$(): Observable<DifficultyAdjustment> {
|
getDifficultyAdjustment$(): Observable<DifficultyAdjustment> {
|
||||||
return this.httpClient.get<DifficultyAdjustment>(this.apiBaseUrl + this.apiBasePath + '/api/v1/difficulty-adjustment');
|
return this.httpClient.get<DifficultyAdjustment>(this.apiBaseUrl + this.apiBasePath + '/api/v1/difficulty-adjustment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validateAddress$(address: string): Observable<AddressInformation> {
|
||||||
|
return this.httpClient.get<AddressInformation>(this.apiBaseUrl + this.apiBasePath + '/api/v1/validate-address/' + address);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
HOSTNAME=$(hostname)
|
HOSTNAME=$(hostname)
|
||||||
|
|
||||||
echo restarting mempool backends | wall
|
echo restarting mempool backends | wall
|
||||||
echo "${HOSTNAME} restarted mempool backends" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.devops
|
echo "${HOSTNAME} restarted mempool backends" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.ops
|
||||||
ps uaxw|grep 'dist/index'|grep -v grep|grep -v services|awk '{print $2}'|xargs -n 1 kill
|
ps uaxw|grep 'dist/index'|grep -v grep|grep -v services|awk '{print $2}'|xargs -n 1 kill
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -70,6 +70,6 @@ for target in mainnet liquid bisq;do build_frontend "${target}";done
|
|||||||
for target in mainnet liquid bisq;do ship_frontend "${target}";done
|
for target in mainnet liquid bisq;do ship_frontend "${target}";done
|
||||||
|
|
||||||
echo "${HOSTNAME} updated to \`${REF}\` @ \`${HASH}\`" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.dev
|
echo "${HOSTNAME} updated to \`${REF}\` @ \`${HASH}\`" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.dev
|
||||||
echo "${HOSTNAME} updated to \`${REF}\` @ \`${HASH}\`" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.devops
|
echo "${HOSTNAME} updated to \`${REF}\` @ \`${HASH}\`" | /usr/local/bin/keybase chat send --nonblock --channel general mempool.ops
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
local7.>=notice |/usr/local/bin/sudo -u mempool /usr/local/bin/mempool-logger mempool.devops general
|
local7.>=notice |/usr/local/bin/sudo -u mempool /usr/local/bin/mempool-logger mempool.ops alerts
|
||||||
local7.info |/usr/local/bin/sudo -u mempool /usr/local/bin/mempool-logger mempool.devops node100
|
local7.info |/usr/local/bin/sudo -u mempool /usr/local/bin/mempool-logger mempool.ops node100
|
||||||
local7.info /var/log/mempool
|
local7.info /var/log/mempool
|
||||||
local7.* /var/log/mempool.debug
|
local7.* /var/log/mempool.debug
|
||||||
|
|||||||
Reference in New Issue
Block a user