Skip to content

Commit

Permalink
Bugfix/jup error (#836)
Browse files Browse the repository at this point in the history
* bump deps (#821)

* bump deps 0.9.12 (#822)

* Fix getPositionKeysForOwner args (#823)

* 2.10.1

* update hooks to use prop conditional when fetching new output (#824)

* Fix bug when claiming all with custom destination (#832)

* Show jupiter error before tx error

---------

Co-authored-by: Bryan <[email protected]>
  • Loading branch information
ChewingGlass and bryzettler authored Dec 4, 2024
1 parent 5e28346 commit 538b3a3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@graphql-codegen/typescript-rtk-query": "^3.1.1",
"@helium/account-fetch-cache": "0.9.7",
"@helium/account-fetch-cache-hooks": "0.9.7",
"@helium/account-fetch-cache": "0.9.14",
"@helium/account-fetch-cache-hooks": "0.9.14",
"@helium/address": "4.10.2",
"@helium/circuit-breaker-sdk": "^0.9.14",
"@helium/crypto-react-native": "4.8.0",
Expand Down
25 changes: 18 additions & 7 deletions src/features/swaps/SwapScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ const SwapScreen = () => {
return t('swapsScreen.insufficientTokensToSwap')
if (hasInsufficientBalance) return t('generic.insufficientBalance')
if (networkError) return networkError
if (transactionError) return transactionError
if (jupiterError) return jupiterError
if (transactionError) return transactionError
if (routeNotFound) return t('swapsScreen.routeNotFound')
}, [
hasRecipientError,
Expand Down Expand Up @@ -413,32 +413,43 @@ const SwapScreen = () => {
],
)

useEffect(() => {
setRecipient('')
setRecipientOpen(false)
setOutputAmount(0)
}, [
inputMint,
inputAmount,
outputMint,
setRecipient,
setRecipientOpen,
setOutputAmount,
])

useEffect(() => {
// if changing outputMint ensure we get new routes
;(async () => {
if (
!isDevnet &&
inputMintAcc &&
outputMintAcc &&
inputMintAcc?.address === inputMint &&
outputMintAcc?.address === outputMint &&
typeof inputAmount !== 'undefined' &&
inputAmount > 0 &&
!outputMintAcc?.address.equals(DC_MINT)
) {
setRecipient('')
setRecipientOpen(false)
await getOutputAmount({
balance: toBN(inputAmount || 0, inputMintAcc.decimals),
})
}
})()
}, [
getOutputAmount,
inputMint,
inputAmount,
inputMintAcc,
outputMint,
outputMintAcc,
isDevnet,
setRecipient,
setRecipientOpen,
])

const getInputAmount = useCallback(
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15097,8 +15097,8 @@ __metadata:
"@graphql-codegen/typescript": ^4.0.1
"@graphql-codegen/typescript-operations": ^4.0.1
"@graphql-codegen/typescript-rtk-query": ^3.1.1
"@helium/account-fetch-cache": 0.9.7
"@helium/account-fetch-cache-hooks": 0.9.7
"@helium/account-fetch-cache": 0.9.14
"@helium/account-fetch-cache-hooks": 0.9.14
"@helium/address": 4.10.2
"@helium/circuit-breaker-sdk": ^0.9.14
"@helium/crypto-react-native": 4.8.0
Expand Down

0 comments on commit 538b3a3

Please sign in to comment.