I am developing a decentralised notary app, using truffle/web3/react. It need to deploy multiple instances of a same contract.
I managed to deploy multiple instances of a contract, MyContract via a registry, MyContractRegistry.
const contractRegistry = contract(MyContractRegistry);
contractRegistry.setProvider(web3.currentProvider);
contractRegistry.deployed().then(function(instance) {
registryInstance = instance;
myArray.map(function(){
return registryInstance
.createCertificate(
params
{ from: issuer }
)
});
});
The above code works, but if the myArray have 10 elements, then Metamask will popup 10 confirmation dialogs. Yes it should and as expected.
So, my question is what is the better approach to the problem above.