@cygnus-wealth/data-models 0.0.1
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/README.md +117 -0
- package/dist/enums/AccountType.d.ts +12 -0
- package/dist/enums/AssetType.d.ts +15 -0
- package/dist/enums/Chain.d.ts +12 -0
- package/dist/enums/IntegrationSource.d.ts +18 -0
- package/dist/enums/TransactionType.d.ts +21 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/interfaces/Account.d.ts +24 -0
- package/dist/interfaces/ApiError.d.ts +5 -0
- package/dist/interfaces/ApiResponse.d.ts +7 -0
- package/dist/interfaces/Asset.d.ts +18 -0
- package/dist/interfaces/Balance.d.ts +13 -0
- package/dist/interfaces/BaseEntity.d.ts +5 -0
- package/dist/interfaces/FilterOptions.d.ts +12 -0
- package/dist/interfaces/IntegrationCredentials.d.ts +11 -0
- package/dist/interfaces/LendingPosition.d.ts +18 -0
- package/dist/interfaces/LiquidityPosition.d.ts +18 -0
- package/dist/interfaces/MarketData.d.ts +14 -0
- package/dist/interfaces/Metadata.d.ts +3 -0
- package/dist/interfaces/NFT.d.ts +14 -0
- package/dist/interfaces/PaginatedResponse.d.ts +7 -0
- package/dist/interfaces/Portfolio.d.ts +21 -0
- package/dist/interfaces/PortfolioItem.d.ts +4 -0
- package/dist/interfaces/Price.d.ts +7 -0
- package/dist/interfaces/StakedPosition.d.ts +19 -0
- package/dist/interfaces/SyncStatus.d.ts +11 -0
- package/dist/interfaces/Transaction.d.ts +35 -0
- package/dist/types/AssetIdentifier.d.ts +7 -0
- package/dist/types/SortOrder.d.ts +1 -0
- package/dist/types/TimeRange.d.ts +4 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# @cygnus-wealth/data-models
|
|
2
|
+
|
|
3
|
+
TypeScript type definitions for standardizing financial data across the CygnusWealth ecosystem.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides a unified type system for financial data from various sources including:
|
|
8
|
+
- Centralized exchanges (CEX) - Robinhood, Kraken, Coinbase
|
|
9
|
+
- Decentralized exchanges (DEX) and on-chain data
|
|
10
|
+
- Multi-chain wallets - MetaMask, Phantom, Sui Wallet
|
|
11
|
+
- Manual entries and external financial platforms
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @cygnus-wealth/data-models
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import {
|
|
23
|
+
Portfolio,
|
|
24
|
+
Asset,
|
|
25
|
+
Transaction,
|
|
26
|
+
MarketData
|
|
27
|
+
} from '@cygnus-wealth/data-models';
|
|
28
|
+
|
|
29
|
+
// Example: Working with portfolio data
|
|
30
|
+
const portfolio: Portfolio = {
|
|
31
|
+
id: 'portfolio-123',
|
|
32
|
+
name: 'Main Portfolio',
|
|
33
|
+
assets: [],
|
|
34
|
+
totalValue: 50000,
|
|
35
|
+
source: 'kraken',
|
|
36
|
+
lastUpdated: new Date()
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Core Types
|
|
41
|
+
|
|
42
|
+
### Financial Data Types
|
|
43
|
+
- `Portfolio` - Complete portfolio representation
|
|
44
|
+
- `Asset` - Individual asset holdings
|
|
45
|
+
- `Transaction` - Transaction records across platforms
|
|
46
|
+
- `MarketData` - Real-time and historical market data
|
|
47
|
+
- `Position` - Trading positions and holdings
|
|
48
|
+
- `Balance` - Account and wallet balances
|
|
49
|
+
|
|
50
|
+
### Source Identifiers
|
|
51
|
+
- `DataSource` - Union type for all supported data sources
|
|
52
|
+
- `ChainId` - Blockchain network identifiers
|
|
53
|
+
- `AssetType` - Asset classification (crypto, stock, NFT, etc.)
|
|
54
|
+
|
|
55
|
+
## Type Design Principles
|
|
56
|
+
|
|
57
|
+
1. **Multi-source compatibility** - Types accommodate data from various financial platforms
|
|
58
|
+
2. **Optional fields** - Prefer optional properties over provider-specific interfaces
|
|
59
|
+
3. **Source tracking** - Include identifiers to track data origin
|
|
60
|
+
4. **Normalization-ready** - Structured for easy data transformation
|
|
61
|
+
5. **Type safety** - Leverage TypeScript's type system for compile-time guarantees
|
|
62
|
+
|
|
63
|
+
## Development
|
|
64
|
+
|
|
65
|
+
### Prerequisites
|
|
66
|
+
- Node.js 18+
|
|
67
|
+
- npm or yarn
|
|
68
|
+
|
|
69
|
+
### Setup
|
|
70
|
+
```bash
|
|
71
|
+
# Install dependencies
|
|
72
|
+
npm install
|
|
73
|
+
|
|
74
|
+
# Build type declarations
|
|
75
|
+
npm run build
|
|
76
|
+
|
|
77
|
+
# Run tests
|
|
78
|
+
npm test
|
|
79
|
+
|
|
80
|
+
# Lint code
|
|
81
|
+
npm run lint
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Project Structure
|
|
85
|
+
```
|
|
86
|
+
src/
|
|
87
|
+
├── index.ts # Main entry point with all type exports
|
|
88
|
+
└── index.test.ts # Type definition tests
|
|
89
|
+
|
|
90
|
+
dist/ # Generated TypeScript declarations (gitignored)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Testing
|
|
94
|
+
Tests ensure type consistency and proper structure:
|
|
95
|
+
```bash
|
|
96
|
+
npm test # Run tests in watch mode
|
|
97
|
+
npm test -- --run # Run tests once
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Contributing
|
|
101
|
+
|
|
102
|
+
When adding new types:
|
|
103
|
+
1. Define types in `src/index.ts`
|
|
104
|
+
2. Add corresponding tests in `src/index.test.ts`
|
|
105
|
+
3. Follow existing naming conventions
|
|
106
|
+
4. Document complex types with JSDoc comments
|
|
107
|
+
5. Run tests and linting before submitting
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
Part of the CygnusWealth project. See LICENSE file for details.
|
|
112
|
+
|
|
113
|
+
## Related Packages
|
|
114
|
+
|
|
115
|
+
- `@cygnus-wealth/web-app` - Main web application
|
|
116
|
+
- `@cygnus-wealth/crypto-utils` - Blockchain utilities
|
|
117
|
+
- `@cygnus-wealth/api-clients` - Exchange API integrations
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum AccountType {
|
|
2
|
+
SPOT = "SPOT",
|
|
3
|
+
MARGIN = "MARGIN",
|
|
4
|
+
FUTURES = "FUTURES",
|
|
5
|
+
SAVINGS = "SAVINGS",
|
|
6
|
+
STAKING = "STAKING",
|
|
7
|
+
WALLET = "WALLET",
|
|
8
|
+
DEFI = "DEFI",
|
|
9
|
+
BROKERAGE = "BROKERAGE",
|
|
10
|
+
RETIREMENT = "RETIREMENT",
|
|
11
|
+
OTHER = "OTHER"
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum AssetType {
|
|
2
|
+
CRYPTOCURRENCY = "CRYPTOCURRENCY",
|
|
3
|
+
STOCK = "STOCK",
|
|
4
|
+
ETF = "ETF",
|
|
5
|
+
MUTUAL_FUND = "MUTUAL_FUND",
|
|
6
|
+
BOND = "BOND",
|
|
7
|
+
COMMODITY = "COMMODITY",
|
|
8
|
+
FIAT = "FIAT",
|
|
9
|
+
NFT = "NFT",
|
|
10
|
+
DERIVATIVE = "DERIVATIVE",
|
|
11
|
+
LIQUIDITY_POOL = "LIQUIDITY_POOL",
|
|
12
|
+
STAKED_POSITION = "STAKED_POSITION",
|
|
13
|
+
LENDING_POSITION = "LENDING_POSITION",
|
|
14
|
+
OTHER = "OTHER"
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare enum IntegrationSource {
|
|
2
|
+
ROBINHOOD = "ROBINHOOD",
|
|
3
|
+
KRAKEN = "KRAKEN",
|
|
4
|
+
COINBASE = "COINBASE",
|
|
5
|
+
BINANCE = "BINANCE",
|
|
6
|
+
UNISWAP = "UNISWAP",
|
|
7
|
+
SUSHISWAP = "SUSHISWAP",
|
|
8
|
+
PANCAKESWAP = "PANCAKESWAP",
|
|
9
|
+
CURVE = "CURVE",
|
|
10
|
+
BALANCER = "BALANCER",
|
|
11
|
+
METAMASK = "METAMASK",
|
|
12
|
+
RABBY = "RABBY",
|
|
13
|
+
PHANTOM = "PHANTOM",
|
|
14
|
+
SLUSH = "SLUSH",
|
|
15
|
+
MANUAL_ENTRY = "MANUAL_ENTRY",
|
|
16
|
+
BLOCKCHAIN_DIRECT = "BLOCKCHAIN_DIRECT",
|
|
17
|
+
OTHER = "OTHER"
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum TransactionType {
|
|
2
|
+
BUY = "BUY",
|
|
3
|
+
SELL = "SELL",
|
|
4
|
+
TRANSFER_IN = "TRANSFER_IN",
|
|
5
|
+
TRANSFER_OUT = "TRANSFER_OUT",
|
|
6
|
+
SWAP = "SWAP",
|
|
7
|
+
STAKE = "STAKE",
|
|
8
|
+
UNSTAKE = "UNSTAKE",
|
|
9
|
+
CLAIM_REWARD = "CLAIM_REWARD",
|
|
10
|
+
PROVIDE_LIQUIDITY = "PROVIDE_LIQUIDITY",
|
|
11
|
+
REMOVE_LIQUIDITY = "REMOVE_LIQUIDITY",
|
|
12
|
+
BORROW = "BORROW",
|
|
13
|
+
REPAY = "REPAY",
|
|
14
|
+
LIQUIDATION = "LIQUIDATION",
|
|
15
|
+
MINT = "MINT",
|
|
16
|
+
BURN = "BURN",
|
|
17
|
+
FEE = "FEE",
|
|
18
|
+
DIVIDEND = "DIVIDEND",
|
|
19
|
+
INTEREST = "INTEREST",
|
|
20
|
+
OTHER = "OTHER"
|
|
21
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export { AssetType } from './enums/AssetType';
|
|
2
|
+
export { Chain } from './enums/Chain';
|
|
3
|
+
export { IntegrationSource } from './enums/IntegrationSource';
|
|
4
|
+
export { TransactionType } from './enums/TransactionType';
|
|
5
|
+
export { AccountType } from './enums/AccountType';
|
|
6
|
+
export { BaseEntity } from './interfaces/BaseEntity';
|
|
7
|
+
export { Metadata } from './interfaces/Metadata';
|
|
8
|
+
export { Asset } from './interfaces/Asset';
|
|
9
|
+
export { NFT } from './interfaces/NFT';
|
|
10
|
+
export { Price } from './interfaces/Price';
|
|
11
|
+
export { MarketData } from './interfaces/MarketData';
|
|
12
|
+
export { Balance } from './interfaces/Balance';
|
|
13
|
+
export { LiquidityPosition } from './interfaces/LiquidityPosition';
|
|
14
|
+
export { StakedPosition } from './interfaces/StakedPosition';
|
|
15
|
+
export { LendingPosition } from './interfaces/LendingPosition';
|
|
16
|
+
export { Account } from './interfaces/Account';
|
|
17
|
+
export { Portfolio } from './interfaces/Portfolio';
|
|
18
|
+
export { Transaction } from './interfaces/Transaction';
|
|
19
|
+
export { IntegrationCredentials } from './interfaces/IntegrationCredentials';
|
|
20
|
+
export { SyncStatus } from './interfaces/SyncStatus';
|
|
21
|
+
export { ApiResponse } from './interfaces/ApiResponse';
|
|
22
|
+
export { ApiError } from './interfaces/ApiError';
|
|
23
|
+
export { PaginatedResponse } from './interfaces/PaginatedResponse';
|
|
24
|
+
export { AssetIdentifier } from './types/AssetIdentifier';
|
|
25
|
+
export { TimeRange } from './types/TimeRange';
|
|
26
|
+
export { SortOrder } from './types/SortOrder';
|
|
27
|
+
export { FilterOptions } from './interfaces/FilterOptions';
|
|
28
|
+
export { PortfolioItem } from './interfaces/PortfolioItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AccountType } from '../enums/AccountType';
|
|
2
|
+
import { IntegrationSource } from '../enums/IntegrationSource';
|
|
3
|
+
import { Balance } from './Balance';
|
|
4
|
+
import { LiquidityPosition } from './LiquidityPosition';
|
|
5
|
+
import { StakedPosition } from './StakedPosition';
|
|
6
|
+
import { LendingPosition } from './LendingPosition';
|
|
7
|
+
import { NFT } from './NFT';
|
|
8
|
+
import { Price } from './Price';
|
|
9
|
+
import { Metadata } from './Metadata';
|
|
10
|
+
export interface Account {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: AccountType;
|
|
14
|
+
source: IntegrationSource;
|
|
15
|
+
sourceAccountId?: string;
|
|
16
|
+
balances: Balance[];
|
|
17
|
+
liquidityPositions?: LiquidityPosition[];
|
|
18
|
+
stakedPositions?: StakedPosition[];
|
|
19
|
+
lendingPositions?: LendingPosition[];
|
|
20
|
+
nfts?: NFT[];
|
|
21
|
+
totalValue?: Price;
|
|
22
|
+
lastSynced?: Date;
|
|
23
|
+
metadata?: Metadata;
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AssetType } from '../enums/AssetType';
|
|
2
|
+
import { Chain } from '../enums/Chain';
|
|
3
|
+
import { Metadata } from './Metadata';
|
|
4
|
+
export interface Asset {
|
|
5
|
+
id: string;
|
|
6
|
+
symbol: string;
|
|
7
|
+
name: string;
|
|
8
|
+
type: AssetType;
|
|
9
|
+
decimals?: number;
|
|
10
|
+
contractAddress?: string;
|
|
11
|
+
chain?: Chain;
|
|
12
|
+
logoUrl?: string;
|
|
13
|
+
coingeckoId?: string;
|
|
14
|
+
cmc_id?: string;
|
|
15
|
+
cusip?: string;
|
|
16
|
+
isin?: string;
|
|
17
|
+
metadata?: Metadata;
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Asset } from './Asset';
|
|
2
|
+
import { Price } from './Price';
|
|
3
|
+
import { Metadata } from './Metadata';
|
|
4
|
+
export interface Balance {
|
|
5
|
+
assetId: string;
|
|
6
|
+
asset: Asset;
|
|
7
|
+
amount: string;
|
|
8
|
+
value?: Price;
|
|
9
|
+
cost_basis?: number;
|
|
10
|
+
realized_pnl?: number;
|
|
11
|
+
unrealized_pnl?: number;
|
|
12
|
+
metadata?: Metadata;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Chain } from '../enums/Chain';
|
|
2
|
+
import { AssetType } from '../enums/AssetType';
|
|
3
|
+
import { IntegrationSource } from '../enums/IntegrationSource';
|
|
4
|
+
import { TimeRange } from '../types/TimeRange';
|
|
5
|
+
export interface FilterOptions {
|
|
6
|
+
chains?: Chain[];
|
|
7
|
+
assetTypes?: AssetType[];
|
|
8
|
+
sources?: IntegrationSource[];
|
|
9
|
+
timeRange?: TimeRange;
|
|
10
|
+
minValue?: number;
|
|
11
|
+
maxValue?: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IntegrationSource } from '../enums/IntegrationSource';
|
|
2
|
+
import { Metadata } from './Metadata';
|
|
3
|
+
export interface IntegrationCredentials {
|
|
4
|
+
source: IntegrationSource;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
apiSecret?: string;
|
|
7
|
+
passphrase?: string;
|
|
8
|
+
walletAddress?: string;
|
|
9
|
+
chainId?: string;
|
|
10
|
+
metadata?: Metadata;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Chain } from '../enums/Chain';
|
|
2
|
+
import { Asset } from './Asset';
|
|
3
|
+
import { Price } from './Price';
|
|
4
|
+
import { Metadata } from './Metadata';
|
|
5
|
+
export interface LendingPosition {
|
|
6
|
+
id: string;
|
|
7
|
+
protocol: string;
|
|
8
|
+
chain: Chain;
|
|
9
|
+
type: 'SUPPLY' | 'BORROW';
|
|
10
|
+
asset: Asset;
|
|
11
|
+
amount: string;
|
|
12
|
+
apy?: number;
|
|
13
|
+
accrued_interest?: number;
|
|
14
|
+
health_factor?: number;
|
|
15
|
+
liquidation_threshold?: number;
|
|
16
|
+
value?: Price;
|
|
17
|
+
metadata?: Metadata;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Chain } from '../enums/Chain';
|
|
2
|
+
import { Balance } from './Balance';
|
|
3
|
+
import { Price } from './Price';
|
|
4
|
+
import { Metadata } from './Metadata';
|
|
5
|
+
export interface LiquidityPosition {
|
|
6
|
+
id: string;
|
|
7
|
+
protocol: string;
|
|
8
|
+
poolAddress: string;
|
|
9
|
+
poolName: string;
|
|
10
|
+
chain: Chain;
|
|
11
|
+
tokens: Balance[];
|
|
12
|
+
lpTokenBalance?: string;
|
|
13
|
+
share?: number;
|
|
14
|
+
value?: Price;
|
|
15
|
+
fees_earned?: number;
|
|
16
|
+
impermanent_loss?: number;
|
|
17
|
+
metadata?: Metadata;
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Price } from './Price';
|
|
2
|
+
export interface MarketData {
|
|
3
|
+
assetId: string;
|
|
4
|
+
currentPrice: Price;
|
|
5
|
+
marketCap?: number;
|
|
6
|
+
volume24h?: number;
|
|
7
|
+
priceChange24h?: number;
|
|
8
|
+
priceChangePercentage24h?: number;
|
|
9
|
+
high24h?: number;
|
|
10
|
+
low24h?: number;
|
|
11
|
+
circulatingSupply?: number;
|
|
12
|
+
totalSupply?: number;
|
|
13
|
+
lastUpdated: Date;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Asset } from './Asset';
|
|
2
|
+
export interface NFT extends Asset {
|
|
3
|
+
tokenId: string;
|
|
4
|
+
collectionAddress: string;
|
|
5
|
+
collectionName: string;
|
|
6
|
+
tokenUri?: string;
|
|
7
|
+
imageUrl?: string;
|
|
8
|
+
animationUrl?: string;
|
|
9
|
+
attributes?: Array<{
|
|
10
|
+
trait_type: string;
|
|
11
|
+
value: string | number;
|
|
12
|
+
display_type?: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Account } from './Account';
|
|
2
|
+
import { Price } from './Price';
|
|
3
|
+
export interface Portfolio {
|
|
4
|
+
id: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
accounts: Account[];
|
|
8
|
+
totalValue: Price;
|
|
9
|
+
totalValueHistory?: Array<{
|
|
10
|
+
timestamp: Date;
|
|
11
|
+
value: Price;
|
|
12
|
+
}>;
|
|
13
|
+
performance?: {
|
|
14
|
+
day: number;
|
|
15
|
+
week: number;
|
|
16
|
+
month: number;
|
|
17
|
+
year: number;
|
|
18
|
+
all_time: number;
|
|
19
|
+
};
|
|
20
|
+
lastUpdated: Date;
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Chain } from '../enums/Chain';
|
|
2
|
+
import { Asset } from './Asset';
|
|
3
|
+
import { Balance } from './Balance';
|
|
4
|
+
import { Price } from './Price';
|
|
5
|
+
import { Metadata } from './Metadata';
|
|
6
|
+
export interface StakedPosition {
|
|
7
|
+
id: string;
|
|
8
|
+
protocol: string;
|
|
9
|
+
validator?: string;
|
|
10
|
+
chain: Chain;
|
|
11
|
+
asset: Asset;
|
|
12
|
+
stakedAmount: string;
|
|
13
|
+
rewards: Balance[];
|
|
14
|
+
lockupPeriod?: number;
|
|
15
|
+
unlockDate?: Date;
|
|
16
|
+
apr?: number;
|
|
17
|
+
value?: Price;
|
|
18
|
+
metadata?: Metadata;
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IntegrationSource } from '../enums/IntegrationSource';
|
|
2
|
+
import { Metadata } from './Metadata';
|
|
3
|
+
export interface SyncStatus {
|
|
4
|
+
source: IntegrationSource;
|
|
5
|
+
accountId: string;
|
|
6
|
+
status: 'IDLE' | 'SYNCING' | 'SUCCESS' | 'ERROR';
|
|
7
|
+
lastSyncTime?: Date;
|
|
8
|
+
lastError?: string;
|
|
9
|
+
itemsSynced?: number;
|
|
10
|
+
metadata?: Metadata;
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TransactionType } from '../enums/TransactionType';
|
|
2
|
+
import { Chain } from '../enums/Chain';
|
|
3
|
+
import { Asset } from './Asset';
|
|
4
|
+
import { Price } from './Price';
|
|
5
|
+
import { Metadata } from './Metadata';
|
|
6
|
+
export interface Transaction {
|
|
7
|
+
id: string;
|
|
8
|
+
accountId: string;
|
|
9
|
+
type: TransactionType;
|
|
10
|
+
status: 'PENDING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
|
|
11
|
+
hash?: string;
|
|
12
|
+
chain?: Chain;
|
|
13
|
+
from?: string;
|
|
14
|
+
to?: string;
|
|
15
|
+
timestamp: Date;
|
|
16
|
+
blockNumber?: number;
|
|
17
|
+
assets_in?: Array<{
|
|
18
|
+
asset: Asset;
|
|
19
|
+
amount: string;
|
|
20
|
+
value?: Price;
|
|
21
|
+
}>;
|
|
22
|
+
assets_out?: Array<{
|
|
23
|
+
asset: Asset;
|
|
24
|
+
amount: string;
|
|
25
|
+
value?: Price;
|
|
26
|
+
}>;
|
|
27
|
+
fees?: Array<{
|
|
28
|
+
asset: Asset;
|
|
29
|
+
amount: string;
|
|
30
|
+
value?: Price;
|
|
31
|
+
}>;
|
|
32
|
+
protocol?: string;
|
|
33
|
+
method?: string;
|
|
34
|
+
metadata?: Metadata;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SortOrder = 'ASC' | 'DESC';
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cygnus-wealth/data-models",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Shared TypeScript data models for CygnusWealth project",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "vitest",
|
|
10
|
+
"lint": "eslint . --ext .ts"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"private": false,
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@eslint/js": "^9.32.0",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
26
|
+
"@typescript-eslint/parser": "^8.38.0",
|
|
27
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
28
|
+
"eslint": "^9.32.0",
|
|
29
|
+
"globals": "^16.3.0",
|
|
30
|
+
"jsdom": "^26.1.0",
|
|
31
|
+
"typescript": "^5.8.3",
|
|
32
|
+
"typescript-eslint": "^8.38.0",
|
|
33
|
+
"vitest": "^3.2.4"
|
|
34
|
+
}
|
|
35
|
+
}
|