Skip to content

Commit

Permalink
fix(mobile): fix TON position (#854)
Browse files Browse the repository at this point in the history
* fix(mobile): stop support tonkeeper domain in manifest

* fix(mobile): Move TON to bottom
  • Loading branch information
voloshinskii authored May 15, 2024
1 parent 35ad5f1 commit c301bc0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
8 changes: 8 additions & 0 deletions packages/mobile/src/tonconnect/TonConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<TonConnectModalResponse>((resolve, reject) =>
Expand Down
18 changes: 9 additions & 9 deletions packages/shared/components/RefillBattery/RechargeMethods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@ export const RechargeMethods = memo(() => {
return (
<View>
<List indent={false}>
{hasTonBalance && (
<List.Item
chevron
leftContent={<TonIcon showDiamond />}
title={t('battery.other_ways.by_crypto.title', { symbol: 'TON' })}
onPress={handleRechargeBattery(false)}
subtitle={formatter.format(balances.ton, { currency: 'TON' })}
/>
)}
{filteredJettonBalances.map((jettonBalance) => (
<List.Item
chevron
Expand All @@ -91,6 +82,15 @@ export const RechargeMethods = memo(() => {
})}
/>
))}
{hasTonBalance && (
<List.Item
chevron
leftContent={<TonIcon showDiamond />}
title={t('battery.other_ways.by_crypto.title', { symbol: 'TON' })}
onPress={handleRechargeBattery(false)}
subtitle={formatter.format(balances.ton, { currency: 'TON' })}
/>
)}
{hasAnyBalance && (
<List.Item
onPress={handleRechargeBattery(true)}
Expand Down
22 changes: 11 additions & 11 deletions packages/shared/modals/SelectRechargeMethodModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ export const SelectRechargeMethodModal = memo<SelectRechargeMethodModalParams>(
<Modal.Header title={t('battery.recharge_by_crypto.tokens')} />
<Modal.Content safeArea>
<List>
<List.Item
leftContent={<TonIcon showDiamond />}
title={'TON'}
onPress={handleSelectJettonMaster(undefined)}
rightContent={
!props.selectedJettonMaster && (
<Icon color={'accentBlue'} name={'ic-donemark-outline-28'} />
)
}
subtitle={formatter.format(balances.ton, { currency: 'TON' })}
/>
{filteredJettonBalances.map((jettonBalance) => (
<List.Item
key={jettonBalance.jettonAddress}
Expand All @@ -76,6 +65,17 @@ export const SelectRechargeMethodModal = memo<SelectRechargeMethodModalParams>(
title={jettonBalance.metadata.symbol}
/>
))}
<List.Item
leftContent={<TonIcon showDiamond />}
title={'TON'}
onPress={handleSelectJettonMaster(undefined)}
rightContent={
!props.selectedJettonMaster && (
<Icon color={'accentBlue'} name={'ic-donemark-outline-28'} />
)
}
subtitle={formatter.format(balances.ton, { currency: 'TON' })}
/>
</List>
</Modal.Content>
</Modal>
Expand Down

0 comments on commit c301bc0

Please sign in to comment.