@pioneer-platform/zapper-client 8.3.11 → 8.3.13
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 +169 -117
- package/package.json +10 -13
- package/test-output.txt +1230 -0
package/lib/index.js
CHANGED
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
https://docs.blocknative.com/webhook-api
|
|
4
4
|
|
|
5
5
|
*/
|
|
6
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
7
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
8
|
-
return cooked;
|
|
9
|
-
};
|
|
10
6
|
var __assign = (this && this.__assign) || function () {
|
|
11
7
|
__assign = Object.assign || function(t) {
|
|
12
8
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -28,8 +24,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
28
24
|
});
|
|
29
25
|
};
|
|
30
26
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
-
return g =
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
29
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
30
|
function step(op) {
|
|
35
31
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -62,32 +58,124 @@ var pioneer_caip_1 = require("@pioneer-platform/pioneer-caip");
|
|
|
62
58
|
var Axios = require('axios');
|
|
63
59
|
var https = require('https');
|
|
64
60
|
var API_KEY = process.env['ZAPPER_API_KEY'];
|
|
65
|
-
var API_KEY_NEW = process.env['ZAPPER_API_KEY_TIMELINE'];
|
|
66
61
|
if (!API_KEY)
|
|
67
62
|
throw Error("api key required! set env ZAPPER_API_KEY");
|
|
68
|
-
if (!API_KEY_NEW)
|
|
69
|
-
throw Error("api key required! set env ZAPPER_API_KEY_TIMELINE");
|
|
70
63
|
var axios = Axios.create();
|
|
71
64
|
var Authorization = "Basic ".concat(Buffer.from("".concat(API_KEY, ":"), "binary").toString("base64"));
|
|
72
65
|
console.log(Authorization);
|
|
73
66
|
var URL_SERVICE = "https://api.zapper.xyz";
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// if
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
67
|
+
// Removed axios-retry - using basic axios
|
|
68
|
+
/**
|
|
69
|
+
* Validates if a CAIP is correctly formatted for the given token
|
|
70
|
+
*/
|
|
71
|
+
var validateCaip = function (caip, token, networkName) {
|
|
72
|
+
var _a;
|
|
73
|
+
var tag = TAG + " | validateCaip | ";
|
|
74
|
+
try {
|
|
75
|
+
if (!caip || !caip.includes('/')) {
|
|
76
|
+
log.error(tag, "Invalid CAIP format:", caip);
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
var _b = caip.split('/'), network = _b[0], assetType = _b[1];
|
|
80
|
+
// Check if token has contract address
|
|
81
|
+
var hasContractAddress = token.address &&
|
|
82
|
+
token.address !== '0x0000000000000000000000000000000000000000' &&
|
|
83
|
+
token.address.toLowerCase() !== '0x0';
|
|
84
|
+
// Special handling for eETH (Ether.fi staked ETH)
|
|
85
|
+
var isEETH = token.symbol === 'eETH' ||
|
|
86
|
+
(token.address && token.address.toLowerCase() === '0x35fa164735182de50811e8e2e824cfb9b6118ac2');
|
|
87
|
+
if (hasContractAddress || isEETH) {
|
|
88
|
+
// This should be an ERC-20 token
|
|
89
|
+
if (!(assetType === null || assetType === void 0 ? void 0 : assetType.includes('erc20'))) {
|
|
90
|
+
log.error(tag, "Token ".concat(token.symbol, " with address ").concat(token.address, " should have ERC-20 CAIP but got: ").concat(caip));
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
// Verify contract address is in CAIP
|
|
94
|
+
if (!(assetType === null || assetType === void 0 ? void 0 : assetType.includes((_a = token.address) === null || _a === void 0 ? void 0 : _a.toLowerCase()))) {
|
|
95
|
+
log.error(tag, "Token ".concat(token.symbol, " CAIP missing contract address: ").concat(caip));
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// This should be a native asset
|
|
101
|
+
if (!(assetType === null || assetType === void 0 ? void 0 : assetType.includes('slip44'))) {
|
|
102
|
+
log.error(tag, "Native asset ".concat(token.symbol, " should have slip44 CAIP but got: ").concat(caip));
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
log.error(tag, "CAIP validation error:", e);
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Assigns the correct CAIP for a token based on its properties
|
|
115
|
+
*/
|
|
116
|
+
var assignCorrectCaip = function (networkId, token, networkName) {
|
|
117
|
+
var tag = TAG + " | assignCorrectCaip | ";
|
|
118
|
+
try {
|
|
119
|
+
// Check if token has a valid contract address
|
|
120
|
+
var hasContractAddress = token.address &&
|
|
121
|
+
token.address !== '0x0000000000000000000000000000000000000000' &&
|
|
122
|
+
token.address.toLowerCase() !== '0x0' &&
|
|
123
|
+
token.address.toLowerCase() !== '0x';
|
|
124
|
+
// Known token addresses for special handling
|
|
125
|
+
var knownTokens = {
|
|
126
|
+
'eETH': '0x35fa164735182de50811e8e2e824cfb9b6118ac2',
|
|
127
|
+
'weETH': '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee',
|
|
128
|
+
'stETH': '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
|
|
129
|
+
'wstETH': '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0'
|
|
130
|
+
};
|
|
131
|
+
// Check if this is a known token that should be ERC-20
|
|
132
|
+
var knownAddress = knownTokens[token.symbol];
|
|
133
|
+
if (knownAddress) {
|
|
134
|
+
var caip_1 = "".concat(networkId, "/erc20:").concat(knownAddress.toLowerCase());
|
|
135
|
+
log.debug(tag, "Assigned known token CAIP for ".concat(token.symbol, ": ").concat(caip_1));
|
|
136
|
+
return caip_1;
|
|
137
|
+
}
|
|
138
|
+
// For tokens with valid contract addresses (ERC-20/ERC-721)
|
|
139
|
+
if (hasContractAddress) {
|
|
140
|
+
var caip_2 = "".concat(networkId, "/erc20:").concat(token.address.toLowerCase());
|
|
141
|
+
log.debug(tag, "Assigned ERC-20 CAIP for ".concat(token.symbol, ": ").concat(caip_2));
|
|
142
|
+
return caip_2;
|
|
143
|
+
}
|
|
144
|
+
// For native tokens (ETH, BNB, MATIC, etc) - only when explicitly base-token or no address
|
|
145
|
+
if (token.type === 'base-token' || token.symbol === 'ETH' || token.symbol === 'BNB' || token.symbol === 'MATIC') {
|
|
146
|
+
var caip_3 = "".concat(networkId, "/slip44:60");
|
|
147
|
+
log.debug(tag, "Assigned native CAIP for ".concat(token.symbol, ": ").concat(caip_3));
|
|
148
|
+
return caip_3;
|
|
149
|
+
}
|
|
150
|
+
// Default to slip44:60 for native assets without addresses
|
|
151
|
+
var caip = "".concat(networkId, "/slip44:60");
|
|
152
|
+
log.warn(tag, "Default CAIP assignment for ".concat(token.symbol, ": ").concat(caip));
|
|
153
|
+
return caip;
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
log.error(tag, "Error assigning CAIP:", e);
|
|
157
|
+
// Fallback to native token CAIP
|
|
158
|
+
return "".concat(networkId, "/slip44:60");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Logs CAIP assignment for debugging
|
|
163
|
+
*/
|
|
164
|
+
var logCaipAssignment = function (balance, originalCaip) {
|
|
165
|
+
var tag = TAG + " | logCaipAssignment | ";
|
|
166
|
+
if (originalCaip && originalCaip !== balance.caip) {
|
|
167
|
+
log.info(tag, "CAIP corrected for ".concat(balance.symbol, ":"));
|
|
168
|
+
log.info(tag, " Original: ".concat(originalCaip));
|
|
169
|
+
log.info(tag, " Corrected: ".concat(balance.caip));
|
|
170
|
+
log.info(tag, " Token details:", {
|
|
171
|
+
symbol: balance.symbol,
|
|
172
|
+
name: balance.name,
|
|
173
|
+
address: balance.tokenAddress,
|
|
174
|
+
type: balance.tokenType,
|
|
175
|
+
metaType: balance.metaType
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
91
179
|
module.exports = {
|
|
92
180
|
getTokens: function (address) {
|
|
93
181
|
return get_tokens(address);
|
|
@@ -101,68 +189,18 @@ module.exports = {
|
|
|
101
189
|
getTotalNetworth: function (address) {
|
|
102
190
|
return get_total_networth(address);
|
|
103
191
|
},
|
|
104
|
-
getAccountHistory: function (address) {
|
|
105
|
-
return get_account_history(address);
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
var get_account_history = function (address) {
|
|
109
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
-
var tag, endpoint, encodedKey_1, httpLink, authLink, client, query, variables, response, e_1;
|
|
111
|
-
return __generator(this, function (_a) {
|
|
112
|
-
switch (_a.label) {
|
|
113
|
-
case 0:
|
|
114
|
-
tag = "get_account_history | ";
|
|
115
|
-
_a.label = 1;
|
|
116
|
-
case 1:
|
|
117
|
-
_a.trys.push([1, 3, , 4]);
|
|
118
|
-
endpoint = "https://public.zapper.xyz/graphql";
|
|
119
|
-
encodedKey_1 = Buffer.from(API_KEY_NEW).toString('base64');
|
|
120
|
-
httpLink = new HttpLink({
|
|
121
|
-
uri: endpoint,
|
|
122
|
-
fetch: fetch,
|
|
123
|
-
});
|
|
124
|
-
authLink = setContext(function (_, _a) {
|
|
125
|
-
var headers = _a.headers;
|
|
126
|
-
return ({
|
|
127
|
-
headers: __assign(__assign({}, headers), { 'Content-Type': 'application/json', 'Authorization': "Basic ".concat(encodedKey_1) }),
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
client = new ApolloClient({
|
|
131
|
-
link: authLink.concat(httpLink),
|
|
132
|
-
cache: new InMemoryCache(),
|
|
133
|
-
});
|
|
134
|
-
query = gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query ($addresses: [Address!], $realtimeInterpretation: Boolean, $isSigner: Boolean) {\n accountsTimeline(addresses: $addresses, realtimeInterpretation: $realtimeInterpretation, isSigner: $isSigner) {\n edges {\n node {\n transaction {\n fromUser {\n address\n displayName {\n value\n }\n }\n toUser {\n displayName {\n value\n }\n }\n }\n interpretation {\n processedDescription\n }\n app {\n name\n imgUrl\n }\n network\n timestamp\n }\n }\n }\n }\n "], ["\n query ($addresses: [Address!], $realtimeInterpretation: Boolean, $isSigner: Boolean) {\n accountsTimeline(addresses: $addresses, realtimeInterpretation: $realtimeInterpretation, isSigner: $isSigner) {\n edges {\n node {\n transaction {\n fromUser {\n address\n displayName {\n value\n }\n }\n toUser {\n displayName {\n value\n }\n }\n }\n interpretation {\n processedDescription\n }\n app {\n name\n imgUrl\n }\n network\n timestamp\n }\n }\n }\n }\n "])));
|
|
135
|
-
variables = {
|
|
136
|
-
addresses: [address],
|
|
137
|
-
realtimeInterpretation: true,
|
|
138
|
-
isSigner: true,
|
|
139
|
-
};
|
|
140
|
-
return [4 /*yield*/, client.query({ query: query, variables: variables })];
|
|
141
|
-
case 2:
|
|
142
|
-
response = _a.sent();
|
|
143
|
-
console.log("response:", response.data);
|
|
144
|
-
console.log("response:", response.data.accountsTimeline.edges);
|
|
145
|
-
return [2 /*return*/, response.data.accountsTimeline.edges];
|
|
146
|
-
case 3:
|
|
147
|
-
e_1 = _a.sent();
|
|
148
|
-
console.error(tag, "Error: ", e_1);
|
|
149
|
-
return [2 /*return*/, null];
|
|
150
|
-
case 4: return [2 /*return*/];
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
192
|
};
|
|
155
193
|
var get_portfolio = function (address) {
|
|
156
|
-
var _a, _b;
|
|
157
194
|
return __awaiter(this, void 0, void 0, function () {
|
|
158
|
-
var tag, output_1, appsResponse, apps, totalBalanceUSDApp_1, i, app, j, product, k, asset, l, token, balance, tokensResponse, totalBalanceUsdTokens_1, tokens, limit, allTokens, cursor, url, response, tokens, error_1, nftResponse, nftUsdNetWorth, totalNetWorth,
|
|
159
|
-
|
|
160
|
-
|
|
195
|
+
var tag, output_1, appsResponse, apps, totalBalanceUSDApp_1, i, app, j, product, k, asset, l, token, balance, tokenForCaip, tokensResponse, totalBalanceUsdTokens_1, tokens, limit, allTokens, cursor, url, response, tokens, error_1, nftResponse, nftUsdNetWorth, totalNetWorth, e_1;
|
|
196
|
+
var _a, _b, _c, _d;
|
|
197
|
+
return __generator(this, function (_e) {
|
|
198
|
+
switch (_e.label) {
|
|
161
199
|
case 0:
|
|
162
200
|
tag = TAG + " | get_portfolio | ";
|
|
163
|
-
|
|
201
|
+
_e.label = 1;
|
|
164
202
|
case 1:
|
|
165
|
-
|
|
203
|
+
_e.trys.push([1, 11, , 12]);
|
|
166
204
|
output_1 = {
|
|
167
205
|
balances: []
|
|
168
206
|
};
|
|
@@ -173,7 +211,7 @@ var get_portfolio = function (address) {
|
|
|
173
211
|
},
|
|
174
212
|
})];
|
|
175
213
|
case 2:
|
|
176
|
-
appsResponse =
|
|
214
|
+
appsResponse = _e.sent();
|
|
177
215
|
log.info(tag, "appsResponse: ", appsResponse.data);
|
|
178
216
|
apps = appsResponse.data;
|
|
179
217
|
totalBalanceUSDApp_1 = 0;
|
|
@@ -195,22 +233,35 @@ var get_portfolio = function (address) {
|
|
|
195
233
|
balance.balance = token === null || token === void 0 ? void 0 : token.balance.toString();
|
|
196
234
|
balance.chain = app.network;
|
|
197
235
|
balance.networkId = pioneer_caip_1.evmCaips[app.network].split('/')[0];
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
236
|
+
tokenForCaip = token;
|
|
237
|
+
if (asset.type === 'app-token' && asset.address &&
|
|
238
|
+
asset.address !== '0x0000000000000000000000000000000000000000') {
|
|
239
|
+
// Use the asset-level address for app tokens
|
|
240
|
+
tokenForCaip = __assign(__assign({}, token), { address: asset.address, symbol: asset.symbol || token.symbol });
|
|
203
241
|
}
|
|
242
|
+
// Assign correct CAIP based on token properties
|
|
243
|
+
balance.caip = assignCorrectCaip(balance.networkId, tokenForCaip, app.network);
|
|
244
|
+
// Log CAIP assignment for debugging
|
|
245
|
+
log.debug(tag, "CAIP assigned for ".concat(asset.symbol || token.symbol, ": ").concat(balance.caip), {
|
|
246
|
+
assetAddress: asset.address,
|
|
247
|
+
tokenAddress: token.address,
|
|
248
|
+
assetType: asset.type,
|
|
249
|
+
tokenType: token.type,
|
|
250
|
+
network: app.network
|
|
251
|
+
});
|
|
204
252
|
balance.metaType = token.metaType || product.metaType;
|
|
205
253
|
balance.name = asset.displayProps.label;
|
|
206
254
|
balance.appId = app.appId;
|
|
207
255
|
balance.icon = asset.displayProps.images[0];
|
|
208
256
|
balance.display = asset.displayProps.images;
|
|
209
257
|
balance.groupId = asset.groupId;
|
|
210
|
-
balance.symbol = token.symbol;
|
|
211
|
-
balance.ticker = token.symbol;
|
|
212
|
-
balance.priceUsd = ((_a = token === null || token === void 0 ? void 0 : token.price) === null ||
|
|
213
|
-
balance.valueUsd = ((
|
|
258
|
+
balance.symbol = asset.symbol || token.symbol; // Use asset symbol if available
|
|
259
|
+
balance.ticker = asset.symbol || token.symbol; // Use asset symbol if available
|
|
260
|
+
balance.priceUsd = ((_a = asset.price) === null || _a === void 0 ? void 0 : _a.toString()) || ((_b = token === null || token === void 0 ? void 0 : token.price) === null || _b === void 0 ? void 0 : _b.toString()) || '0'; // Use asset price if available
|
|
261
|
+
balance.valueUsd = ((_c = asset.balanceUSD) === null || _c === void 0 ? void 0 : _c.toString()) || ((_d = token === null || token === void 0 ? void 0 : token.balanceUSD) === null || _d === void 0 ? void 0 : _d.toString()) || '0'; // Use asset value if available
|
|
262
|
+
// Add additional fields for debugging
|
|
263
|
+
balance.tokenAddress = asset.address || token.address;
|
|
264
|
+
balance.tokenType = asset.type || token.type;
|
|
214
265
|
output_1.balances.push(balance);
|
|
215
266
|
}
|
|
216
267
|
}
|
|
@@ -223,7 +274,7 @@ var get_portfolio = function (address) {
|
|
|
223
274
|
},
|
|
224
275
|
})];
|
|
225
276
|
case 3:
|
|
226
|
-
tokensResponse =
|
|
277
|
+
tokensResponse = _e.sent();
|
|
227
278
|
console.log("tokensResponse: ", tokensResponse.data);
|
|
228
279
|
if (tokensResponse.data && tokensResponse.data[address.toLowerCase()]) {
|
|
229
280
|
tokens = tokensResponse.data;
|
|
@@ -239,12 +290,8 @@ var get_portfolio = function (address) {
|
|
|
239
290
|
var caip = pioneer_caip_1.evmCaips[network];
|
|
240
291
|
if (caip) {
|
|
241
292
|
token.networkId = caip.split('/')[0];
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
token.assetCaip = caip;
|
|
247
|
-
}
|
|
293
|
+
// Assign correct CAIP based on token properties
|
|
294
|
+
token.assetCaip = assignCorrectCaip(token.networkId, token.token, network);
|
|
248
295
|
var balance = {
|
|
249
296
|
balance: token.token.balance.toString(),
|
|
250
297
|
networkId: token.networkId,
|
|
@@ -257,7 +304,13 @@ var get_portfolio = function (address) {
|
|
|
257
304
|
decimals: token.token.decimals,
|
|
258
305
|
priceUsd: token.token.price,
|
|
259
306
|
valueUsd: token.token.balanceUSD.toString(),
|
|
307
|
+
tokenAddress: token.token.address,
|
|
260
308
|
};
|
|
309
|
+
// Log CAIP assignment for debugging
|
|
310
|
+
log.debug(tag, "CAIP assigned for ".concat(token.token.symbol, ": ").concat(token.assetCaip), {
|
|
311
|
+
address: token.token.address,
|
|
312
|
+
network: network
|
|
313
|
+
});
|
|
261
314
|
output_1.balances.push(balance);
|
|
262
315
|
log.debug(tag, "token.balanceUSD: ", token.token.balanceUSD);
|
|
263
316
|
totalBalanceUsdTokens_1 += token.token.balanceUSD;
|
|
@@ -274,12 +327,12 @@ var get_portfolio = function (address) {
|
|
|
274
327
|
limit = 100;
|
|
275
328
|
allTokens = [];
|
|
276
329
|
cursor = null;
|
|
277
|
-
|
|
330
|
+
_e.label = 4;
|
|
278
331
|
case 4:
|
|
279
332
|
if (!true) return [3 /*break*/, 9];
|
|
280
|
-
|
|
333
|
+
_e.label = 5;
|
|
281
334
|
case 5:
|
|
282
|
-
|
|
335
|
+
_e.trys.push([5, 7, , 8]);
|
|
283
336
|
url = "https://api.zapper.xyz/v2/nft/user/tokens?userAddress=".concat(address, "&limit=").concat(limit);
|
|
284
337
|
if (cursor) {
|
|
285
338
|
url += "&cursor=".concat(cursor);
|
|
@@ -291,7 +344,7 @@ var get_portfolio = function (address) {
|
|
|
291
344
|
},
|
|
292
345
|
})];
|
|
293
346
|
case 6:
|
|
294
|
-
response =
|
|
347
|
+
response = _e.sent();
|
|
295
348
|
tokens = response.data;
|
|
296
349
|
//console.log("tokens: ",tokens)
|
|
297
350
|
allTokens = allTokens.concat(tokens.items);
|
|
@@ -301,7 +354,7 @@ var get_portfolio = function (address) {
|
|
|
301
354
|
}
|
|
302
355
|
return [3 /*break*/, 8];
|
|
303
356
|
case 7:
|
|
304
|
-
error_1 =
|
|
357
|
+
error_1 = _e.sent();
|
|
305
358
|
console.error(error_1);
|
|
306
359
|
return [3 /*break*/, 8];
|
|
307
360
|
case 8: return [3 /*break*/, 4];
|
|
@@ -314,7 +367,7 @@ var get_portfolio = function (address) {
|
|
|
314
367
|
},
|
|
315
368
|
})];
|
|
316
369
|
case 10:
|
|
317
|
-
nftResponse =
|
|
370
|
+
nftResponse = _e.sent();
|
|
318
371
|
nftUsdNetWorth = nftResponse.data;
|
|
319
372
|
output_1.nftUsdNetWorth = nftUsdNetWorth;
|
|
320
373
|
output_1.totalBalanceUsdTokens = totalBalanceUsdTokens_1;
|
|
@@ -324,8 +377,8 @@ var get_portfolio = function (address) {
|
|
|
324
377
|
output_1.totalNetWorth = totalNetWorth;
|
|
325
378
|
return [2 /*return*/, output_1];
|
|
326
379
|
case 11:
|
|
327
|
-
|
|
328
|
-
console.error(tag, "e: ",
|
|
380
|
+
e_1 = _e.sent();
|
|
381
|
+
console.error(tag, "e: ", e_1);
|
|
329
382
|
return [3 /*break*/, 12];
|
|
330
383
|
case 12: return [2 /*return*/];
|
|
331
384
|
}
|
|
@@ -334,7 +387,7 @@ var get_portfolio = function (address) {
|
|
|
334
387
|
};
|
|
335
388
|
var get_total_networth = function (address) {
|
|
336
389
|
return __awaiter(this, void 0, void 0, function () {
|
|
337
|
-
var tag, appsResponse, apps, totalBalanceUSDApp_2, tokensResponse, tokens, totalBalanceUsdTokens_2, nftResponse, nftUsdNetWorth, totalNetWorth,
|
|
390
|
+
var tag, appsResponse, apps, totalBalanceUSDApp_2, tokensResponse, tokens, totalBalanceUsdTokens_2, nftResponse, nftUsdNetWorth, totalNetWorth, e_2;
|
|
338
391
|
return __generator(this, function (_a) {
|
|
339
392
|
switch (_a.label) {
|
|
340
393
|
case 0:
|
|
@@ -393,8 +446,8 @@ var get_total_networth = function (address) {
|
|
|
393
446
|
log.debug("totalNetWorth: ", totalNetWorth);
|
|
394
447
|
return [2 /*return*/, totalNetWorth];
|
|
395
448
|
case 5:
|
|
396
|
-
|
|
397
|
-
console.error(tag, "e: ",
|
|
449
|
+
e_2 = _a.sent();
|
|
450
|
+
console.error(tag, "e: ", e_2);
|
|
398
451
|
return [3 /*break*/, 6];
|
|
399
452
|
case 6: return [2 /*return*/];
|
|
400
453
|
}
|
|
@@ -403,7 +456,7 @@ var get_total_networth = function (address) {
|
|
|
403
456
|
};
|
|
404
457
|
var get_tokens = function (address) {
|
|
405
458
|
return __awaiter(this, void 0, void 0, function () {
|
|
406
|
-
var tag, apiKey, appsResponse,
|
|
459
|
+
var tag, apiKey, appsResponse, e_3;
|
|
407
460
|
return __generator(this, function (_a) {
|
|
408
461
|
switch (_a.label) {
|
|
409
462
|
case 0:
|
|
@@ -443,8 +496,8 @@ var get_tokens = function (address) {
|
|
|
443
496
|
// },headers)
|
|
444
497
|
return [2 /*return*/, appsResponse.data];
|
|
445
498
|
case 3:
|
|
446
|
-
|
|
447
|
-
console.error(tag, "e: ",
|
|
499
|
+
e_3 = _a.sent();
|
|
500
|
+
console.error(tag, "e: ", e_3);
|
|
448
501
|
return [3 /*break*/, 4];
|
|
449
502
|
case 4: return [2 /*return*/];
|
|
450
503
|
}
|
|
@@ -453,7 +506,7 @@ var get_tokens = function (address) {
|
|
|
453
506
|
};
|
|
454
507
|
var get_nfts = function (address) {
|
|
455
508
|
return __awaiter(this, void 0, void 0, function () {
|
|
456
|
-
var tag, url, result,
|
|
509
|
+
var tag, url, result, e_4;
|
|
457
510
|
return __generator(this, function (_a) {
|
|
458
511
|
switch (_a.label) {
|
|
459
512
|
case 0:
|
|
@@ -470,12 +523,11 @@ var get_nfts = function (address) {
|
|
|
470
523
|
result = _a.sent();
|
|
471
524
|
return [2 /*return*/, result.data];
|
|
472
525
|
case 3:
|
|
473
|
-
|
|
474
|
-
console.error(tag, "e: ",
|
|
526
|
+
e_4 = _a.sent();
|
|
527
|
+
console.error(tag, "e: ", e_4);
|
|
475
528
|
return [3 /*break*/, 4];
|
|
476
529
|
case 4: return [2 /*return*/];
|
|
477
530
|
}
|
|
478
531
|
});
|
|
479
532
|
});
|
|
480
533
|
};
|
|
481
|
-
var templateObject_1;
|
package/package.json
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/zapper-client",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.13",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@apollo/client": "^3.12.4",
|
|
8
7
|
"@pioneer-platform/loggerdog": "^8.3.1",
|
|
9
8
|
"@pioneer-platform/pioneer-caip": "^9.2.36",
|
|
10
|
-
"axios": "^1.
|
|
11
|
-
"dotenv": "^8.2.0"
|
|
12
|
-
"graphql": "^16.10.0",
|
|
13
|
-
"node-fetch": "2"
|
|
9
|
+
"axios": "^1.6.0",
|
|
10
|
+
"dotenv": "^8.2.0"
|
|
14
11
|
},
|
|
15
12
|
"scripts": {
|
|
16
|
-
"npm": "
|
|
17
|
-
"test": "
|
|
13
|
+
"npm": "pnpm i",
|
|
14
|
+
"test": "pnpm run build && node __tests__/test-module.js",
|
|
18
15
|
"build": "tsc -p .",
|
|
19
|
-
"prepublish": "
|
|
20
|
-
"refresh": "rm -rf ./node_modules ./package-lock.json &&
|
|
16
|
+
"prepublish": "pnpm run build",
|
|
17
|
+
"refresh": "rm -rf ./node_modules ./package-lock.json && pnpm install"
|
|
21
18
|
},
|
|
22
19
|
"devDependencies": {
|
|
23
20
|
"@types/jest": "^25.2.3",
|
|
24
|
-
"@types/node": "^
|
|
21
|
+
"@types/node": "^18.16.0",
|
|
25
22
|
"@types/source-map-support": "^0.5.3",
|
|
26
23
|
"jest": "^26.4.2",
|
|
27
24
|
"onchange": "^7.0.2",
|
|
28
25
|
"serve": "^11.3.2",
|
|
29
26
|
"source-map-support": "^0.5.19",
|
|
30
27
|
"ts-jest": "^29.0.5",
|
|
31
|
-
"typescript": "^5.0.
|
|
28
|
+
"typescript": "^5.0.4"
|
|
32
29
|
},
|
|
33
30
|
"gitHead": "aeae28273014ab69b42f22abec159c6693a56c40"
|
|
34
|
-
}
|
|
31
|
+
}
|