Add fee to useSettings hook

This commit is contained in:
finned-palmer 2021-06-30 17:44:45 -05:00 committed by ixv
parent ecc8352656
commit 76743129fb
2 changed files with 6 additions and 2 deletions

View File

@ -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']],

View File

@ -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,