zkSync-Community-Hub / zksync-developers

Project for Discussions with the ZKsync Community.
366 stars 236 forks source link

[General] Passing an array in zksync-cli #656

Open bxpana opened 3 weeks ago

bxpana commented 3 weeks ago

Tracking in https://github.com/matter-labs/zksync-cli/issues/164

Discussed in https://github.com/zkSync-Community-Hub/zksync-developers/discussions/646

Originally posted by **1am** August 10, 2024 ### Environment Mainnet ### Provide a brief description of the functionality you're trying to implement and the issue you are running into. Hello I'm trying to test one contract which requires an address[] as input but it doesn't seem possible with zksync-cli, am I getting it right? Whatever I try to input it never gets interpreted as array and API encodes it as a s string in [this line](https://github.com/matter-labs/zksync-cli/blob/main/src/commands/contract/read.ts#L126) My flow looks like below (addresses trimmed for readability, though nothing secret here) ```sh $ zksync-cli contract read ? Chain to use zkSync Mainnet ? Contract address 0x8....4 ? Contract method to call getPairInfo(address[] path, bool stable) view returns (address tokenA, address tokenB, address pair, uint256 reserveA, uint256 reserveB, uint256 fee) ? Provide method arguments: ? [1/2] path (address[]) [0x5...E,0x0...A] >> Failed to encode provided argument: expected array value (argument="path", value="[0x5...E,0x0...A]", code=INVALID_ARGUMENT, version=abi/5.7.0) ``` Is there some other way to interact with such contracts, other than writing a script? I find the CLI super useful but got stopped by this situation ;) ### Repo Link (Optional) _No response_ ### Additional Details _No response_
itsacoyote commented 3 weeks ago

This has been fixed with https://github.com/matter-labs/zksync-cli/pull/166