let batch = new this.web3.BatchRequest();
const arr = [
{name: "test1", att: 100, def: 100},
{name: "test2", att: 100, def: 100},
{name: "test3", att: 100, def: 100},
{name: "test4", att: 100, def: 100},
]
arr.forEach((d) => {
batch.add(this.contract.methods.createCountry(d.name, d.att, d.def, 10, this.account).send.request(this.contractObject, (err, res) => {
if (err) {
throw err;
} else {
console.log(res);
}
}));
});
console.log(batch);
batch.execute();
All values in the contract are set to "test4"
I know it's not the smart contract that is the problem since I tested it thoroughly in Remix and with separate country pushes. I use web3 and Metamask.