These are chat archives for Nethereum/Nethereum

18th
Sep 2016
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 07:03
Hello guys. Did someone had troubles with calling contract function, which accepts array of items?
Juan Blanco
@juanfranblanco
Sep 18 2016 07:26
No, post a sample
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 07:57
I can't send transaction with params
while creating contract
Juan Blanco
@juanfranblanco
Sep 18 2016 07:58
Hmmm enough gas ?
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 07:59
Y. I can create it from online compiler
I can't send array of addresses to my constructor
1 min, i will try one more thing
Juan Blanco
@juanfranblanco
Sep 18 2016 07:59
Ok
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:01
var transactionHash = web3.Eth.DeployContract.SendRequestAsync(byteCode,sender,new HexBigInteger(300000), HERE must be array of addresses ).Result;
with abi i can't deploy, AbiDecompiler says that it should be array type
here is contract constructor:
function Deal(address[] participants) {
Juan Blanco
@juanfranblanco
Sep 18 2016 08:07
You need the abi and a string array?
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:16
var transactionHash = web3.Eth.DeployContract.SendRequestAsync(abi, byteCode,sender, new string[] { sender }).Result;
doesn't work
Juan Blanco
@juanfranblanco
Sep 18 2016 08:18
Any error? Gas?
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:18
Array value expected for type
"System.Exception" in Nethereum.ABI.dll
Juan Blanco
@juanfranblanco
Sep 18 2016 08:19
Ok so what's the abi constructor
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:20
{""inputs"":[{""name"":""participants"",""type"":""address[]""}],""type"":""constructor""}
it's from abi
Juan Blanco
@juanfranblanco
Sep 18 2016 08:23
Ok top of my head
The constructor is using params
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:24
yep
Juan Blanco
@juanfranblanco
Sep 18 2016 08:25
Passing the array as such here it things each object is a string
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:25
i tried passing it as "["+sender+"]"
wait.
passed it as new [] { new[] { sender } }
Juan Blanco
@juanfranblanco
Sep 18 2016 08:27
Ok
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:28
now ethereum itself doesn't work
TypeError: Cannot read property 'length' of undefined
Juan Blanco
@juanfranblanco
Sep 18 2016 08:30
So now it is recognised as an array
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:30
mapping (address => bool) public _participants;
function Deal(address[] participants) {
    for(uint i=0; i<participants.length; i++) {
        _participants[participants[i]] = true;
    }
}
here is what in contract
i'm trying to call using webcompiler _participants[sender]
and it returns can't read property length of undefined. And it's extremely strange
Juan Blanco
@juanfranblanco
Sep 18 2016 08:32
Yes but that is a .net error
Correct?
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:33
no. this is what i'm getting while trying to access via online web3
each object returns this error
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:38
so, notation new []{ new []{sender}} completely brokes the contract
Juan Blanco
@juanfranblanco
Sep 18 2016 08:38
So I assume you have a mapping participants that is public
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:39
yep
it's above the formatted code
mapping (address => bool) public _participants;
Juan Blanco
@juanfranblanco
Sep 18 2016 08:39
And want to look up if a participant is there
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:39
i just need to save them
in mapping
Juan Blanco
@juanfranblanco
Sep 18 2016 08:41
What about declaring your object before passing it as a parameter
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:41
you mean declare participants in contract?
address[] participants;
mapping (address => bool) public _participants;
smth like this?
Juan Blanco
@juanfranblanco
Sep 18 2016 08:43
No I mean on .net
When passing to the constructor
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:43
ok. i'll try
Juan Blanco
@juanfranblanco
Sep 18 2016 08:44
Is your contract deployed
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:44
yep
but it seems that it's crashed
Juan Blanco
@juanfranblanco
Sep 18 2016 08:45
No errors
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:45
no errors in nethereum. But web3 in online compiler says typeerror
Juan Blanco
@juanfranblanco
Sep 18 2016 08:45
Can you get the contract byte code using
GetCode?
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 08:46
wait. I'm passing only abi and bytecode
Juan Blanco
@juanfranblanco
Sep 18 2016 08:59
Ok I don't have a PC near me to test it
Juan Blanco
@juanfranblanco
Sep 18 2016 12:22
@VladimirMilenko did you get sorted?
Vladimir Milenko
@VladimirMilenko
Sep 18 2016 13:26
I've used web3.js with node for demo purposes
i'm at hackathon:)
Juan Blanco
@juanfranblanco
Sep 18 2016 15:37
Ok :smile: