Skip to content
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

Issue with handling transaction failures in flutter_injected_web3 #5

Open
flutterdevcodiste opened this issue Feb 20, 2024 · 0 comments

Comments

@flutterdevcodiste
Copy link

I'm encountering an issue while using the signTransactions method from the flutter_injected_web3 package (version 1.0.1). When attempting transactions on PancakeSwap, if the transaction fails, it results in a runtime error "null is not subtype of string".

Here's the method I'm using:

Future<String> signTransactions({required BuildContext context, required InAppWebViewController controller, required JsTransactionObject data, required int chainId}) async {
    try { 
       // return cubit.signTransaction();
       return "0x45fb0060681bf5d8ea675ab0b3f76aa15c84b172f2fb3191b7a8ceb1e6a7f372";
    } catch (e) {
      return "";
    }
  }

I need guidance on how to properly handle this error to prevent the runtime crash. Specifically, I'd like to know:

  • How can I identify when a transaction fails using flutter_injected_web3?
  • What is the appropriate way to handle transaction failures to avoid runtime errors like the one mentioned above?

Any assistance or guidance on resolving this issue would be greatly appreciated. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant