Skip to content

Commit

Permalink
Hide export tron in case of account bip39
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovNikita committed Jan 7, 2025
1 parent 2692faf commit 15803ab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/core/src/entries/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,23 @@ export function isAccountTronCompatible(
}
}

export function isAccountBip39(account: Account) {
switch (account.type) {
case 'testnet':
case 'mnemonic':
return account.mnemonicType === 'bip39';
case 'mam':
case 'ton-only':
case 'ledger':
case 'watch-only':
case 'ton-multisig':
case 'keystone':
return false;
default:
return assertUnreachable(account);
}
}

export type AccountsState = Account[];

export const defaultAccountState: AccountsState = [];
Expand Down
7 changes: 6 additions & 1 deletion packages/uikit/src/pages/settings/Recovery.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
AccountId,
isAccountBip39,
isAccountTronCompatible,
isMnemonicAndPassword
} from '@tonkeeper/core/dist/entries/account';
Expand Down Expand Up @@ -133,7 +134,11 @@ export const RecoveryContent: FC<{
);
}

const hasTronWallet = account && isAccountTronCompatible(account) && !!account.activeTronWallet;
const hasTronWallet =
account &&
isAccountTronCompatible(account) &&
!!account.activeTronWallet &&
!isAccountBip39(account);

const onShowTron = async () => {
const tronMnemonic = await tonMnemonicToTronMnemonic(mnemonic!);
Expand Down

0 comments on commit 15803ab

Please sign in to comment.