@pioneer-platform/zapper-client 8.1.27 → 8.1.29
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/index.js +25 -20
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports = {
|
|
|
82
82
|
};
|
|
83
83
|
var get_portfolio = function (address) {
|
|
84
84
|
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
-
var tag, output, appsResponse, apps, totalBalanceUSDApp_1, tokensResponse,
|
|
85
|
+
var tag, output, appsResponse, apps, totalBalanceUSDApp_1, tokensResponse, totalBalanceUsdTokens_1, tokens, limit, allTokens, cursor, url, response, tokens, error_1, nftResponse, nftUsdNetWorth, totalNetWorth, e_1;
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
switch (_a.label) {
|
|
88
88
|
case 0:
|
|
@@ -113,23 +113,28 @@ var get_portfolio = function (address) {
|
|
|
113
113
|
})];
|
|
114
114
|
case 3:
|
|
115
115
|
tokensResponse = _a.sent();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
116
|
+
if (tokensResponse.data && tokensResponse.data[address.toLowerCase()]) {
|
|
117
|
+
tokens = tokensResponse.data;
|
|
118
|
+
totalBalanceUsdTokens_1 = 0;
|
|
119
|
+
tokens = tokens[address.toLowerCase()];
|
|
120
|
+
output.tokens = tokens;
|
|
121
|
+
log.info(tag, "tokens: ", tokens.length);
|
|
122
|
+
if (tokens) {
|
|
123
|
+
tokens.forEach(function (token) {
|
|
124
|
+
log.debug(tag, "token: ", token);
|
|
125
|
+
var network = token.network;
|
|
126
|
+
log.debug(tag, "network: ", token);
|
|
127
|
+
var caip = pioneer_caip_1.evmCaips[network];
|
|
128
|
+
token.blockchainCaip = caip;
|
|
129
|
+
token.assetCaip = caip + ":" + token.token.address;
|
|
130
|
+
log.debug(tag, "token.balanceUSD: ", token.token.balanceUSD);
|
|
131
|
+
totalBalanceUsdTokens_1 += token.token.balanceUSD;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
output.tokens = [];
|
|
137
|
+
totalBalanceUsdTokens_1 = 0;
|
|
133
138
|
}
|
|
134
139
|
limit = 100;
|
|
135
140
|
allTokens = [];
|
|
@@ -152,9 +157,9 @@ var get_portfolio = function (address) {
|
|
|
152
157
|
})];
|
|
153
158
|
case 6:
|
|
154
159
|
response = _a.sent();
|
|
155
|
-
|
|
160
|
+
tokens = response.data;
|
|
156
161
|
//console.log("tokens: ",tokens)
|
|
157
|
-
allTokens = allTokens.concat(
|
|
162
|
+
allTokens = allTokens.concat(tokens.items);
|
|
158
163
|
cursor = response.data.cursor;
|
|
159
164
|
if (!cursor) {
|
|
160
165
|
return [3 /*break*/, 9];
|