classic-ui/utils/instanceUtils.js

17 lines
421 B
JavaScript
Raw Permalink Normal View History

2022-04-22 06:05:56 +03: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
}
}
}
}
}