Skip to content

Commit

Permalink
fix: issue with testnet4 config
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Oct 17, 2024
1 parent 46c1f2d commit 59eba3c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 16 additions & 1 deletion packages/models/src/network/network.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -109,7 +124,7 @@ const networkTestnet: NetworkConfiguration = {
};

const networkTestnet4: NetworkConfiguration = {
id: WalletDefaultNetworkConfigurationIds.testnet,
id: WalletDefaultNetworkConfigurationIds.testnet4,
name: 'Testnet4',
chain: {
stacks: {
Expand Down
4 changes: 3 additions & 1 deletion packages/models/src/network/network.schema.ts
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down

0 comments on commit 59eba3c

Please sign in to comment.