buy/sell color change fix
This commit is contained in:
@@ -61,21 +61,28 @@ export async function addExtraToken(chainId, addr) {
|
||||
}
|
||||
else {
|
||||
if( provider===null ) {
|
||||
console.log('warning: token lookup cancelled due to null provider', addr)
|
||||
console.warn('warning: token lookup cancelled due to null provider', addr)
|
||||
resolve(null)
|
||||
}
|
||||
else {
|
||||
const token = await newContract(addr, 'IERC20Metadata', provider)
|
||||
Promise.all( [token.name(), token.symbol(), token.decimals()] ).then((name,symbol,decimals)=>{
|
||||
info = {
|
||||
a: addr,
|
||||
n: name,
|
||||
s: symbol,
|
||||
d: decimals,
|
||||
for( let tries=1; tries<=5; tries++ ) {
|
||||
try {
|
||||
const token = await newContract(addr, 'IERC20Metadata', provider)
|
||||
const [name, symbol, decimals] = await Promise.all([token.name(), token.symbol(), token.decimals()])
|
||||
info = {
|
||||
a: addr,
|
||||
n: name,
|
||||
s: symbol,
|
||||
d: decimals,
|
||||
}
|
||||
s.addToken(chainId, info)
|
||||
resolve(info)
|
||||
break
|
||||
}
|
||||
s.addToken(chainId, info)
|
||||
resolve(info)
|
||||
})
|
||||
catch (e) {
|
||||
console.warn(`Could not lookup token ${addr}`, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user