@pioneer-platform/zapper-client 8.3.9 → 8.3.10
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 +32 -24
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -123,7 +123,12 @@ var get_portfolio = function (address) {
|
|
|
123
123
|
balance.balance = token === null || token === void 0 ? void 0 : token.balance.toString();
|
|
124
124
|
balance.chain = app.network;
|
|
125
125
|
balance.networkId = pioneer_caip_1.evmCaips[app.network].split('/')[0];
|
|
126
|
-
|
|
126
|
+
if (token.type !== 'base-token' && token.address !== '0x0000000000000000000000000000000000000000') {
|
|
127
|
+
balance.caip = balance.networkId + "/erc20:" + token.address;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
balance.caip = balance.networkId + 'slip44:60';
|
|
131
|
+
}
|
|
127
132
|
balance.metaType = token.metaType || product.metaType;
|
|
128
133
|
balance.name = asset.displayProps.label;
|
|
129
134
|
balance.appId = app.appId;
|
|
@@ -158,33 +163,36 @@ var get_portfolio = function (address) {
|
|
|
158
163
|
tokens.forEach(function (token) {
|
|
159
164
|
log.debug(tag, "token: ", token);
|
|
160
165
|
var network = token.network;
|
|
161
|
-
log.debug(tag, "network: ",
|
|
166
|
+
log.debug(tag, "network: ", network);
|
|
162
167
|
var caip = pioneer_caip_1.evmCaips[network];
|
|
163
|
-
if (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
if (caip) {
|
|
169
|
+
token.networkId = caip.split('/')[0];
|
|
170
|
+
if (token.token.address !== '0x0000000000000000000000000000000000000000') {
|
|
171
|
+
token.assetCaip = token.networkId + "/erc20:" + token.token.address;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
token.assetCaip = caip;
|
|
175
|
+
}
|
|
176
|
+
var balance = {
|
|
177
|
+
balance: token.token.balance.toString(),
|
|
178
|
+
networkId: token.networkId,
|
|
179
|
+
chain: token.network,
|
|
180
|
+
caip: token.assetCaip,
|
|
181
|
+
type: 'erc20',
|
|
182
|
+
name: token.token.name,
|
|
183
|
+
symbol: token.token.symbol,
|
|
184
|
+
ticker: token.token.symbol,
|
|
185
|
+
decimals: token.token.decimals,
|
|
186
|
+
priceUsd: token.token.price,
|
|
187
|
+
valueUsd: token.token.balanceUSD.toString(),
|
|
188
|
+
};
|
|
189
|
+
output_1.balances.push(balance);
|
|
190
|
+
log.debug(tag, "token.balanceUSD: ", token.token.balanceUSD);
|
|
191
|
+
totalBalanceUsdTokens_1 += token.token.balanceUSD;
|
|
168
192
|
}
|
|
169
193
|
else {
|
|
170
|
-
|
|
194
|
+
log.error(tag, "No caip found for network: ", network);
|
|
171
195
|
}
|
|
172
|
-
var balance = {
|
|
173
|
-
balance: token.token.balance.toString(),
|
|
174
|
-
networkId: token.networkId,
|
|
175
|
-
chain: token.network,
|
|
176
|
-
caip: token.assetCaip,
|
|
177
|
-
type: 'erc20',
|
|
178
|
-
name: token.token.name,
|
|
179
|
-
symbol: token.token.symbol,
|
|
180
|
-
ticker: token.token.symbol,
|
|
181
|
-
decimals: token.token.decimals,
|
|
182
|
-
priceUsd: token.token.price,
|
|
183
|
-
valueUsd: token.token.balanceUSD.toString(),
|
|
184
|
-
};
|
|
185
|
-
output_1.balances.push(balance);
|
|
186
|
-
log.debug(tag, "token.balanceUSD: ", token.token.balanceUSD);
|
|
187
|
-
totalBalanceUsdTokens_1 += token.token.balanceUSD;
|
|
188
196
|
});
|
|
189
197
|
}
|
|
190
198
|
}
|