Skip to content

Commit

Permalink
Merge pull request zingolabs#539 from juanky201271/dev_basic_mode_aut…
Browse files Browse the repository at this point in the history
…o_fetch_usd_price

Send screen - auto fetch price in basic mode
  • Loading branch information
juanky201271 authored Oct 12, 2023
2 parents aada12f + 52bd117 commit a012789
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions components/Send/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,24 @@ const Send: React.FunctionComponent<SendProps> = ({
};
}, [slideAnim, titleViewHeight]);

useEffect(() => {
(async () => {
if (mode === 'basic') {
const price = await RPC.rpc_getZecPrice();
// values:
// 0 - initial/default value
// -1 - error in Gemini/zingolib.
// -2 - error in RPCModule, likely.
// > 0 - real value
if (price <= 0) {
setZecPrice(price, 0);
} else {
setZecPrice(price, Date.now());
}
}
})();
}, [mode, setZecPrice]);

const updateToField = async (
address: string | null,
amount: string | null,
Expand Down

0 comments on commit a012789

Please sign in to comment.