-
Notifications
You must be signed in to change notification settings - Fork 180
Nma 1067 custodial swaps sell dash #926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
HashEngineering
merged 16 commits into
feature-coinbase-integration
from
NMA-1067_Custodial_Swaps_Sell_Dash
Apr 1, 2022
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
dc95cbc
fix: add dash balance
hadia 3fcdc33
feat: add error dialog
hadia 244dc78
feat: send dash to coinbase
hadia 589e10b
feat: send dash to coinbase
hadia 832ce8a
feat: send dash to coinbase
hadia 6d72f37
feat: send dash sync
hadia a49b68a
feat: send dash with 2fa
hadia e1448bf
feat: send dash
hadia b811928
feat: update test
hadia 55bb0f0
Merge branch 'feature-coinbase-integration' into NMA-1067_Custodial_S…
hadia 861f7af
feat: update branch
hadia 006e3a0
feat: Add error for sending coins
hadia 6114627
fix: nav direction and fait error
hadia 8797cf8
fix: null pointer for dash input
hadia f31eabc
fix: min value issue
hadia e92d795
fix: min value issue
hadia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
common/src/main/java/org/dash/wallet/common/services/SendPaymentService.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Copyright 2022 Dash Core Group. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package org.dash.wallet.common.services | ||
|
|
||
| import org.bitcoinj.core.Address | ||
| import org.bitcoinj.core.Coin | ||
| import org.bitcoinj.core.Transaction | ||
|
|
||
| interface SendPaymentService { | ||
| suspend fun sendCoins( | ||
| address: Address, | ||
| amount: Coin, | ||
| constrainInputsTo: Address? = null, | ||
| emptyWallet: Boolean = false | ||
| ): Transaction | ||
| } | ||
43 changes: 43 additions & 0 deletions
43
common/src/main/java/org/dash/wallet/common/transactions/ByAddressCoinSelector.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright 2022 Dash Core Group. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package org.dash.wallet.common.transactions | ||
|
|
||
| import org.bitcoinj.core.Address | ||
| import org.bitcoinj.core.Coin | ||
| import org.bitcoinj.core.TransactionOutput | ||
| import org.bitcoinj.script.ScriptPattern | ||
| import org.bitcoinj.wallet.CoinSelection | ||
| import org.bitcoinj.wallet.CoinSelector | ||
| import org.bitcoinj.wallet.ZeroConfCoinSelector | ||
|
|
||
| class ByAddressCoinSelector(private val address: Address) : CoinSelector { | ||
| private val selector = ZeroConfCoinSelector.get() | ||
|
|
||
| override fun select( | ||
| target: Coin, | ||
| candidates: MutableList<TransactionOutput> | ||
| ): CoinSelection { | ||
| val filtered = candidates.filter { output -> | ||
| val script = output.scriptPubKey | ||
| (ScriptPattern.isP2PKH(script) || ScriptPattern.isP2SH(script)) && | ||
| script.getToAddress(address.parameters) == address | ||
| } | ||
|
|
||
| return selector.select(target, filtered) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...src/main/java/org/dash/wallet/integration/coinbase_integration/model/AddressesResponse.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package org.dash.wallet.integration.coinbase_integration.model | ||
|
|
||
| import android.os.Parcelable | ||
| import com.google.gson.annotations.SerializedName | ||
| import kotlinx.android.parcel.Parcelize | ||
|
|
||
| @Parcelize | ||
| data class AddressesResponse( | ||
|
|
||
| @field:SerializedName("data") | ||
| val addresses: Addresses? = null | ||
| ) : Parcelable | ||
|
|
||
| @Parcelize | ||
| data class Addresses( | ||
|
|
||
| @field:SerializedName("deposit_uri") | ||
| val depositUri: String? = null, | ||
|
|
||
| @field:SerializedName("address_info") | ||
| val addressInfo: AddressInfo? = null, | ||
|
|
||
| @field:SerializedName("address") | ||
| val address: String? = null, | ||
|
|
||
| @field:SerializedName("resource") | ||
| val resource: String? = null, | ||
|
|
||
| @field:SerializedName("warnings") | ||
| val warnings: List<String?>? = null, | ||
|
|
||
| @field:SerializedName("created_at") | ||
| val createdAt: String? = null, | ||
|
|
||
| @field:SerializedName("uri_scheme") | ||
| val uriScheme: String? = null, | ||
|
|
||
| @field:SerializedName("network") | ||
| val network: String? = null, | ||
|
|
||
| @field:SerializedName("callback_url") | ||
| val callbackUrl: String? = null, | ||
|
|
||
| @field:SerializedName("updated_at") | ||
| val updatedAt: String? = null, | ||
|
|
||
| @field:SerializedName("resource_path") | ||
| val resourcePath: String? = null, | ||
|
|
||
| @field:SerializedName("name") | ||
| val name: String? = null, | ||
|
|
||
| @field:SerializedName("id") | ||
| val id: String? = null | ||
| ) : Parcelable | ||
|
|
96 changes: 96 additions & 0 deletions
96
.../org/dash/wallet/integration/coinbase_integration/model/CoinBaseAccountAddressResponse.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| package org.dash.wallet.integration.coinbase_integration.model | ||
|
|
||
| import android.os.Parcelable | ||
| import com.google.gson.annotations.SerializedName | ||
| import kotlinx.android.parcel.Parcelize | ||
|
|
||
| @Parcelize | ||
| data class CoinBaseAccountAddressResponse( | ||
|
|
||
| @field:SerializedName("pagination") | ||
| val pagination: Pagination? = null, | ||
|
|
||
| @field:SerializedName("data") | ||
| val data: List<DataItem?>? = null | ||
| ) : Parcelable | ||
|
|
||
| @Parcelize | ||
| data class CoinBaseAccountAddressInfo( | ||
| @field:SerializedName("address") | ||
| val address: String? = null | ||
| ) : Parcelable | ||
|
|
||
| @Parcelize | ||
| data class WarningsItem( | ||
|
|
||
| @field:SerializedName("image_url") | ||
| val imageUrl: String? = null, | ||
|
|
||
| @field:SerializedName("options") | ||
| val options: List<OptionsItem?>? = null, | ||
|
|
||
| @field:SerializedName("details") | ||
| val details: String? = null, | ||
|
|
||
| @field:SerializedName("type") | ||
| val type: String? = null, | ||
|
|
||
| @field:SerializedName("title") | ||
| val title: String? = null | ||
| ) : Parcelable | ||
|
|
||
| @Parcelize | ||
| data class OptionsItem( | ||
|
|
||
| @field:SerializedName("style") | ||
| val style: String? = null, | ||
|
|
||
| @field:SerializedName("text") | ||
| val text: String? = null, | ||
|
|
||
| @field:SerializedName("id") | ||
| val id: String? = null | ||
| ) : Parcelable | ||
|
|
||
| @Parcelize | ||
| data class DataItem( | ||
|
|
||
| @field:SerializedName("deposit_uri") | ||
| val depositUri: String? = null, | ||
|
|
||
| @field:SerializedName("address_info") | ||
| val addressInfo: CoinBaseAccountAddressInfo? = null, | ||
|
|
||
| @field:SerializedName("address") | ||
| val address: String? = null, | ||
|
|
||
| @field:SerializedName("resource") | ||
| val resource: String? = null, | ||
|
|
||
| @field:SerializedName("warnings") | ||
| val warnings: List<WarningsItem?>? = null, | ||
|
|
||
| @field:SerializedName("created_at") | ||
| val createdAt: String? = null, | ||
|
|
||
| @field:SerializedName("uri_scheme") | ||
| val uriScheme: String? = null, | ||
|
|
||
| @field:SerializedName("network") | ||
| val network: String? = null, | ||
|
|
||
| @field:SerializedName("callback_url") | ||
| val callbackUrl: String? = null, | ||
|
|
||
| @field:SerializedName("updated_at") | ||
| val updatedAt: String? = null, | ||
|
|
||
| @field:SerializedName("resource_path") | ||
| val resourcePath: String? = null, | ||
|
|
||
| @field:SerializedName("name") | ||
| val name: String? = null, | ||
|
|
||
| @field:SerializedName("id") | ||
| val id: String? = null | ||
| ) : Parcelable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Syn-McJ Didn't also make a similar service? or is this the same one?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same one as I understand, Hadia has asked me about sending coins and I have referenced my solution.