@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toruslabs/ethereum-controllers",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.8",
|
|
4
4
|
"homepage": "https://github.com/torusresearch/controllers#readme",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/ethereumControllers.cjs.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ed4d9b8fa78f3dfabc8799f03ab106ddf144566d",
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
|
|
70
70
|
"hardhat": "^2.19.5"
|
|
@@ -215,6 +215,7 @@ export default class PreferencesController
|
|
|
215
215
|
chainId: this.getProviderConfig().chainId,
|
|
216
216
|
});
|
|
217
217
|
const finalEthScanTxn = await addEtherscanTransactions(etherscanTxn, selectedAddress, this.provider, chainId);
|
|
218
|
+
log.info("Formatted Etherscan Response", finalEthScanTxn);
|
|
218
219
|
this.updateState({ etherscanTransactions: finalEthScanTxn });
|
|
219
220
|
return etherscanTxn;
|
|
220
221
|
}
|
|
@@ -226,7 +227,7 @@ export default class PreferencesController
|
|
|
226
227
|
const url = new URL(`${this.config.api}/etherscan`);
|
|
227
228
|
url.searchParams.append("chainId", parameters.chainId);
|
|
228
229
|
const response = await get<{ success: boolean; data: T[] }>(url.href, this.headers(parameters.selectedAddress));
|
|
229
|
-
log.info("Etherscan Response", response);
|
|
230
|
+
log.info("Etherscan Response API", response);
|
|
230
231
|
return response.success ? response.data : [];
|
|
231
232
|
} catch (error) {
|
|
232
233
|
log.error("unable to fetch etherscan tx", error);
|
package/src/utils/helpers.ts
CHANGED
|
@@ -36,7 +36,7 @@ export const formatPastTx = (x: TransactionPayload, lowerCaseSelectedAddress?: s
|
|
|
36
36
|
else if (x.type === CONTRACT_TYPE_ERC20) totalAmountString = formatSmallNumbers(Number.parseFloat(x.total_amount), x.symbol, true);
|
|
37
37
|
else totalAmountString = formatSmallNumbers(Number.parseFloat(x.total_amount), x.type_name, true);
|
|
38
38
|
const currencyAmountString =
|
|
39
|
-
x.type === CONTRACT_TYPE_ERC721 || x.type === CONTRACT_TYPE_ERC1155
|
|
39
|
+
x.type === CONTRACT_TYPE_ERC721 || x.type === CONTRACT_TYPE_ERC1155 || x.isEtherscan
|
|
40
40
|
? ""
|
|
41
41
|
: formatSmallNumbers(Number.parseFloat(x.currency_amount), x.selected_currency, true);
|
|
42
42
|
const finalObject: FormattedTransactionActivity = {
|
|
@@ -66,7 +66,6 @@ export const formatPastTx = (x: TransactionPayload, lowerCaseSelectedAddress?: s
|
|
|
66
66
|
type_image_link: x.type_image_link,
|
|
67
67
|
transaction_hash: x.transaction_hash,
|
|
68
68
|
transaction_category: x.transaction_category,
|
|
69
|
-
// TODO: // figure out how to handle these values.
|
|
70
69
|
isEtherscan: x.isEtherscan,
|
|
71
70
|
input: x.input || "",
|
|
72
71
|
token_id: x.token_id || "",
|
|
@@ -199,7 +198,8 @@ export const addEtherscanTransactions = async (
|
|
|
199
198
|
);
|
|
200
199
|
|
|
201
200
|
const finalTxs = transactionPromises.reduce((accumulator, x) => {
|
|
202
|
-
const
|
|
201
|
+
const totalAmountString = x.value ? formatEther(x.value) : "";
|
|
202
|
+
|
|
203
203
|
const etherscanTransaction: TransactionPayload = {
|
|
204
204
|
etherscanLink: getEtherScanHashLink(x.hash, chainId),
|
|
205
205
|
type: x.type || SUPPORTED_NETWORKS[chainId]?.ticker || CONTRACT_TYPE_ETH,
|
|
@@ -207,12 +207,12 @@ export const addEtherscanTransactions = async (
|
|
|
207
207
|
type_name: x.type_name || "n/a",
|
|
208
208
|
symbol: SUPPORTED_NETWORKS[chainId]?.ticker,
|
|
209
209
|
token_id: x.tokenID || "",
|
|
210
|
-
total_amount:
|
|
210
|
+
total_amount: totalAmountString,
|
|
211
211
|
created_at: new Date(Number(x.timeStamp) * 1000),
|
|
212
212
|
from: x.from,
|
|
213
213
|
to: x.to,
|
|
214
214
|
transaction_hash: x.hash,
|
|
215
|
-
status: x.txreceipt_status && x.txreceipt_status === "0" ? TransactionStatus.failed : TransactionStatus.
|
|
215
|
+
status: x.txreceipt_status && x.txreceipt_status === "0" ? TransactionStatus.failed : TransactionStatus.confirmed,
|
|
216
216
|
isEtherscan: true,
|
|
217
217
|
input: x.input,
|
|
218
218
|
contract_address: x.contractAddress,
|