Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
put back provide erc20
Browse files Browse the repository at this point in the history
  • Loading branch information
gre committed May 18, 2021
1 parent 413f822 commit c9227d7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/families/ethereum/signOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import invariant from "invariant";
import { Observable, from, of } from "rxjs";
import { mergeMap } from "rxjs/operators";
import { byContractAddress } from "@ledgerhq/hw-app-eth/erc20";
import eip55 from "eip55";
import { BigNumber } from "bignumber.js";
import { log } from "@ledgerhq/logs";
import { FeeNotLoaded } from "@ledgerhq/errors";
import Eth from "@ledgerhq/hw-app-eth";
import { byContractAddress } from "@ledgerhq/hw-app-eth/erc20";
import type { Transaction } from "./types";
import type { Operation, Account, SignOperationEvent } from "../../types";
import { getGasLimit, buildEthereumTx } from "./transaction";
Expand Down Expand Up @@ -65,7 +65,7 @@ export const signOperation = ({

if (cancelled) return;

// FIXME regardless of ledgerjs changes, we seem to still need this for compound
// FIXME this part is still required for compound to correctly display info on the device
const addrs =
(fillTransactionDataResult &&
fillTransactionDataResult.erc20contracts) ||
Expand All @@ -77,6 +77,12 @@ export const signOperation = ({
}
}

const tokenInfo = byContractAddress(to);
// if the destination happens to be a contract address of a token, we need to provide to device meta info
if (tokenInfo) {
await eth.provideERC20TokenInformation(tokenInfo);
}

if (cancelled) return;

o.next({ type: "device-signature-requested" });
Expand Down

0 comments on commit c9227d7

Please sign in to comment.