@cygnus-wealth/data-models 1.1.2 → 1.4.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/cjs/enums/ChainFamily.js +54 -0
- package/dist/cjs/enums/DeFiDiscoverySource.js +37 -0
- package/dist/cjs/enums/DeFiPositionType.js +39 -0
- package/dist/cjs/enums/DeFiProtocol.js +46 -0
- package/dist/cjs/enums/IntegrationSource.js +8 -0
- package/dist/cjs/enums/VaultStrategyType.js +34 -0
- package/dist/cjs/index.js +11 -1
- package/dist/cjs/interfaces/AccountAssetEntry.js +2 -0
- package/dist/cjs/interfaces/AccountBalanceList.js +2 -0
- package/dist/cjs/interfaces/AccountGroup.js +2 -0
- package/dist/cjs/interfaces/AccountMetadata.js +2 -0
- package/dist/cjs/interfaces/AccountPortfolio.js +2 -0
- package/dist/cjs/interfaces/AccountSummary.js +2 -0
- package/dist/cjs/interfaces/AddressRequest.js +2 -0
- package/dist/cjs/interfaces/AssetDistribution.js +2 -0
- package/dist/cjs/interfaces/ConnectedAccount.js +2 -0
- package/dist/cjs/interfaces/DeFiPosition.js +2 -0
- package/dist/cjs/interfaces/GroupPortfolio.js +2 -0
- package/dist/cjs/interfaces/TrackedAddress.js +2 -0
- package/dist/cjs/interfaces/VaultPosition.js +2 -0
- package/dist/cjs/interfaces/WalletConnection.js +2 -0
- package/dist/cjs/interfaces/WalletPortfolio.js +2 -0
- package/dist/cjs/interfaces/WatchAddress.js +2 -0
- package/dist/cjs/types/AccountId.js +2 -0
- package/dist/cjs/types/Caip2ChainId.js +2 -0
- package/dist/cjs/types/WalletConnectionId.js +2 -0
- package/dist/cjs/types/WalletProviderId.js +2 -0
- package/dist/enums/ChainFamily.d.ts +50 -0
- package/dist/enums/ChainFamily.js +51 -0
- package/dist/enums/DeFiDiscoverySource.d.ts +33 -0
- package/dist/enums/DeFiDiscoverySource.js +34 -0
- package/dist/enums/DeFiPositionType.d.ts +35 -0
- package/dist/enums/DeFiPositionType.js +36 -0
- package/dist/enums/DeFiProtocol.d.ts +42 -0
- package/dist/enums/DeFiProtocol.js +43 -0
- package/dist/enums/IntegrationSource.d.ts +8 -0
- package/dist/enums/IntegrationSource.js +8 -0
- package/dist/enums/VaultStrategyType.d.ts +30 -0
- package/dist/enums/VaultStrategyType.js +31 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +5 -0
- package/dist/interfaces/Account.d.ts +3 -0
- package/dist/interfaces/AccountAssetEntry.d.ts +42 -0
- package/dist/interfaces/AccountAssetEntry.js +1 -0
- package/dist/interfaces/AccountBalanceList.d.ts +85 -0
- package/dist/interfaces/AccountBalanceList.js +1 -0
- package/dist/interfaces/AccountGroup.d.ts +37 -0
- package/dist/interfaces/AccountGroup.js +1 -0
- package/dist/interfaces/AccountMetadata.d.ts +54 -0
- package/dist/interfaces/AccountMetadata.js +1 -0
- package/dist/interfaces/AccountPortfolio.d.ts +47 -0
- package/dist/interfaces/AccountPortfolio.js +1 -0
- package/dist/interfaces/AccountSummary.d.ts +49 -0
- package/dist/interfaces/AccountSummary.js +1 -0
- package/dist/interfaces/AddressRequest.d.ts +36 -0
- package/dist/interfaces/AddressRequest.js +1 -0
- package/dist/interfaces/Asset.d.ts +6 -0
- package/dist/interfaces/AssetDistribution.d.ts +45 -0
- package/dist/interfaces/AssetDistribution.js +1 -0
- package/dist/interfaces/ConnectedAccount.d.ts +52 -0
- package/dist/interfaces/ConnectedAccount.js +1 -0
- package/dist/interfaces/DeFiPosition.d.ts +79 -0
- package/dist/interfaces/DeFiPosition.js +1 -0
- package/dist/interfaces/FilterOptions.d.ts +8 -0
- package/dist/interfaces/GroupPortfolio.d.ts +39 -0
- package/dist/interfaces/GroupPortfolio.js +1 -0
- package/dist/interfaces/IntegrationCredentials.d.ts +3 -0
- package/dist/interfaces/LendingPosition.d.ts +3 -0
- package/dist/interfaces/LiquidityPosition.d.ts +3 -0
- package/dist/interfaces/Portfolio.d.ts +8 -0
- package/dist/interfaces/StakedPosition.d.ts +3 -0
- package/dist/interfaces/TrackedAddress.d.ts +50 -0
- package/dist/interfaces/TrackedAddress.js +1 -0
- package/dist/interfaces/Transaction.d.ts +3 -0
- package/dist/interfaces/VaultPosition.d.ts +113 -0
- package/dist/interfaces/VaultPosition.js +1 -0
- package/dist/interfaces/WalletConnection.d.ts +67 -0
- package/dist/interfaces/WalletConnection.js +1 -0
- package/dist/interfaces/WalletPortfolio.d.ts +40 -0
- package/dist/interfaces/WalletPortfolio.js +1 -0
- package/dist/interfaces/WatchAddress.d.ts +42 -0
- package/dist/interfaces/WatchAddress.js +1 -0
- package/dist/types/AccountId.d.ts +27 -0
- package/dist/types/AccountId.js +1 -0
- package/dist/types/Caip2ChainId.d.ts +27 -0
- package/dist/types/Caip2ChainId.js +1 -0
- package/dist/types/WalletConnectionId.d.ts +19 -0
- package/dist/types/WalletConnectionId.js +1 -0
- package/dist/types/WalletProviderId.d.ts +17 -0
- package/dist/types/WalletProviderId.js +1 -0
- package/package.json +26 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-known DeFi protocol identifiers for position attribution.
|
|
3
|
+
*
|
|
4
|
+
* Provides standardized identifiers for major DeFi protocols across chains.
|
|
5
|
+
* Extensible via OTHER for protocols not yet explicitly enumerated.
|
|
6
|
+
* Protocol-specific version info (e.g., "Aave V3") should be stored in
|
|
7
|
+
* position metadata rather than the enum.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { DeFiProtocol } from '@cygnus-wealth/data-models';
|
|
12
|
+
*
|
|
13
|
+
* const protocol = DeFiProtocol.AAVE;
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @since 1.3.0
|
|
17
|
+
* @stability extended
|
|
18
|
+
*
|
|
19
|
+
* @see {@link DeFiPosition} for usage in position interfaces
|
|
20
|
+
*/
|
|
21
|
+
export var DeFiProtocol;
|
|
22
|
+
(function (DeFiProtocol) {
|
|
23
|
+
/** Beefy Finance — multi-chain yield optimizer / auto-compounder */
|
|
24
|
+
DeFiProtocol["BEEFY"] = "BEEFY";
|
|
25
|
+
/** Aave — decentralized lending and borrowing protocol */
|
|
26
|
+
DeFiProtocol["AAVE"] = "AAVE";
|
|
27
|
+
/** Uniswap — Ethereum-native AMM / DEX */
|
|
28
|
+
DeFiProtocol["UNISWAP"] = "UNISWAP";
|
|
29
|
+
/** Compound — algorithmic money market protocol */
|
|
30
|
+
DeFiProtocol["COMPOUND"] = "COMPOUND";
|
|
31
|
+
/** Lido — liquid staking for Ethereum and other PoS chains */
|
|
32
|
+
DeFiProtocol["LIDO"] = "LIDO";
|
|
33
|
+
/** Marinade Finance — liquid staking for Solana */
|
|
34
|
+
DeFiProtocol["MARINADE"] = "MARINADE";
|
|
35
|
+
/** Raydium — Solana AMM and liquidity provider */
|
|
36
|
+
DeFiProtocol["RAYDIUM"] = "RAYDIUM";
|
|
37
|
+
/** Jupiter — Solana DEX aggregator and perps platform */
|
|
38
|
+
DeFiProtocol["JUPITER"] = "JUPITER";
|
|
39
|
+
/** Orca — Solana concentrated liquidity DEX */
|
|
40
|
+
DeFiProtocol["ORCA"] = "ORCA";
|
|
41
|
+
/** Protocol not covered by other values; store name in metadata */
|
|
42
|
+
DeFiProtocol["OTHER"] = "OTHER";
|
|
43
|
+
})(DeFiProtocol || (DeFiProtocol = {}));
|
|
@@ -60,6 +60,14 @@ export declare enum IntegrationSource {
|
|
|
60
60
|
MANUAL_ENTRY = "MANUAL_ENTRY",
|
|
61
61
|
/** Data fetched directly from blockchain via RPC */
|
|
62
62
|
BLOCKCHAIN_DIRECT = "BLOCKCHAIN_DIRECT",
|
|
63
|
+
/** SUI blockchain integration */
|
|
64
|
+
SUI = "SUI",
|
|
65
|
+
/** Bitcoin blockchain integration */
|
|
66
|
+
BITCOIN = "BITCOIN",
|
|
67
|
+
/** Cosmos ecosystem integration */
|
|
68
|
+
COSMOS = "COSMOS",
|
|
69
|
+
/** Aptos blockchain integration */
|
|
70
|
+
APTOS = "APTOS",
|
|
63
71
|
/** Other or unclassified data source */
|
|
64
72
|
OTHER = "OTHER"
|
|
65
73
|
}
|
|
@@ -61,6 +61,14 @@ export var IntegrationSource;
|
|
|
61
61
|
IntegrationSource["MANUAL_ENTRY"] = "MANUAL_ENTRY";
|
|
62
62
|
/** Data fetched directly from blockchain via RPC */
|
|
63
63
|
IntegrationSource["BLOCKCHAIN_DIRECT"] = "BLOCKCHAIN_DIRECT";
|
|
64
|
+
/** SUI blockchain integration */
|
|
65
|
+
IntegrationSource["SUI"] = "SUI";
|
|
66
|
+
/** Bitcoin blockchain integration */
|
|
67
|
+
IntegrationSource["BITCOIN"] = "BITCOIN";
|
|
68
|
+
/** Cosmos ecosystem integration */
|
|
69
|
+
IntegrationSource["COSMOS"] = "COSMOS";
|
|
70
|
+
/** Aptos blockchain integration */
|
|
71
|
+
IntegrationSource["APTOS"] = "APTOS";
|
|
64
72
|
/** Other or unclassified data source */
|
|
65
73
|
IntegrationSource["OTHER"] = "OTHER";
|
|
66
74
|
})(IntegrationSource || (IntegrationSource = {}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy type for yield vault positions.
|
|
3
|
+
*
|
|
4
|
+
* Classifies the underlying strategy used by a yield vault to generate returns.
|
|
5
|
+
* Different strategy types carry different risk profiles and return characteristics.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { VaultStrategyType } from '@cygnus-wealth/data-models';
|
|
10
|
+
*
|
|
11
|
+
* const strategyType = VaultStrategyType.YIELD_AGGREGATOR;
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @since 1.2.0
|
|
15
|
+
* @stability extended
|
|
16
|
+
*
|
|
17
|
+
* @see {@link VaultPosition} for usage in vault positions
|
|
18
|
+
*/
|
|
19
|
+
export declare enum VaultStrategyType {
|
|
20
|
+
/** Auto-compounding yield aggregator (e.g., Yearn, Beefy) */
|
|
21
|
+
YIELD_AGGREGATOR = "YIELD_AGGREGATOR",
|
|
22
|
+
/** Single-asset lending vault (e.g., Yearn USDC vault lending on Aave) */
|
|
23
|
+
LENDING = "LENDING",
|
|
24
|
+
/** Liquidity provision strategy (vault deposits into LP pools) */
|
|
25
|
+
LIQUIDITY_PROVISION = "LIQUIDITY_PROVISION",
|
|
26
|
+
/** Delta-neutral or options-based structured product */
|
|
27
|
+
STRUCTURED_PRODUCT = "STRUCTURED_PRODUCT",
|
|
28
|
+
/** Strategy type not covered by other categories */
|
|
29
|
+
OTHER = "OTHER"
|
|
30
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy type for yield vault positions.
|
|
3
|
+
*
|
|
4
|
+
* Classifies the underlying strategy used by a yield vault to generate returns.
|
|
5
|
+
* Different strategy types carry different risk profiles and return characteristics.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { VaultStrategyType } from '@cygnus-wealth/data-models';
|
|
10
|
+
*
|
|
11
|
+
* const strategyType = VaultStrategyType.YIELD_AGGREGATOR;
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @since 1.2.0
|
|
15
|
+
* @stability extended
|
|
16
|
+
*
|
|
17
|
+
* @see {@link VaultPosition} for usage in vault positions
|
|
18
|
+
*/
|
|
19
|
+
export var VaultStrategyType;
|
|
20
|
+
(function (VaultStrategyType) {
|
|
21
|
+
/** Auto-compounding yield aggregator (e.g., Yearn, Beefy) */
|
|
22
|
+
VaultStrategyType["YIELD_AGGREGATOR"] = "YIELD_AGGREGATOR";
|
|
23
|
+
/** Single-asset lending vault (e.g., Yearn USDC vault lending on Aave) */
|
|
24
|
+
VaultStrategyType["LENDING"] = "LENDING";
|
|
25
|
+
/** Liquidity provision strategy (vault deposits into LP pools) */
|
|
26
|
+
VaultStrategyType["LIQUIDITY_PROVISION"] = "LIQUIDITY_PROVISION";
|
|
27
|
+
/** Delta-neutral or options-based structured product */
|
|
28
|
+
VaultStrategyType["STRUCTURED_PRODUCT"] = "STRUCTURED_PRODUCT";
|
|
29
|
+
/** Strategy type not covered by other categories */
|
|
30
|
+
VaultStrategyType["OTHER"] = "OTHER";
|
|
31
|
+
})(VaultStrategyType || (VaultStrategyType = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export { AssetType } from './enums/AssetType';
|
|
2
2
|
export { Chain } from './enums/Chain';
|
|
3
|
+
export { ChainFamily } from './enums/ChainFamily';
|
|
3
4
|
export { IntegrationSource } from './enums/IntegrationSource';
|
|
4
5
|
export { TransactionType } from './enums/TransactionType';
|
|
5
6
|
export { AccountType } from './enums/AccountType';
|
|
6
7
|
export { LendingPositionType } from './enums/LendingPositionType';
|
|
8
|
+
export { VaultStrategyType } from './enums/VaultStrategyType';
|
|
9
|
+
export { DeFiPositionType } from './enums/DeFiPositionType';
|
|
10
|
+
export { DeFiProtocol } from './enums/DeFiProtocol';
|
|
11
|
+
export { DeFiDiscoverySource } from './enums/DeFiDiscoverySource';
|
|
7
12
|
export { BaseEntity } from './interfaces/BaseEntity';
|
|
8
13
|
export { Metadata } from './interfaces/Metadata';
|
|
9
14
|
export { Asset } from './interfaces/Asset';
|
|
@@ -14,9 +19,29 @@ export { Balance } from './interfaces/Balance';
|
|
|
14
19
|
export { LiquidityPosition } from './interfaces/LiquidityPosition';
|
|
15
20
|
export { StakedPosition } from './interfaces/StakedPosition';
|
|
16
21
|
export { LendingPosition } from './interfaces/LendingPosition';
|
|
22
|
+
export { VaultPosition } from './interfaces/VaultPosition';
|
|
23
|
+
export { DeFiPosition } from './interfaces/DeFiPosition';
|
|
17
24
|
export { Account } from './interfaces/Account';
|
|
18
25
|
export { Portfolio } from './interfaces/Portfolio';
|
|
19
26
|
export { PortfolioAsset } from './interfaces/PortfolioAsset';
|
|
27
|
+
export type { WalletProviderId } from './types/WalletProviderId';
|
|
28
|
+
export type { WalletConnectionId } from './types/WalletConnectionId';
|
|
29
|
+
export type { AccountId } from './types/AccountId';
|
|
30
|
+
export type { Caip2ChainId } from './types/Caip2ChainId';
|
|
31
|
+
export type { WalletConnection } from './interfaces/WalletConnection';
|
|
32
|
+
export type { ConnectedAccount } from './interfaces/ConnectedAccount';
|
|
33
|
+
export type { WatchAddress } from './interfaces/WatchAddress';
|
|
34
|
+
export type { AccountGroup } from './interfaces/AccountGroup';
|
|
35
|
+
export type { AccountPortfolio } from './interfaces/AccountPortfolio';
|
|
36
|
+
export type { WalletPortfolio } from './interfaces/WalletPortfolio';
|
|
37
|
+
export type { GroupPortfolio } from './interfaces/GroupPortfolio';
|
|
38
|
+
export type { AccountSummary } from './interfaces/AccountSummary';
|
|
39
|
+
export type { AssetDistribution } from './interfaces/AssetDistribution';
|
|
40
|
+
export type { AccountAssetEntry } from './interfaces/AccountAssetEntry';
|
|
41
|
+
export type { TrackedAddress } from './interfaces/TrackedAddress';
|
|
42
|
+
export type { AccountMetadata } from './interfaces/AccountMetadata';
|
|
43
|
+
export type { AddressRequest } from './interfaces/AddressRequest';
|
|
44
|
+
export type { AccountBalanceList, AccountBalance, AccountError } from './interfaces/AccountBalanceList';
|
|
20
45
|
export { Transaction } from './interfaces/Transaction';
|
|
21
46
|
export { IntegrationCredentials } from './interfaces/IntegrationCredentials';
|
|
22
47
|
export { SyncStatus } from './interfaces/SyncStatus';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// Enums
|
|
2
2
|
export { AssetType } from './enums/AssetType';
|
|
3
3
|
export { Chain } from './enums/Chain';
|
|
4
|
+
export { ChainFamily } from './enums/ChainFamily';
|
|
4
5
|
export { IntegrationSource } from './enums/IntegrationSource';
|
|
5
6
|
export { TransactionType } from './enums/TransactionType';
|
|
6
7
|
export { AccountType } from './enums/AccountType';
|
|
7
8
|
export { LendingPositionType } from './enums/LendingPositionType';
|
|
9
|
+
export { VaultStrategyType } from './enums/VaultStrategyType';
|
|
10
|
+
export { DeFiPositionType } from './enums/DeFiPositionType';
|
|
11
|
+
export { DeFiProtocol } from './enums/DeFiProtocol';
|
|
12
|
+
export { DeFiDiscoverySource } from './enums/DeFiDiscoverySource';
|
|
@@ -4,6 +4,7 @@ import { Balance } from './Balance';
|
|
|
4
4
|
import { LiquidityPosition } from './LiquidityPosition';
|
|
5
5
|
import { StakedPosition } from './StakedPosition';
|
|
6
6
|
import { LendingPosition } from './LendingPosition';
|
|
7
|
+
import { VaultPosition } from './VaultPosition';
|
|
7
8
|
import { NFT } from './NFT';
|
|
8
9
|
import { Price } from './Price';
|
|
9
10
|
import { Metadata } from './Metadata';
|
|
@@ -105,6 +106,8 @@ export interface Account {
|
|
|
105
106
|
stakedPositions?: StakedPosition[];
|
|
106
107
|
/** Array of lending/borrowing positions (for DeFi money markets) */
|
|
107
108
|
lendingPositions?: LendingPosition[];
|
|
109
|
+
/** Array of yield vault positions (for vault deposits) */
|
|
110
|
+
vaultPositions?: VaultPosition[];
|
|
108
111
|
/** Array of NFTs held in this account */
|
|
109
112
|
nfts?: NFT[];
|
|
110
113
|
/** Total value of all holdings in this account (sum of all positions) */
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AccountId } from '../types/AccountId';
|
|
2
|
+
import { Balance } from './Balance';
|
|
3
|
+
import { Price } from './Price';
|
|
4
|
+
/**
|
|
5
|
+
* A single account's holding of an asset within an asset distribution.
|
|
6
|
+
*
|
|
7
|
+
* Used as part of {@link AssetDistribution} to show how much of a specific
|
|
8
|
+
* asset is held in each account and what percentage of the total it represents.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { AccountAssetEntry } from '@cygnus-wealth/data-models';
|
|
13
|
+
*
|
|
14
|
+
* const entry: AccountAssetEntry = {
|
|
15
|
+
* accountId: 'metamask:a1b2:0xAbc',
|
|
16
|
+
* accountLabel: 'Main DeFi',
|
|
17
|
+
* connectionLabel: 'My MetaMask',
|
|
18
|
+
* quantity: { assetId: 'eth', asset: ethAsset, amount: '7.0' },
|
|
19
|
+
* value: { value: 14000, currency: 'USD', timestamp: new Date() },
|
|
20
|
+
* percentage: 66.67
|
|
21
|
+
* };
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @since 1.3.0
|
|
25
|
+
* @stability extended
|
|
26
|
+
*
|
|
27
|
+
* @see {@link AssetDistribution} for the parent distribution context
|
|
28
|
+
*/
|
|
29
|
+
export interface AccountAssetEntry {
|
|
30
|
+
/** Account holding this portion of the asset */
|
|
31
|
+
accountId: AccountId;
|
|
32
|
+
/** User-assigned account label */
|
|
33
|
+
accountLabel: string;
|
|
34
|
+
/** Label of the parent wallet connection */
|
|
35
|
+
connectionLabel: string;
|
|
36
|
+
/** Quantity of the asset in this account */
|
|
37
|
+
quantity: Balance;
|
|
38
|
+
/** Value of this account's holding */
|
|
39
|
+
value: Price;
|
|
40
|
+
/** Percentage of total for this asset (e.g., 66.67 = 66.67%) */
|
|
41
|
+
percentage: number;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { AccountId } from '../types/AccountId';
|
|
2
|
+
import { Chain } from '../enums/Chain';
|
|
3
|
+
import { Balance } from './Balance';
|
|
4
|
+
/**
|
|
5
|
+
* A single account's balance result for a specific chain.
|
|
6
|
+
*
|
|
7
|
+
* Contains the native balance and token balances for one account
|
|
8
|
+
* on one chain, with the AccountId for attribution.
|
|
9
|
+
*
|
|
10
|
+
* @since 1.3.0
|
|
11
|
+
* @stability extended
|
|
12
|
+
*
|
|
13
|
+
* @see {@link AccountBalanceList} for the container type
|
|
14
|
+
*/
|
|
15
|
+
export interface AccountBalance {
|
|
16
|
+
/** Account this balance belongs to */
|
|
17
|
+
accountId: AccountId;
|
|
18
|
+
/** Checksummed address */
|
|
19
|
+
address: string;
|
|
20
|
+
/** Chain this balance was fetched from */
|
|
21
|
+
chainId: Chain;
|
|
22
|
+
/** Native token balance (e.g., ETH on Ethereum) */
|
|
23
|
+
nativeBalance: Balance;
|
|
24
|
+
/** ERC-20 and other token balances */
|
|
25
|
+
tokenBalances: Balance[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Error encountered while fetching data for a specific account.
|
|
29
|
+
*
|
|
30
|
+
* Supports partial failure: some accounts may succeed while others fail.
|
|
31
|
+
*
|
|
32
|
+
* @since 1.3.0
|
|
33
|
+
* @stability extended
|
|
34
|
+
*/
|
|
35
|
+
export interface AccountError {
|
|
36
|
+
/** Account that encountered the error */
|
|
37
|
+
accountId: AccountId;
|
|
38
|
+
/** Chain where the error occurred */
|
|
39
|
+
chainId: Chain;
|
|
40
|
+
/** Error message */
|
|
41
|
+
message: string;
|
|
42
|
+
/** Error code for programmatic handling */
|
|
43
|
+
code?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Account-attributed balance results with support for partial failure.
|
|
47
|
+
*
|
|
48
|
+
* Returned by integration contracts when fetching balances for multiple
|
|
49
|
+
* accounts. Each balance carries its AccountId for attribution, and
|
|
50
|
+
* per-account errors are reported separately.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import { AccountBalanceList } from '@cygnus-wealth/data-models';
|
|
55
|
+
*
|
|
56
|
+
* const result: AccountBalanceList = {
|
|
57
|
+
* balances: [
|
|
58
|
+
* {
|
|
59
|
+
* accountId: 'metamask:a1b2:0xAbc',
|
|
60
|
+
* address: '0xAbc',
|
|
61
|
+
* chainId: Chain.ETHEREUM,
|
|
62
|
+
* nativeBalance: ethBalance,
|
|
63
|
+
* tokenBalances: [usdcBalance, daiBalance]
|
|
64
|
+
* }
|
|
65
|
+
* ],
|
|
66
|
+
* errors: [],
|
|
67
|
+
* timestamp: '2026-02-19T08:00:00Z'
|
|
68
|
+
* };
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @since 1.3.0
|
|
72
|
+
* @stability extended
|
|
73
|
+
*
|
|
74
|
+
* @see {@link AddressRequest} for the request format
|
|
75
|
+
* @see {@link AccountBalance} for individual balance results
|
|
76
|
+
* @see {@link AccountError} for per-account errors
|
|
77
|
+
*/
|
|
78
|
+
export interface AccountBalanceList {
|
|
79
|
+
/** Successful balance results */
|
|
80
|
+
balances: AccountBalance[];
|
|
81
|
+
/** Per-account errors (partial failure) */
|
|
82
|
+
errors: AccountError[];
|
|
83
|
+
/** ISO 8601 timestamp of the fetch */
|
|
84
|
+
timestamp: string;
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AccountId } from '../types/AccountId';
|
|
2
|
+
/**
|
|
3
|
+
* User-defined grouping of accounts for organizational purposes.
|
|
4
|
+
*
|
|
5
|
+
* Allows users to create custom groups like "DeFi Accounts", "Long-term Holdings",
|
|
6
|
+
* or "Family" that span across wallet connections and watch addresses.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { AccountGroup } from '@cygnus-wealth/data-models';
|
|
11
|
+
*
|
|
12
|
+
* const group: AccountGroup = {
|
|
13
|
+
* groupId: 'group-defi-1',
|
|
14
|
+
* groupName: 'DeFi Accounts',
|
|
15
|
+
* accountIds: [
|
|
16
|
+
* 'metamask:a1b2c3d4:0xAbC...123',
|
|
17
|
+
* 'rabby:e5f6g7h8:0xDef...456'
|
|
18
|
+
* ],
|
|
19
|
+
* createdAt: '2026-02-10T09:00:00Z'
|
|
20
|
+
* };
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @since 1.3.0
|
|
24
|
+
* @stability extended
|
|
25
|
+
*
|
|
26
|
+
* @see {@link AccountId} for account identifier format
|
|
27
|
+
*/
|
|
28
|
+
export interface AccountGroup {
|
|
29
|
+
/** Unique group identifier */
|
|
30
|
+
groupId: string;
|
|
31
|
+
/** User-assigned group name */
|
|
32
|
+
groupName: string;
|
|
33
|
+
/** References to accounts from any connection or watch addresses */
|
|
34
|
+
accountIds: AccountId[];
|
|
35
|
+
/** ISO 8601 timestamp when the group was created */
|
|
36
|
+
createdAt: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AccountId } from '../types/AccountId';
|
|
2
|
+
import { WalletConnectionId } from '../types/WalletConnectionId';
|
|
3
|
+
import { WalletProviderId } from '../types/WalletProviderId';
|
|
4
|
+
/**
|
|
5
|
+
* Full metadata for an account, including group membership and lifecycle status.
|
|
6
|
+
*
|
|
7
|
+
* Provides comprehensive account context for portfolio aggregation and UI
|
|
8
|
+
* display, combining identity, labeling, and status information.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { AccountMetadata } from '@cygnus-wealth/data-models';
|
|
13
|
+
*
|
|
14
|
+
* const metadata: AccountMetadata = {
|
|
15
|
+
* accountId: 'metamask:a1b2c3d4:0xAbCdEf1234567890',
|
|
16
|
+
* address: '0xAbCdEf1234567890',
|
|
17
|
+
* accountLabel: 'Main DeFi',
|
|
18
|
+
* connectionLabel: 'My MetaMask',
|
|
19
|
+
* providerId: 'metamask',
|
|
20
|
+
* walletConnectionId: 'metamask:a1b2c3d4',
|
|
21
|
+
* groups: ['group-defi-1'],
|
|
22
|
+
* discoveredAt: '2026-01-15T10:30:00Z',
|
|
23
|
+
* isStale: false,
|
|
24
|
+
* isActive: true
|
|
25
|
+
* };
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @since 1.3.0
|
|
29
|
+
* @stability extended
|
|
30
|
+
*
|
|
31
|
+
* @see {@link TrackedAddress} for the lightweight address tracking variant
|
|
32
|
+
*/
|
|
33
|
+
export interface AccountMetadata {
|
|
34
|
+
/** Account identifier */
|
|
35
|
+
accountId: AccountId;
|
|
36
|
+
/** Checksummed address */
|
|
37
|
+
address: string;
|
|
38
|
+
/** User-assigned account label */
|
|
39
|
+
accountLabel: string;
|
|
40
|
+
/** Label of the parent wallet connection */
|
|
41
|
+
connectionLabel: string;
|
|
42
|
+
/** Wallet provider identifier, or 'watch' for watch addresses */
|
|
43
|
+
providerId: WalletProviderId | 'watch';
|
|
44
|
+
/** Wallet connection identifier, or 'watch' for watch addresses */
|
|
45
|
+
walletConnectionId: WalletConnectionId | 'watch';
|
|
46
|
+
/** Group IDs this account belongs to */
|
|
47
|
+
groups: string[];
|
|
48
|
+
/** ISO 8601 timestamp when first discovered */
|
|
49
|
+
discoveredAt: string;
|
|
50
|
+
/** Whether the provider no longer exposes this account */
|
|
51
|
+
isStale: boolean;
|
|
52
|
+
/** Whether this is the currently active account in the provider */
|
|
53
|
+
isActive: boolean;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AccountId } from '../types/AccountId';
|
|
2
|
+
import { WalletConnectionId } from '../types/WalletConnectionId';
|
|
3
|
+
import { Asset } from './Asset';
|
|
4
|
+
import { Price } from './Price';
|
|
5
|
+
/**
|
|
6
|
+
* Portfolio slice for a single account.
|
|
7
|
+
*
|
|
8
|
+
* Represents the holdings attributed to one specific account, whether
|
|
9
|
+
* it's a connected wallet account or a watch address.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { AccountPortfolio } from '@cygnus-wealth/data-models';
|
|
14
|
+
*
|
|
15
|
+
* const accountPortfolio: AccountPortfolio = {
|
|
16
|
+
* accountId: 'metamask:a1b2c3d4:0xAbCdEf1234567890',
|
|
17
|
+
* accountLabel: 'Main DeFi',
|
|
18
|
+
* walletConnectionId: 'metamask:a1b2c3d4',
|
|
19
|
+
* providerName: 'MetaMask',
|
|
20
|
+
* assets: [],
|
|
21
|
+
* totalValue: { value: 25000, currency: 'USD', timestamp: new Date() },
|
|
22
|
+
* lastUpdated: '2026-02-19T08:00:00Z'
|
|
23
|
+
* };
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @since 1.3.0
|
|
27
|
+
* @stability extended
|
|
28
|
+
*
|
|
29
|
+
* @see {@link WalletPortfolio} for per-wallet rollup
|
|
30
|
+
* @see {@link Portfolio} for aggregate portfolio
|
|
31
|
+
*/
|
|
32
|
+
export interface AccountPortfolio {
|
|
33
|
+
/** Account this portfolio slice belongs to */
|
|
34
|
+
accountId: AccountId;
|
|
35
|
+
/** User-assigned account label */
|
|
36
|
+
accountLabel: string;
|
|
37
|
+
/** Wallet connection this account belongs to, or 'watch' for watch addresses */
|
|
38
|
+
walletConnectionId: WalletConnectionId | 'watch';
|
|
39
|
+
/** Human-readable provider name */
|
|
40
|
+
providerName: string;
|
|
41
|
+
/** Assets held in this account */
|
|
42
|
+
assets: Asset[];
|
|
43
|
+
/** Total value of this account's holdings */
|
|
44
|
+
totalValue: Price;
|
|
45
|
+
/** ISO 8601 timestamp of last data update */
|
|
46
|
+
lastUpdated: string;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { AccountId } from '../types/AccountId';
|
|
2
|
+
import { WalletProviderId } from '../types/WalletProviderId';
|
|
3
|
+
import { Chain } from '../enums/Chain';
|
|
4
|
+
import { Price } from './Price';
|
|
5
|
+
/**
|
|
6
|
+
* Summary view of an account for cross-account analysis.
|
|
7
|
+
*
|
|
8
|
+
* Lightweight representation containing key metrics for each account,
|
|
9
|
+
* suitable for dashboard summary views and account comparison.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { AccountSummary } from '@cygnus-wealth/data-models';
|
|
14
|
+
*
|
|
15
|
+
* const summary: AccountSummary = {
|
|
16
|
+
* accountId: 'metamask:a1b2c3d4:0xAbCdEf1234567890',
|
|
17
|
+
* accountLabel: 'Main DeFi',
|
|
18
|
+
* connectionLabel: 'My MetaMask',
|
|
19
|
+
* providerId: 'metamask',
|
|
20
|
+
* totalValue: { value: 25000, currency: 'USD', timestamp: new Date() },
|
|
21
|
+
* assetCount: 12,
|
|
22
|
+
* chains: [Chain.ETHEREUM, Chain.POLYGON],
|
|
23
|
+
* lastUpdated: '2026-02-19T08:00:00Z'
|
|
24
|
+
* };
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @since 1.3.0
|
|
28
|
+
* @stability extended
|
|
29
|
+
*
|
|
30
|
+
* @see {@link AccountPortfolio} for full account portfolio details
|
|
31
|
+
*/
|
|
32
|
+
export interface AccountSummary {
|
|
33
|
+
/** Account identifier */
|
|
34
|
+
accountId: AccountId;
|
|
35
|
+
/** User-assigned account label */
|
|
36
|
+
accountLabel: string;
|
|
37
|
+
/** Label of the parent wallet connection */
|
|
38
|
+
connectionLabel: string;
|
|
39
|
+
/** Wallet provider identifier, or 'watch' for watch addresses */
|
|
40
|
+
providerId: WalletProviderId | 'watch';
|
|
41
|
+
/** Total value of the account's holdings */
|
|
42
|
+
totalValue: Price;
|
|
43
|
+
/** Number of distinct assets held */
|
|
44
|
+
assetCount: number;
|
|
45
|
+
/** Chains this account has activity on */
|
|
46
|
+
chains: Chain[];
|
|
47
|
+
/** ISO 8601 timestamp of last data update */
|
|
48
|
+
lastUpdated: string;
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AccountId } from '../types/AccountId';
|
|
2
|
+
import { Chain } from '../enums/Chain';
|
|
3
|
+
import { ChainFamily } from '../enums/ChainFamily';
|
|
4
|
+
/**
|
|
5
|
+
* Request to query data for a specific account address.
|
|
6
|
+
*
|
|
7
|
+
* Used by integration contracts to request data with account attribution.
|
|
8
|
+
* Carries the AccountId so results can be attributed back to the originating
|
|
9
|
+
* account, and includes chain scope for per-account chain filtering.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { AddressRequest, Chain } from '@cygnus-wealth/data-models';
|
|
14
|
+
*
|
|
15
|
+
* const request: AddressRequest = {
|
|
16
|
+
* accountId: 'metamask:a1b2c3d4:0xAbCdEf1234567890',
|
|
17
|
+
* address: '0xAbCdEf1234567890',
|
|
18
|
+
* chainScope: [Chain.ETHEREUM, Chain.POLYGON, Chain.ARBITRUM]
|
|
19
|
+
* };
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @since 1.3.0
|
|
23
|
+
* @stability extended
|
|
24
|
+
*
|
|
25
|
+
* @see {@link AccountBalanceList} for the response format
|
|
26
|
+
*/
|
|
27
|
+
export interface AddressRequest {
|
|
28
|
+
/** Account identifier for result attribution */
|
|
29
|
+
accountId: AccountId;
|
|
30
|
+
/** Checksummed address to query */
|
|
31
|
+
address: string;
|
|
32
|
+
/** Chain family for routing to the correct integration */
|
|
33
|
+
chainFamily: ChainFamily;
|
|
34
|
+
/** Chains to query for this address */
|
|
35
|
+
chainScope: Chain[];
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AssetType } from '../enums/AssetType';
|
|
2
2
|
import { Chain } from '../enums/Chain';
|
|
3
|
+
import { AccountId } from '../types/AccountId';
|
|
4
|
+
import { WalletConnectionId } from '../types/WalletConnectionId';
|
|
3
5
|
import { Metadata } from './Metadata';
|
|
4
6
|
/**
|
|
5
7
|
* Universal asset representation normalizing data from multiple sources.
|
|
@@ -72,6 +74,10 @@ export interface Asset {
|
|
|
72
74
|
cusip?: string;
|
|
73
75
|
/** ISIN identifier for international securities */
|
|
74
76
|
isin?: string;
|
|
77
|
+
/** Account holding this asset (for multi-wallet multi-account attribution) */
|
|
78
|
+
accountId?: AccountId;
|
|
79
|
+
/** Wallet connection this asset belongs to, or 'watch' for watch addresses */
|
|
80
|
+
walletConnectionId?: WalletConnectionId | 'watch';
|
|
75
81
|
/** Source-specific additional data and custom fields */
|
|
76
82
|
metadata?: Metadata;
|
|
77
83
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Balance } from './Balance';
|
|
2
|
+
import { Price } from './Price';
|
|
3
|
+
import { AccountAssetEntry } from './AccountAssetEntry';
|
|
4
|
+
/**
|
|
5
|
+
* Distribution of a specific asset across multiple accounts.
|
|
6
|
+
*
|
|
7
|
+
* Shows how holdings of a single asset (by symbol) are distributed
|
|
8
|
+
* across the user's accounts, useful for concentration analysis.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { AssetDistribution } from '@cygnus-wealth/data-models';
|
|
13
|
+
*
|
|
14
|
+
* const ethDistribution: AssetDistribution = {
|
|
15
|
+
* symbol: 'ETH',
|
|
16
|
+
* totalQuantity: { assetId: 'eth', asset: ethAsset, amount: '10.5' },
|
|
17
|
+
* totalValue: { value: 21000, currency: 'USD', timestamp: new Date() },
|
|
18
|
+
* distribution: [
|
|
19
|
+
* {
|
|
20
|
+
* accountId: 'metamask:a1b2:0xAbc',
|
|
21
|
+
* accountLabel: 'Main',
|
|
22
|
+
* connectionLabel: 'MetaMask',
|
|
23
|
+
* quantity: { assetId: 'eth', asset: ethAsset, amount: '7.0' },
|
|
24
|
+
* value: { value: 14000, currency: 'USD', timestamp: new Date() },
|
|
25
|
+
* percentage: 66.67
|
|
26
|
+
* }
|
|
27
|
+
* ]
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @since 1.3.0
|
|
32
|
+
* @stability extended
|
|
33
|
+
*
|
|
34
|
+
* @see {@link AccountAssetEntry} for per-account breakdown
|
|
35
|
+
*/
|
|
36
|
+
export interface AssetDistribution {
|
|
37
|
+
/** Asset trading symbol */
|
|
38
|
+
symbol: string;
|
|
39
|
+
/** Total quantity across all accounts */
|
|
40
|
+
totalQuantity: Balance;
|
|
41
|
+
/** Total value across all accounts */
|
|
42
|
+
totalValue: Price;
|
|
43
|
+
/** Per-account breakdown of this asset's distribution */
|
|
44
|
+
distribution: AccountAssetEntry[];
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|