OpenZeppelin / openzeppelin-sdk

OpenZeppelin SDK repository for CLI and upgrades.js. No longer actively developed.
MIT License
431 stars 200 forks source link

`oz send-tx` with parameter arguments separated by spaces errors with: A network name must be provided to execute the requested action. #1542

Closed abcoathup closed 4 years ago

abcoathup commented 4 years ago

oz send-tx with parameter arguments separated by spaces errors with: A network name must be provided to execute the requested action.

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

Reported in Telegram (with a post in the forum): https://forum.openzeppelin.com/t/oz-send-tx-to-a-function-with-array-arguments-errors-with-a-network-name-must-be-provided-to-execute-the-requested-action/2916

It can be reproduced as follows:

A.sol

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

contract A {
    function doStuff(uint256 a, uint256 b) public {}
}

Deploy

$ code .
✓ Compiled contracts with solc 0.6.8 (commit.0bbfe453)
? Choose the kind of deployment regular
? Pick a network development
? Pick a contract to deploy A
✓ Deployed instance of A
0x9b1f7F645351AF3631a656421eD2e40f2802E6c0

send-tx

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

The community member wasn't able to find the correct syntax in the --help or the documentation.

The correct syntax is to separate parameters with commas.

$ npx oz send-tx --network development --from 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 --to 0x9b1f7F645351AF3631a656421eD2e40f2802E6c0 --method doStuff --args 1,2
✓ Transaction successful. Transaction hash: 0x847ad217d23eb263869dd48a1fbb1f1b62ff843997431f194916ff3361d1f705
frangio commented 4 years ago

Duplicate of https://github.com/OpenZeppelin/openzeppelin-sdk/issues/783.