instanceUtils.js 421 B

1234567891011121314151617
  1. import networkConfig from '@/networkConfig'
  2. export function getInstanceByAddress({ netId, address }) {
  3. const { tokens } = networkConfig[`netId${netId}`]
  4. for (const [currency, { instanceAddress }] of Object.entries(tokens)) {
  5. for (const [amount, instance] of Object.entries(instanceAddress)) {
  6. if (instance === address) {
  7. return {
  8. amount,
  9. currency
  10. }
  11. }
  12. }
  13. }
  14. }