@toruslabs/ethereum-controllers 5.3.7 → 5.3.8
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/dist/ethereumControllers.cjs.js +6 -6
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +6 -6
- package/dist/ethereumControllers.esm.js.map +1 -1
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/ethereumControllers.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/Preferences/PreferencesController.ts +2 -1
- package/src/utils/helpers.ts +5 -5
|
@@ -1350,7 +1350,7 @@ const formatPastTx = (x, lowerCaseSelectedAddress) => {
|
|
|
1350
1350
|
var _x$to;
|
|
1351
1351
|
let totalAmountString = "";
|
|
1352
1352
|
if (x.type === CONTRACT_TYPE_ERC721 || x.type === CONTRACT_TYPE_ERC1155) totalAmountString = x.symbol;else if (x.type === CONTRACT_TYPE_ERC20) totalAmountString = formatSmallNumbers(Number.parseFloat(x.total_amount), x.symbol, true);else totalAmountString = formatSmallNumbers(Number.parseFloat(x.total_amount), x.type_name, true);
|
|
1353
|
-
const currencyAmountString = x.type === CONTRACT_TYPE_ERC721 || x.type === CONTRACT_TYPE_ERC1155 ? "" : formatSmallNumbers(Number.parseFloat(x.currency_amount), x.selected_currency, true);
|
|
1353
|
+
const currencyAmountString = x.type === CONTRACT_TYPE_ERC721 || x.type === CONTRACT_TYPE_ERC1155 || x.isEtherscan ? "" : formatSmallNumbers(Number.parseFloat(x.currency_amount), x.selected_currency, true);
|
|
1354
1354
|
const finalObject = {
|
|
1355
1355
|
id: x.created_at.toString(),
|
|
1356
1356
|
date: new Date(x.created_at).toString(),
|
|
@@ -1375,7 +1375,6 @@ const formatPastTx = (x, lowerCaseSelectedAddress) => {
|
|
|
1375
1375
|
type_image_link: x.type_image_link,
|
|
1376
1376
|
transaction_hash: x.transaction_hash,
|
|
1377
1377
|
transaction_category: x.transaction_category,
|
|
1378
|
-
// TODO: // figure out how to handle these values.
|
|
1379
1378
|
isEtherscan: x.isEtherscan,
|
|
1380
1379
|
input: x.input || "",
|
|
1381
1380
|
token_id: x.token_id || "",
|
|
@@ -1496,7 +1495,7 @@ const addEtherscanTransactions = async (txn, lowerCaseSelectedAddress, provider,
|
|
|
1496
1495
|
}));
|
|
1497
1496
|
const finalTxs = transactionPromises.reduce((accumulator, x) => {
|
|
1498
1497
|
var _SUPPORTED_NETWORKS$c3, _SUPPORTED_NETWORKS$c4;
|
|
1499
|
-
const
|
|
1498
|
+
const totalAmountString = x.value ? formatEther(x.value) : "";
|
|
1500
1499
|
const etherscanTransaction = {
|
|
1501
1500
|
etherscanLink: getEtherScanHashLink(x.hash, chainId),
|
|
1502
1501
|
type: x.type || ((_SUPPORTED_NETWORKS$c3 = SUPPORTED_NETWORKS[chainId]) === null || _SUPPORTED_NETWORKS$c3 === void 0 ? void 0 : _SUPPORTED_NETWORKS$c3.ticker) || CONTRACT_TYPE_ETH,
|
|
@@ -1504,12 +1503,12 @@ const addEtherscanTransactions = async (txn, lowerCaseSelectedAddress, provider,
|
|
|
1504
1503
|
type_name: x.type_name || "n/a",
|
|
1505
1504
|
symbol: (_SUPPORTED_NETWORKS$c4 = SUPPORTED_NETWORKS[chainId]) === null || _SUPPORTED_NETWORKS$c4 === void 0 ? void 0 : _SUPPORTED_NETWORKS$c4.ticker,
|
|
1506
1505
|
token_id: x.tokenID || "",
|
|
1507
|
-
total_amount:
|
|
1506
|
+
total_amount: totalAmountString,
|
|
1508
1507
|
created_at: new Date(Number(x.timeStamp) * 1000),
|
|
1509
1508
|
from: x.from,
|
|
1510
1509
|
to: x.to,
|
|
1511
1510
|
transaction_hash: x.hash,
|
|
1512
|
-
status: x.txreceipt_status && x.txreceipt_status === "0" ? TransactionStatus.failed : TransactionStatus.
|
|
1511
|
+
status: x.txreceipt_status && x.txreceipt_status === "0" ? TransactionStatus.failed : TransactionStatus.confirmed,
|
|
1513
1512
|
isEtherscan: true,
|
|
1514
1513
|
input: x.input,
|
|
1515
1514
|
contract_address: x.contractAddress,
|
|
@@ -4285,6 +4284,7 @@ class PreferencesController extends BasePreferencesController {
|
|
|
4285
4284
|
chainId: this.getProviderConfig().chainId
|
|
4286
4285
|
});
|
|
4287
4286
|
const finalEthScanTxn = await addEtherscanTransactions(etherscanTxn, selectedAddress, this.provider, chainId);
|
|
4287
|
+
log.info("Formatted Etherscan Response", finalEthScanTxn);
|
|
4288
4288
|
this.updateState({
|
|
4289
4289
|
etherscanTransactions: finalEthScanTxn
|
|
4290
4290
|
});
|
|
@@ -4297,7 +4297,7 @@ class PreferencesController extends BasePreferencesController {
|
|
|
4297
4297
|
const url = new URL(`${this.config.api}/etherscan`);
|
|
4298
4298
|
url.searchParams.append("chainId", parameters.chainId);
|
|
4299
4299
|
const response = await get(url.href, this.headers(parameters.selectedAddress));
|
|
4300
|
-
log.info("Etherscan Response", response);
|
|
4300
|
+
log.info("Etherscan Response API", response);
|
|
4301
4301
|
return response.success ? response.data : [];
|
|
4302
4302
|
} catch (error) {
|
|
4303
4303
|
log.error("unable to fetch etherscan tx", error);
|