Giter Site home page Giter Site logo

Comments (7)

simolus3 avatar simolus3 commented on July 29, 2024

Hey, thanks for pointing this out. I think that quote only refers to the Solidity language itself and not to the encoding per se, but I'll try to grab some test encodings from other Ethereum clients to see if they encode strings differently. That should help to find the exact problem.

from web3dart.

simolus3 avatar simolus3 commented on July 29, 2024

I just checked whether the test cases of web3j, notably https://github.com/web3j/web3j/blob/master/abi/src/test/java/org/web3j/abi/TypeEncoderTest.java and https://github.com/web3j/web3j/blob/master/abi/src/test/java/org/web3j/abi/TypeEncoderTest.java for strings and static / dynamic length bytes also work for this library and they produce the expected output...
Can you help me with this by giving an example of a contract definition that returns a string that can't be decoded by this library? That would really be helpful!

from web3dart.

DrasiusMajere avatar DrasiusMajere commented on July 29, 2024

Ropsten, chainid: 3

Address: 0xD73845bba002a3f2a5c2DF835fD67d282afbf4E8

ABI: [ { "constant": true, "inputs": [ { "name": "fileHash", "type": "string" } ], "name": "getOwner", "outputs": [ { "name": "", "type": "string", "value": "" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x4aaf4a12" }, { "constant": true, "inputs": [ { "name": "fileHash", "type": "string" } ], "name": "get", "outputs": [ { "name": "", "type": "uint256", "value": "1542556069" }, { "name": "", "type": "string", "value": "pepito" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x693ec85e" }, { "constant": true, "inputs": [ { "name": "fileHash", "type": "string" } ], "name": "getTime", "outputs": [ { "name": "", "type": "uint256", "value": "0" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xb359cedd" }, { "constant": false, "inputs": [ { "name": "owner", "type": "string" }, { "name": "fileHash", "type": "string" } ], "name": "set", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xe942b516" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "status", "type": "bool" }, { "indexed": false, "name": "timestamp", "type": "uint256" }, { "indexed": false, "name": "owner", "type": "string" }, { "indexed": false, "name": "fileHash", "type": "string" } ], "name": "logFileAddedStatus", "type": "event", "signature": "0x0d3bbc3c02da6ed436712ca1a0f626f1269df703a105f034e4637c7b10fb7ba5" } ]

Source Code: https://gist.github.com/DrasiusMajere/ad37aabcad54f96a45be8faf7c694be8

P.D: soljs, remix, etherscan are not able to create the bytecode yet. I've used solc to compile it.

from web3dart.

DrasiusMajere avatar DrasiusMajere commented on July 29, 2024

Silly question why prepareForPaymentCall, prepareForCall functions need DeployedContract instance if transaction object already has credentials and send and call methods has to pass them web3client. Is it not sufficient with EthereumAddress?
I have too many things to learn, it's huge this cryptoworld

from web3dart.

simolus3 avatar simolus3 commented on July 29, 2024

Thanks for the contract. Can you give me some sample method invocation that fails in web3dart? Any fileHash I can put into getOwner should return a string that breaks in web3dart, right?

Silly question why prepareForPaymentCall, prepareForCall functions need DeployedContract instance if transaction object already has credentials and send and call methods has to pass them web3client. Is it not sufficient with EthereumAddress?

Not a silly question at all! You're right, the EthereumAddress would suffice. My idea was that users should only have to specify that whole thing once. Also, I planned that this library might do some code-generation based on contract ABIs to convert them into dart classes. Then, we could just have something like MyContract(credentials, client, address).getOwner(fileHash) and call all other functions on MyContract without having to specify everything for each function call.
However, I didn't have the time to implement this yet so right now everything is pretty low-level and this is indeed irrelevant information passed to the contract object.

I have too many things to learn, it's huge this cryptoworld

Yeah, I feel like that as well sometimes, I also don't have any experience with cryptocurrencies except for this library. Put poking around with some code helps. In fact, I mainly started this library to learn about some low-level basics about Ethereum transactions 😃

from web3dart.

DrasiusMajere avatar DrasiusMajere commented on July 29, 2024

Sorry I forgot that ,Hash: "123456789" for instance....if you use ethereum wallet is easy to watch any contract and use its functions....
Use the get method instead of getOwner or getTime beuause these ones were just created to know which return value was provoking the failure(error).
If you call to getOwner it's just receive an empty string.

from web3dart.

simolus3 avatar simolus3 commented on July 29, 2024

This should now be fixed in version 0.4.5 on pub, sorry for taking this long. I didn't catch it earlier because all the types are decoding properly, it's just the function decoder that messes things up. Many thanks to @xiaoch05 for pointing out the error. Let me know if it still doesn't work.

from web3dart.

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.