@btc-vision/cli 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -4
- package/.gitattributes +0 -2
- package/.github/dependabot.yml +0 -9
- package/.github/workflows/ci.yml +0 -48
- package/.prettierrc.json +0 -12
- package/CONTRIBUTING.md +0 -56
- package/NOTICE +0 -17
- package/SECURITY.md +0 -35
- package/eslint.config.js +0 -41
- package/gulpfile.js +0 -41
- package/src/commands/AcceptCommand.ts +0 -224
- package/src/commands/BaseCommand.ts +0 -59
- package/src/commands/CompileCommand.ts +0 -195
- package/src/commands/ConfigCommand.ts +0 -117
- package/src/commands/DeprecateCommand.ts +0 -193
- package/src/commands/InfoCommand.ts +0 -293
- package/src/commands/InitCommand.ts +0 -541
- package/src/commands/InstallCommand.ts +0 -179
- package/src/commands/KeygenCommand.ts +0 -157
- package/src/commands/ListCommand.ts +0 -169
- package/src/commands/LoginCommand.ts +0 -197
- package/src/commands/LogoutCommand.ts +0 -76
- package/src/commands/PublishCommand.ts +0 -340
- package/src/commands/ScopeRegisterCommand.ts +0 -164
- package/src/commands/SearchCommand.ts +0 -140
- package/src/commands/SignCommand.ts +0 -110
- package/src/commands/TransferCommand.ts +0 -363
- package/src/commands/UndeprecateCommand.ts +0 -167
- package/src/commands/UpdateCommand.ts +0 -200
- package/src/commands/VerifyCommand.ts +0 -228
- package/src/commands/WhoamiCommand.ts +0 -113
- package/src/index.ts +0 -88
- package/src/lib/PackageRegistry.abi.json +0 -765
- package/src/lib/PackageRegistry.abi.ts +0 -365
- package/src/lib/binary.ts +0 -338
- package/src/lib/config.ts +0 -265
- package/src/lib/credentials.ts +0 -176
- package/src/lib/ipfs.ts +0 -382
- package/src/lib/manifest.ts +0 -195
- package/src/lib/provider.ts +0 -121
- package/src/lib/registry.ts +0 -467
- package/src/lib/transaction.ts +0 -205
- package/src/lib/wallet.ts +0 -262
- package/src/types/PackageRegistry.ts +0 -344
- package/src/types/index.ts +0 -147
- package/tsconfig.json +0 -25
package/src/lib/config.ts
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration management for OPNet CLI
|
|
3
|
-
*
|
|
4
|
-
* Manages CLI configuration stored in ~/.opnet/config.json
|
|
5
|
-
*
|
|
6
|
-
* @module lib/config
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import * as fs from 'fs';
|
|
10
|
-
import * as path from 'path';
|
|
11
|
-
import * as os from 'os';
|
|
12
|
-
import { CLIConfig, CLIMldsaLevel, NetworkName } from '../types/index.js';
|
|
13
|
-
|
|
14
|
-
/** Default configuration directory */
|
|
15
|
-
const CONFIG_DIR = path.join(os.homedir(), '.opnet');
|
|
16
|
-
/** Configuration file path */
|
|
17
|
-
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Default CLI configuration
|
|
21
|
-
*/
|
|
22
|
-
export const DEFAULT_CONFIG: CLIConfig = {
|
|
23
|
-
defaultNetwork: 'regtest',
|
|
24
|
-
rpcUrls: {
|
|
25
|
-
mainnet: 'https://api.opnet.org',
|
|
26
|
-
testnet: 'https://testnet.opnet.org',
|
|
27
|
-
regtest: 'https://regtest.opnet.org',
|
|
28
|
-
},
|
|
29
|
-
ipfsGateway: 'https://ipfs.opnet.org/ipfs/',
|
|
30
|
-
ipfsGateways: [
|
|
31
|
-
'https://ipfs.opnet.org/ipfs/',
|
|
32
|
-
'https://ipfs.io/ipfs/',
|
|
33
|
-
'https://cloudflare-ipfs.com/ipfs/',
|
|
34
|
-
'https://dweb.link/ipfs/',
|
|
35
|
-
],
|
|
36
|
-
ipfsPinningEndpoint: 'https://ipfs.opnet.org/api/v0/add',
|
|
37
|
-
ipfsPinningApiKey: '',
|
|
38
|
-
ipfsPinningSecret: '',
|
|
39
|
-
ipfsPinningAuthHeader: 'Authorization',
|
|
40
|
-
registryAddresses: {
|
|
41
|
-
mainnet: '', // TODO: Set once deployed
|
|
42
|
-
testnet: '', // TODO: Set once deployed
|
|
43
|
-
regtest: '0x0737d17d0eff9915208f3c20ed7659587889bc94d25972672b3a6c03ff4ddbcc', // TODO: Set once deployed
|
|
44
|
-
},
|
|
45
|
-
defaultMldsaLevel: 44,
|
|
46
|
-
indexerUrl: 'https://indexer.opnet.org',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Environment variable overrides
|
|
51
|
-
*/
|
|
52
|
-
function getEnvOverrides(): Partial<CLIConfig> {
|
|
53
|
-
const overrides: Partial<CLIConfig> = {};
|
|
54
|
-
|
|
55
|
-
if (process.env.OPNET_NETWORK) {
|
|
56
|
-
const network = process.env.OPNET_NETWORK as NetworkName;
|
|
57
|
-
if (['mainnet', 'testnet', 'regtest'].includes(network)) {
|
|
58
|
-
overrides.defaultNetwork = network;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (process.env.OPNET_RPC_URL) {
|
|
63
|
-
// Override the current network's RPC URL
|
|
64
|
-
const config = loadConfig();
|
|
65
|
-
overrides.rpcUrls = {
|
|
66
|
-
...config.rpcUrls,
|
|
67
|
-
[config.defaultNetwork]: process.env.OPNET_RPC_URL,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (process.env.OPNET_IPFS_GATEWAY) {
|
|
72
|
-
overrides.ipfsGateway = process.env.OPNET_IPFS_GATEWAY;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (process.env.OPNET_IPFS_PINNING_ENDPOINT) {
|
|
76
|
-
overrides.ipfsPinningEndpoint = process.env.OPNET_IPFS_PINNING_ENDPOINT;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (process.env.OPNET_IPFS_PINNING_KEY) {
|
|
80
|
-
overrides.ipfsPinningApiKey = process.env.OPNET_IPFS_PINNING_KEY;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (process.env.OPNET_REGISTRY_ADDRESS) {
|
|
84
|
-
const config = loadConfig();
|
|
85
|
-
overrides.registryAddresses = {
|
|
86
|
-
...config.registryAddresses,
|
|
87
|
-
[config.defaultNetwork]: process.env.OPNET_REGISTRY_ADDRESS,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (process.env.OPNET_INDEXER_URL) {
|
|
92
|
-
overrides.indexerUrl = process.env.OPNET_INDEXER_URL;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return overrides;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Ensure the config directory exists
|
|
100
|
-
*/
|
|
101
|
-
export function ensureConfigDir(): void {
|
|
102
|
-
if (!fs.existsSync(CONFIG_DIR)) {
|
|
103
|
-
fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Load configuration from file
|
|
109
|
-
*
|
|
110
|
-
* @returns The CLI configuration with defaults and environment overrides applied
|
|
111
|
-
*/
|
|
112
|
-
export function loadConfig(): CLIConfig {
|
|
113
|
-
ensureConfigDir();
|
|
114
|
-
|
|
115
|
-
let fileConfig: Partial<CLIConfig> = {};
|
|
116
|
-
|
|
117
|
-
if (fs.existsSync(CONFIG_FILE)) {
|
|
118
|
-
try {
|
|
119
|
-
const content = fs.readFileSync(CONFIG_FILE, 'utf-8');
|
|
120
|
-
fileConfig = JSON.parse(content) as Partial<CLIConfig>;
|
|
121
|
-
} catch {
|
|
122
|
-
// Ignore parse errors, use defaults
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Merge: defaults < file config < env overrides
|
|
127
|
-
const envOverrides = getEnvOverrides();
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
...DEFAULT_CONFIG,
|
|
131
|
-
...fileConfig,
|
|
132
|
-
...envOverrides,
|
|
133
|
-
rpcUrls: {
|
|
134
|
-
...DEFAULT_CONFIG.rpcUrls,
|
|
135
|
-
...fileConfig.rpcUrls,
|
|
136
|
-
...envOverrides.rpcUrls,
|
|
137
|
-
},
|
|
138
|
-
ipfsGateways: fileConfig.ipfsGateways || DEFAULT_CONFIG.ipfsGateways,
|
|
139
|
-
registryAddresses: {
|
|
140
|
-
...DEFAULT_CONFIG.registryAddresses,
|
|
141
|
-
...fileConfig.registryAddresses,
|
|
142
|
-
...envOverrides.registryAddresses,
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Save configuration to file
|
|
149
|
-
*
|
|
150
|
-
* @param config - The configuration to save
|
|
151
|
-
*/
|
|
152
|
-
export function saveConfig(config: CLIConfig): void {
|
|
153
|
-
ensureConfigDir();
|
|
154
|
-
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 4), { mode: 0o600 });
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Get a specific configuration value
|
|
159
|
-
*
|
|
160
|
-
* @param key - The configuration key (dot notation supported)
|
|
161
|
-
* @returns The configuration value or undefined
|
|
162
|
-
*/
|
|
163
|
-
export function getConfigValue(key: string): unknown {
|
|
164
|
-
const config = loadConfig();
|
|
165
|
-
const keys = key.split('.');
|
|
166
|
-
let value: unknown = config;
|
|
167
|
-
|
|
168
|
-
for (const k of keys) {
|
|
169
|
-
if (value && typeof value === 'object' && k in value) {
|
|
170
|
-
value = (value as Record<string, unknown>)[k];
|
|
171
|
-
} else {
|
|
172
|
-
return undefined;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return value;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Set a specific configuration value
|
|
181
|
-
*
|
|
182
|
-
* @param key - The configuration key (dot notation supported)
|
|
183
|
-
* @param value - The value to set
|
|
184
|
-
*/
|
|
185
|
-
export function setConfigValue(key: string, value: unknown): void {
|
|
186
|
-
const config = loadConfig();
|
|
187
|
-
const keys = key.split('.');
|
|
188
|
-
let target: Record<string, unknown> = config as unknown as Record<string, unknown>;
|
|
189
|
-
|
|
190
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
191
|
-
const k = keys[i];
|
|
192
|
-
if (!(k in target) || typeof target[k] !== 'object') {
|
|
193
|
-
target[k] = {};
|
|
194
|
-
}
|
|
195
|
-
target = target[k] as Record<string, unknown>;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const finalKey = keys[keys.length - 1];
|
|
199
|
-
target[finalKey] = value;
|
|
200
|
-
|
|
201
|
-
saveConfig(config);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Get the RPC URL for a specific network
|
|
206
|
-
*
|
|
207
|
-
* @param network - The network name (defaults to configured default)
|
|
208
|
-
* @returns The RPC URL
|
|
209
|
-
*/
|
|
210
|
-
export function getRpcUrl(network?: NetworkName): string {
|
|
211
|
-
const config = loadConfig();
|
|
212
|
-
const targetNetwork = network || config.defaultNetwork;
|
|
213
|
-
return config.rpcUrls[targetNetwork] || config.rpcUrls.mainnet;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Get the registry address for a specific network
|
|
218
|
-
*
|
|
219
|
-
* @param network - The network name (defaults to configured default)
|
|
220
|
-
* @returns The registry contract address
|
|
221
|
-
*/
|
|
222
|
-
export function getRegistryAddress(network?: NetworkName): string {
|
|
223
|
-
const config = loadConfig();
|
|
224
|
-
const targetNetwork = network || config.defaultNetwork;
|
|
225
|
-
const address = config.registryAddresses[targetNetwork];
|
|
226
|
-
|
|
227
|
-
if (!address) {
|
|
228
|
-
throw new Error(
|
|
229
|
-
`Registry address not configured for network: ${targetNetwork}\n` +
|
|
230
|
-
`Run: opnet config set registryAddresses.${targetNetwork} <address>`,
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return address;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Get the default MLDSA level
|
|
239
|
-
*
|
|
240
|
-
* @returns The default MLDSA security level
|
|
241
|
-
*/
|
|
242
|
-
export function getDefaultMldsaLevel(): CLIMldsaLevel {
|
|
243
|
-
const config = loadConfig();
|
|
244
|
-
return config.defaultMldsaLevel;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Get the default network
|
|
249
|
-
*
|
|
250
|
-
* @returns The default network name
|
|
251
|
-
*/
|
|
252
|
-
export function getDefaultNetwork(): NetworkName {
|
|
253
|
-
const config = loadConfig();
|
|
254
|
-
return config.defaultNetwork;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Display current configuration
|
|
259
|
-
*
|
|
260
|
-
* @returns Formatted configuration string
|
|
261
|
-
*/
|
|
262
|
-
export function displayConfig(): string {
|
|
263
|
-
const config = loadConfig();
|
|
264
|
-
return JSON.stringify(config, null, 2);
|
|
265
|
-
}
|
package/src/lib/credentials.ts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credentials management for OPNet CLI
|
|
3
|
-
*
|
|
4
|
-
* Manages wallet credentials stored in ~/.opnet/credentials.json
|
|
5
|
-
*
|
|
6
|
-
* @module lib/credentials
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import * as fs from 'fs';
|
|
10
|
-
import * as path from 'path';
|
|
11
|
-
import * as os from 'os';
|
|
12
|
-
import { CLICredentials, CLIMldsaLevel, NetworkName } from '../types/index.js';
|
|
13
|
-
import { ensureConfigDir } from './config.js';
|
|
14
|
-
|
|
15
|
-
/** Credentials file path */
|
|
16
|
-
const CREDENTIALS_FILE = path.join(os.homedir(), '.opnet', 'credentials.json');
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Load credentials from file
|
|
20
|
-
*
|
|
21
|
-
* @returns The stored credentials or null if not found
|
|
22
|
-
*/
|
|
23
|
-
export function loadCredentials(): CLICredentials | null {
|
|
24
|
-
// Check for environment variable overrides first
|
|
25
|
-
if (process.env.OPNET_MNEMONIC) {
|
|
26
|
-
return {
|
|
27
|
-
mnemonic: process.env.OPNET_MNEMONIC,
|
|
28
|
-
mldsaLevel:
|
|
29
|
-
(parseInt(process.env.OPNET_MLDSA_LEVEL || '44', 10) as CLIMldsaLevel) || 44,
|
|
30
|
-
network: (process.env.OPNET_NETWORK as NetworkName) || 'mainnet',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (process.env.OPNET_PRIVATE_KEY || process.env.OPNET_MLDSA_KEY) {
|
|
35
|
-
return {
|
|
36
|
-
wif: process.env.OPNET_PRIVATE_KEY,
|
|
37
|
-
mldsaPrivateKey: process.env.OPNET_MLDSA_KEY,
|
|
38
|
-
mldsaLevel:
|
|
39
|
-
(parseInt(process.env.OPNET_MLDSA_LEVEL || '44', 10) as CLIMldsaLevel) || 44,
|
|
40
|
-
network: (process.env.OPNET_NETWORK as NetworkName) || 'mainnet',
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Load from file
|
|
45
|
-
if (!fs.existsSync(CREDENTIALS_FILE)) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
const content = fs.readFileSync(CREDENTIALS_FILE, 'utf-8');
|
|
51
|
-
return JSON.parse(content) as CLICredentials;
|
|
52
|
-
} catch {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Save credentials to file with secure permissions
|
|
59
|
-
*
|
|
60
|
-
* @param credentials - The credentials to save
|
|
61
|
-
*/
|
|
62
|
-
export function saveCredentials(credentials: CLICredentials): void {
|
|
63
|
-
ensureConfigDir();
|
|
64
|
-
|
|
65
|
-
// Write with restricted permissions (owner read/write only)
|
|
66
|
-
fs.writeFileSync(CREDENTIALS_FILE, JSON.stringify(credentials, null, 4), {
|
|
67
|
-
mode: 0o600,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Delete stored credentials
|
|
73
|
-
*
|
|
74
|
-
* @returns True if credentials were deleted, false if not found
|
|
75
|
-
*/
|
|
76
|
-
export function deleteCredentials(): boolean {
|
|
77
|
-
if (fs.existsSync(CREDENTIALS_FILE)) {
|
|
78
|
-
fs.unlinkSync(CREDENTIALS_FILE);
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Check if credentials exist
|
|
86
|
-
*
|
|
87
|
-
* @returns True if credentials are available (file or env)
|
|
88
|
-
*/
|
|
89
|
-
export function hasCredentials(): boolean {
|
|
90
|
-
// Check environment variables
|
|
91
|
-
if (
|
|
92
|
-
process.env.OPNET_MNEMONIC ||
|
|
93
|
-
process.env.OPNET_PRIVATE_KEY ||
|
|
94
|
-
process.env.OPNET_MLDSA_KEY
|
|
95
|
-
) {
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return fs.existsSync(CREDENTIALS_FILE);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Validate that credentials are sufficient for signing
|
|
104
|
-
*
|
|
105
|
-
* @param credentials - The credentials to validate
|
|
106
|
-
* @returns True if credentials can be used for signing
|
|
107
|
-
*/
|
|
108
|
-
export function canSign(credentials: CLICredentials | null): boolean {
|
|
109
|
-
if (!credentials) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Mnemonic provides both classical and quantum keys
|
|
114
|
-
if (credentials.mnemonic) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// WIF + MLDSA key for advanced users
|
|
119
|
-
if (credentials.wif && credentials.mldsaPrivateKey) {
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Get a user-friendly description of the credential source
|
|
128
|
-
*
|
|
129
|
-
* @returns Description of where credentials are loaded from
|
|
130
|
-
*/
|
|
131
|
-
export function getCredentialSource(): string {
|
|
132
|
-
if (process.env.OPNET_MNEMONIC) {
|
|
133
|
-
return 'environment (OPNET_MNEMONIC)';
|
|
134
|
-
}
|
|
135
|
-
if (process.env.OPNET_PRIVATE_KEY || process.env.OPNET_MLDSA_KEY) {
|
|
136
|
-
return 'environment (OPNET_PRIVATE_KEY/OPNET_MLDSA_KEY)';
|
|
137
|
-
}
|
|
138
|
-
if (fs.existsSync(CREDENTIALS_FILE)) {
|
|
139
|
-
return CREDENTIALS_FILE;
|
|
140
|
-
}
|
|
141
|
-
return 'none';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Mask sensitive data for display
|
|
146
|
-
*
|
|
147
|
-
* @param value - The value to mask
|
|
148
|
-
* @param showChars - Number of characters to show at start and end
|
|
149
|
-
* @returns Masked string
|
|
150
|
-
*/
|
|
151
|
-
export function maskSensitive(value: string, showChars: number = 4): string {
|
|
152
|
-
if (value.length <= showChars * 2) {
|
|
153
|
-
return '*'.repeat(value.length);
|
|
154
|
-
}
|
|
155
|
-
return value.slice(0, showChars) + '...' + value.slice(-showChars);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Validate MLDSA level
|
|
160
|
-
*
|
|
161
|
-
* @param level - The level to validate
|
|
162
|
-
* @returns True if valid MLDSA level
|
|
163
|
-
*/
|
|
164
|
-
export function isValidMldsaLevel(level: number): level is CLIMldsaLevel {
|
|
165
|
-
return level === 44 || level === 65 || level === 87;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Validate network name
|
|
170
|
-
*
|
|
171
|
-
* @param network - The network name to validate
|
|
172
|
-
* @returns True if valid network name
|
|
173
|
-
*/
|
|
174
|
-
export function isValidNetwork(network: string): network is NetworkName {
|
|
175
|
-
return network === 'mainnet' || network === 'testnet' || network === 'regtest';
|
|
176
|
-
}
|