Skip to content

Add "Max" option to Send Dialog #41

Description

@riongull

We really need a "Max" option on the Send screens.

It's annoying to not be able to just send all the money out of a burner wallet (a key use case for a web wallet).
I don't like the idea of leaving dust everywhere I go by just trying to get close.

Just "Max" for now will do. I don't know of anyone who uses 25%, 50%, etc.

I think our SDKs facilitate this somehow. I remember dealing with it with @coolaj86 but not 100% sure we finished that feature.

Activity

  1. changed the title [-]feat: No way to send 100%. I think our SDKs facilitate this.[/-] [+]feat: "Max" option in all send screens[/+] on Feb 14, 2024
  2. changed the title [-]feat: "Max" option in all send screens[/-] [+]Add "Max" option to Send Dialog[/+] on Feb 19, 2024
  3. self-assigned this
    on Feb 19, 2024
  4. jojobyte commented on Feb 24, 2024

    @jojobyte
    Contributor

    Fixed by 6e5febb

  5. added this to the Stage 2 milestone on Feb 28, 2024
  6. moved this from Backlog to Ready in Wallet UI - Roadmapon Feb 28, 2024
  7. moved this from Ready to In progress in Wallet UI - Roadmapon Feb 28, 2024
  8. moved this from In progress to In review in Wallet UI - Roadmapon Feb 28, 2024
  9. jojobyte commented on Feb 28, 2024

    @jojobyte
    Contributor
  10. 6 remaining items

  11. moved this from In review to Done in Wallet UI - Roadmapon Mar 15, 2024
  12. riongull commented on Mar 15, 2024

    @riongull
    Author

    Moved to Done since it's "done for now", but I'm leaving the issue open so we can check that "Max" works with both send options as mentioned above when we get the toggle/setting working.

  13. riongull commented on Mar 15, 2024

    @riongull
    Author

    More testing revealed another issue with sending "Full":

    Image

    Uncaught (in promise) Error: cannot spend Đ0.123024 without breaking change: add another coin of between Đ0.000002 and Đ0.001, or break change first
        at wallet._createNonTransactableError (dashwallet.js:1313:17)
        at wallet.useAllCoins (dashwallet.js:1276:22)
        at createStandardTx (wallet.js:1462:28)
        at async createTx (wallet.js:1543:13)
        at async HTMLFormElement.<anonymous> (send-or-request.js:598:45)
    
  14. moved this from Done to In progress in Wallet UI - Roadmapon Mar 15, 2024
  15. riongull commented on Mar 15, 2024

    @riongull
    Author

    I was able to get past the error by sending "Half".

    Presumably any value other than "Full" might have worked as well, so it does seem like an issue with the send max/full amount feature, so I moved it back to "in progress".

    Seems like this might have to be addressed by @coolaj86 at the library/sdk level.

  16. jojobyte commented on Mar 15, 2024

    @jojobyte
    Contributor
    utils.js:1062 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '0')
        at getAddressIndexFromUsage (utils.js:1062:32)
        at getAccountWallet (wallet.js:1144:29)
        at async main (main.js:622:14)
    getAddressIndexFromUsage	@	utils.js:1062
    getAccountWallet	@	wallet.js:1144
    await in getAccountWallet (async)		
    (anonymous)	@	main.js:1150
    

    This appears to be related to using an older wallet backup that was created before we added change address support.

    We likely need to add version numbers to the backups and have some form of import migration path for older backups.

  17. jojobyte commented on Mar 16, 2024

    @jojobyte
    Contributor

    More testing revealed another issue with sending "Full":

    Uncaught (in promise) Error: cannot spend Đ0.123024 without breaking change: add another coin of between Đ0.000002 and Đ0.001, or break change first
        at wallet._createNonTransactableError (dashwallet.js:1313:17)
        at wallet.useAllCoins (dashwallet.js:1276:22)
        at createStandardTx (wallet.js:1462:28)
        at async createTx (wallet.js:1543:13)
        at async HTMLFormElement.<anonymous> (send-or-request.js:598:45)
    

    Traced this error to https://github.com/dashhive/wallet-ui/blob/fix/dashwallet-implementation/src/helpers/wallet.js#L1464, regardless of breakChange being set to true or false, under certain circumstances this always fails.

    @coolaj86 is there a way to manually break change before we call this function, or can the function be updated to work in the full send scenario.

    Around this timestamp https://youtu.be/QEcXscc_r8A?t=10151 you can see the debugging of this issue.

  18. coolaj86 commented on Mar 16, 2024

    @coolaj86
    Member

    @jojobyte If you're doing XPub Send then you get that error when sending that amount requires "unmixing" coins.

    For example, you have two coins
    0.001 00000
    0.005 02800

    And you want to send 0.001.
    Sending 0.001 costs 0.001 00193.

    Since your only other option is 0.005, you'll have to "steal" some stamps from the 0.005, and then you have to send change back to yourself.

    When breakChange is set to true, then it will allow "unmixing" the 0.005 02800 and you'll end up with two coins:

    0.001 01200 - to the recipient
    0.005 01200 - back to yourself
    

    Another scenario would be when you have just one coin:

    0.005 03200
    

    Here, the same rules apply and you'd end up with 2 or 3 coins, depending on the stamp values:

    0.002 01000 - to the recipient
    
    0.002 01000 - back to yourself
    0.001 01000
    

    If you have legacy nano change (anything less than 0.001), it will attempt to use one of those coins to fill the gaps.

  19. coolaj86 commented on Mar 16, 2024

    @coolaj86
    Member

    The idea is that you should first try without "breaking change", let the user check the box that says "I realize this may fingerprint my transaction, do it anyway".

    In the case of a max / full send, however, you don't need to double check.

  20. coolaj86 commented on Mar 16, 2024

    @coolaj86
    Member

    In your example it looks like you only have one coin, and it's value is

    0.01959386
    

    So unless you were sending exactly 0.019, it would have to break change.

    Now, you've clicked "Full Send", but it only selected 0.001, not 0.019.

  21. coolaj86 commented on Mar 17, 2024

    @coolaj86
    Member

    Okay, so maybe 0.01959386 was a coin I saw from another window's log.

    At 3h 06m (https://youtube.com/watch?v=QEcXscc_r8A&t=11160) it looks like you only have a single coin of value 001 00000, in which case you can't send it, because all you have is nano change / dust.

    "Cannot create spendable coin from "

    Keyword SPENDABLE.

    The other person would receive 0.000 xxxxx which is ~= 0.000, also $0.00, so there's no way to represent the value of the transaction because there was no face value - you're just sending what amounts to transaction fees (stamps), not spendable, mercantile, economic value.

  22. jojobyte commented on Mar 17, 2024

    @jojobyte
    Contributor

    In your example it looks like you only have one coin, and it's value is

    0.01959386
    

    So unless you were sending exactly 0.019, it would have to break change.

    Now, you've clicked "Full Send", but it only selected 0.001, not 0.019.

    In the video, the wallet that fails has exactly 0.001. The wallet with 0.01959385 is a different wallet and the one that is supposed to receive the funds.

    In @riongull's error here he has a lot more and still ran into the error.

  23. jojobyte commented on Apr 6, 2024

    @jojobyte
    Contributor

    Merged with #59

  24. moved this from In progress to Done in Wallet UI - Roadmapon Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions