walleth / walleth

free (libre) native Android Ethereum wallet
https://walleth.org
GNU General Public License v3.0
608 stars 178 forks source link

"No value for gasLimit" in WalletConnect flow #327

Open ligi opened 5 years ago

ligi commented 5 years ago

reported by @mqklin

java.lang.Error: org.json.JSONException: No value for gasLimit
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1119)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)
Caused by: org.json.JSONException: No value for gasLimit
at org.json.JSONObject.get(JSONObject.java:389)
at org.json.JSONObject.getString(JSONObject.java:550)
at org.walleth.walletconnect.WalletConnectFunKt.createIntentForTransaction(WalletConnectFun.kt:36)
at org.walleth.fcm.WallethFirebaseMessageService.onMessageReceived(WallethFirebaseMessageService.kt:37)
at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source)
at com.google.firebase.iid.zzc.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
... 3 more
mqklin commented 5 years ago

Yep, that's why I can't use WallETH and WalletConnect. I try to send tokens through beta.zerion.io We call sendTransaction: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsendtransaction and pass gasLimit as hexadecimal estimateGas:

web3.eth.estimateGas(
  args,
  (e, gasCost) => {
    if (e) {
      throw new Error(e);
    }
    gasCost = web3.fromDecimal(gasCost);
  },
);
...

const webConnector = new WalletConnect({
  bridgeUrl: 'https://wcbridge.tokenary.io',
  dappName: 'Zerion',
});
...
const params = {
  from: selectedWalletAddress,
  to: recipientAddress,
  value: web3.fromDecimal(value),
  gasPrice: web3.fromDecimal(blockchainStats.suggested[sendingSpeed]),
  gas: gasCost, // THIS IS gasLimit
};
...
webConnector.sendTransaction(params);