These are chat archives for Nethereum/Nethereum

15th
Apr 2017
mfamfa
@mfamfa
Apr 15 2017 04:55
thanks, @juanfranblanco I used the code generator - however the same method generates an exception. The parameter passed is an address - string - which is 40 characters long..
My call: var result = await tokenFactoryService.GetTokenTypesForAccountAsyncCall(account1);
The generated code and output:
        public Task<string[]> GetTokenTypesForAccountAsyncCall(string adr) {
            var function = GetFunctionGetTokenTypesForAccount();
            return function.CallAsync<string[]>(adr);
        }

Error Message:
 Nethereum.JsonRpc.Client.RpcResponseException : AssertionError: The field to must have byte length of 20
    at FakeTransaction.setter [as to] (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/node_modules/ethereumjs-util/index.js:609:9)
    at /usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/node_modules/ethereumjs-util/index.js:659:63
    at Array.forEach (native)
    at Object.exports.defineProperties (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/node_modules/ethereumjs-util/index.js:658:14)
    at FakeTransaction.Transaction (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/node_modules/ethereumjs-tx/index.js:93:13)
    at FakeTransaction (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/node_modules/ethereumjs-tx/fake.js:36:5)
    at VmSubprovider.runVm (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/subproviders/vm.js:96:12)
    at VmSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/subproviders/vm.js:45:8)
    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/node_modules/web3-provider-engine/index.js:95:18)
    at /usr/local/lib/node_modules/ethereumjs-testrpc/lib/subproviders/gethdefaults.js:31:7
mfamfa
@mfamfa
Apr 15 2017 06:36
(btw: I do get your point about using an index to iterator over the arrays)
Juan Blanco
@juanfranblanco
Apr 15 2017 07:13
Ah that is interesting, what contract address are you using ?
@bitcoinbrisbane well based on your code yes
Juan Blanco
@juanfranblanco
Apr 15 2017 07:20
@mfamfa just to clarify the test RPC error seems to refer to the To field of the call / transaction.
Which is the contract address
@bitcoinbrisbane if you post a gist might be able to help
mfamfa
@mfamfa
Apr 15 2017 08:50
@juanfranblanco ah yes, I wasn't passing in the correct contract adr. With that fixed I am back to: System.MissingMethodException : No parameterless constructor defined for this object. - shouldn't the generated code be: return function.CallAsync<List<string>>(adr);? - If I change it to that everything works! Thanks for your help.
Juan Blanco
@juanfranblanco
Apr 15 2017 12:19
yes it should, ill change thanks
do what i say not what i generate.. doh