From 3467e978184cdb8dfe3236c2781a97f40b00f2fa Mon Sep 17 00:00:00 2001 From: ThornM9 Date: Tue, 15 Aug 2023 17:16:31 +1000 Subject: [PATCH] Cancel transaction if not enough sol and not converting --- README.md | 13 +++++++++++++ src/features/collectables/ClaimAllRewardsScreen.tsx | 11 ++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f02ab3348..97f84c041 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,19 @@ Follow the instructions for "React Native CLI Quickstart" found [here](https://r ```bash yarn ``` +- Fill out your env.sample with your values and rename it to `.env`. Set up a Mapbox account and generate a public and private key for the access token and download token environment variables. + +- Create a netrc file to authenticate with mapbox + ```bash + touch ~/.netrc + nano ~/.netrc + ``` +- Insert your mapbox authentication details + ```bash + machine api.mapbox.com + login mapbox + password + ``` - Install Pods ```bash yarn pod-install diff --git a/src/features/collectables/ClaimAllRewardsScreen.tsx b/src/features/collectables/ClaimAllRewardsScreen.tsx index e398de7d6..9bc274dcd 100644 --- a/src/features/collectables/ClaimAllRewardsScreen.tsx +++ b/src/features/collectables/ClaimAllRewardsScreen.tsx @@ -40,7 +40,7 @@ const ClaimAllRewardsScreen = () => { const { showOKCancelAlert } = useAlert() const { anchorProvider } = useSolana() const showHNTConversionAlert = useCallback(async () => { - if (!anchorProvider || !hntSolConvertTransaction) return + if (!anchorProvider || !hntSolConvertTransaction) return false const decision = await showOKCancelAlert({ title: t('browserScreen.insufficientSolToPayForFees'), @@ -50,7 +50,7 @@ const ClaimAllRewardsScreen = () => { }), }) - if (!decision) return + if (!decision) return false const signed = await anchorProvider.wallet.signTransaction( hntSolConvertTransaction, ) @@ -62,6 +62,7 @@ const ClaimAllRewardsScreen = () => { }, 'confirmed', ) + return true }, [ anchorProvider, hntSolConvertTransaction, @@ -92,7 +93,11 @@ const ClaimAllRewardsScreen = () => { setClaimError(undefined) setRedeeming(true) if (!hasEnoughSol) { - await showHNTConversionAlert() + const success = await showHNTConversionAlert() + if (!success) { + setRedeeming(false) + return + } } const balanceChanges: BalanceChange[] = []