Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Unblock fee rate limit, add caption warning about mempool monitors #358

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"sass": "^1.56.2",
"unchained-bitcoin": "^1.0.1",
"unchained-bitcoin": "^1.2.0",
"unchained-wallets": "^1.0.3"
}
}
4 changes: 4 additions & 0 deletions src/components/ScriptExplorer/OutputsForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ class OutputsForm extends React.Component {
}}
/>
</Box>
<Typography variant="caption" className={styles.outputsFormLabel}>
Refer to mempool monitoring websites to ensure your selected fee
rate is appropriate.
</Typography>
</Grid>

<Grid item xs={4}>
Expand Down
22 changes: 18 additions & 4 deletions src/reducers/transactionReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Network,
P2SH,
estimateMultisigTransactionFee,
validateFeeRate,
validateFee,
validateOutputAmount,
satoshisToBitcoins,
Expand All @@ -12,6 +11,9 @@ import {
unsignedMultisigTransaction,
unsignedMultisigPSBT,
unsignedTransactionObjectFromPSBT,
checkFeeRateError,
getFeeErrorMessage,
FeeValidationError,
} from "unchained-bitcoin";
import updateState from "./utils";
import { SET_NETWORK, SET_ADDRESS_TYPE } from "../actions/settingsActions";
Expand Down Expand Up @@ -154,15 +156,27 @@ function deleteOutput(state, action) {

function updateFeeRate(state, action) {
const feeRateString = action.value;
const feeRateError = validateFeeRate(feeRateString);

// Gets the error type. Useful for conditionally displaying errors.
const feeRateError = checkFeeRateError(feeRateString);

// Get the fee. Ignore rate-too-high errors because this value creates
// problems when trying to author a CPFP.
const fee =
feeRateError === ""
feeRateError === null ||
feeRateError === FeeValidationError.FEE_RATE_TOO_HIGH
? setFeeForRate(state, feeRateString, state.outputs.length)
: "";

// Get the error message for the error type if error is not rate-too-high.
const feeRateErrorMessage =
feeRateError !== FeeValidationError.FEE_RATE_TOO_HIGH
? getFeeErrorMessage(feeRateError)
: "";

return updateState(state, {
feeRate: feeRateString,
feeRateError,
feeRateError: feeRateErrorMessage,
fee,
feeError: "",
});
Expand Down