-
Notifications
You must be signed in to change notification settings - Fork 82
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
Incorrect Return Type #55
Comments
In the Stack Exchange example the function is giving the error because is not a Not sure about it but Solidity 0.6.9 but must have a way to mark Could you attach the generated ABI files? |
ABI: Abi.txt Take a look at ERC20BalanceOf() which has a view attribute on the function. |
Excellent, thank you!
… On Aug 19, 2020, at 5:35 AM, Joaquin Alfaro ***@***.***> wrote:
From solidity 0.6 the property constant included in the ABI has been replaced by the value of stateMutability <ethereum/solidity#8065>
The version 4.5.11 of web3j-maven-plugin uses the value of constant to determine if a function is a view
You can wait to the version 4.5.18 of web3j-maven-plugin which probably will solve the problem or make a fork of web3j-maven-plugin and update the version of web3j in pom.xml to 4.5.18
Replace
<web3j.version>4.5.11</web3j.version>
With
<web3j.version>4.5.18</web3j.version>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#55 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB77WVYGJ2AQUQVPD6ZNHULSBPBKVANCNFSM4OCEE5XA>.
|
When do you guys plan to release 4.5.18? |
Hi, we just released v4.6.4, can I close this issue? |
Absolutely, thank you!
Also, do you know how to generate an Ethereum address from a xpub (extended public key) using Web3j?
Cheers!
Chris
… On Oct 6, 2020, at 10:40 AM, Xavi Arias Seguí ***@***.***> wrote:
Hi, we just released v4.6.4, can I close this issue?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#55 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB77WV4BKFEEVEZQBY6NUGTSJNJA5ANCNFSM4OCEE5XA>.
|
final String address = org.web3j.crypto.Keys.getAddress("<public key>") |
Excellent, thank you!
I believe xpub (extended public keys) are Base58 encoded, does org.web3j.crypto.Keys.getAddress("<public key>”) take this into account? I tried the following xpub and it did generate an Ehtereum address, but wanted to make sure of the encoding:
xpub68vRSzZR9TYbhy2EMt8GTem3JPdpd8pLkKWxutr9v3DHV9upZGYH9kWpquYgPyDghzcuRYKKSAC638WdEeq8gmK431NFYbQumxMx4GvhqnB
Cheers!
Chris
… On Oct 6, 2020, at 10:57 AM, Xavi Arias Seguí ***@***.***> wrote:
final String address = org.web3j.crypto.Keys.getAddress("<public key>")
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#55 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB77WV3LYFBOJ67MS3JDTLLSJNK7TANCNFSM4OCEE5XA>.
|
I guess my question is that does Keys.getAddress() support BIP32 or other standards?
… On Oct 7, 2020, at 8:23 AM, Christopher McGregor ***@***.***> wrote:
Excellent, thank you!
I believe xpub (extended public keys) are Base58 encoded, does org.web3j.crypto.Keys.getAddress("<public key>”) take this into account? I tried the following xpub and it did generate an Ehtereum address, but wanted to make sure of the encoding:
xpub68vRSzZR9TYbhy2EMt8GTem3JPdpd8pLkKWxutr9v3DHV9upZGYH9kWpquYgPyDghzcuRYKKSAC638WdEeq8gmK431NFYbQumxMx4GvhqnB
Cheers!
Chris
> On Oct 6, 2020, at 10:57 AM, Xavi Arias Seguí ***@***.*** ***@***.***>> wrote:
>
>
> final String address = org.web3j.crypto.Keys.getAddress("<public key>")
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub <#55 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB77WV3LYFBOJ67MS3JDTLLSJNK7TANCNFSM4OCEE5XA>.
>
|
Not sure about that, have you tried it? @josh-richardson may have a better answer. |
Thank you for the response!
I figured out that the xpub I sent you is a BIP32 extended public key which has a compressed 33 byte key. I noticed that Web3j generates uncompressed public keys 64 bytes. Is there a utility in Web3j to compress/uncompress public keys?
… On Oct 8, 2020, at 2:43 AM, Xavi Arias Seguí ***@***.***> wrote:
I guess my question is that does Keys.getAddress() support BIP32 or other standards?
Not sure about that, have you tried it? @josh-richardson <https://github.com/josh-richardson> may have a better answer.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#55 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB77WV3Y6WHVWJZ3Z2MPTVLSJWCVBANCNFSM4OCEE5XA>.
|
I am using Solc v0.6.9 and we I generate the Java code I am getting the incorrect return type for a few of my ERC20 smart contract functions (e.g., balanceOf).
ERC20 balanceOf function (Solidity code):
function balanceOf(address who) external view returns (uint256);
Java generated method (returns TransactionReceipt):
public RemoteFunctionCall<TransactionReceipt> ERC20BalanceOf(String _erc20Address, String _who) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_ERC20BALANCEOF, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _erc20Address), new org.web3j.abi.datatypes.Address(160, _who)), Collections.<TypeReference<?>>emptyList()); return executeRemoteCallTransaction(function); }
Expected Java generated function (returns BigInteger):
public RemoteFunctionCall<BigInteger> ERC20BalanceOf(String _erc20Address, String _who) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_ERC20BALANCEOF, Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _erc20Address), new org.web3j.abi.datatypes.Address(160, _who)), Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {})); return executeRemoteCallSingleValueReturn(function, BigInteger.class); }
https://ethereum.stackexchange.com/questions/40730/why-is-web3j-java-not-generating-correct-return-types-for-my-contract
The text was updated successfully, but these errors were encountered: