Skip to content

Commit

Permalink
v1.17.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Dec 28, 2023
1 parent 456cce1 commit b4066fc
Show file tree
Hide file tree
Showing 21 changed files with 92 additions and 56 deletions.
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The wallet is **self-custodial and safe**. The developers **do not** have access
- [Requirements](#requirements)
- [Local Setup](#local-setup)
- [Dev Mode](#dev-mode)
- [Installing App on Linux](#installing-app-on-linux)
- [Linux](#linux-desktop)
- [Electron](./docs/electron.md)
- [Verifying GPG Signatures](./docs/gpg-check.md)
- [Support Us](#support-us)
Expand Down Expand Up @@ -39,9 +39,31 @@ npm i
npm run dev
```

## Installing App on Linux
## Linux Desktop Troubleshooting

In order for the application to work correctly and be displayed in the Linux menu, you need to install the AppImage via [AppImageLauncher](https://github.com/TheAssassin/AppImageLauncher)
**If the app does not start after click:**

Install the [FUSE 2 library](https://github.com/AppImage/AppImageKit/wiki/FUSE)

**If the app does not appear in the system menu or does not process ton:// and TON Connect deeplinks:**

Install [AppImageLauncher](https://github.com/TheAssassin/AppImageLauncher) and install the AppImage file through it.

```bash
sudo add-apt-repository ppa:appimagelauncher-team/stable
sudo apt-get update
sudo apt-get install appimagelauncher
```

**If the app does not connect to Ledger:**

Copy the udev rules from the [official repository](https://github.com/LedgerHQ/udev-rules) and run the file `add_udev_rules.sh` with root rights.

```bash
git clone https://github.com/LedgerHQ/udev-rules
cd udev-rules
sudo bash ./add_udev_rules.sh
```

## Support Us

Expand Down
1 change: 1 addition & 0 deletions changelogs/1.17.9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bug fixes
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": "1.17.8",
"version": "1.17.9",
"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
2 changes: 1 addition & 1 deletion public/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.8
1.17.9
31 changes: 20 additions & 11 deletions src/api/blockchains/ton/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import { isAddressInitialized } from './wallet';
const LIQUID_STAKE_AMOUNT = '1';
const LIQUID_UNSTAKE_AMOUNT = '1';
const UNSTAKE_AMOUNT = '1';
const MIN_NOMINATORS_AMOUNT = '10001';

export async function checkStakeDraft(
accountId: string,
Expand All @@ -50,10 +49,7 @@ export async function checkStakeDraft(
let result: CheckTransactionDraftResult;
const bigAmount = Big(fromNano(amount));

if (
(staked?.type === 'nominators' && bigAmount.gte(STAKING_MIN_AMOUNT))
|| (staked.type === 'empty' && bigAmount.gte(MIN_NOMINATORS_AMOUNT))
) {
if (staked?.type === 'nominators' && bigAmount.gte(STAKING_MIN_AMOUNT)) {
type = 'nominators';

const poolAddress = backendState.nominatorsPool.address;
Expand Down Expand Up @@ -242,6 +238,12 @@ export async function getStakingState(
}
}

const { loyaltyType } = backendState;
let liquidApy = commonData.liquid.apy;
if (loyaltyType && loyaltyType in commonData.liquid.loyaltyApy) {
liquidApy = commonData.liquid.loyaltyApy[loyaltyType];
}

if (tokenBalance.gt(0) || unstakeAmount.gt(0)) {
const fullTokenAmount = tokenBalance.plus(unstakeAmount);
const amount = Big(currentRate).times(fullTokenAmount).toFixed(DEFAULT_DECIMALS);
Expand All @@ -251,6 +253,7 @@ export async function getStakingState(
tokenAmount: tokenBalance.toFixed(DEFAULT_DECIMALS),
amount: parseFloat(amount),
unstakeRequestAmount: unstakeAmount.toNumber(),
apy: liquidApy,
};
}

Expand All @@ -259,16 +262,22 @@ export async function getStakingState(
const nominators = await nominatorPool.getListNominators();
const currentNominator = nominators.find((n) => n.address === address);

if (currentNominator) {
if (!currentNominator) {
return {
type: 'nominators',
amount: parseFloat(currentNominator.amount),
pendingDepositAmount: parseFloat(currentNominator.pendingDepositAmount),
isUnstakeRequested: currentNominator.withdrawRequested,
type: 'liquid',
tokenAmount: '0',
amount: 0,
unstakeRequestAmount: 0,
apy: liquidApy,
};
}

return { type: 'empty' };
return {
type: 'nominators',
amount: parseFloat(currentNominator.amount),
pendingDepositAmount: parseFloat(currentNominator.pendingDepositAmount),
isUnstakeRequested: currentNominator.withdrawRequested,
};
}

function getPoolContract(network: ApiNetwork, poolAddress: string) {
Expand Down
5 changes: 5 additions & 0 deletions src/api/types/backend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Decentralized swap of TON and tokens
import type { ApiLoyaltyType } from './misc';

export type ApiSwapEstimateRequest = {
from: string;
to: string;
Expand Down Expand Up @@ -124,6 +126,9 @@ export type ApiStakingCommonData = {
collection?: string;
apy: number;
available: string;
loyaltyApy: {
[key in ApiLoyaltyType]: number;
};
};
round: {
start: number;
Expand Down
6 changes: 4 additions & 2 deletions src/api/types/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ export type ApiStakingState = {
tokenAmount: string;
amount: number;
unstakeRequestAmount: number;
} | {
type: 'empty';
apy: number;
};

export interface ApiNominatorsPool {
Expand All @@ -116,6 +115,7 @@ export interface ApiBackendStakingState {
balance: number;
totalProfit: number;
nominatorsPool: ApiNominatorsPool;
loyaltyType?: ApiLoyaltyType;
}

export type ApiStakingHistory = {
Expand Down Expand Up @@ -179,3 +179,5 @@ export enum ApiLiquidUnstakeMode {
Instant,
BestRate,
}

export type ApiLoyaltyType = 'black' | 'platinum' | 'gold' | 'silver' | 'standard';
4 changes: 3 additions & 1 deletion src/components/main/sections/Actions/PortraitActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { getActions } from '../../../../global';

import { ElectronEvent } from '../../../../electron/types';

import { IS_CAPACITOR } from '../../../../config';
import buildClassName from '../../../../util/buildClassName';
import { clearLaunchUrl, getLaunchUrl } from '../../../../util/capacitor';
import { processDeeplink } from '../../../../util/processDeeplink';
import { IS_IOS } from '../../../../util/windowEnvironment';

import useLang from '../../../../hooks/useLang';
import useLastCallback from '../../../../hooks/useLastCallback';
Expand All @@ -32,7 +34,7 @@ function PortraitActions({

const lang = useLang();

const isSwapAllowed = !(isTestnet || isLedger);
const isSwapAllowed = !(isTestnet || isLedger || (IS_IOS && IS_CAPACITOR));
const isStakingAllowed = !(isTestnet || isLedger);

useEffect(() => {
Expand Down
5 changes: 2 additions & 3 deletions src/components/main/sections/Card/AccountSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ function AccountSelector({

const accountsAmount = useMemo(() => Object.keys(accounts || {}).length, [accounts]);
const shouldRenderQrScannerButton = Boolean(onQrScanPress);
const shouldRenderSettingsButton = !noSettingsButton && !shouldRenderQrScannerButton;

useEffect(() => {
if (isOpen && forceClose) {
Expand Down Expand Up @@ -163,7 +162,7 @@ function AccountSelector({
const accountTitleClassName = buildClassName(
styles.accountTitle,
accountClassName,
shouldRenderQrScannerButton && shouldRenderSettingsButton && styles.accountTitleShort,
shouldRenderQrScannerButton && !noSettingsButton && styles.accountTitleShort,
);
const settingsButtonClassName = buildClassName(
styles.menuButton,
Expand All @@ -179,7 +178,7 @@ function AccountSelector({
{currentAccount?.title || shortenAddress(currentAccount?.address || '')}
</div>
)}
{shouldRenderSettingsButton && (
{!noSettingsButton && (
<Button
className={settingsButtonClassName}
isText
Expand Down
4 changes: 2 additions & 2 deletions src/components/main/sections/Card/StickyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { UserToken } from '../../../../global/types';
import { selectCurrentAccountTokens } from '../../../../global/selectors';
import buildClassName from '../../../../util/buildClassName';
import { getShortCurrencySymbol } from '../../../../util/formatNumber';
import { IS_ELECTRON, IS_MAC_OS } from '../../../../util/windowEnvironment';
import { IS_ELECTRON, IS_MAC_OS, IS_WINDOWS } from '../../../../util/windowEnvironment';
import { buildTokenValues } from './helpers/buildTokenValues';

import AccountSelector from './AccountSelector';
Expand Down Expand Up @@ -45,7 +45,7 @@ function StickyCard({
accountClassName={styles.account}
accountSelectorClassName="sticky-card-account-selector"
menuButtonClassName={styles.menuButton}
noSettingsButton
noSettingsButton={(IS_ELECTRON && IS_WINDOWS) || Boolean(onQrScanPress)}
noAccountSelector={IS_ELECTRON && IS_MAC_OS}
onQrScanPress={onQrScanPress}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/main/sections/Content/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function Swap({
// Skip the 'waiting' status for transactions from TON to account for delayed status updates from changelly.
text = lang('Waiting for payment');
} else if (isPending) {
text = lang('Waiting for payment');
text = lang('In progress');
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const PROXY_HOSTS = process.env.PROXY_HOSTS;

export const TINY_TRANSFER_MAX_COST = 0.01;

export const LANG_CACHE_NAME = 'mtw-lang-55';
export const LANG_CACHE_NAME = 'mtw-lang-56';

export const LANG_LIST: LangItem[] = [{
langCode: 'en',
Expand Down
32 changes: 9 additions & 23 deletions src/global/actions/apiUpdates/initial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,18 @@ addActionHandler('apiUpdate', (global, actions, update) => {
}, true);
} else {
const isPrevRoundUnlocked = Date.now() > stakingCommonData.prevRound.unlock;
const state = {

balance = stakingState.amount;
global = updateAccountStakingState(global, accountId, {
type: stakingState.type,
balance,
isUnstakeRequested: !!stakingState.unstakeRequestAmount,
unstakeRequestedAmount: Number(stakingState.unstakeRequestAmount),
start: isPrevRoundUnlocked ? stakingCommonData.round.start : stakingCommonData.prevRound.start,
end: isPrevRoundUnlocked ? stakingCommonData.round.unlock : stakingCommonData.prevRound.unlock,
apy: stakingCommonData.liquid.apy,
apy: stakingState.apy,
totalProfit: backendStakingState.totalProfit,
};

if (stakingState.type === 'liquid') {
balance = stakingState.amount;
global = updateAccountStakingState(global, accountId, {
type: stakingState.type,
balance,
isUnstakeRequested: !!stakingState.unstakeRequestAmount,
unstakeRequestedAmount: Number(stakingState.unstakeRequestAmount),
...state,
}, true);
} else {
balance = 0;
global = updateAccountStakingState(global, accountId, {
type: 'liquid',
balance,
isUnstakeRequested: false,
unstakeRequestedAmount: undefined,
...state,
}, true);
}
}, true);
}

let shouldOpenStakingInfo = false;
Expand Down
7 changes: 4 additions & 3 deletions src/hooks/useInfiniteScroll.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef } from '../lib/teact/teact';
import { useRef } from '../lib/teact/teact';

import { LoadMoreDirection } from '../global/types';

Expand All @@ -7,6 +7,7 @@ import useForceUpdate from './useForceUpdate';
import useLastCallback from './useLastCallback';
import usePrevious from './usePrevious';
import usePrevious2 from './usePrevious2';
import useSyncEffect from './useSyncEffect';

type GetMore = (args: { direction: LoadMoreDirection }) => void;
type ResetScroll = () => void;
Expand Down Expand Up @@ -62,8 +63,8 @@ const useInfiniteScroll = <ListId extends string | number>(
requestParamsRef.current = {};
});

useEffect(() => {
if (!isActive && slug !== prevSlug) {
useSyncEffect(() => {
if (!isActive || slug !== prevSlug) {
resetScroll();
}
}, [isActive, prevSlug, resetScroll, slug]);
Expand Down
1 change: 1 addition & 0 deletions src/i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ Failed: Failed
Refunded: Refunded
On hold: On hold
Expired: Expired
In progress: In progress
Waiting for Payment: Waiting for Payment
Waiting for payment: Waiting for payment
Blockchain: Blockchain
Expand Down
1 change: 1 addition & 0 deletions src/i18n/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ Failed: Fallido
Refunded: Reembolsado
On hold: En espera
Expired: Expirado
In progress: En progreso
Waiting for Payment: Esperando el pago
Waiting for payment: Esperando el pago
Blockchain: Blockchain
Expand Down
1 change: 1 addition & 0 deletions src/i18n/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ Failed: Ошибка
Refunded: Возвращено
On hold: Удержан
Expired: Истёк
In progress: В процессе
Waiting for Payment: Ожидание оплаты
Waiting for payment: Ожидание оплаты
Blockchain: Блокчейн
Expand Down
1 change: 1 addition & 0 deletions src/i18n/zh-Hans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ Failed: 失败
Refunded: 退款
On hold: 持有
Expired: 过期
In progress: 进行中
Waiting for Payment: 等待付款
Waiting for payment: 等待付款
Blockchain: 区块链
Expand Down
1 change: 1 addition & 0 deletions src/i18n/zh-Hant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ Failed: 失敗
Refunded: 退款
On hold: 持有
Expired: 過期
In progress: 進行中
Waiting for Payment: 等待付款
Waiting for payment: 等待付款
Blockchain: 區塊鏈
Expand Down
8 changes: 6 additions & 2 deletions src/util/windowSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ function patchSafeAreaProperty() {
}

function getSafeAreaTop() {
return parseInt(getComputedStyle(document.documentElement).getPropertyValue('--safe-area-top-value'), 10);
const value = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--safe-area-top-value'), 10);

return Number.isNaN(value) ? 0 : value;
}

function getSafeAreaBottom() {
return parseInt(getComputedStyle(document.documentElement).getPropertyValue('--safe-area-bottom-value'), 10);
const value = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--safe-area-bottom-value'), 10);

return Number.isNaN(value) ? 0 : value;
}

0 comments on commit b4066fc

Please sign in to comment.