near-api-js icon indicating copy to clipboard operation
near-api-js copied to clipboard

signAndSendTransactions should be able to handle multiple transactions without redirect

Open mattlockyer opened this issue 2 years ago • 1 comments

Describe the bug

NEARWallet MyNearWallet

When using signAndSendTransactions (multiple) combined with actions that have no NEAR deposit (they should be able to be handled by access key); currently this still requires a redirect to the web wallet page for confirmation.

Instead, when all transactions in a call to signAndSendTransactions can be handled by access key (there is an access key and every action in each transaction has deposit: 0) these transactions should be executed in serial as regular calls to signAndSendTransaction.

To Reproduce Steps to reproduce the behavior:

  1. Create 1 or more transactions with zero deposit
  2. Call wallet.signAndSendTransactions
  3. You are redirected

Expected behavior No redirect, since the access key should be able to handle each transaction

mattlockyer avatar Nov 22 '22 17:11 mattlockyer

Hey, @mattlockyer thank you for raising this issue.

We have been investigating this issue and because we are using the requestSignTransactions of WalletConnection from near-api-js to sign and send multiple transactions we're not doing deposit check inside Wallet Selector.

We have done some work on this branch (supports the flow you suggested) but we're thinking it might be better for near-api-js to handle this internally since all browser wallets use the WalletConnection of near-api-js.

DamirSQA avatar Dec 01 '22 16:12 DamirSQA