Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two-dimensional array problem??? #110

Open
EthanOK opened this issue Jun 6, 2023 · 0 comments
Open

Two-dimensional array problem??? #110

EthanOK opened this issue Jun 6, 2023 · 0 comments

Comments

@EthanOK
Copy link

EthanOK commented Jun 6, 2023

Issue_title

use mvn web3j:generate-sources get java code, Two-dimensional array problem???

Issue_description

1D and 2D arrays generate the same code parameters, which I think might be incorrect?

    function setOrders(Order[] calldata) external {}
    function setOrderss(Order[][] calldata) external {}

Issue_context

solidity code

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

contract TestArray {
    struct Order {
        address from;
        address to;
    }

    function setOrder(Order calldata) external {}

    function setOrders(Order[] calldata) external {}

    function setOrderss(Order[][] calldata) external {}

    // function get(uint256[][] calldata) external {}
}

use mvn web3j:generate-sources get java code

    public RemoteFunctionCall<TransactionReceipt> setOrder(Order param0) {
        final Function function = new Function(
                FUNC_SETORDER, 
                Arrays.<Type>asList(param0), 
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteFunctionCall<TransactionReceipt> setOrders(List<Order> param0) {
        final Function function = new Function(
                FUNC_SETORDERS, 
                Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<Order>(Order.class, param0)), 
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

    public RemoteFunctionCall<TransactionReceipt> setOrderss(List<Order> param0) {
        final Function function = new Function(
                FUNC_SETORDERSS, 
                Arrays.<Type>asList(new org.web3j.abi.datatypes.DynamicArray<Order>(Order.class, param0)), 
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

my system cofig:

windows 10, solidity 0.8.17, web3j 4.10.0

    public RemoteFunctionCall<TransactionReceipt> setOrderss(List<List<Order>> param0) {
      // code
    }

How should I write this code???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant