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

signAndSend doesn't wait for Finalized event #40

Open
poka-IT opened this issue Jan 5, 2024 · 1 comment
Open

signAndSend doesn't wait for Finalized event #40

poka-IT opened this issue Jan 5, 2024 · 1 comment

Comments

@poka-IT
Copy link
Contributor

poka-IT commented Jan 5, 2024

Your signAndSend method is commented with:

/// Send tx, [params] will be ignored if we have [rawParam].
/// [onStatusChange] is a callback when tx status change.
/// @return txHash [string] if tx finalized success.

But that's wrong, the method return hash when transaction is validate by Babe, but still not Finalized by Granpa.

By reading your code in tx.dart, I realy don't understand why :

  Future<Map?> signAndSend(Map txInfo, String params, password,
      Function(String) onStatusChange) async {
    final msgId =
        "onStatusChange${serviceRoot.webView!.getEvalJavascriptUID()}";
    serviceRoot.webView!.addMsgHandler(msgId, onStatusChange);
    final code =
        'keyring.sendTx(api, ${jsonEncode(txInfo)}, $params, "$password", "$msgId")';
    // print(code);
    final dynamic res = await serviceRoot.webView!.evalJavascript(code);
    serviceRoot.webView!.removeMsgHandler(msgId);

    return res;
  }

Do you have an idea ?

@RomeroYang
Copy link
Member

You're right, the comment is wrong, it doesn't wait for finalized event.

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

2 participants