File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -46,13 +46,14 @@ export const updateSecondaryTokens = async (
4646 const chainRPC = chain . rpcUrl
4747 if ( ! chain . secondaryTokens || ! chain . secondaryTokens . length || ! chainRPC )
4848 return
49+
4950 const ethersProvider = new ethers . providers . Web3Provider (
5051 wallet . provider ,
5152 'any'
5253 )
5354 const signer = ethersProvider . getSigner ( )
5455
55- const abi = [
56+ const erc20ABISubset = [
5657 {
5758 inputs : [ { name : 'owner' , type : 'address' } ] ,
5859 name : 'balanceOf' ,
@@ -68,10 +69,15 @@ export const updateSecondaryTokens = async (
6869 type : 'function'
6970 }
7071 ]
71- const updatedBalances = await Promise . all (
72+
73+ const tokenBalances = await Promise . all (
7274 chain . secondaryTokens . map ( async token => {
7375 try {
74- const swapContract = new ethers . Contract ( token . address , abi , signer )
76+ const swapContract = new ethers . Contract (
77+ token . address ,
78+ erc20ABISubset ,
79+ signer
80+ )
7581 const bigNumBalance = await swapContract . balanceOf ( account )
7682 const tokenName = await swapContract . symbol ( )
7783 return {
@@ -87,7 +93,7 @@ export const updateSecondaryTokens = async (
8793 }
8894 } )
8995 )
90- return updatedBalances
96+ return tokenBalances
9197}
9298
9399export default updateBalances
You can’t perform that action at this time.
0 commit comments