We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
调用 invokeEVMContract 时候,argss 需要传递 evmaddress ,没找到对应的 XchainToEVMAddress 方法
The text was updated successfully, but these errors were encountered:
Java sdk 目前还没有地址转换功能,可以使用go sdk 或 xchain-cli 进行转换,java sdk 的地址转换在不久后会上线
Sorry, something went wrong.
目前解决方法,从sdk分支中找到(搬砖)
/** * AKAddress 转 EVMAddress * * @return * @throws Exception */ public static String getAkToEVMAddress(String akAddress) { if (akAddress == null) { throw new RuntimeException("getAKAddress() is null"); } byte[] rawAddr = new byte[0]; try { rawAddr = Base58.decode(akAddress); } catch (Exception e) { throw new RuntimeException("getAKAddress() Base58 Error"); } if (rawAddr.length < 21) { throw new RuntimeException("bad address"); } byte[] ripemd160Hash = Arrays.copyOfRange(rawAddr, 1, 21); StringBuilder result = new StringBuilder(); for (int index = 0, len = ripemd160Hash.length; index <= len - 1; index += 1) { String invalue1 = Integer.toHexString((ripemd160Hash[index] >> 4) & 0xF); String intValue2 = Integer.toHexString(ripemd160Hash[index] & 0xF); result.append(invalue1); result.append(intValue2); } return result.toString().toUpperCase(Locale.ROOT); } /** * 使用方法 */ public static void main(String[] args) { Account account = Account.create(1,2); // getAkToEVMAddress(account.getAddress()); getAkToEVMAddress(account.getAKAddress()); }
No branches or pull requests
调用 invokeEVMContract 时候,argss 需要传递 evmaddress ,没找到对应的 XchainToEVMAddress 方法
The text was updated successfully, but these errors were encountered: