From 6badb91b6f4780c62ad3fcef75462a47a935059f Mon Sep 17 00:00:00 2001 From: finned-palmer Date: Wed, 30 Jun 2021 17:44:45 -0500 Subject: [PATCH] Add fee to useSettings hook --- pkg/btc-wallet/src/js/components/lib/send.js | 2 -- pkg/btc-wallet/src/js/hooks/useSettings.js | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/btc-wallet/src/js/components/lib/send.js b/pkg/btc-wallet/src/js/components/lib/send.js index abec450436..f3b050643a 100644 --- a/pkg/btc-wallet/src/js/components/lib/send.js +++ b/pkg/btc-wallet/src/js/components/lib/send.js @@ -125,7 +125,6 @@ const Send = ({ stopSending, value, conversion }) => { }; useEffect(() => { - console.log({ network }); if (network === 'bitcoin') { let url = 'https://bitcoiner.live/api/fees/estimates/latest'; fetch(url) @@ -134,7 +133,6 @@ const Send = ({ stopSending, value, conversion }) => { // let estimates = Object.keys(n.estimates); // let mid = Math.floor(estimates.length / 2); // let high = estimates.length - 1; - console.log('hello'); setFeeChoices({ high: [30, n.estimates[30]['sat_per_vbyte']], mid: [180, n.estimates[180]['sat_per_vbyte']], diff --git a/pkg/btc-wallet/src/js/hooks/useSettings.js b/pkg/btc-wallet/src/js/hooks/useSettings.js index 8e35d52345..02393afcb2 100644 --- a/pkg/btc-wallet/src/js/hooks/useSettings.js +++ b/pkg/btc-wallet/src/js/hooks/useSettings.js @@ -27,6 +27,8 @@ export const SettingsContext = createContext({ setBtcState: () => {}, history: [], setHistory: () => {}, + fee: 0, + setFee: () => {}, psbt: '', setPsbt: () => {}, address: null, @@ -58,6 +60,7 @@ export const SettingsProvider = ({ channel, children }) => { const [btcState, setBtcState] = useState(null); const [history, setHistory] = useState([]); const [psbt, setPsbt] = useState(''); + const [fee, setFee] = useState(0); const [address, setAddress] = useState(null); const [currencyRates, setCurrencyRates] = useState({ BTC: { last: 1, symbol: 'BTC' }, @@ -223,6 +226,7 @@ export const SettingsProvider = ({ channel, children }) => { } if (psbtData) { setPsbt(psbtData.pb); + setFee(psbtData.fee); } if (cancelTx) { handleCancelTx(cancelTx); @@ -281,6 +285,8 @@ export const SettingsProvider = ({ channel, children }) => { setHistory, psbt, setPsbt, + fee, + setFee, address, setAddress, currencyRates,