From 24302eb7b44b89ec0e8af6b3462077581522b08f Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Fri, 10 Jan 2025 14:52:05 +0100 Subject: [PATCH] fix: ethers contract results --- ui/helpers/utils/token-util.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ui/helpers/utils/token-util.js b/ui/helpers/utils/token-util.js index 10beae68b39e..143cdf220ed3 100644 --- a/ui/helpers/utils/token-util.js +++ b/ui/helpers/utils/token-util.js @@ -14,8 +14,7 @@ const DEFAULT_SYMBOL = ''; async function getSymbolFromContract(tokenAddress) { const token = util.getContractAtAddress(tokenAddress); try { - const result = await token.symbol(); - return result[0]; + return await token.symbol(); } catch (error) { log.warn( `symbol() call for token at address ${tokenAddress} resulted in error:`, @@ -28,8 +27,7 @@ async function getSymbolFromContract(tokenAddress) { async function getNameFromContract(tokenAddress) { const token = util.getContractAtAddress(tokenAddress); try { - const [name] = await token.name(); - return name; + return await token.name(); } catch (error) { log.warn( `name() call for token at address ${tokenAddress} resulted in error:`, @@ -43,8 +41,7 @@ async function getDecimalsFromContract(tokenAddress) { const token = util.getContractAtAddress(tokenAddress); try { - const result = await token.decimals(); - const decimalsBN = result[0]; + const decimalsBN = await token.decimals(); return decimalsBN?.toString(); } catch (error) { log.warn(