Skip to content

Commit

Permalink
feat(send): display tx fee input field only with supported backends
Browse files Browse the repository at this point in the history
  • Loading branch information
theborakompanioni committed Jan 25, 2024
1 parent fd051ca commit b17c0bb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 14 additions & 4 deletions src/components/Send/SendForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import { WalletInfo } from '../../context/WalletContext'
import { useSettings } from '../../context/SettingsContext'
import styles from './SendForm.module.css'
import { TxFeeInputField, validateTxFee } from '../settings/TxFeeInputField'
import { useServiceInfo } from '../../context/ServiceInfoContext'
import { isFeatureEnabled } from '../../constants/features'

type CollaborativeTransactionOptionsProps = {
selectedAmount?: AmountValue
Expand All @@ -54,8 +56,8 @@ function CollaborativeTransactionOptions({
feeConfigValues,
reloadFeeConfigValues,
}: CollaborativeTransactionOptionsProps) {
const settings = useSettings()
const { t } = useTranslation()
const settings = useSettings()

const [activeFeeConfigModalSection, setActiveFeeConfigModalSection] = useState<FeeConfigSectionKey>()
const [showFeeConfigModal, setShowFeeConfigModal] = useState(false)
Expand Down Expand Up @@ -238,6 +240,7 @@ const InnerSendForm = ({
disabled = false,
}: InnerSendFormProps) => {
const { t } = useTranslation()
const serviceInfo = useServiceInfo()

const jarBalances = useMemo(() => {
if (!walletInfo) return []
Expand Down Expand Up @@ -343,9 +346,16 @@ const InnerSendForm = ({
/>
</div>

<div className="mb-4">
<Field name="txFee" label={t('send.label_tx_fees')} className={styles.input} component={TxFeeInputField} />
</div>
{serviceInfo && isFeatureEnabled('txFeeOnSend', serviceInfo) && (
<div className="mb-4">
<Field
name="txFee"
label={t('send.label_tx_fees')}
className={styles.input}
component={TxFeeInputField}
/>
</div>
)}
</Accordion>

<SubmitButton
Expand Down
4 changes: 2 additions & 2 deletions src/constants/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { ServiceInfo } from '../context/ServiceInfoContext'
interface Features {
importWallet: SemVer
rescanChain: SemVer
directSendTxFee: SemVer
txFeeOnSend: SemVer
}

const features: Features = {
importWallet: { major: 0, minor: 9, patch: 10 }, // added in https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1461
rescanChain: { major: 0, minor: 9, patch: 10 }, // added in https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1461
directSendTxFee: { major: 0, minor: 9, patch: 10 }, // added in https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1597
txFeeOnSend: { major: 0, minor: 9, patch: 11 }, // added in https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1597
}

type Feature = keyof Features
Expand Down

0 comments on commit b17c0bb

Please sign in to comment.