From c9227d7c3209f23088ee69ad5d79cfa9b3d98d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Tue, 18 May 2021 11:18:23 +0200 Subject: [PATCH] put back provide erc20 --- src/families/ethereum/signOperation.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/families/ethereum/signOperation.js b/src/families/ethereum/signOperation.js index 8690667c2e..821c04d5f1 100644 --- a/src/families/ethereum/signOperation.js +++ b/src/families/ethereum/signOperation.js @@ -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"; @@ -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) || @@ -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" });