classic-ui/utils/instanceUtils.js

17 lines
421 B
JavaScript
Raw Normal View History

2022-04-21 23:05:56 -04:00
import networkConfig from '@/networkConfig'
export function getInstanceByAddress({ netId, address }) {
const { tokens } = networkConfig[`netId${netId}`]
for (const [currency, { instanceAddress }] of Object.entries(tokens)) {
for (const [amount, instance] of Object.entries(instanceAddress)) {
if (instance === address) {
return {
amount,
currency
}
}
}
}
}