Repository navigation
Add "Max" option to Send Dialog #41
Description
Activity
- 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 - changed the title
[-]feat: "Max" option in all send screens[/-][+]Add "Max" option to Send Dialog[/+]on Feb 19, 2024 Fixed by 6e5febb
@riongull please test this functionality at https://fix-dashwallet-implementation.wallet.dashincubator.dev/
6 remaining items
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.
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)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.
Reacted by jojobyteutils.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:1150This appears to be related to using an older wallet backup that was created before we added
changeaddress support.We likely need to add version numbers to the backups and have some form of import migration path for older backups.
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
breakChangebeing set totrueorfalse, 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 sendscenario.Around this timestamp https://youtu.be/QEcXscc_r8A?t=10151 you can see the debugging of this issue.
@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 02800And you want to send
0.001.
Sending0.001costs0.001 00193.Since your only other option is
0.005, you'll have to "steal" some stamps from the0.005, and then you have to send change back to yourself.When
breakChangeis set totrue, then it will allow "unmixing" the0.005 02800and you'll end up with two coins:0.001 01200 - to the recipient 0.005 01200 - back to yourselfAnother scenario would be when you have just one coin:
0.005 03200Here, 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 01000If you have legacy nano change (anything less than
0.001), it will attempt to use one of those coins to fill the gaps.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.
In your example it looks like you only have one coin, and it's value is
0.01959386So 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, not0.019.Okay, so maybe
0.01959386was 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 xxxxxwhich 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.In your example it looks like you only have one coin, and it's value is
0.01959386So 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, not0.019.In the video, the wallet that fails has exactly
0.001. The wallet with0.01959385is 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.
Merged with #59
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone

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.