web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

handling tuples (structs)

Open simon-jentzsch opened this issue 8 years ago • 76 comments

in solidity verion 0.4.19 tuples are supported, which allow structs as input-params. The current encoder in web3-eth-abi does not support them yet. a definition of them can be found here: http://solidity.readthedocs.io/en/develop/abi-spec.html?highlight=tuple#handling-tuple-types

example:

[
  {
    "name": "f",
    "type": "function",
    "inputs": [
      {
        "name": "s",
        "type": "tuple",
        "components": [
          {
            "name": "a",
            "type": "uint256"
          },
          {
            "name": "b",
            "type": "uint256[]"
          },
          {
            "name": "c",
            "type": "tuple[]",
            "components": [
              {
                "name": "x",
                "type": "uint256"
              },
              {
                "name": "y",
                "type": "uint256"
              }
            ]
          }
        ]
      },
      {
        "name": "t",
        "type": "tuple",
        "components": [
          {
            "name": "x",
            "type": "uint256"
          },
          {
            "name": "y",
            "type": "uint256"
          }
        ]
      },
      {
        "name": "a",
        "type": "uint256"
      }
    ],
    "outputs": []
  }
]

simon-jentzsch avatar Dec 20 '17 14:12 simon-jentzsch

We should definitely support that. I started looking into this. Any help would be welcome.

frozeman avatar Dec 22 '17 07:12 frozeman

Any updates on this? Thanks.

riordant avatar Jan 08 '18 13:01 riordant

Will it be available for solidity view function too ?

Remi-Burgel avatar Jan 11 '18 12:01 Remi-Burgel

This will be a great feature, it will let me focus more of the filtering on the frontend instead of within the contract. Also should reduce the number of calls to the contract. Any idea when a feature like this might be ready?

OlyRice avatar Jan 16 '18 18:01 OlyRice

Any updates?

pizzarob avatar Jan 19 '18 05:01 pizzarob

+1

pnicorelli avatar Jan 26 '18 15:01 pnicorelli

@OlyRice ethers.js have this working now https://github.com/ethers-io/ethers.js/issues/84

riordant avatar Jan 27 '18 11:01 riordant

+1

gassogba avatar Feb 02 '18 14:02 gassogba

+1

peetzweg avatar Feb 03 '18 18:02 peetzweg

++;

03.02.2018 7:10 PM "Phil" [email protected] napisał(a):

+1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ethereum/web3.js/issues/1241#issuecomment-362841404, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiASdWz1fh5hJEBQ5RT0ImwOh_ted5Mks5tRKERgaJpZM4RIdkx .

TomaszWaszczyk avatar Feb 03 '18 19:02 TomaszWaszczyk

+= 1;

ghost avatar Feb 14 '18 20:02 ghost

+1

saniales avatar Feb 15 '18 11:02 saniales

I've encountered this issue now using Truffle. I looked at the link with the definition, but I don't understand it. Could ethers.js and web3 share the same code?

ghost avatar Feb 18 '18 10:02 ghost

+1

vascomedici avatar Feb 21 '18 20:02 vascomedici

+1

p6m459 avatar Feb 21 '18 22:02 p6m459

Im on this in the #newAbiLib branch, but wont be able to finish the next two weeks, as im on holidays.

frozeman avatar Mar 24 '18 10:03 frozeman

Just ran into the same thing, wanting to pass a struct as a constructor argument with contract.new(constructorArg, {data:...});

svendeckers avatar Mar 28 '18 14:03 svendeckers

I've joined to waiting

NoChance777 avatar Mar 30 '18 08:03 NoChance777

+1

victorrseloy avatar Apr 03 '18 10:04 victorrseloy

@frozeman any news on this?

antono avatar Apr 16 '18 17:04 antono