-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Custom fee rates #129
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
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7bb5aeb
refactor: Move BlocktankNotificationType up to models dir
ovitrif 29c401b
feat: Add TransactionSpeed model
ovitrif 113cbaf
feat: Add convertVByteToKwu to ln service
ovitrif a1001e7
feat: Add tx speed logic WIP
ovitrif 1df87f1
feat: Add tx speed logic 2
ovitrif 2673cef
feat: Transaction speed button on general settings
ovitrif d119cc0
feat: Transaction speed screen scaffold
ovitrif 9e4d8a4
feat: Transaction speed screen preset fee rates
ovitrif a39d44f
feat: Reusable settings button row component
ovitrif fb4d1a7
feat: Set custom fee
ovitrif 5cb3750
feat: Set custom fee average tx text
ovitrif b5b4563
refactor: Rename PinNumberPad to NumberPadSimple
ovitrif 2e0d70b
feat: Local currency settings UI improvements
ovitrif d0ff09c
fix: SettingsButtonRow clickable area
ovitrif 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package to.bitkit.ext | ||
|
|
||
| import to.bitkit.models.TransactionSpeed | ||
| import uniffi.bitkitcore.FeeRates | ||
|
|
||
| fun FeeRates.getSatsPerVByteFor(speed: TransactionSpeed): UInt { | ||
| return when (speed) { | ||
| is TransactionSpeed.Fast -> fast | ||
| is TransactionSpeed.Medium -> mid | ||
| is TransactionSpeed.Slow -> slow | ||
| is TransactionSpeed.Custom -> speed.satsPerVByte | ||
| } | ||
| } |
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
2 changes: 1 addition & 1 deletion
2
...ls/blocktank/BlocktankNotificationType.kt → ...itkit/models/BlocktankNotificationType.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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package to.bitkit.models.blocktank | ||
| package to.bitkit.models | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
|
|
||
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,53 @@ | ||
| package to.bitkit.models | ||
|
|
||
| import kotlinx.serialization.KSerializer | ||
| import kotlinx.serialization.Serializable | ||
| import kotlinx.serialization.descriptors.PrimitiveKind | ||
| import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor | ||
| import kotlinx.serialization.descriptors.SerialDescriptor | ||
| import kotlinx.serialization.encoding.Decoder | ||
| import kotlinx.serialization.encoding.Encoder | ||
|
|
||
| @Serializable(with = TransactionSpeedSerializer::class) | ||
| sealed class TransactionSpeed { | ||
| object Fast : TransactionSpeed() | ||
| object Medium : TransactionSpeed() | ||
| object Slow : TransactionSpeed() | ||
| data class Custom(val satsPerVByte: UInt) : TransactionSpeed() | ||
|
|
||
| fun serialized(): String = when (this) { | ||
| is Fast -> "fast" | ||
| is Medium -> "medium" | ||
| is Slow -> "slow" | ||
| is Custom -> "custom_$satsPerVByte" | ||
| } | ||
|
|
||
| companion object { | ||
| fun fromString(value: String): TransactionSpeed = when { | ||
| value == "fast" -> Fast | ||
| value == "medium" -> Medium | ||
| value == "slow" -> Slow | ||
| value.matches(Regex("custom_\\d+")) -> { | ||
| value.substringAfter("custom_") | ||
| .toUIntOrNull() | ||
| ?.let { Custom(it) } | ||
| ?: Medium | ||
| } | ||
|
|
||
| else -> Medium | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private object TransactionSpeedSerializer : KSerializer<TransactionSpeed> { | ||
| override val descriptor: SerialDescriptor = | ||
| PrimitiveSerialDescriptor("TransactionSpeed", PrimitiveKind.STRING) | ||
|
|
||
| override fun serialize(encoder: Encoder, value: TransactionSpeed) { | ||
| encoder.encodeString(value.serialized()) | ||
| } | ||
|
|
||
| override fun deserialize(decoder: Decoder): TransactionSpeed { | ||
| return TransactionSpeed.fromString(decoder.decodeString()) | ||
| } | ||
| } | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.