@pioneer-platform/zapper-client 8.1.27 → 8.1.28
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 -19
- 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:
|
|
@@ -114,22 +114,28 @@ var get_portfolio = function (address) {
|
|
|
114
114
|
case 3:
|
|
115
115
|
tokensResponse = _a.sent();
|
|
116
116
|
console.log("tokensResponse: ", tokensResponse.data);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
117
|
+
if (tokensResponse.data && tokensResponse.data[address]) {
|
|
118
|
+
tokens = tokensResponse.data[address];
|
|
119
|
+
totalBalanceUsdTokens_1 = 0;
|
|
120
|
+
tokens = tokens[address.toLowerCase()];
|
|
121
|
+
output.tokens = tokens;
|
|
122
|
+
log.debug(tag, "tokens: ", tokens.length);
|
|
123
|
+
if (tokens) {
|
|
124
|
+
tokens.forEach(function (token) {
|
|
125
|
+
log.debug(tag, "token: ", token);
|
|
126
|
+
var network = token.network;
|
|
127
|
+
log.debug(tag, "network: ", token);
|
|
128
|
+
var caip = pioneer_caip_1.evmCaips[network];
|
|
129
|
+
token.blockchainCaip = caip;
|
|
130
|
+
token.assetCaip = caip + ":" + token.token.address;
|
|
131
|
+
log.debug(tag, "token.balanceUSD: ", token.token.balanceUSD);
|
|
132
|
+
totalBalanceUsdTokens_1 += token.token.balanceUSD;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
output.tokens = [];
|
|
138
|
+
totalBalanceUsdTokens_1 = 0;
|
|
133
139
|
}
|
|
134
140
|
limit = 100;
|
|
135
141
|
allTokens = [];
|
|
@@ -152,9 +158,9 @@ var get_portfolio = function (address) {
|
|
|
152
158
|
})];
|
|
153
159
|
case 6:
|
|
154
160
|
response = _a.sent();
|
|
155
|
-
|
|
161
|
+
tokens = response.data;
|
|
156
162
|
//console.log("tokens: ",tokens)
|
|
157
|
-
allTokens = allTokens.concat(
|
|
163
|
+
allTokens = allTokens.concat(tokens.items);
|
|
158
164
|
cursor = response.data.cursor;
|
|
159
165
|
if (!cursor) {
|
|
160
166
|
return [3 /*break*/, 9];
|