diff --git a/package.json b/package.json index b7bb14090..f9e752aa2 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "@solana/spl-token-registry": "0.2.4574", "@solana/wallet-adapter-react": "0.15.33", "@solana/wallet-standard-features": "1.0.0", - "@solana/web3.js": "1.64.0", + "@solana/web3.js": "1.67.2", "@tradle/react-native-http": "2.0.1", "@turf/bbox": "6.5.0", "@turf/center": "6.5.0", diff --git a/src/features/account/AccountTokenScreen.tsx b/src/features/account/AccountTokenScreen.tsx index 4bccd218f..a27390a38 100644 --- a/src/features/account/AccountTokenScreen.tsx +++ b/src/features/account/AccountTokenScreen.tsx @@ -33,6 +33,7 @@ import Animated, { useSharedValue, } from 'react-native-reanimated' import { useSafeAreaInsets } from 'react-native-safe-area-context' +import { useModal } from '@storage/ModalsProvider' import { useSolana } from '../../solana/SolanaProvider' import { useAccountStorage } from '../../storage/AccountStorageProvider' import { Activity } from '../../types/activity' @@ -67,9 +68,10 @@ const AccountTokenScreen = () => { const [topHeaderYPos, setTopHeaderYPos] = useState(0) const [headerContainerYPos, setHeaderContainerYPos] = useState(0) const listAnimatedPos = useSharedValue(0) - const { cluster } = useSolana() + const { cluster, isDevnet } = useSolana() const insets = useSafeAreaInsets() const colors = useColors() + const { showModal } = useModal() const [ onEndReachedCalledDuringMomentum, setOnEndReachedCalledDuringMomentum, @@ -496,6 +498,7 @@ const AccountTokenScreen = () => { {mint.equals(NATIVE_MINT) && + !isDevnet && (amount || 0) < 0.02 * LAMPORTS_PER_SOL ? ( { {t('accountsScreen.solWarning')} + showModal({ type: 'InsufficientSolConversion' })} + > + + {t('accountsScreen.solSwap')} + + ) : ( diff --git a/src/hooks/useSimulatedTransaction.ts b/src/hooks/useSimulatedTransaction.ts index 86e102b9a..37a9ff419 100644 --- a/src/hooks/useSimulatedTransaction.ts +++ b/src/hooks/useSimulatedTransaction.ts @@ -3,7 +3,6 @@ import { AccountLayout, NATIVE_MINT, TOKEN_PROGRAM_ID } from '@solana/spl-token' import { AddressLookupTableAccount, Connection, - Message, LAMPORTS_PER_SOL, ParsedAccountData, PublicKey, @@ -79,9 +78,7 @@ export function useSimulatedTransaction( } try { - fee = - (await c?.getFeeForMessage(t.message as Message, 'confirmed')) - .value || fee + fee = (await c?.getFeeForMessage(t.message, 'confirmed')).value || fee } catch (err) { logger.error(err) } @@ -134,6 +131,7 @@ export function useSimulatedTransaction( ), ), ] + const { blockhash } = await connection?.getLatestBlockhash() transaction.message.recentBlockhash = blockhash const result = await connection?.simulateTransaction(transaction, { diff --git a/src/locales/en.ts b/src/locales/en.ts index d20977d5a..63c76ad12 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -176,6 +176,7 @@ export default { }, solWarning: 'Your balance may not have enough SOL to cover all transactions. Solana wallets require a minimum of 0.00089088 SOL. We recommend keeping greater than 0.02 sol in your wallet for the best experience', + solSwap: 'Swap Tokens To SOL', hideFilters: 'Hide Filters', myTransactions: 'My Transactions', showFilters: 'Show Filters', @@ -389,7 +390,7 @@ export default { }, insufficientSolConversionModal: { title: 'Insufficient SOL', - body: 'You currently dont have enough SOL to perform this action. Please swap one of the following tokens to receive more SOL in order to continue. Tokens that you dont have any balance in will be disabled.', + body: 'Please swap one of the following tokens to receive more SOL in order to continue. Tokens that you dont have any balance in will be disabled.', noBalance: 'You currently dont hold a balance of any of the tokens supported by this swap.', }, diff --git a/yarn.lock b/yarn.lock index ab5889045..efe5b4454 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4241,10 +4241,10 @@ "@wallet-standard/app" "^1.0.1" "@wallet-standard/base" "^1.0.1" -"@solana/web3.js@1.64.0": - version "1.64.0" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.64.0.tgz#b7f5a976976039a0161242e94d6e1224ab5d30f9" - integrity sha512-AcFaoy48GxSmzBryVwB88C/UPJd/UQa+nFrO/uPc8ww6RCjanZY2vEZxdfTZub+q1NMUckwXpPwF32jJLe7SPA== +"@solana/web3.js@1.67.2": + version "1.67.2" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.67.2.tgz#6832139fb906ff2fb13390a81afab04d35b8aa0c" + integrity sha512-qfdV0m/qcTpoJsIwonvXJQz8YY5mrSfBVLS/Cp+MPaaUzDzkpSV7WU1QeHsj+dkHX82W37zuhhg/DadRJls7+g== dependencies: "@babel/runtime" "^7.12.5" "@noble/ed25519" "^1.7.0"