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

Sign and send transaction to MyNearWallet loses Promise<FinalExecutionOutcome> #1057

Closed
PierreLeGuen opened this issue Jan 12, 2024 · 5 comments
Assignees
Labels
bug Something isn't working Emerging Tech Emerging Tech flying formation at Pagoda

Comments

@PierreLeGuen
Copy link

PierreLeGuen commented Jan 12, 2024

Describe the bug

SignAndSendTransaction for MyNearWallet redirects to MyNearWallet app causing the currently running app to lose state/memory of the wallet selector. This is causing issues when you want to act based on the promise result.

Steps To Reproduceå

Steps to reproduce the behavior:

  1. SignAndSend any transaction to MNW
  2. await on the promise
  3. console.log(...) after the promise. The console log will never be triggered.

Error description

Expected behavior

Keep state and resolve the promise.

@PierreLeGuen PierreLeGuen added bug Something isn't working Emerging Tech Emerging Tech flying formation at Pagoda Near BOS labels Jan 12, 2024
@PierreLeGuen PierreLeGuen changed the title Signing with MyNearWallet loses the state of wallet-selector on signAndSend Sign and send transaction to MyNearWallet loses Promise<FinalExecutionOutcome> Jan 12, 2024
@kujtimprenkuSQA
Copy link
Contributor

Hi @PierreLeGuen thank you for raising this issue.

This is the default behavior of browser wallets for transactions that attach any deposit or non-function-call actions because these transactions can not be signed with a limited access key and need to be signed with the full-access-key on the wallet.

@PierreLeGuen
Copy link
Author

Understood, but how are we supposed to handle transaction approval after redirect on app side?

@PierreLeGuen
Copy link
Author

Maybe you could open the sign page in an other tab/window and poll rpc for transaction status?

@kujtimprenkuSQA
Copy link
Contributor

The wallet will add the transactionHashes query param into the callbackUrl of signAndSendTransaction(s):

For example something like this:
https://near.github.io/wallet-selector/?transactionHashes=6EgAkd1iKTzEdyx8E8cn7Kocv6Go24SCG6hED6BgBSii

In your dApp you could check the txStatus:

const provider = new providers.JsonRpcProvider({ url: network.nodeUrl });
const txHash = "6EgAkd1iKTzEdyx8E8cn7Kocv6Go24SCG6hED6BgBSii";
const accountId = "kujtimp.testnet";
const result = await provider.txStatus(txHash, accountId);
console.log("Execution Outcome Result: ", result);

@kujtimprenkuSQA
Copy link
Contributor

@PierreLeGuen we're closing the issue for now, if you have any other questions feel free to re-open the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Emerging Tech Emerging Tech flying formation at Pagoda
Projects
None yet
Development

No branches or pull requests

2 participants