-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use CrowdNode API for fees (#1324)
* feat: use CrowdNode API for fees * tests: update MainViewModelTest
- Loading branch information
1 parent
261c7de
commit 92d361c
Showing
7 changed files
with
183 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 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
49 changes: 49 additions & 0 deletions
49
.../crowdnode/src/main/java/org/dash/wallet/integrations/crowdnode/model/CrowdNodeFeeInfo.kt
This file contains 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,49 @@ | ||
package org.dash.wallet.integrations.crowdnode.model | ||
|
||
import android.os.Parcelable | ||
import com.google.gson.annotations.SerializedName | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.parcelize.RawValue | ||
|
||
data class FeeLadder( | ||
val name: String, | ||
val type: String, | ||
val amount: Double, | ||
val fee: Double | ||
) | ||
|
||
/* | ||
[ | ||
{ | ||
"Key":"FeeLadder", | ||
"Value":"[ | ||
{ | ||
\"name\":\"Up to 10 Dash and above\", | ||
\"type\":\"Normal\", | ||
\"amount\":10.0,\"fee\":35.0 | ||
}, | ||
{ | ||
\"name\":\"Trustless up to 100 Dash and above\", | ||
\"type\":\"Trustless\", | ||
\"amount\":100.0, | ||
\"fee\":20.0 | ||
} | ||
]" | ||
} | ||
] | ||
*/ | ||
@Parcelize | ||
data class FeeInfo( | ||
@SerializedName("FeeLadder") val feeLadder: @RawValue List<FeeLadder> | ||
) : Parcelable { | ||
companion object { | ||
const val DEFAULT_FEE = 35.0 | ||
const val DEFAULT_AMOUNT = 100.0 | ||
const val KEY_FEELADDER = "FeeLadder" | ||
const val TYPE_NORMAL = "Normal" | ||
const val TYPE_TRUSTLESS = "Trustless" | ||
val default = FeeInfo(listOf(FeeLadder("", TYPE_NORMAL, DEFAULT_AMOUNT, DEFAULT_FEE))) | ||
} | ||
|
||
fun getNormal() = feeLadder.find { it.type == FeeInfo.TYPE_NORMAL } | ||
} |
This file contains 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 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 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 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