Skip to content

Commit

Permalink
fix(TransactionController): Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gantunesr committed Sep 8, 2021
1 parent d2c0bbc commit 142a11e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/transaction/TransactionController.ts
Expand Up @@ -1148,7 +1148,7 @@ export class TransactionController extends BaseController<
normalizedTxs = this.trimTransactionsForState(normalizedTxs);
normalizedTokenTxs = this.trimTransactionsForState(normalizedTokenTxs);

const [updateTxs, allTxs] = this.transactionStateReconciler(
const [updateRequired, allTxs] = this.transactionStateReconciler(
[...normalizedTxs, ...normalizedTokenTxs],
transactions,
StateReconcileMethod.ETHERSCAN,
Expand Down Expand Up @@ -1193,7 +1193,7 @@ export class TransactionController extends BaseController<
});
// Update state only if new transactions were fetched or
// the status or gas data of a transaction has changed
if (updateTxs) {
if (updateRequired) {
this.update({ transactions: allTxs });
}
return latestIncomingTxBlockNumber;
Expand Down Expand Up @@ -1293,9 +1293,9 @@ export class TransactionController extends BaseController<
return txIdx === -1 ? tx : outdatedTxs[txIdx];
});

const update = newTxs.length > 0 || updatedLocalTxs.length > 0;
const updateRequired = newTxs.length > 0 || updatedLocalTxs.length > 0;

return [update, [...newTxs, ...updatedLocalTxs]];
return [updateRequired, [...newTxs, ...updatedLocalTxs]];
}

/**
Expand All @@ -1318,8 +1318,8 @@ export class TransactionController extends BaseController<
}

/**
* Get all the transactions that are locally outdated respect a
* remote source (etherscan or blockchain). The returned array
* Get all the transactions that are locally outdated with respect
* to a remote source (etherscan or blockchain). The returned array
* contains the transactions with the updated data.
* @param remoteTxs - Array of transactions from remote source
* @param localTxs - Array of transactions stored locally
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Expand Up @@ -183,7 +183,7 @@ export async function handleTransactionFetch(
networkType: string,
address: string,
opt?: FetchAllOptions,
): Promise<any[]> {
): Promise<[{ [result: string]: [] }, { [result: string]: [] }]> {
// transactions
const urlParams = {
module: 'account',
Expand Down

0 comments on commit 142a11e

Please sign in to comment.