GithubHelp home page GithubHelp logo

Comments (8)

ferranbt avatar ferranbt commented on August 22, 2024

Hello.

Does multipleTransfer(tuple(address,tuple(uint256,address)[])) works?

from ethgo.

darioAnongba avatar darioAnongba commented on August 22, 2024

No it sadly does not. This feature is not necessarily needed as I see it too complex and the best way to create a new Method should be through the usage of the complete ABI of that method and not only the method signature.

But if it is possible to create a Method struct with only the method signature deterministically, that would be really powerful and useful (for example, you won't need the ABI to be able to communicate with a contract but only the method signature would be enough)

from ethgo.

ferranbt avatar ferranbt commented on August 22, 2024

I understand, something like this is available https://github.com/umbracle/go-web3/blob/master/abi/abi_test.go#L53 but it will not work if the input is a struct (I think). In ethers.js it does work with tuples. I can work to fix this over the weekend since I have to do a couple more changes on abi .json decoding.

from ethgo.

darioAnongba avatar darioAnongba commented on August 22, 2024

Thanks! Just be aware that this multipleTransfer(tuple(address,tuple(uint256,address)[])) is not a valid method signature. The tuple keyword should not be part of the signature. If you encounter a parenthesis "inside" of the method signature (first parenthesis), I think you can assume it's a tuple.

from ethgo.

ferranbt avatar ferranbt commented on August 22, 2024

Ok, but I do not think there any difference with what ethers.js decodes here right? I will just try to implement those test cases.

from ethgo.

ferranbt avatar ferranbt commented on August 22, 2024

I have a fix in #134. It turns out it was already supported but the regexp expression to get the function parameters was not correct to counter for extra '('. I will merge this after your #131.

from ethgo.

ferranbt avatar ferranbt commented on August 22, 2024

Please test the branch #134 with the changes, note that you need to use function multipleTransfer(tuple(address,tuple(uint256,address)[])) with the function prefix and tuple().

from ethgo.

darioAnongba avatar darioAnongba commented on August 22, 2024

Sadly that is not useful for our use case because using tuple in the method signature is not valid. One of the use case of this method is to be able to pass a method signature and get a Method back so arguments can be encoded without needing the whole ABI.

You should be able to do something like:

abi := web3.NewABI(myABI)
method := web3.ParseMethodSignature(abi.Methods[0].Sig())
txData := web3.Encode(method.Inputs, args)

where abi.Methods[0].Sig() is the method signature multipleTransfer((address,(uint256,address)[]))

Would that work ?

from ethgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.