Merge pull request #5040 from mempool/mononaut/testnet4

test
This commit is contained in:
wiz
2024-05-07 02:50:37 +09:00
committed by GitHub
41 changed files with 484 additions and 66 deletions

View File

@@ -40,6 +40,7 @@ export interface Customization {
export interface Env {
TESTNET_ENABLED: boolean;
TESTNET4_ENABLED: boolean;
SIGNET_ENABLED: boolean;
LIQUID_ENABLED: boolean;
LIQUID_TESTNET_ENABLED: boolean;
@@ -73,6 +74,7 @@ export interface Env {
const defaultEnv: Env = {
'TESTNET_ENABLED': false,
'TESTNET4_ENABLED': false,
'SIGNET_ENABLED': false,
'LIQUID_ENABLED': false,
'LIQUID_TESTNET_ENABLED': false,
@@ -318,7 +320,7 @@ export class StateService {
// (?:preview\/)? optional "preview" prefix (non-capturing)
// (testnet|signet)/ network string (captured as networkMatches[1])
// ($|\/) network string must end or end with a slash
const networkMatches = url.match(/^\/(?:[a-z]{2}(?:-[A-Z]{2})?\/)?(?:preview\/)?(testnet|signet)($|\/)/);
const networkMatches = url.match(/^\/(?:[a-z]{2}(?:-[A-Z]{2})?\/)?(?:preview\/)?(testnet4?|signet)($|\/)/);
switch (networkMatches && networkMatches[1]) {
case 'signet':
if (this.network !== 'signet') {
@@ -337,6 +339,12 @@ export class StateService {
}
}
return;
case 'testnet4':
if (this.network !== 'testnet4') {
this.network = 'testnet4';
this.networkChanged$.next('testnet4');
}
return;
default:
if (this.env.BASE_MODULE !== 'mempool') {
if (this.network !== this.env.BASE_MODULE) {
@@ -385,7 +393,7 @@ export class StateService {
}
isAnyTestnet(): boolean {
return ['testnet', 'signet', 'liquidtestnet'].includes(this.network);
return ['testnet', 'testnet4', 'signet', 'liquidtestnet'].includes(this.network);
}
resetChainTip() {