@cygnus-wealth/data-models 1.0.0 → 1.1.0
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/dist/index.d.ts
CHANGED
|
@@ -27,4 +27,5 @@ export { AssetIdentifier } from './types/AssetIdentifier';
|
|
|
27
27
|
export { TimeRange } from './types/TimeRange';
|
|
28
28
|
export { SortOrder } from './types/SortOrder';
|
|
29
29
|
export { FilterOptions } from './interfaces/FilterOptions';
|
|
30
|
+
export { NetworkEnvironment, EnvironmentConfig } from './types/NetworkEnvironment';
|
|
30
31
|
export { PortfolioItem } from './interfaces/PortfolioItem';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Chain } from '../enums/Chain';
|
|
2
|
+
/**
|
|
3
|
+
* Discriminator type for blockchain network environments.
|
|
4
|
+
*
|
|
5
|
+
* Distinguishes between production (mainnet), testnet, and local development
|
|
6
|
+
* environments. Used to ensure operations target the correct network tier
|
|
7
|
+
* and to prevent accidental cross-environment interactions.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { NetworkEnvironment } from '@cygnus-wealth/data-models';
|
|
12
|
+
*
|
|
13
|
+
* const env: NetworkEnvironment = 'production';
|
|
14
|
+
*
|
|
15
|
+
* function getRpcUrl(env: NetworkEnvironment): string {
|
|
16
|
+
* switch (env) {
|
|
17
|
+
* case 'production': return 'https://mainnet.infura.io/v3/...';
|
|
18
|
+
* case 'testnet': return 'https://sepolia.infura.io/v3/...';
|
|
19
|
+
* case 'local': return 'http://localhost:8545';
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @since 1.1.0
|
|
25
|
+
* @stability standard
|
|
26
|
+
*
|
|
27
|
+
* @see {@link EnvironmentConfig} for full environment configuration
|
|
28
|
+
* @see {@link Chain} for blockchain network identifiers
|
|
29
|
+
*/
|
|
30
|
+
export type NetworkEnvironment = 'production' | 'testnet' | 'local';
|
|
31
|
+
/**
|
|
32
|
+
* Configuration for a specific network environment.
|
|
33
|
+
*
|
|
34
|
+
* Pairs a {@link NetworkEnvironment} discriminator with the target blockchain
|
|
35
|
+
* chain and an RPC endpoint URL. Provides a structured way to manage
|
|
36
|
+
* environment-specific connection details.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { EnvironmentConfig, Chain } from '@cygnus-wealth/data-models';
|
|
41
|
+
*
|
|
42
|
+
* const mainnetConfig: EnvironmentConfig = {
|
|
43
|
+
* environment: 'production',
|
|
44
|
+
* chain: Chain.ETHEREUM,
|
|
45
|
+
* rpcUrl: 'https://mainnet.infura.io/v3/YOUR_KEY'
|
|
46
|
+
* };
|
|
47
|
+
*
|
|
48
|
+
* const testnetConfig: EnvironmentConfig = {
|
|
49
|
+
* environment: 'testnet',
|
|
50
|
+
* chain: Chain.ETHEREUM,
|
|
51
|
+
* rpcUrl: 'https://sepolia.infura.io/v3/YOUR_KEY',
|
|
52
|
+
* label: 'Sepolia Testnet'
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* const localConfig: EnvironmentConfig = {
|
|
56
|
+
* environment: 'local',
|
|
57
|
+
* chain: Chain.ETHEREUM,
|
|
58
|
+
* rpcUrl: 'http://localhost:8545',
|
|
59
|
+
* label: 'Hardhat Local'
|
|
60
|
+
* };
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @since 1.1.0
|
|
64
|
+
* @stability standard
|
|
65
|
+
*
|
|
66
|
+
* @see {@link NetworkEnvironment} for environment discriminator values
|
|
67
|
+
* @see {@link Chain} for supported blockchain networks
|
|
68
|
+
*/
|
|
69
|
+
export interface EnvironmentConfig {
|
|
70
|
+
/** The network environment tier */
|
|
71
|
+
environment: NetworkEnvironment;
|
|
72
|
+
/** Target blockchain network */
|
|
73
|
+
chain: Chain;
|
|
74
|
+
/** RPC endpoint URL for this environment */
|
|
75
|
+
rpcUrl: string;
|
|
76
|
+
/** Optional human-readable label (e.g., 'Sepolia Testnet', 'Hardhat Local') */
|
|
77
|
+
label?: string;
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cygnus-wealth/data-models",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Shared TypeScript data models for CygnusWealth project",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
"license": "ISC",
|
|
42
42
|
"type": "module",
|
|
43
43
|
"private": false,
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/Cygnus-Wealth/data-models.git"
|
|
47
|
+
},
|
|
44
48
|
"publishConfig": {
|
|
45
49
|
"access": "public"
|
|
46
50
|
},
|
|
File without changes
|