api icon indicating copy to clipboard operation
api copied to clipboard

API accepting undefined destination for transfer

Open bee344 opened this issue 2 years ago • 0 comments

  • I'm submitting a ...
  • [x] Bug report
  • [ ] Feature request
  • [ ] Support request
  • [ ] Other
  • What is the current behavior and expected behavior?

Currently when calling api.tx.balances.transfer and leaving the destination address as undefined, the funds are taken from the sender's account and sent to the address 111111111111111111111111111111111HC1. In these cases the transaction should fail and alert the sender they should input the destination address.

  • What is the motivation for changing the behavior?

Now the funds sent this way are being lost, since trying to retrieve them using keyring.createFromUri("0x Hex") to recreate the private key of the undefined address and sending the funds back to the original address returns:

"error": "1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low"
  • Please tell us about your environment:
  • Version: api v10.9.1

  • Environment:

    • [x] Node.js
    • [ ] Browser
    • [ ] Other (limited support for other environments)
  • Language:

    • [ ] JavaScript
    • [x] TypeScript (include tsc --version) v4.9.4
    • [ ] Other

bee344 avatar Jul 27 '23 12:07 bee344