Skip to content

Commit

Permalink
v3.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Sep 13, 2024
1 parent 75fd389 commit bfd0e99
Show file tree
Hide file tree
Showing 23 changed files with 134 additions and 49 deletions.
1 change: 1 addition & 0 deletions changelogs/3.0.13.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bug fixes and performance improvements
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mytonwallet",
"version": "3.0.12",
"version": "3.0.13",
"description": "The most feature-rich web wallet and browser extension for TON – with support of multi-accounts, tokens (jettons), NFT, TON DNS, TON Sites, TON Proxy, and TON Magic.",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions public/static-sites/go/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ <h1>Open <span class="gradient-text">MyTonWallet</span></h1>
} = location;

const redirectTo = `${pathname.slice(1)}${search}`;
const protocol = redirectTo.startsWith('transfer') ? 'ton://' : 'mtw://';

document.getElementById('btn-sign-in').href = `mtw://${redirectTo}`;
document.getElementById('btn-sign-in').href = `${protocol}${redirectTo}`;

if (!search?.includes('no-redirect')) {
location.href = `mtw://${redirectTo}`;
location.href = `${protocol}${redirectTo}`;
history.replaceState({}, '', `${pathname}${search}${search ? '&' : '?'}no-redirect`);
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion public/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.12
3.0.13
4 changes: 4 additions & 0 deletions src/api/methods/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,13 @@ export async function importNewWalletVersion(accountId: string, version: ApiWall

const newAddress = publicKeyToAddress(network, publicKey, version);
const newAccountId = await getNewAccountId(network);

const ledger = account.ledger;
const newAccount: ApiAccount = {
address: newAddress,
publicKey: account.publicKey,
version,
ledger,
};

await Promise.all([
Expand All @@ -166,6 +169,7 @@ export async function importNewWalletVersion(accountId: string, version: ApiWall
return {
accountId: newAccountId,
address: newAddress,
ledger,
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/api/methods/nfts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ export async function submitNftTransfers(
createLocalTransaction(accountId, {
amount: message.amount,
fromAddress,
toAddress: message.toAddress,
toAddress,
comment,
fee,
slug: TONCOIN_SLUG,
normalizedAddress: message.toAddress,
inMsgHash: result.msgHash,
type: 'nftTransferred',
nft: nfts?.[i],
Expand Down
12 changes: 9 additions & 3 deletions src/api/methods/polling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import type {
OnApiUpdate,
} from '../types';

import { DEFAULT_PRICE_CURRENCY, POPULAR_WALLET_VERSIONS, TONCOIN_SLUG } from '../../config';
import {
DEFAULT_PRICE_CURRENCY, LEDGER_WALLET_VERSIONS, POPULAR_WALLET_VERSIONS, TONCOIN_SLUG,
} from '../../config';
import { parseAccountId } from '../../util/account';
import { areDeepEqual } from '../../util/areDeepEqual';
import { compareActivities } from '../../util/compareActivities';
Expand Down Expand Up @@ -573,12 +575,13 @@ export async function setupWalletVersionsPolling(accountId: string) {
const localOnUpdate = onUpdate;

const {
address, publicKey, version, isInitialized,
address, publicKey, version, isInitialized, ledger,
} = await fetchStoredAccount(accountId);
const publicKeyBytes = hexToBytes(publicKey);
const { network } = parseAccountId(accountId);

const versions = POPULAR_WALLET_VERSIONS.filter((value) => value !== version);
const walletVersions = ledger ? LEDGER_WALLET_VERSIONS : POPULAR_WALLET_VERSIONS;
const versions = walletVersions.filter((value) => value !== version);
let lastResult: ApiWalletInfo[] | undefined;

let shouldCheckV4 = false;
Expand All @@ -588,6 +591,9 @@ export async function setupWalletVersionsPolling(accountId: string) {
const { lastTxId } = await ton.getWalletInfo(network, address);
shouldCheckV4 = !lastTxId;
}
if (ledger) {
shouldCheckV4 = true;
}

while (isAlive(localOnUpdate, accountId)) {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/components/auth/AuthImportMnemonic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ const AuthImportMnemonic = ({ isActive, isLoading, error }: OwnProps & StateProp
});

useEffect(() => {
return isSubmitDisabled
return isSubmitDisabled || isLoading
? undefined
: captureKeyboardListeners({
onEnter: handleSubmit,
});
}, [afterImportMnemonic, handleSubmit, isSubmitDisabled, mnemonic]);
}, [afterImportMnemonic, handleSubmit, isLoading, isSubmitDisabled, mnemonic]);

return (
<div className={buildClassName(styles.container, styles.container_scrollable, 'custom-scroll')}>
Expand Down
18 changes: 15 additions & 3 deletions src/components/explore/hooks/useDappBridge.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import type {
AppRequest, ConnectEvent,
ConnectEventError, ConnectRequest, DeviceInfo, RpcMethod, WalletEvent,
AppRequest,
ConnectEvent,
ConnectEventError,
ConnectRequest,
DeviceInfo,
RpcMethod,
WalletEvent,
WalletResponse,
} from '@tonconnect/protocol';
import { BottomSheet } from 'native-bottom-sheet';
import { useMemo, useRef, useState } from '../../../lib/teact/teact';
import { getGlobal } from '../../../global';
import { getActions, getGlobal } from '../../../global';

import type { CustomInAppBrowserObject } from './useWebViewBridge';
import { CONNECT_EVENT_ERROR_CODES, SEND_TRANSACTION_ERROR_CODES } from '../../../api/tonConnect/types';
Expand Down Expand Up @@ -36,6 +41,8 @@ interface OwnProps {
export function useDappBridge({
endpoint,
}: OwnProps) {
const { openLoadingOverlay, closeLoadingOverlay } = getActions();

// eslint-disable-next-line no-null/no-null
const inAppBrowserRef = useRef<CustomInAppBrowserObject>(null);
const [requestId, setRequestId] = useState(0);
Expand Down Expand Up @@ -67,12 +74,17 @@ export function useDappBridge({
await BottomSheet.enable();
}

openLoadingOverlay();

const response = await callApi(
'tonConnect_connect',
buildDappRequest(origin),
request,
requestId,
);

closeLoadingOverlay();

if (IS_DELEGATING_BOTTOM_SHEET) {
await BottomSheet.disable();
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/main/sections/Content/Token.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,6 @@
-webkit-text-fill-color: transparent;

:global(.theme-dark) & {
background-image: linear-gradient(81.88deg, #44B5ED 19.42%, #2CD36F 71.55%);
background-image: linear-gradient(81.88deg, #58AFFF 19.42%, #2CD36F 71.55%);
}
}
4 changes: 4 additions & 0 deletions src/components/settings/Settings.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,10 @@ a.item:hover {
color: var(--color-black);
}

.walletVersionAddress {
white-space: nowrap;
}

.walletVersionAddress,
.walletVersionAmount {
font-size: 0.75rem;
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ function Settings({
<i className={buildClassName(styles.iconChevronRight, 'icon-chevron-right')} aria-hidden />
</div>
)}
{!!versions?.length && !isHardwareAccount && (
{!!versions?.length && (
<div className={styles.item} onClick={handleOpenWalletVersion}>
<img className={styles.menuIcon} src={walletVersionImg} alt={lang('Wallet Versions')} />
{lang('Wallet Versions')}
Expand Down
9 changes: 8 additions & 1 deletion src/components/transfer/TransferComplete.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { memo } from '../../lib/teact/teact';
import React, { memo, useEffect } from '../../lib/teact/teact';
import { getActions } from '../../global';

import type { ApiNft } from '../../api/types';

import { TONCOIN_SLUG } from '../../config';
import buildClassName from '../../util/buildClassName';
import captureKeyboardListeners from '../../util/captureKeyboardListeners';
import { ANIMATED_STICKERS_PATHS } from '../ui/helpers/animatedAssets';

import { useDeviceScreen } from '../../hooks/useDeviceScreen';
Expand Down Expand Up @@ -68,6 +69,12 @@ function TransferComplete({
onBack: onClose,
});

useEffect(() => {
return isActive
? captureKeyboardListeners({ onEnter: onClose })
: undefined;
}, [isActive, onClose]);

const handleTransactionRepeatClick = useLastCallback(() => {
startTransfer({
isPortrait,
Expand Down
8 changes: 3 additions & 5 deletions src/components/ui/PasswordForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,10 @@ function PasswordForm({
});

useEffect(() => {
return isSubmitDisabled
return isSubmitDisabled || isLoading
? undefined
: captureKeyboardListeners({
onEnter: handleSubmit,
});
}, [handleSubmit, isSubmitDisabled]);
: captureKeyboardListeners({ onEnter: handleSubmit });
}, [handleSubmit, isLoading, isSubmitDisabled]);

function getPinPadTitle() {
switch (operationType) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/vesting/VestingModal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
-webkit-text-fill-color: transparent;

:global(.theme-dark) & {
background: linear-gradient(81.88deg, #44B5ED 19.42%, #2CD36F 71.55%);
background: linear-gradient(81.88deg, #58AFFF 19.42%, #2CD36F 71.55%);
background-clip: text;

-webkit-text-fill-color: transparent;
Expand Down Expand Up @@ -294,7 +294,7 @@
background-size: 100%;

:global(.theme-dark) & {
background-image: linear-gradient(81.88deg, #0C9EE8 19.42%, #2CD36F 71.55%);
background-image: linear-gradient(81.88deg, #469CEC 19.42%, #2CD36F 71.55%);
}
}
}
Expand Down Expand Up @@ -326,7 +326,7 @@
background-size: 100%;

:global(.theme-dark) & {
background-image: linear-gradient(81.88deg, #0C9EE8 19.42%, #2CD36F 71.55%);
background-image: linear-gradient(81.88deg, #469CEC 19.42%, #2CD36F 71.55%);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export const BURN_ADDRESS = 'UQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJKZ';

export const DEFAULT_WALLET_VERSION: ApiWalletVersion = 'W5';
export const POPULAR_WALLET_VERSIONS: ApiWalletVersion[] = ['v3R1', 'v3R2', 'v4R2', 'W5'];
export const LEDGER_WALLET_VERSIONS: ApiWalletVersion[] = ['v3R2', 'v4R2'];

export const DEFAULT_TIMEOUT = 10000;
export const DEFAULT_RETRIES = 3;
Expand Down
11 changes: 10 additions & 1 deletion src/global/actions/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,16 @@ addActionHandler('importAccountByVersion', async (global, actions, { version })
const { title: currentWalletTitle } = (global.accounts?.byId ?? {})[accountId];

global = updateCurrentAccountId(global, wallet!.accountId);
global = createAccount(global, wallet!.accountId, wallet!.address, { title: currentWalletTitle }, version);

const ledgerInfo = wallet!.ledger ? {
isHardware: true,
ledger: wallet?.ledger,
} : undefined;

global = createAccount(global, wallet!.accountId, wallet!.address, {
title: currentWalletTitle,
...ledgerInfo,
}, version);
setGlobal(global);
});

Expand Down
2 changes: 2 additions & 0 deletions src/global/actions/api/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ addActionHandler('cancelSwap', (global, actions, { shouldReset } = {}) => {
swapFee: '0',
networkFee: 0,
realNetworkFee: 0,
amountIn: '0',
amountOutMin: '0',
amountOut: '0',
inputSource: SwapInputSource.In,
swapType,
pairs,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useVesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function useVesting({ vesting, userMycoin }: { vesting?: ApiVesti
const {
shouldRender,
transitionClassNames,
} = useShowTransition(Boolean(hasVesting && isMycoinLoaded && userMycoin));
} = useShowTransition(Boolean(hasVesting && isMycoinLoaded && userMycoin && amount !== '0'));

const onVestingTokenClick = useLastCallback(() => {
openVestingModal();
Expand Down
14 changes: 7 additions & 7 deletions src/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@

&:global(.theme-dark),
:global(.component-theme-dark) {
--color-blue: #0C9EE8;
--color-blue: #469CEC;
--color-black: #DCEEFF;
--color-gray-1: #A3B8CA;
--color-gray-2: #8799B3;
Expand All @@ -219,7 +219,7 @@
--color-green-2: #79A28B;
--color-purple-1: #95A0FE;
--color-purple-2: #7986F7;
--color-blue-10o: #0C9EE81A;
--color-blue-10o: #469CEC1A;

--color-background-first: #1E2732;
--color-background-first-disabled: #1A2129;
Expand All @@ -236,8 +236,8 @@

--color-input-hint: #435362;

--color-blue-button-background: #0C9EE8;
--color-blue-button-background-hover: #39BAFB;
--color-blue-button-background: #469CEC;
--color-blue-button-background-hover: #51A7F7;

--color-red-button-background: #D74A4A;
--color-red-button-background-hover: #F35B5B;
Expand Down Expand Up @@ -317,9 +317,9 @@
--color-background-blue-second: #133950;
--color-vesting-close-background: #124B6B;
--color-vesting-close-background-hover: #105F89;
--color-vesting-blue: #0C9EE8;
--color-vesting-blue-hover: #28AAEA;
--color-vesting-text: #34B5F6;
--color-vesting-blue: #469CEC;
--color-vesting-blue-hover: #51A7F7;
--color-vesting-text: #58AFFF;
--color-vesting-background: #115073;
}
}
13 changes: 13 additions & 0 deletions src/util/deeplink/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum DeeplinkCommand {
BuyWithCrypto = 'buy-with-crypto',
BuyWithCard = 'buy-with-card',
Stake = 'stake',
Transfer = 'transfer',
}

let urlAfterSignIn: string | undefined;
Expand Down Expand Up @@ -286,6 +287,18 @@ export function processSelfDeeplink(deeplink: string) {
}
break;
}

case DeeplinkCommand.Transfer: {
let tonDeeplink = deeplink;
SELF_UNIVERSAL_URLS.forEach((prefix) => {
if (tonDeeplink.startsWith(prefix)) {
tonDeeplink = tonDeeplink.replace(prefix, TON_PROTOCOL);
}
});

processTonDeeplink(tonDeeplink);
break;
}
}
} catch (err) {
logDebugError('processSelfDeeplink', err);
Expand Down
Loading

0 comments on commit bfd0e99

Please sign in to comment.