vendredi 27 septembre 2019

Having import name as an argument, how to reference the import?

Having import name as an argument, how to reference the import?

Example:

import PolicyRegistry from './PolicyRegistry.json'

import web3 from './web3'

export const contractInstance = (name, address) =>
  new web3.eth.Contract(name.abi, address)

And I want to call like: module.contractInstance(PolicyRegistry, "address")





Aucun commentaire:

Enregistrer un commentaire