Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Cancel claim all transaction #425

Merged
merged 1 commit into from
Aug 15, 2023
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <INSERT API TOKEN>
```
- Install Pods
```bash
yarn pod-install
Expand Down
11 changes: 8 additions & 3 deletions src/features/collectables/ClaimAllRewardsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -50,7 +50,7 @@ const ClaimAllRewardsScreen = () => {
}),
})

if (!decision) return
if (!decision) return false
const signed = await anchorProvider.wallet.signTransaction(
hntSolConvertTransaction,
)
Expand All @@ -62,6 +62,7 @@ const ClaimAllRewardsScreen = () => {
},
'confirmed',
)
return true
}, [
anchorProvider,
hntSolConvertTransaction,
Expand Down Expand Up @@ -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[] = []
Expand Down
Loading