`oz send-tx` to a function with array arguments errors with "A network name must be provided to execute the requested action"

@shark0der reported on Telegram:

Sending a transaction to a function with array arguments (uint amount, address[] contractAddresses, uint[] allocations) errors with “A network name must be provided to execute the requested action”

Hi @shark0der,

I can reproduce when separating the arguments with spaces:

$ npx oz send-tx --network development --from 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 --to 0xe982E462b094850F12AF94d21D470e21bE9D0E9C --method doStuff --args 1 [0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1
,0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1] [1,2,3]
A network name must be provided to execute the requested action.

Sample.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;


contract Sample {

    uint256 public amount;
    address[] public contractAddresses;
    uint256[] public allocations;

    function doStuff(
        uint256 setAmount,
        address[] memory setContractAddresses,
        uint256[] memory setAllocations
    ) public {
        amount = setAmount;
        contractAddresses = setContractAddresses;
        allocations = setAllocations;
    }
}

Arguments should be separated by commas and the transaction will be successful:

$ npx oz send-tx --network development --from 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 --to 0xe982E462b094850F12AF94d21D470e21bE9D0E9C --method doStuff --args 1,[0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1,0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1],[1,2,3]
✓ Transaction successful. Transaction hash: 0xf138402d83c7fb90a2cccf557a29b30e4361961e7a177ca6d449aaa67beedf7b

Hi @shark0der,

I created an issue for this: https://github.com/OpenZeppelin/openzeppelin-sdk/issues/1542

1 Like