Nma 1067 custodial swaps sell dash - #926
Conversation
…waps_Sell_Dash # Conflicts: # integrations/coinbase-integration/src/main/java/org/dash/wallet/integration/coinbase_integration/ui/CoinbaseBuyDashOrderReviewFragment.kt # integrations/coinbase-integration/src/main/res/values/strings.xml
| interface SendPaymentService { | ||
| suspend fun sendCoins( | ||
| address: Address, | ||
| amount: Coin, | ||
| constrainInputsTo: Address? = null, | ||
| emptyWallet: Boolean = false | ||
| ): Transaction | ||
| } |
There was a problem hiding this comment.
@Syn-McJ Didn't also make a similar service? or is this the same one?
There was a problem hiding this comment.
It's the same one as I understand, Hadia has asked me about sending coins and I have referenced my solution.
Syn-McJ
left a comment
There was a problem hiding this comment.
Looks good, but I have some comments/questions. I'm mostly concerned with AlertDialog that is going to stick on top of the lock screen
| } | ||
|
|
||
| private fun show2FADialog() { | ||
| val builder: AlertDialog.Builder = android.app.AlertDialog.Builder(requireContext()) |
There was a problem hiding this comment.
AlertDialog will not be dismissed automatically when the lock screen shows up. Can this be implemented with a DialogFragment subclass instead?
There was a problem hiding this comment.
For this its just temp code and will be replaced in with the new 2FA Dialog
| } | ||
|
|
||
| private fun show2FADialog() { | ||
| val builder: AlertDialog.Builder = android.app.AlertDialog.Builder(requireContext()) |
There was a problem hiding this comment.
Same point about AlertDialog (see above)
There was a problem hiding this comment.
For this its just temp code and will be replaced in with the new 2FA Dialog
| binding.youWillReceiveValue.isVisible = hasBalance | ||
| if (hasBalance) { | ||
| binding.youWillReceiveValue.text = context?.getString(R.string.you_will_receive_dash, dashFormat.format(balance).toString()) | ||
| binding.youWillReceiveValue.text = context?.getString( |
There was a problem hiding this comment.
You can use requireContext here.
| binding.youWillReceiveValue.text = context?.getString( | |
| binding.youWillReceiveValue.text = requireContext().getString( |
| interface SendPaymentService { | ||
| suspend fun sendCoins( | ||
| address: Address, | ||
| amount: Coin, | ||
| constrainInputsTo: Address? = null, | ||
| emptyWallet: Boolean = false | ||
| ): Transaction | ||
| } |
There was a problem hiding this comment.
It's the same one as I understand, Hadia has asked me about sending coins and I have referenced my solution.
| } | ||
|
|
||
| private fun getFaitAmount(balance: String, currencyCode: String): Fiat? { | ||
| private fun getFaitAmount(balance: String, currencyCode: String): Pair<Fiat?, Coin?>? { |
| viewModel.selectedCryptoCurrencyAccount.value?.let { userAccountData -> | ||
|
|
||
|
|
||
| val cleanedValue = |
There was a problem hiding this comment.
This method (setAmountValue) seems quite convoluted, and it's all just for getting a clean value. Maybe it's worth to think about how to simplify it / extract some parts to separate methods
| fun setOnSwapDashFromToCryptoClicked(dashToCrypto: Boolean) { | ||
| if (dashToCrypto) { | ||
| if (walletDataProvider.getWalletBalance().isZero) { | ||
| _userDashAccountEmptyError.value = true |
There was a problem hiding this comment.
since _userDashAccountEmptyError.value = true always applies, I think you're better off using SingleLiveEvent<Unit>
| import java.math.RoundingMode | ||
| import javax.inject.Inject | ||
|
|
||
| @ExperimentalCoroutinesApi |
There was a problem hiding this comment.
you might as well add this annotation in the CoinbaseConvertCryptoFragment class
| private val walletDataProvider: WalletDataProvider | ||
| ) : ViewModel() { | ||
|
|
||
| val dashFormat = MonetaryFormat().withLocale(GenericUtils.getDeviceLocale()) |
There was a problem hiding this comment.
This property could be private if used only within this class
|
|
||
| private val _dashToCrypto = MutableLiveData<Boolean>() | ||
| val dashToCrypto: LiveData<Boolean> | ||
| get() = this._dashToCrypto |
There was a problem hiding this comment.
is there a specific reason for appending this keyword in some of the properties used within this class ?!
I think you can get rid of it
| _dashToCrypto.value = dashToCrypto | ||
| } | ||
|
|
||
| fun clear() { _selectedCryptoCurrencyAccount.value = null } |
There was a problem hiding this comment.
Since this function is to be called when the view is no more used, you might as well call it directly in onCleared() function of the VM which is automatically called when fragment is destroyed
ClaudeHangui
left a comment
There was a problem hiding this comment.
Works for me !
slight improvements though could be made in some view models
Built from platform `integration/v41-keystore-qa5` @ 7c495eab76. Three changes over v41int19: * **Pooled asset-lock funding** (dashpay/platform#4350). An invitation, identity registration or top-up now funds from the union of the BIP44 and BIP32 accounts at the given index plus every DashPay contact-receiving account, with change back to BIP44 — the same set the send path has pooled since #4329. A lock no longer needs its whole amount sitting in one account, so the sweep-then-lock hop (an extra on-chain transaction, an extra fee, and a reused transparent address) is gone. Reservation release after a rejected broadcast now reaches every contributing account under the build's owner token, and the funding-transaction lookup that gates the proof wait searches all four account families — a lock funded entirely out of BIP32 or a contact account was previously invisible to it. Shielded funding and CoinJoin funding are unchanged: both still draw from the one account the caller names. Carries the rust-dashcore pin from 8f26456b to d44d241d, which is that commit plus exactly one — dashpay/rust-dashcore#935, the pooled builder this depends on. * **Contact watch-only records no longer define the persisted transaction row** (#926 completion). A payment TO a contact stopped being persisted as incoming, and the contact's own coins stopped entering `txos`. * Pre-existing clippy/rustfmt debt on the qa5 line cleared, so the lint gate is green again. Verified before publishing: platform-wallet 637 Rust tests, platform-wallet-ffi 254, rs-unified-sdk-jni 38, Kotlin SDK 436 unit tests, `cargo clippy --lib --tests -- -D warnings` and `cargo fmt --check` clean, and both JNI libraries verified (241 exports, 16 KB-aligned LOAD segments, arm64-v8a + x86_64). Here: `:wallet:compile_testNet3DebugKotlin` plus the full unit suite — 1705 tests, 0 failures. No APK built and nothing installed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
As a user who has a Coinbase account I would like to be able to swap my dash in my Dash Wallet to another crypto into my Coinbase account.
Issue being fixed or feature implemented
Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist: