Skip to content

Commit

Permalink
BUG 3
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovNikita committed Nov 25, 2024
1 parent b258ce6 commit c6dc7d0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
42 changes: 20 additions & 22 deletions packages/core/src/service/walletService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { AuthKeychain, AuthPassword, MnemonicType } from '../entries/password';
import {
WalletVersion,
WalletVersions,
sortWalletsByVersion,
TonWalletStandard,
DerivationItemNamed,
WalletId
Expand Down Expand Up @@ -83,32 +82,30 @@ export const createReadOnlyTonAccountByAddress = async (
});
};

const getWalletId = (rawAddress: string, network: Network): WalletId => {
if (network === Network.TESTNET) {
return Address.parseRaw(rawAddress).toString({
urlSafe: true,
bounceable: false,
testOnly: true
});
} else {
return rawAddress;
}
};

export const getTonWalletStandard = (
item: { rawAddress: string; version: WalletVersion },
publicKey: string,
network: Network
): TonWalletStandard => {
if (network === Network.TESTNET) {
return {
id: Address.parseRaw(item.rawAddress).toString({
urlSafe: true,
bounceable: false,
testOnly: true
}),
publicKey,
version: item.version,
rawAddress: item.rawAddress,
network
};
} else {
return {
id: item.rawAddress,
publicKey,
version: item.version,
rawAddress: item.rawAddress,
network
};
}
return {
id: getWalletId(item.rawAddress, network),
publicKey,
version: item.version,
rawAddress: item.rawAddress,
network
};
};

interface CreateWalletContext {
Expand Down Expand Up @@ -677,6 +674,7 @@ export async function getStandardTonWalletVersions({

return versions.map((v, index) => ({
...v,
id: getWalletId(v.address.toRawString(), network),
tonBalance: response.accounts[index].balance,
hasJettons: walletsJettonsBalances[index].balances.some(
b => b.price?.prices && Number(b.balance) > 0
Expand Down
9 changes: 5 additions & 4 deletions packages/uikit/src/pages/settings/Version.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import {
backwardCompatibilityOnlyWalletVersions,
WalletVersion as WalletVersionType,
WalletVersions,
walletVersionText
walletVersionText,
WalletId
} from '@tonkeeper/core/dist/entries/wallet';
import { formatAddress, toShortValue } from '@tonkeeper/core/dist/utils/common';
import {
AccountId,
AccountVersionEditable,
getNetworkByAccount
} from '@tonkeeper/core/dist/entries/account';
import React, { FC } from 'react';
import { FC } from 'react';
import styled from 'styled-components';
import { InnerBody } from '../../components/Body';
import { SubHeader } from '../../components/SubHeader';
Expand Down Expand Up @@ -150,10 +151,10 @@ export const WalletVersionPageContentInternal: FC<{
});
};

const onHideWallet = async (w: { address: Address }) => {
const onHideWallet = async (w: { id: WalletId; address: Address }) => {
hideWallet({
accountId: account.id,
walletId: w.address.toRawString()
walletId: w.id
});
};
if (!wallets) {
Expand Down

0 comments on commit c6dc7d0

Please sign in to comment.