@leather.io/models 0.47.0 → 0.49.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +48 -0
- package/dist/index.d.ts +229 -65
- package/dist/index.js +154 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/activity/activity.utils.ts +89 -0
- package/src/assets/asset-id.model.ts +0 -1
- package/src/assets/asset.model.ts +3 -0
- package/src/assets/sip9-asset.model.ts +2 -2
- package/src/index.ts +17 -4
- package/src/swap/swap.model.ts +35 -1
- package/src/yield/helpers/yield.helpers.ts +66 -45
- package/src/yield/providers/{bitflow.model.ts → bitflow-position.model.ts} +17 -9
- package/src/yield/providers/fast-pool-position.model.ts +6 -0
- package/src/yield/providers/granite-position.model.ts +27 -0
- package/src/yield/providers/hermetica-position.model.ts +19 -0
- package/src/yield/providers/lisa-position.model.ts +22 -0
- package/src/yield/providers/{stacking-dao.model.ts → stacking-dao-position.model.ts} +16 -13
- package/src/yield/providers/velar-position.model.ts +39 -0
- package/src/yield/providers/xverse-position.model.ts +6 -0
- package/src/yield/providers/{zest.model.ts → zest-position.model.ts} +3 -5
- package/src/yield/yield-position.base.model.ts +6 -3
- package/src/yield/yield-position.model.ts +31 -9
- package/src/yield/yield-product.model.ts +41 -17
- package/src/yield/yield-provider.model.ts +5 -2
- package/src/yield/providers/granite.model.ts +0 -31
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CryptoAsset } from '../assets/asset.model';
|
|
2
|
+
import { ChainId, NetworkConfiguration } from '../network/network.model';
|
|
3
|
+
|
|
4
|
+
export type BitcoinNetworkPreference = 'mainnet' | 'testnet4' | 'signet';
|
|
5
|
+
type StacksNetworkPreference = 'mainnet' | 'testnet';
|
|
6
|
+
|
|
7
|
+
const HIRO_EXPLORER_URL = 'https://explorer.hiro.so';
|
|
8
|
+
const MEMPOOL_BASE_URL = 'https://mempool.space';
|
|
9
|
+
|
|
10
|
+
export interface MakeActivityArgs {
|
|
11
|
+
txid: string;
|
|
12
|
+
networkPreference: NetworkConfiguration;
|
|
13
|
+
asset?: CryptoAsset;
|
|
14
|
+
}
|
|
15
|
+
export function makeActivityLink({ txid, networkPreference, asset }: MakeActivityArgs) {
|
|
16
|
+
if (txid && asset) {
|
|
17
|
+
return makeActivityExplorerLink({
|
|
18
|
+
asset,
|
|
19
|
+
txid,
|
|
20
|
+
networkPreference,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface MakeActivityExplorerLinkArgs {
|
|
27
|
+
asset: CryptoAsset;
|
|
28
|
+
txid: string;
|
|
29
|
+
networkPreference: NetworkConfiguration;
|
|
30
|
+
}
|
|
31
|
+
function makeActivityExplorerLink({
|
|
32
|
+
asset,
|
|
33
|
+
txid,
|
|
34
|
+
networkPreference,
|
|
35
|
+
}: MakeActivityExplorerLinkArgs) {
|
|
36
|
+
if (asset.chain === 'bitcoin') {
|
|
37
|
+
return getMempoolExplorerLink({
|
|
38
|
+
networkPreference: networkPreference.chain.bitcoin.bitcoinNetwork as BitcoinNetworkPreference,
|
|
39
|
+
id: txid,
|
|
40
|
+
type: 'txid',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return makeStacksTxExplorerLink({
|
|
44
|
+
networkPreference:
|
|
45
|
+
networkPreference.chain.stacks.chainId === ChainId.Testnet ? 'testnet' : 'mainnet',
|
|
46
|
+
searchParams: undefined,
|
|
47
|
+
txid,
|
|
48
|
+
explorerUrl: HIRO_EXPLORER_URL,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface MakeStacksTxExplorerLinkArgs {
|
|
53
|
+
networkPreference: StacksNetworkPreference;
|
|
54
|
+
searchParams?: URLSearchParams;
|
|
55
|
+
txid: string;
|
|
56
|
+
explorerUrl: string;
|
|
57
|
+
}
|
|
58
|
+
function makeStacksTxExplorerLink({
|
|
59
|
+
networkPreference,
|
|
60
|
+
searchParams = new URLSearchParams(),
|
|
61
|
+
txid,
|
|
62
|
+
explorerUrl,
|
|
63
|
+
}: MakeStacksTxExplorerLinkArgs) {
|
|
64
|
+
searchParams.append('chain', networkPreference);
|
|
65
|
+
return `${explorerUrl}/txid/${txid}?${searchParams.toString()}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface GetMempoolExplorerLinkArgs {
|
|
69
|
+
id: string;
|
|
70
|
+
type: 'txid' | 'block';
|
|
71
|
+
networkPreference: BitcoinNetworkPreference;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getMempoolExplorerLink({
|
|
75
|
+
id,
|
|
76
|
+
type,
|
|
77
|
+
networkPreference,
|
|
78
|
+
}: GetMempoolExplorerLinkArgs) {
|
|
79
|
+
switch (networkPreference) {
|
|
80
|
+
case 'mainnet':
|
|
81
|
+
return `${MEMPOOL_BASE_URL}/${type}/${id}`;
|
|
82
|
+
case 'testnet4':
|
|
83
|
+
return `${MEMPOOL_BASE_URL}/testnet4/${type}/${id}`;
|
|
84
|
+
case 'signet':
|
|
85
|
+
return `${MEMPOOL_BASE_URL}/signet/${type}/${id}`;
|
|
86
|
+
default:
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -51,11 +51,13 @@ interface BaseFungibleCryptoAsset extends BaseCryptoAsset {
|
|
|
51
51
|
export interface BtcAsset extends BaseFungibleCryptoAsset {
|
|
52
52
|
readonly chain: 'bitcoin';
|
|
53
53
|
readonly protocol: 'nativeBtc';
|
|
54
|
+
readonly name: 'Bitcoin';
|
|
54
55
|
readonly symbol: 'BTC';
|
|
55
56
|
}
|
|
56
57
|
export interface StxAsset extends BaseFungibleCryptoAsset {
|
|
57
58
|
readonly chain: 'stacks';
|
|
58
59
|
readonly protocol: 'nativeStx';
|
|
60
|
+
readonly name: 'Stacks';
|
|
59
61
|
readonly symbol: 'STX';
|
|
60
62
|
}
|
|
61
63
|
export interface Brc20Asset extends BaseFungibleCryptoAsset {
|
|
@@ -120,6 +122,7 @@ export interface InscriptionAsset extends BaseNonFungibleCryptoAsset {
|
|
|
120
122
|
readonly offset: string;
|
|
121
123
|
readonly preview: string;
|
|
122
124
|
readonly src: string;
|
|
125
|
+
readonly thumbnailSrc?: string;
|
|
123
126
|
readonly value: string;
|
|
124
127
|
readonly genesisBlockHash: string;
|
|
125
128
|
readonly genesisTimestamp: number;
|
|
@@ -47,6 +47,8 @@ export interface Sip9Collection {
|
|
|
47
47
|
name: string;
|
|
48
48
|
collectionExplorerUrl: string;
|
|
49
49
|
totalItems?: number;
|
|
50
|
+
floorPrice?: Money;
|
|
51
|
+
latestSale?: Money;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
export interface Sip9AssetContent {
|
|
@@ -72,7 +74,5 @@ export interface Sip9Asset extends BaseNonFungibleCryptoAsset {
|
|
|
72
74
|
readonly attributes?: Sip9Attribute[];
|
|
73
75
|
readonly collection?: Sip9Collection;
|
|
74
76
|
readonly creator?: string;
|
|
75
|
-
readonly floorPrice?: Money;
|
|
76
|
-
readonly latestSale?: Money;
|
|
77
77
|
readonly rarityRank?: number;
|
|
78
78
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,11 +29,24 @@ export * from './types';
|
|
|
29
29
|
export * from './types.utils';
|
|
30
30
|
export * from './utxo.model';
|
|
31
31
|
export * from './yield/helpers/yield.helpers';
|
|
32
|
-
export * from './yield/providers/bitflow.model';
|
|
33
|
-
export * from './yield/providers/
|
|
34
|
-
export * from './yield/providers/
|
|
35
|
-
export * from './yield/providers/
|
|
32
|
+
export * from './yield/providers/bitflow-position.model';
|
|
33
|
+
export * from './yield/providers/fast-pool-position.model';
|
|
34
|
+
export * from './yield/providers/granite-position.model';
|
|
35
|
+
export * from './yield/providers/hermetica-position.model';
|
|
36
|
+
export * from './yield/providers/lisa-position.model';
|
|
37
|
+
export * from './yield/providers/stacking-dao-position.model';
|
|
38
|
+
export * from './yield/providers/velar-position.model';
|
|
39
|
+
export * from './yield/providers/xverse-position.model';
|
|
40
|
+
export * from './yield/providers/zest-position.model';
|
|
36
41
|
export * from './yield/yield-position.base.model';
|
|
37
42
|
export * from './yield/yield-position.model';
|
|
38
43
|
export * from './yield/yield-product.model';
|
|
39
44
|
export * from './yield/yield-provider.model';
|
|
45
|
+
export * from './activity/activity-level.model';
|
|
46
|
+
export * from './activity/activity-status.model';
|
|
47
|
+
export * from './activity/activity-type.model';
|
|
48
|
+
export * from './activity/activity.model';
|
|
49
|
+
export * from './activity/activity.utils';
|
|
50
|
+
export * from './account.model';
|
|
51
|
+
export * from './bns.model';
|
|
52
|
+
export * from './swap/swap.model';
|
package/src/swap/swap.model.ts
CHANGED
|
@@ -23,7 +23,13 @@ export interface SwapProviderAsset {
|
|
|
23
23
|
assetId: CryptoAssetId;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export
|
|
26
|
+
export type SwapQuote =
|
|
27
|
+
| AlexSdkSwapQuote
|
|
28
|
+
| VelarSdkSwapQuote
|
|
29
|
+
| BitflowSdkSwapQuote
|
|
30
|
+
| SbtcBridgeSwapQuote;
|
|
31
|
+
|
|
32
|
+
export interface BaseSwapQuote {
|
|
27
33
|
executionType: SwapExecutionType;
|
|
28
34
|
providerId: SwapProviderId;
|
|
29
35
|
providerQuoteData: unknown;
|
|
@@ -34,6 +40,34 @@ export interface SwapQuote {
|
|
|
34
40
|
assetPath: (NativeCryptoAsset | Sip10Asset)[];
|
|
35
41
|
}
|
|
36
42
|
|
|
43
|
+
export interface AlexSdkSwapQuote extends BaseSwapQuote {
|
|
44
|
+
providerId: 'alex-sdk';
|
|
45
|
+
providerQuoteData: {
|
|
46
|
+
baseProviderAssetId: string;
|
|
47
|
+
targetProviderAssetId: string;
|
|
48
|
+
alexSdkAmmRoute: unknown;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface VelarSdkSwapQuote extends BaseSwapQuote {
|
|
53
|
+
providerId: 'velar-sdk';
|
|
54
|
+
providerQuoteData: {
|
|
55
|
+
baseProviderAssetId: string;
|
|
56
|
+
targetProviderAssetId: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface BitflowSdkSwapQuote extends BaseSwapQuote {
|
|
61
|
+
providerId: 'bitflow-sdk';
|
|
62
|
+
providerQuoteData: {
|
|
63
|
+
bitflowSdkSelectedSwapRoute: unknown;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface SbtcBridgeSwapQuote extends BaseSwapQuote {
|
|
68
|
+
providerId: 'sbtc-bridge';
|
|
69
|
+
}
|
|
70
|
+
|
|
37
71
|
export interface SwapDex {
|
|
38
72
|
name: string;
|
|
39
73
|
url: string;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import type { BitflowAmmLpPosition } from '../providers/bitflow.model';
|
|
2
|
-
import type { GraniteV1Position } from '../providers/granite.model';
|
|
3
1
|
import type {
|
|
4
|
-
|
|
2
|
+
BitflowAmmLpPosition,
|
|
3
|
+
BitflowAmmStakingPosition,
|
|
4
|
+
} from '../providers/bitflow-position.model';
|
|
5
|
+
import type {
|
|
6
|
+
GraniteV1BorrowPosition,
|
|
7
|
+
GraniteV1EarnPosition,
|
|
8
|
+
} from '../providers/granite-position.model';
|
|
9
|
+
import type {
|
|
5
10
|
StackingDaoPooledStackingPosition,
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
StackingDaoStStxBtcPosition,
|
|
12
|
+
StackingDaoStStxPosition,
|
|
13
|
+
} from '../providers/stacking-dao-position.model';
|
|
14
|
+
import type { ZestBorrowMarketPosition } from '../providers/zest-position.model';
|
|
8
15
|
import type { YieldPosition } from '../yield-position.model';
|
|
9
16
|
import {
|
|
10
17
|
YieldProduct,
|
|
@@ -12,24 +19,38 @@ import {
|
|
|
12
19
|
YieldProductCategory,
|
|
13
20
|
YieldProductKey,
|
|
14
21
|
YieldProductKeys,
|
|
15
|
-
|
|
22
|
+
YieldProductToProviderMap,
|
|
16
23
|
} from '../yield-product.model';
|
|
17
24
|
import { YieldProvider, YieldProviderKey } from '../yield-provider.model';
|
|
18
25
|
|
|
19
|
-
export function
|
|
26
|
+
export function isBitflowAmmLpPosition(pos: YieldPosition): pos is BitflowAmmLpPosition {
|
|
20
27
|
return pos.product === YieldProductKeys.bitflowAmmLp;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
|
-
export function
|
|
24
|
-
return pos.product === YieldProductKeys.
|
|
30
|
+
export function isBitflowAmmStakingPosition(pos: YieldPosition): pos is BitflowAmmStakingPosition {
|
|
31
|
+
return pos.product === YieldProductKeys.bitflowAmmStaking;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
|
-
export function
|
|
28
|
-
return pos.product === YieldProductKeys.
|
|
34
|
+
export function isZestPosition(pos: YieldPosition): pos is ZestBorrowMarketPosition {
|
|
35
|
+
return pos.product === YieldProductKeys.zestBorrowMarket;
|
|
29
36
|
}
|
|
30
37
|
|
|
31
|
-
export function
|
|
32
|
-
return pos.product === YieldProductKeys.
|
|
38
|
+
export function isGraniteEarnPosition(pos: YieldPosition): pos is GraniteV1EarnPosition {
|
|
39
|
+
return pos.product === YieldProductKeys.graniteV1Earn;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function isGraniteBorrowPosition(pos: YieldPosition): pos is GraniteV1BorrowPosition {
|
|
43
|
+
return pos.product === YieldProductKeys.graniteV1Borrow;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function isStackingDaoStStxPosition(pos: YieldPosition): pos is StackingDaoStStxPosition {
|
|
47
|
+
return pos.product === YieldProductKeys.stackingDaoStstx;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function isStackingDaoStStxBtcPosition(
|
|
51
|
+
pos: YieldPosition
|
|
52
|
+
): pos is StackingDaoStStxBtcPosition {
|
|
53
|
+
return pos.product === YieldProductKeys.stackingDaoStstxbtc;
|
|
33
54
|
}
|
|
34
55
|
|
|
35
56
|
export function isStackingDaoPooledPosition(
|
|
@@ -38,11 +59,11 @@ export function isStackingDaoPooledPosition(
|
|
|
38
59
|
return pos.product === YieldProductKeys.stackingDaoPooledStacking;
|
|
39
60
|
}
|
|
40
61
|
|
|
41
|
-
export function
|
|
62
|
+
export function filterPositionsByProvider(
|
|
42
63
|
positions: YieldPosition[],
|
|
43
|
-
|
|
64
|
+
provider: YieldProviderKey
|
|
44
65
|
): YieldPosition[] {
|
|
45
|
-
return positions.filter(p => p.provider ===
|
|
66
|
+
return positions.filter(p => p.provider === provider);
|
|
46
67
|
}
|
|
47
68
|
|
|
48
69
|
export function filterPositionsByProduct(
|
|
@@ -73,8 +94,8 @@ export function sortPositionsByBalance(
|
|
|
73
94
|
|
|
74
95
|
export function sortPositionsByApy(positions: YieldPosition[], ascending = false): YieldPosition[] {
|
|
75
96
|
return [...positions].sort((a, b) => {
|
|
76
|
-
const apyA = a.
|
|
77
|
-
const apyB = b.
|
|
97
|
+
const apyA = a.apy;
|
|
98
|
+
const apyB = b.apy;
|
|
78
99
|
return ascending ? apyA - apyB : apyB - apyA;
|
|
79
100
|
});
|
|
80
101
|
}
|
|
@@ -84,27 +105,27 @@ export function sortPositionsByUpdateTime(
|
|
|
84
105
|
ascending = false
|
|
85
106
|
): YieldPosition[] {
|
|
86
107
|
return [...positions].sort((a, b) => {
|
|
87
|
-
const timeA = a.updatedAt
|
|
88
|
-
const timeB = b.updatedAt
|
|
108
|
+
const timeA = 'updatedAt' in a && a.updatedAt instanceof Date ? a.updatedAt.getTime() : 0;
|
|
109
|
+
const timeB = 'updatedAt' in b && b.updatedAt instanceof Date ? b.updatedAt.getTime() : 0;
|
|
89
110
|
return ascending ? timeA - timeB : timeB - timeA;
|
|
90
111
|
});
|
|
91
112
|
}
|
|
92
113
|
|
|
93
|
-
export function
|
|
94
|
-
return
|
|
114
|
+
export function getProviderForProduct(product: YieldProductKey): YieldProviderKey {
|
|
115
|
+
return YieldProductToProviderMap[product];
|
|
95
116
|
}
|
|
96
117
|
|
|
97
118
|
export function getCategoryForProduct(product: YieldProduct): YieldProductCategory {
|
|
98
119
|
return product.category;
|
|
99
120
|
}
|
|
100
121
|
|
|
101
|
-
export function
|
|
102
|
-
return
|
|
122
|
+
export function isProductInProvider(product: YieldProductKey, provider: YieldProviderKey): boolean {
|
|
123
|
+
return YieldProductToProviderMap[product] === provider;
|
|
103
124
|
}
|
|
104
125
|
|
|
105
|
-
export function
|
|
106
|
-
return Object.entries(
|
|
107
|
-
.filter(([_, p]) => p ===
|
|
126
|
+
export function getProductsForProvider(provider: YieldProviderKey): YieldProductKey[] {
|
|
127
|
+
return Object.entries(YieldProductToProviderMap)
|
|
128
|
+
.filter(([_, p]) => p === provider)
|
|
108
129
|
.map(([product]) => product as YieldProductKey);
|
|
109
130
|
}
|
|
110
131
|
|
|
@@ -115,17 +136,17 @@ export function getProductsInCategory(
|
|
|
115
136
|
return products.filter(p => p.category === category);
|
|
116
137
|
}
|
|
117
138
|
|
|
118
|
-
export function
|
|
139
|
+
export function groupPositionsByProvider(
|
|
119
140
|
positions: YieldPosition[]
|
|
120
141
|
): Record<YieldProviderKey, YieldPosition[]> {
|
|
121
142
|
const grouped: Partial<Record<YieldProviderKey, YieldPosition[]>> = {};
|
|
122
143
|
|
|
123
144
|
for (const position of positions) {
|
|
124
|
-
const
|
|
125
|
-
if (!grouped[
|
|
126
|
-
grouped[
|
|
145
|
+
const provider = position.provider;
|
|
146
|
+
if (!grouped[provider]) {
|
|
147
|
+
grouped[provider] = [];
|
|
127
148
|
}
|
|
128
|
-
grouped[
|
|
149
|
+
grouped[provider].push(position);
|
|
129
150
|
}
|
|
130
151
|
|
|
131
152
|
return grouped as Record<YieldProviderKey, YieldPosition[]>;
|
|
@@ -165,11 +186,11 @@ export function getPositionsInCategories(
|
|
|
165
186
|
});
|
|
166
187
|
}
|
|
167
188
|
|
|
168
|
-
export function
|
|
189
|
+
export function hasPositionsInProvider(
|
|
169
190
|
positions: YieldPosition[],
|
|
170
|
-
|
|
191
|
+
provider: YieldProviderKey
|
|
171
192
|
): boolean {
|
|
172
|
-
return positions.some(p => p.provider ===
|
|
193
|
+
return positions.some(p => p.provider === provider);
|
|
173
194
|
}
|
|
174
195
|
|
|
175
196
|
export function hasPositionsInCategory(
|
|
@@ -181,11 +202,11 @@ export function hasPositionsInCategory(
|
|
|
181
202
|
return positions.some(pos => productMap.get(pos.product)?.category === category);
|
|
182
203
|
}
|
|
183
204
|
|
|
184
|
-
export function
|
|
205
|
+
export function enrichPositionWithProvider<T extends YieldPosition>(
|
|
185
206
|
position: T,
|
|
186
|
-
|
|
187
|
-
): T & {
|
|
188
|
-
return { ...position,
|
|
207
|
+
provider: YieldProvider
|
|
208
|
+
): T & { providerData: YieldProvider } {
|
|
209
|
+
return { ...position, providerData: provider };
|
|
189
210
|
}
|
|
190
211
|
|
|
191
212
|
export function enrichPositionWithProduct<T extends YieldPosition>(
|
|
@@ -197,19 +218,19 @@ export function enrichPositionWithProduct<T extends YieldPosition>(
|
|
|
197
218
|
|
|
198
219
|
export function enrichPositionWithMetadata<T extends YieldPosition>(
|
|
199
220
|
position: T,
|
|
200
|
-
|
|
221
|
+
provider: YieldProvider,
|
|
201
222
|
product: YieldProduct
|
|
202
|
-
): T & {
|
|
203
|
-
return { ...position,
|
|
223
|
+
): T & { providerData: YieldProvider; productData: YieldProduct } {
|
|
224
|
+
return { ...position, providerData: provider, productData: product };
|
|
204
225
|
}
|
|
205
226
|
|
|
206
227
|
export function getCategoryDisplayName(category: YieldProductCategory): string {
|
|
207
228
|
const displayNames: Record<YieldProductCategory, string> = {
|
|
208
229
|
[YieldProductCategories.AMM]: 'Liquidity Pools',
|
|
209
230
|
[YieldProductCategories.LENDING]: 'Lending & Borrowing',
|
|
210
|
-
[YieldProductCategories.
|
|
211
|
-
[YieldProductCategories.
|
|
212
|
-
[YieldProductCategories.
|
|
231
|
+
[YieldProductCategories.LIQUID_STACKING]: 'Liquid Stacking',
|
|
232
|
+
[YieldProductCategories.POOLED_STACKING]: 'Pooled Stacking',
|
|
233
|
+
[YieldProductCategories.STAKING]: 'Staking',
|
|
213
234
|
[YieldProductCategories.PERPS]: 'Perpetuals',
|
|
214
235
|
};
|
|
215
236
|
return displayNames[category] || category;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import type { FungibleCryptoAsset } from '../../assets/asset.model';
|
|
2
2
|
import type { Money } from '../../money.model';
|
|
3
3
|
import type { BaseYieldPosition } from '../yield-position.base.model';
|
|
4
|
-
import type { YieldProductKeys } from '../yield-product.model';
|
|
5
|
-
import type { YieldProviderKeys } from '../yield-provider.model';
|
|
6
4
|
|
|
7
5
|
export interface BitflowAmmLpPosition extends BaseYieldPosition {
|
|
8
|
-
provider:
|
|
9
|
-
product:
|
|
10
|
-
pools: BitflowAmmLpPool[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface BitflowAmmLpPool {
|
|
14
|
-
apy: number;
|
|
6
|
+
provider: 'bitflow';
|
|
7
|
+
product: 'bitflow-amm-lp';
|
|
15
8
|
poolSharePercentage: number;
|
|
16
9
|
lpToken: {
|
|
17
10
|
asset: FungibleCryptoAsset;
|
|
@@ -29,3 +22,18 @@ export interface BitflowAmmLpPool {
|
|
|
29
22
|
balanceQuote: Money;
|
|
30
23
|
};
|
|
31
24
|
}
|
|
25
|
+
|
|
26
|
+
export interface BitflowAmmStakingPosition extends BaseYieldPosition {
|
|
27
|
+
provider: 'bitflow';
|
|
28
|
+
product: 'bitflow-amm-staking';
|
|
29
|
+
stakedLpToken: {
|
|
30
|
+
asset: FungibleCryptoAsset;
|
|
31
|
+
balance: Money;
|
|
32
|
+
balanceQuote: Money;
|
|
33
|
+
};
|
|
34
|
+
rewardToken?: {
|
|
35
|
+
asset: FungibleCryptoAsset;
|
|
36
|
+
balance: Money;
|
|
37
|
+
balanceQuote: Money;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FungibleCryptoAsset } from '../../assets/asset.model';
|
|
2
|
+
import type { Money } from '../../money.model';
|
|
3
|
+
import type { BaseYieldPosition } from '../yield-position.base.model';
|
|
4
|
+
|
|
5
|
+
export interface GraniteV1EarnPosition extends BaseYieldPosition {
|
|
6
|
+
provider: 'granite';
|
|
7
|
+
product: 'granite-v1-earn';
|
|
8
|
+
marketAsset: FungibleCryptoAsset;
|
|
9
|
+
marketAssetSupplyBalance: Money;
|
|
10
|
+
marketAssetSupplyBalanceQuote: Money;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface GraniteV1BorrowPosition extends BaseYieldPosition {
|
|
14
|
+
provider: 'granite';
|
|
15
|
+
product: 'granite-v1-borrow';
|
|
16
|
+
marketAsset: FungibleCryptoAsset;
|
|
17
|
+
marketAssetBorrowBalance: Money;
|
|
18
|
+
marketAssetBorrowBalanceQuote: Money;
|
|
19
|
+
collateralBalanceQuote: Money;
|
|
20
|
+
collateral: GraniteV1CollateralAsset[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface GraniteV1CollateralAsset {
|
|
24
|
+
asset: FungibleCryptoAsset;
|
|
25
|
+
balance: Money;
|
|
26
|
+
balanceQuote: Money;
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FungibleCryptoAsset } from '../../assets/asset.model';
|
|
2
|
+
import type { Money } from '../../money.model';
|
|
3
|
+
import type { BaseYieldPosition } from '../yield-position.base.model';
|
|
4
|
+
|
|
5
|
+
export interface HermeticaUsdhStakingPosition extends BaseYieldPosition {
|
|
6
|
+
provider: 'hermetica';
|
|
7
|
+
product: 'hermetica-usdh-staking';
|
|
8
|
+
staking: HermeticaStaking;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface HermeticaStaking {
|
|
12
|
+
asset: FungibleCryptoAsset;
|
|
13
|
+
balance: Money;
|
|
14
|
+
balanceQuote: Money;
|
|
15
|
+
apy: number;
|
|
16
|
+
rewardAsset?: FungibleCryptoAsset;
|
|
17
|
+
rewardBalance?: Money;
|
|
18
|
+
rewardBalanceQuote?: Money;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FungibleCryptoAsset } from '../../assets/asset.model';
|
|
2
|
+
import type { Money } from '../../money.model';
|
|
3
|
+
import type { BaseYieldPosition } from '../yield-position.base.model';
|
|
4
|
+
|
|
5
|
+
export interface LisaLiStxPosition extends BaseYieldPosition {
|
|
6
|
+
provider: 'lisa';
|
|
7
|
+
product: 'lisa-listx';
|
|
8
|
+
holding: LisaLstHolding;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface LisaLiquidStakingPosition extends BaseYieldPosition {
|
|
12
|
+
provider: 'lisa';
|
|
13
|
+
product: 'lisa-liquid-staking';
|
|
14
|
+
holding: LisaLstHolding;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface LisaLstHolding {
|
|
18
|
+
asset: FungibleCryptoAsset;
|
|
19
|
+
balance: Money;
|
|
20
|
+
balanceQuote: Money;
|
|
21
|
+
apy: number;
|
|
22
|
+
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import type { FungibleCryptoAsset } from '../../assets/asset.model';
|
|
2
2
|
import type { Money } from '../../money.model';
|
|
3
|
-
import type { BaseYieldPosition } from '../yield-position.base.model';
|
|
4
|
-
import type { YieldProductKeys } from '../yield-product.model';
|
|
5
|
-
import type { YieldProviderKeys } from '../yield-provider.model';
|
|
3
|
+
import type { BasePooledStackingPosition, BaseYieldPosition } from '../yield-position.base.model';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
provider:
|
|
9
|
-
product: typeof YieldProductKeys.stackingDaoLst;
|
|
10
|
-
totalBalance: Money;
|
|
5
|
+
interface BaseStackingDaoLstPosition extends BaseYieldPosition {
|
|
6
|
+
provider: 'stackingdao';
|
|
11
7
|
withdrawalsBalance: Money;
|
|
12
|
-
|
|
13
|
-
ststxbtc?: StackingDaoLstHolding;
|
|
14
|
-
sbtcReward?: StackingDaoReward;
|
|
8
|
+
lstHolding?: StackingDaoLstHolding;
|
|
15
9
|
withdrawals: StackingDaoLstWithdrawal[];
|
|
16
10
|
}
|
|
17
11
|
|
|
12
|
+
export interface StackingDaoStStxPosition extends BaseStackingDaoLstPosition {
|
|
13
|
+
product: 'stackingdao-ststx';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface StackingDaoStStxBtcPosition extends BaseStackingDaoLstPosition {
|
|
17
|
+
product: 'stackingdao-ststxbtc';
|
|
18
|
+
sbtcReward?: StackingDaoReward;
|
|
19
|
+
}
|
|
20
|
+
|
|
18
21
|
export interface StackingDaoLstHolding {
|
|
19
22
|
asset: FungibleCryptoAsset;
|
|
20
23
|
balance: Money;
|
|
@@ -39,7 +42,7 @@ export interface StackingDaoLstWithdrawal {
|
|
|
39
42
|
unlockBurnHeight: number;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
export interface StackingDaoPooledStackingPosition extends
|
|
43
|
-
provider:
|
|
44
|
-
product:
|
|
45
|
+
export interface StackingDaoPooledStackingPosition extends BasePooledStackingPosition {
|
|
46
|
+
provider: 'stackingdao';
|
|
47
|
+
product: 'stackingdao-pooled-stacking';
|
|
45
48
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { FungibleCryptoAsset } from '../../assets/asset.model';
|
|
2
|
+
import type { Money } from '../../money.model';
|
|
3
|
+
import type { BaseYieldPosition } from '../yield-position.base.model';
|
|
4
|
+
|
|
5
|
+
export interface VelarAmmLpPosition extends BaseYieldPosition {
|
|
6
|
+
provider: 'velar';
|
|
7
|
+
product: 'velar-amm-lp';
|
|
8
|
+
poolSharePercentage: number;
|
|
9
|
+
lpToken: {
|
|
10
|
+
asset: FungibleCryptoAsset;
|
|
11
|
+
balance: Money;
|
|
12
|
+
balanceQuote: Money;
|
|
13
|
+
};
|
|
14
|
+
tokenX: {
|
|
15
|
+
asset: FungibleCryptoAsset;
|
|
16
|
+
balance: Money;
|
|
17
|
+
balanceQuote: Money;
|
|
18
|
+
};
|
|
19
|
+
tokenY: {
|
|
20
|
+
asset: FungibleCryptoAsset;
|
|
21
|
+
balance: Money;
|
|
22
|
+
balanceQuote: Money;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface VelarFarmPosition extends BaseYieldPosition {
|
|
27
|
+
provider: 'velar';
|
|
28
|
+
product: 'velar-amm-lp-farming';
|
|
29
|
+
stakedLpToken: {
|
|
30
|
+
asset: FungibleCryptoAsset;
|
|
31
|
+
balance: Money;
|
|
32
|
+
balanceQuote: Money;
|
|
33
|
+
};
|
|
34
|
+
rewardToken?: {
|
|
35
|
+
asset: FungibleCryptoAsset;
|
|
36
|
+
balance: Money;
|
|
37
|
+
balanceQuote: Money;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { FungibleCryptoAsset } from '../../assets/asset.model';
|
|
2
2
|
import type { Money } from '../../money.model';
|
|
3
3
|
import type { BaseYieldPosition } from '../yield-position.base.model';
|
|
4
|
-
import type { YieldProductKeys } from '../yield-product.model';
|
|
5
|
-
import type { YieldProviderKeys } from '../yield-provider.model';
|
|
6
4
|
|
|
7
|
-
export interface
|
|
8
|
-
provider:
|
|
9
|
-
product:
|
|
5
|
+
export interface ZestBorrowMarketPosition extends BaseYieldPosition {
|
|
6
|
+
provider: 'zest';
|
|
7
|
+
product: 'zest-borrow-market';
|
|
10
8
|
supplyBalance: Money;
|
|
11
9
|
borrowBalance: Money;
|
|
12
10
|
ltvPercentage: number;
|
|
@@ -3,10 +3,13 @@ import type { YieldProductKey } from './yield-product.model';
|
|
|
3
3
|
import type { YieldProviderKey } from './yield-provider.model';
|
|
4
4
|
|
|
5
5
|
export interface BaseYieldPosition {
|
|
6
|
+
readonly id: string;
|
|
6
7
|
readonly provider: YieldProviderKey;
|
|
7
8
|
readonly product: YieldProductKey;
|
|
8
9
|
readonly totalBalance: Money;
|
|
9
|
-
readonly
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
readonly apy: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface BasePooledStackingPosition extends BaseYieldPosition {
|
|
14
|
+
readonly stackedBalanceStx: Money;
|
|
12
15
|
}
|