Add custom network fee#700
Merged
Merged
Conversation
- Move custom-fee calculation into core primitives; keep gemstone a thin FFI wrapper - Android: hoist custom-fee preview into a view model, unify fee rows, shorten placeholder - iOS: simplify custom-fee scenes/view models with a FeeSelection.custom payload - Remove the Slow fee priority
- Add custom_fee_enabled to FeeConfig (Bitcoin only); simplify field names to decimals/max_multiplier - Remove unused CustomFee.rateText and its dead unitSymbol plumbing - Render the typed value in the primary color in SuffixTextField (iOS + Android)
DRadmir
marked this pull request as ready for review
July 15, 2026 20:26
gemcoder21
reviewed
Jul 16, 2026
| val feeRate = FeeRateUIModel(item, feeAssetInfo, feeUnitType, selectedRate, currentFee.amount, unitSymbol) | ||
| FeeRow( | ||
| emoji = feeRate.emoji, | ||
| title = when (feeRate.priority) { |
Contributor
There was a problem hiding this comment.
title = when (feeRate.priority) {
FeePriority.Fast -> stringResource(R.string.fee_rates_fast)
FeePriority.Normal -> stringResource(R.string.fee_rates_normal)
},
should be moved to extension to get title for the priority
gemcoder21
reviewed
Jul 16, 2026
| } | ||
|
|
||
| #[uniffi::export] | ||
| pub fn custom_gas_price(base: GemGasPriceType, gas_price: String) -> Result<GemGasPriceType, GemstoneError> { |
Contributor
There was a problem hiding this comment.
we should use BigInt instead of String, see other examples that we have
gemcoder21
reviewed
Jul 16, 2026
|
|
||
| #[derive(uniffi::Record, Clone, Debug, PartialEq, Eq)] | ||
| pub struct GemCustomFee { | ||
| pub fee_amount: String, |
Contributor
There was a problem hiding this comment.
Suggested change
| pub fee_amount: String, | |
| pub fee_value: String, |
and should be big int
gemcoder21
reviewed
Jul 16, 2026
| FeeConfig { | ||
| decimals: fee_unit_type(chain).decimals(), | ||
| max_multiplier: 10, | ||
| custom_fee_enabled: chain == Chain::Bitcoin, |
Contributor
There was a problem hiding this comment.
add extension for this, as we will enable more in the future
gemcoder21
reviewed
Jul 16, 2026
| crate::config::chain::get_chain_config(chain) | ||
| } | ||
|
|
||
| fn get_fee_config(&self, chain: String) -> FeeConfig { |
Contributor
There was a problem hiding this comment.
I think we have Chain type for this?
gemcoder21
approved these changes
Jul 16, 2026
The Slow fee priority no longer exists; the key was referenced by no Kotlin or Swift code.
- Pass BigInt over the FFI instead of String; uniffi handles the conversion, so the manual parsing and Result are gone - Rename fee_amount to fee_value - Extract custom_fee_enabled into a chain extension - Take Chain in get_fee_config instead of String, dropping a panicking unwrap - Move CustomFeeEstimate into Primitives and map GemCustomFee via map() throws
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a custom network fee — set your own fee rate for Bitcoin (sat/vB) and EVM chains, with a live fee preview.
Close: #649
iOS
Android