0
setCountries (e){

    Object.keys(countries).forEach((key) => {
        const country = countries[key];
        const attDef = Math.round(countryProps.POP_EST / 1000);
        const price = countryProps.POP_EST;

        this.contract.methods.createCountry(country.name, attDef, attDef, this.account).send(this.contractObject, (err, res) => {
            if (err) {
                throw err;
            } else {
                console.log(res)
            }
        });
    });
}

When I log a country like the following:

getCountryPrice = (id) => {
    this.contract.methods.getCountryPrice(id).call(this.contractObject, (err, res) => {
        if (err) {
            throw err;
        } else {
            console.log(res);
        }
    });
}

I know it's not the smart contract that is the problem since i tested it thoroughly in Remix and with seperate country pushes. I use web3 and Metamask.

If this is the countries object :

    {
"AL":{"name":"AL","id":0,"worldId":4},
"AX":{"name":"AX","id":1,"worldId":5},
"AD":{"name":"AD","id":2,"worldId":6}
}

all values in solidity seemed to be set to AD

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.