From c301bc0c738a05823659602b1747b1acf4871f58 Mon Sep 17 00:00:00 2001 From: Max Voloshinskii Date: Wed, 15 May 2024 14:24:23 +0300 Subject: [PATCH] fix(mobile): fix TON position (#854) * fix(mobile): stop support tonkeeper domain in manifest * fix(mobile): Move TON to bottom --- packages/mobile/src/tonconnect/TonConnect.ts | 8 +++++++ .../RefillBattery/RechargeMethods.tsx | 18 +++++++-------- .../modals/SelectRechargeMethodModal.tsx | 22 +++++++++---------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/packages/mobile/src/tonconnect/TonConnect.ts b/packages/mobile/src/tonconnect/TonConnect.ts index c34ecc890..88cfb7dd8 100644 --- a/packages/mobile/src/tonconnect/TonConnect.ts +++ b/packages/mobile/src/tonconnect/TonConnect.ts @@ -41,6 +41,7 @@ import { SendTransactionError } from './SendTransactionError'; import { tk } from '$wallet'; import { TonConnectRemoteBridge } from './TonConnectRemoteBridge'; import { WithWalletIdentifier } from '$wallet/WalletTypes'; +import { getDomainFromURL } from '$utils'; class TonConnectService { checkProtocolVersionCapability(protocolVersion: number) { @@ -112,6 +113,13 @@ class TonConnectService { const manifest = await this.getManifest(request); + if (getDomainFromURL(manifest.url) === 'tonkeeper.com') { + throw new ConnectEventError( + CONNECT_EVENT_ERROR_CODES.BAD_REQUEST_ERROR, + 'Bad request', + ); + } + try { const { address, replyItems, notificationsEnabled, walletIdentifier } = await new Promise((resolve, reject) => diff --git a/packages/shared/components/RefillBattery/RechargeMethods.tsx b/packages/shared/components/RefillBattery/RechargeMethods.tsx index 64b6f3ac5..153d6f96f 100644 --- a/packages/shared/components/RefillBattery/RechargeMethods.tsx +++ b/packages/shared/components/RefillBattery/RechargeMethods.tsx @@ -65,15 +65,6 @@ export const RechargeMethods = memo(() => { return ( - {hasTonBalance && ( - } - title={t('battery.other_ways.by_crypto.title', { symbol: 'TON' })} - onPress={handleRechargeBattery(false)} - subtitle={formatter.format(balances.ton, { currency: 'TON' })} - /> - )} {filteredJettonBalances.map((jettonBalance) => ( { })} /> ))} + {hasTonBalance && ( + } + title={t('battery.other_ways.by_crypto.title', { symbol: 'TON' })} + onPress={handleRechargeBattery(false)} + subtitle={formatter.format(balances.ton, { currency: 'TON' })} + /> + )} {hasAnyBalance && ( ( - } - title={'TON'} - onPress={handleSelectJettonMaster(undefined)} - rightContent={ - !props.selectedJettonMaster && ( - - ) - } - subtitle={formatter.format(balances.ton, { currency: 'TON' })} - /> {filteredJettonBalances.map((jettonBalance) => ( ( title={jettonBalance.metadata.symbol} /> ))} + } + title={'TON'} + onPress={handleSelectJettonMaster(undefined)} + rightContent={ + !props.selectedJettonMaster && ( + + ) + } + subtitle={formatter.format(balances.ton, { currency: 'TON' })} + />