From 59eba3cde52c4793b670ff016b43b0b41522ed12 Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Thu, 17 Oct 2024 14:56:50 +0200 Subject: [PATCH] fix: issue with testnet4 config --- packages/models/src/network/network.model.ts | 17 ++++++++++++++++- packages/models/src/network/network.schema.ts | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/models/src/network/network.model.ts b/packages/models/src/network/network.model.ts index 290dc892b..cdd731574 100644 --- a/packages/models/src/network/network.model.ts +++ b/packages/models/src/network/network.model.ts @@ -51,6 +51,21 @@ export type BitcoinNetwork = (typeof bitcoinNetworks)[number]; export type NetworkModes = (typeof networkModes)[number]; type BitcoinTestnetModes = (typeof testnetModes)[number]; +export function bitcoinNetworkToNetworkMode(network: BitcoinNetwork): BitcoinNetworkModes { + switch (network) { + case 'mainnet': + return 'mainnet'; + case 'testnet3': + return 'testnet'; + case 'testnet4': + return 'testnet'; + case 'regtest': + return 'regtest'; + case 'signet': + return 'signet'; + } +} + export type BitcoinNetworkModes = NetworkModes | BitcoinTestnetModes; interface BaseChainConfig { @@ -109,7 +124,7 @@ const networkTestnet: NetworkConfiguration = { }; const networkTestnet4: NetworkConfiguration = { - id: WalletDefaultNetworkConfigurationIds.testnet, + id: WalletDefaultNetworkConfigurationIds.testnet4, name: 'Testnet4', chain: { stacks: { diff --git a/packages/models/src/network/network.schema.ts b/packages/models/src/network/network.schema.ts index a8d12395b..c5828cdfd 100644 --- a/packages/models/src/network/network.schema.ts +++ b/packages/models/src/network/network.schema.ts @@ -1,9 +1,11 @@ import { z } from 'zod'; -import { networkModes, testnetModes } from './network.model'; +import { bitcoinNetworks, networkModes, testnetModes } from './network.model'; export const bitcoinNetworkModesSchema = z.enum([...networkModes, ...testnetModes]); +export const bitcoinNetworkSchema = z.enum([...bitcoinNetworks]); + export const networkConfigurationSchema = z.object({ name: z.string(), id: z.string(),