@augustdigital/sdk 9.4.0 → 9.5.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/lib/sdk.d.ts
CHANGED
|
@@ -23741,6 +23741,9 @@ declare type AsArray<T> = T extends readonly unknown[] ? T : never;
|
|
|
23741
23741
|
name: string;
|
|
23742
23742
|
protocol?: string;
|
|
23743
23743
|
symbol: string;
|
|
23744
|
+
/** DeBank `pool.id` of the portfolio item the token belongs to — tells
|
|
23745
|
+
* apart two positions in the same protocol holding the same token. */
|
|
23746
|
+
poolId?: string;
|
|
23744
23747
|
};
|
|
23745
23748
|
|
|
23746
23749
|
/**
|
|
@@ -5,7 +5,7 @@ exports.getVaultExposure = getVaultExposure;
|
|
|
5
5
|
exports.parseLoanLevelDebank = parseLoanLevelDebank;
|
|
6
6
|
const core_1 = require("../../core");
|
|
7
7
|
const core_2 = require("../../core/helpers/core");
|
|
8
|
-
function addToTokenExposure(token, tokenExposure, exposureType, protocol, exposurePerCategory, netValue, borrower) {
|
|
8
|
+
function addToTokenExposure(token, tokenExposure, exposureType, protocol, exposurePerCategory, netValue, borrower, poolId) {
|
|
9
9
|
const usdAmount = Number(token?.price || 0) * Number(token?.amount);
|
|
10
10
|
if (exposureType === 'wallet'
|
|
11
11
|
? !(0, core_2.filterOutBySize)(usdAmount)
|
|
@@ -33,6 +33,7 @@ function addToTokenExposure(token, tokenExposure, exposureType, protocol, exposu
|
|
|
33
33
|
amount: usdAmount,
|
|
34
34
|
protocol: protocol,
|
|
35
35
|
exposureType: exposureType,
|
|
36
|
+
poolId: poolId,
|
|
36
37
|
};
|
|
37
38
|
if (exposureType === 'wallet') {
|
|
38
39
|
exposurePerCategory.wallet.push(protoReturnObj);
|
|
@@ -96,7 +97,7 @@ function parseVaultLevelDebank(debankRes, protocolExposure, tokenExposure, borro
|
|
|
96
97
|
existingArray.push(sup.symbol);
|
|
97
98
|
}
|
|
98
99
|
// add token to vault "token exposure"
|
|
99
|
-
addToTokenExposure(sup, tokenExposure, 'supply', pos.id, exposurePerCategory, netValue, borrower);
|
|
100
|
+
addToTokenExposure(sup, tokenExposure, 'supply', pos.id, exposurePerCategory, netValue, borrower, item?.pool?.id);
|
|
100
101
|
// add token image url to token mapping for display
|
|
101
102
|
if (sup?.symbol && sup?.logo_url) {
|
|
102
103
|
tokenMap[sup.symbol] = sup.logo_url;
|
|
@@ -105,7 +106,7 @@ function parseVaultLevelDebank(debankRes, protocolExposure, tokenExposure, borro
|
|
|
105
106
|
});
|
|
106
107
|
item.detail.borrow_token_list.forEach((bor) => {
|
|
107
108
|
// add token to vault "token exposure"
|
|
108
|
-
addToTokenExposure(bor, tokenExposure, 'borrow', pos.id, exposurePerCategory, netValue, borrower);
|
|
109
|
+
addToTokenExposure(bor, tokenExposure, 'borrow', pos.id, exposurePerCategory, netValue, borrower, item?.pool?.id);
|
|
109
110
|
// add token image url to token mapping for display
|
|
110
111
|
if (bor?.symbol && bor?.logo_url) {
|
|
111
112
|
tokenMap[bor.symbol] = bor.logo_url;
|
|
@@ -149,13 +150,13 @@ function parseVaultLevelDebank(debankRes, protocolExposure, tokenExposure, borro
|
|
|
149
150
|
}
|
|
150
151
|
pos?.portfolio_item_list?.forEach((item) => {
|
|
151
152
|
(item?.detail?.supply_token_list || []).forEach((sup) => {
|
|
152
|
-
addToTokenExposure(sup, tokenExposure, 'supply', pos.id, exposurePerCategory, netValue, borrower);
|
|
153
|
+
addToTokenExposure(sup, tokenExposure, 'supply', pos.id, exposurePerCategory, netValue, borrower, item?.pool?.id);
|
|
153
154
|
if (sup?.symbol && sup?.logo_url) {
|
|
154
155
|
tokenMap[sup.symbol] = sup.logo_url;
|
|
155
156
|
}
|
|
156
157
|
});
|
|
157
158
|
(item?.detail?.borrow_token_list || []).forEach((bor) => {
|
|
158
|
-
addToTokenExposure(bor, tokenExposure, 'borrow', pos.id, exposurePerCategory, netValue, borrower);
|
|
159
|
+
addToTokenExposure(bor, tokenExposure, 'borrow', pos.id, exposurePerCategory, netValue, borrower, item?.pool?.id);
|
|
159
160
|
if (bor?.symbol && bor?.logo_url) {
|
|
160
161
|
tokenMap[bor.symbol] = bor.logo_url;
|
|
161
162
|
}
|
package/lib/types/vaults.d.ts
CHANGED
|
@@ -114,6 +114,9 @@ export type IVaultExposureItem = {
|
|
|
114
114
|
name: string;
|
|
115
115
|
protocol?: string;
|
|
116
116
|
symbol: string;
|
|
117
|
+
/** DeBank `pool.id` of the portfolio item the token belongs to — tells
|
|
118
|
+
* apart two positions in the same protocol holding the same token. */
|
|
119
|
+
poolId?: string;
|
|
117
120
|
};
|
|
118
121
|
export type IExposurePerCategory = {
|
|
119
122
|
borrowing: IVaultExposureItem[];
|