From 3ac9a0f1353b098e263493cf6aad917721d546a4 Mon Sep 17 00:00:00 2001 From: Andrey Sorokin Date: Wed, 15 May 2024 16:24:33 +0500 Subject: [PATCH] fix(mobile): 4.5.0 qa fixes (#853) --- .../AccessConfirmation/AccessConfirmation.tsx | 3 ++- packages/mobile/src/modals/BurnVouchersModal.tsx | 16 +--------------- packages/mobile/src/store/wallet/sagas.ts | 2 +- .../WalletActionButtons/WalletActionButtons.tsx | 12 ++++++++---- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/packages/mobile/src/core/AccessConfirmation/AccessConfirmation.tsx b/packages/mobile/src/core/AccessConfirmation/AccessConfirmation.tsx index 33a965c81..0ce977d0e 100644 --- a/packages/mobile/src/core/AccessConfirmation/AccessConfirmation.tsx +++ b/packages/mobile/src/core/AccessConfirmation/AccessConfirmation.tsx @@ -125,7 +125,8 @@ export const AccessConfirmation: FC = () => { try { const promise = getCurrentConfirmationVaultPromise(); - const walletForUnlock = isUnlock ? tk.walletForUnlock : wallet; + const walletForUnlock = + isUnlock || wallet.isWatchOnly || wallet.isExternal ? tk.walletForUnlock : wallet; const passcode = await vault.exportPasscodeWithBiometry(); const mnemonic = await vault.exportWithPasscode( walletForUnlock.identifier, diff --git a/packages/mobile/src/modals/BurnVouchersModal.tsx b/packages/mobile/src/modals/BurnVouchersModal.tsx index b18efe686..37306db02 100644 --- a/packages/mobile/src/modals/BurnVouchersModal.tsx +++ b/packages/mobile/src/modals/BurnVouchersModal.tsx @@ -1,4 +1,3 @@ -import { useNavigation } from '@tonkeeper/router'; import { Button, Icon, @@ -26,17 +25,6 @@ import { Ton } from '$libs/Ton'; import { BatterySupportedTransaction } from '$wallet/managers/BatteryManager'; import { Address, beginCell, toNano } from '@ton/core'; import { checkBurnDate, getNotcoinBurnAddress } from '$utils/notcoin'; -import nacl from 'tweetnacl'; - -function getRandomUint64(): bigint { - const buffer = nacl.randomBytes(8); - let result = BigInt(0); - for (let i = 0; i < buffer.length; i++) { - result += BigInt(buffer[i]) << BigInt(8 * i); - } - - return result; -} interface BurnVouchersModalProps { max?: boolean; @@ -45,8 +33,6 @@ interface BurnVouchersModalProps { export const BurnVouchersModal = memo((props) => { const { max = false } = props; - const nav = useNavigation(); - const nfts = useNftsState((s) => Object.values(s.accountNfts).filter( (nft) => @@ -97,7 +83,7 @@ export const BurnVouchersModal = memo((props) => { .storeCoins(toNano('0.05')) .storeBit(false) .storeUint(0x5fec6642, 32) - .storeUint(getRandomUint64(), 64) + .storeUint(nft.index, 64) .endCell() .toBoc() .toString('base64'), diff --git a/packages/mobile/src/store/wallet/sagas.ts b/packages/mobile/src/store/wallet/sagas.ts index a6377c184..a443b9ae2 100644 --- a/packages/mobile/src/store/wallet/sagas.ts +++ b/packages/mobile/src/store/wallet/sagas.ts @@ -435,7 +435,7 @@ export function* walletGetUnlockedVault(action?: WalletGetUnlockedVaultAction) { try { const wallet = action?.payload?.walletIdentifier ? tk.wallets.get(action.payload.walletIdentifier)! - : tk.wallet; + : tk.walletForUnlock; let withoutBiometryOnOpen = false; diff --git a/packages/mobile/src/tabs/Wallet/components/WalletActionButtons/WalletActionButtons.tsx b/packages/mobile/src/tabs/Wallet/components/WalletActionButtons/WalletActionButtons.tsx index 689cd1eaf..92257e024 100644 --- a/packages/mobile/src/tabs/Wallet/components/WalletActionButtons/WalletActionButtons.tsx +++ b/packages/mobile/src/tabs/Wallet/components/WalletActionButtons/WalletActionButtons.tsx @@ -59,16 +59,20 @@ export const WalletActionButtons = memo(() => { const handlePressScanQR = React.useCallback(() => { if (store.getState().wallet.wallet) { - openScanQR((address) => { - if (Address.isValid(address)) { + openScanQR((value) => { + if (Address.isValid(value)) { setTimeout(() => { - openSend({ currency: CryptoCurrencies.Ton, address }); + openSend({ currency: CryptoCurrencies.Ton, address: value }); }, 200); return true; } - const resolver = deeplinking.getResolver(address, { + if (value.startsWith('tonkeeper://signer/link')) { + return; + } + + const resolver = deeplinking.getResolver(value, { delay: 200, origin: DeeplinkOrigin.QR_CODE, });