These are chat archives for Nethereum/Nethereum

20th
Mar 2017
Matt Crooks
@mattcrooks
Mar 20 2017 12:29

hi,

I'm trying to use an Array as an input parameter in a function. Below is a simple contract that outlines the sort of thing I'm trying to do.

I've tested it with a simple javascript function (web3) to deploy and call SetFriends (sendTransaction) and it seems to work.

Is it possible to use an array as a parameter in Nethereum?

contract ContactBook
{
    address _owner;

    function ContactBook()
    {
        _owner = msg.sender;
    }

    address[] public Contacts;

    function SetFriends(address[] contacts)
    {
        Contacts = contacts;
    }
}

The abi produced

[
    {
        "constant": false,
        "inputs": [
            {
                "name": "contacts",
                "type": "address[]"
            }
        ],
        "name": "SetFriends",
        "outputs": [],
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "name": "Contacts",
        "outputs": [
            {
                "name": "",
                "type": "address"
            }
        ],
        "type": "function"
    },
    {
        "inputs": [],
        "type": "constructor"
    }
]
Juan Blanco
@juanfranblanco
Mar 20 2017 13:20
Yes it is supported
addresses are strings
@mattcrooks
^^
undertuga
@undertuga
Mar 20 2017 14:23
@juanfranblanco Juan, can you please provide me your email!? I'm sending a email to the ethereum foundation team, regarding private ethereum chain implementation issues, and i would like you on CC, since i've been using your lib to interact with ethereum! Is it ok!?
Juan Blanco
@juanfranblanco
Mar 20 2017 15:44
@undertuga pm you
undertuga
@undertuga
Mar 20 2017 16:55
@juanfranblanco Thanks ;)