From 95d939ac913b7ba9a9e59a16c0ae0c240402be99 Mon Sep 17 00:00:00 2001 From: mytonwalletorg Date: Tue, 6 Feb 2024 17:08:15 +0100 Subject: [PATCH] v1.18.1 --- changelogs/1.18.1.txt | 1 + package-lock.json | 4 +- package.json | 2 +- public/version.txt | 2 +- src/api/blockchains/ton/util/tonapiio.ts | 3 ++ src/api/blockchains/ton/wallet.ts | 2 +- src/api/methods/polling.ts | 2 +- src/components/Dialogs.module.scss | 3 -- src/components/Dialogs.tsx | 5 +-- .../main/sections/Actions/PortraitActions.tsx | 9 +++- src/components/receive/Content.tsx | 2 +- .../receive/ReceiveModal.module.scss | 7 +++- src/config.ts | 2 +- src/global/actions/api/staking.ts | 4 +- src/global/actions/ui/initial.ts | 4 +- src/i18n/de.yaml | 9 ++-- src/i18n/en.yaml | 9 ++-- src/i18n/es.yaml | 9 ++-- src/i18n/ru.yaml | 9 ++-- src/i18n/tr.yaml | 9 ++-- src/i18n/zh-Hans.yaml | 9 ++-- src/i18n/zh-Hant.yaml | 11 ++--- src/util/clipboard.ts | 42 +++---------------- src/util/fetchWithTimeout.ts | 19 +++++++++ 24 files changed, 91 insertions(+), 87 deletions(-) create mode 100644 changelogs/1.18.1.txt delete mode 100644 src/components/Dialogs.module.scss create mode 100644 src/util/fetchWithTimeout.ts diff --git a/changelogs/1.18.1.txt b/changelogs/1.18.1.txt new file mode 100644 index 00000000..619f4cd5 --- /dev/null +++ b/changelogs/1.18.1.txt @@ -0,0 +1 @@ +Bug fixes and performance improvements diff --git a/package-lock.json b/package-lock.json index 14c26c94..bb1d8256 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mytonwallet", - "version": "1.18.0", + "version": "1.18.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mytonwallet", - "version": "1.18.0", + "version": "1.18.1", "license": "GPL-3.0-or-later", "dependencies": { "@awesome-cordova-plugins/core": "^6.6.0", diff --git a/package.json b/package.json index 0ef02676..484ca610 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mytonwallet", - "version": "1.18.0", + "version": "1.18.1", "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": { diff --git a/public/version.txt b/public/version.txt index 84cc5294..ec6d649b 100644 --- a/public/version.txt +++ b/public/version.txt @@ -1 +1 @@ -1.18.0 +1.18.1 diff --git a/src/api/blockchains/ton/util/tonapiio.ts b/src/api/blockchains/ton/util/tonapiio.ts index f1a2f36f..2f772afe 100644 --- a/src/api/blockchains/ton/util/tonapiio.ts +++ b/src/api/blockchains/ton/util/tonapiio.ts @@ -3,6 +3,7 @@ import { Api, HttpClient } from 'tonapi-sdk-js'; import type { ApiNetwork } from '../../../types'; import { TONAPIIO_MAINNET_URL, TONAPIIO_TESTNET_URL } from '../../../../config'; +import fetchWithTimeout from '../../../../util/fetchWithTimeout'; import { getEnvironment } from '../../../environment'; const MAX_LIMIT = 1000; @@ -20,10 +21,12 @@ function getApi(network: ApiNetwork) { mainnet: new Api(new HttpClient({ baseUrl: TONAPIIO_MAINNET_URL, baseApiParams: { headers }, + customFetch: fetchWithTimeout as typeof fetch, })), testnet: new Api(new HttpClient({ baseUrl: TONAPIIO_TESTNET_URL, baseApiParams: { headers }, + customFetch: fetchWithTimeout as typeof fetch, })), }; } diff --git a/src/api/blockchains/ton/wallet.ts b/src/api/blockchains/ton/wallet.ts index 46f6cf36..ba68b9d0 100644 --- a/src/api/blockchains/ton/wallet.ts +++ b/src/api/blockchains/ton/wallet.ts @@ -61,7 +61,7 @@ export async function getWalletInfo(network: ApiNetwork, walletOrAddress: TonWal const { account_state: accountState, wallet: isWallet, - seqno, + seqno = 0, balance, last_transaction_id: { lt, diff --git a/src/api/methods/polling.ts b/src/api/methods/polling.ts index ac923bba..07807952 100644 --- a/src/api/methods/polling.ts +++ b/src/api/methods/polling.ts @@ -46,7 +46,7 @@ const LONG_BACKEND_POLLING_INTERVAL = 60000; // 1 min const FIRST_TRANSACTIONS_LIMIT = 50; -const NFT_FULL_POLLING_INTERVAL = 30000; // 30 sec +const NFT_FULL_POLLING_INTERVAL = 60000; // 60 sec const NFT_FULL_UPDATE_FREQUNCY = Math.round(NFT_FULL_POLLING_INTERVAL / POLLING_INTERVAL); const DOUBLE_CHECK_TOKENS_PAUSE = 30000; // 30 sec diff --git a/src/components/Dialogs.module.scss b/src/components/Dialogs.module.scss deleted file mode 100644 index a70ff80c..00000000 --- a/src/components/Dialogs.module.scss +++ /dev/null @@ -1,3 +0,0 @@ -.content { - margin-bottom: 2rem; -} diff --git a/src/components/Dialogs.tsx b/src/components/Dialogs.tsx index dc960b6b..6a2f134e 100644 --- a/src/components/Dialogs.tsx +++ b/src/components/Dialogs.tsx @@ -13,7 +13,6 @@ import useLang from '../hooks/useLang'; import Button from './ui/Button'; import Modal from './ui/Modal'; -import styles from './Dialogs.module.scss'; import modalStyles from './ui/Modal.module.scss'; type StateProps = { @@ -27,7 +26,7 @@ const Dialogs: FC = ({ dialogs }) => { const [isModalOpen, openModal, closeModal] = useFlag(); const message = dialogs[dialogs.length - 1]; - const title = lang('Something went wrong.'); + const title = lang('Something went wrong'); useEffect(() => { if (IS_DELEGATING_BOTTOM_SHEET || IS_DELEGATED_BOTTOM_SHEET) { @@ -58,7 +57,7 @@ const Dialogs: FC = ({ dialogs }) => { onClose={closeModal} onCloseAnimationEnd={dismissDialog} > -
+
{renderText(lang(message))}
diff --git a/src/components/main/sections/Actions/PortraitActions.tsx b/src/components/main/sections/Actions/PortraitActions.tsx index bf5f77dd..902a0ab1 100644 --- a/src/components/main/sections/Actions/PortraitActions.tsx +++ b/src/components/main/sections/Actions/PortraitActions.tsx @@ -12,6 +12,7 @@ import { IS_CAPACITOR, TON_TOKEN_SLUG, USDT_TRON_TOKEN_SLUG } from '../../../../ import buildClassName from '../../../../util/buildClassName'; import { clearLaunchUrl, getLaunchUrl } from '../../../../util/capacitor'; import { processDeeplink } from '../../../../util/processDeeplink'; +import { IS_DELEGATING_BOTTOM_SHEET } from '../../../../util/windowEnvironment'; import useFlag from '../../../../hooks/useFlag'; import useLang from '../../../../hooks/useLang'; @@ -110,9 +111,13 @@ function PortraitActions({ onReceiveClick, ]; - await BottomSheet.disable(); + if (IS_DELEGATING_BOTTOM_SHEET) { + await BottomSheet.disable(); + } const result = await ActionSheet.showActions({ options }); - await BottomSheet.enable(); + if (IS_DELEGATING_BOTTOM_SHEET) { + await BottomSheet.enable(); + } actionByIndex[result.index]?.(); }); diff --git a/src/components/receive/Content.tsx b/src/components/receive/Content.tsx index 2cca1b7a..a2d67ced 100644 --- a/src/components/receive/Content.tsx +++ b/src/components/receive/Content.tsx @@ -88,7 +88,7 @@ function Content({
{isLedger && ( -
+
{renderText(lang('$ledger_verify_address'))} {' '} diff --git a/src/components/receive/ReceiveModal.module.scss b/src/components/receive/ReceiveModal.module.scss index 4985b33c..0394ac87 100644 --- a/src/components/receive/ReceiveModal.module.scss +++ b/src/components/receive/ReceiveModal.module.scss @@ -21,6 +21,11 @@ text-align: center; } +.qrCode:not(.qrCodeHidden) + .contentTitle { + margin-top: 1rem; + margin-bottom: 0; +} + .qrCode { position: relative; @@ -125,4 +130,4 @@ .actionButton { max-width: 100% !important; -} \ No newline at end of file +} diff --git a/src/config.ts b/src/config.ts index bab21834..6ac25d87 100644 --- a/src/config.ts +++ b/src/config.ts @@ -107,7 +107,7 @@ export const PROXY_HOSTS = process.env.PROXY_HOSTS; export const TINY_TRANSFER_MAX_COST = 0.01; -export const LANG_CACHE_NAME = 'mtw-lang-63'; +export const LANG_CACHE_NAME = 'mtw-lang-64'; export const LANG_LIST: LangItem[] = [{ langCode: 'en', diff --git a/src/global/actions/api/staking.ts b/src/global/actions/api/staking.ts index 1febdbb1..3d70863b 100644 --- a/src/global/actions/api/staking.ts +++ b/src/global/actions/api/staking.ts @@ -171,7 +171,7 @@ addActionHandler('submitStakingPassword', async (global, actions, payload) => { if (!result) { actions.showDialog({ - message: 'Unstaking was unsuccessful. Try again later', + message: 'Unstaking was unsuccessful. Try again later.', }); global = getGlobal(); @@ -198,7 +198,7 @@ addActionHandler('submitStakingPassword', async (global, actions, payload) => { if (!result) { actions.showDialog({ - message: 'Staking was unsuccessful. Try again later', + message: 'Staking was unsuccessful. Try again later.', }); global = getGlobal(); diff --git a/src/global/actions/ui/initial.ts b/src/global/actions/ui/initial.ts index d5b28a89..b811a76f 100644 --- a/src/global/actions/ui/initial.ts +++ b/src/global/actions/ui/initial.ts @@ -156,11 +156,11 @@ addActionHandler('showError', (global, actions, { error } = {}) => { break; case ApiTransactionError.UnsuccesfulTransfer: - actions.showDialog({ message: 'Transfer was unsuccessful. Try again later' }); + actions.showDialog({ message: 'Transfer was unsuccessful. Try again later.' }); break; case ApiTransactionError.UnsupportedHardwareOperation: - actions.showDialog({ message: 'Unfortunately, this operation is not yet supported by Ledger wallet' }); + actions.showDialog({ message: 'Unfortunately, this operation is not yet supported by Ledger wallet.' }); break; case ApiCommonError.ServerError: diff --git a/src/i18n/de.yaml b/src/i18n/de.yaml index 6dd15864..b5b86c70 100644 --- a/src/i18n/de.yaml +++ b/src/i18n/de.yaml @@ -61,6 +61,7 @@ About: Über Exit: Beenden Remove Wallet: Wallet entfernen Something went wrong.: Etwas ist schiefgegangen. +Something went wrong: Etwas ist schiefgegangen Logo: Logo $about_description1: Kryptowährungen sicher speichern, dezentrale Apps erkunden und Blockchain-Zahlungen mit der **Geschwindigkeit des Lichts** durchführen. $about_description2: Die wallet ist **nicht treuhänderisch und sicher**. Die Entwickler haben **keinen** Zugriff auf Ihre Gelder, Browserverlauf oder andere Informationen. @@ -245,9 +246,9 @@ Staked: Gestakt Unstake Requested: Unstaking angefordert Unstaked: Ungestakt The network fee has slightly changed, try sending again.: Die Netzwerkgebühr hat sich geringfügig geändert, versuchen Sie es erneut zu senden. -Transfer was unsuccessful. Try again later: Die Überweisung war nicht erfolgreich. Versuchen Sie es später erneut. -Unstaking was unsuccessful. Try again later: Das unstaken war nicht erfolgreich. Versuchen Sie es später erneut. -Staking was unsuccessful. Try again later: Das Staken war nicht erfolgreich. Versuchen Sie es später erneut. +Transfer was unsuccessful. Try again later.: Die Überweisung war nicht erfolgreich. Versuchen Sie es später erneut. +Unstaking was unsuccessful. Try again later.: Das unstaken war nicht erfolgreich. Versuchen Sie es später erneut. +Staking was unsuccessful. Try again later.: Das Staken war nicht erfolgreich. Versuchen Sie es später erneut. Invalid amount: Ungültiger Betrag Invalid address: Ungültige Adresse Domain is not connected to a wallet: Die Domain ist nicht mit einer Wallet verbunden. @@ -340,7 +341,7 @@ Message is encrypted.: Die Nachricht ist verschlüsselt. $dapp_ledger_warning1: Sie sind dabei, eine Mehrweg-Transaktion mit Ihrer **Ledger**-Wallet durchzuführen. Sie müssen jede zugrunde liegende Transaktion **manuell nacheinander** signieren. $dapp_ledger_warning2: Bitte nehmen Sie sich Zeit und unterbrechen Sie den Prozess nicht. Agree: Zustimmen -Unfortunately, this operation is not yet supported by Ledger wallet: Die Hardware-Wallet unterstützt dieses Datenformat nicht +Unfortunately, this operation is not yet supported by Ledger wallet.: Die Hardware-Wallet unterstützt dieses Datenformat nicht. Swap: Tausch You sell: Sie verkaufen You buy: Sie kaufen diff --git a/src/i18n/en.yaml b/src/i18n/en.yaml index 539bf568..3e6bcfe0 100644 --- a/src/i18n/en.yaml +++ b/src/i18n/en.yaml @@ -61,6 +61,7 @@ About: About Exit: Exit Remove Wallet: Remove Wallet Something went wrong.: Something went wrong. +Something went wrong: Something went wrong Logo: Logo $about_description1: Securely store crypto, explore decentralized apps, and make blockchain payments at the **speed of light**. $about_description2: The wallet is **non-custodial and safe**. The developers **do not** have access to your funds, browser history or any other information. @@ -243,9 +244,9 @@ Staked: Staked Unstake Requested: Unstake Requested Unstaked: Unstaked The network fee has slightly changed, try sending again.: The network fee has slightly changed, try sending again. -Transfer was unsuccessful. Try again later: Transfer was unsuccessful. Try again later -Unstaking was unsuccessful. Try again later: Unstaking was unsuccessful. Try again later -Staking was unsuccessful. Try again later: Staking was unsuccessful. Try again later +Transfer was unsuccessful. Try again later.: Transfer was unsuccessful. Try again later. +Unstaking was unsuccessful. Try again later.: Unstaking was unsuccessful. Try again later. +Staking was unsuccessful. Try again later.: Staking was unsuccessful. Try again later. Invalid amount: Invalid amount Invalid address: Invalid address Domain is not connected to a wallet: Domain is not connected to a wallet @@ -337,7 +338,7 @@ Message is encrypted.: Message is encrypted. $dapp_ledger_warning1: You are about to send a multi-way transaction using your **Ledger** wallet. You will need to sign each underlying transaction **one by one manually**. $dapp_ledger_warning2: Please take your time and do not interrupt the process. Agree: Agree -Unfortunately, this operation is not yet supported by Ledger wallet: Unfortunately, this operation is not yet supported by Ledger wallet +Unfortunately, this operation is not yet supported by Ledger wallet.: Unfortunately, this operation is not yet supported by Ledger wallet. Swap: Swap You sell: You sell You buy: You buy diff --git a/src/i18n/es.yaml b/src/i18n/es.yaml index 1b8b6128..4163e334 100644 --- a/src/i18n/es.yaml +++ b/src/i18n/es.yaml @@ -61,6 +61,7 @@ About: Acerca de Exit: Salir Remove Wallet: Salir Something went wrong.: Oops! Algo salió mal. +Something went wrong: Oops! Algo salió mal Logo: Logotipo $about_description1: Almacene criptomonedas de forma segura, explore aplicaciones descentralizadas y realice pagos blockchain a la **velocidad de la luz**. $about_description2: Un monedero **sin custodia y seguro**. Los desarrolladores **no** tienen acceso a sus activos, historial del navegador o cualquier otra información. @@ -242,9 +243,9 @@ Staked: Apostado Unstake Requested: Retiro solicitado Unstaked: Retirado The network fee has slightly changed, try sending again.: La comisión de red ha cambiado ligeramente, inténtalo de nuevo. -Transfer was unsuccessful. Try again later: La transferencia no tuvo éxito. Inténtalo de nuevo más tarde -Unstaking was unsuccessful. Try again later: El retiro no tuvo éxito. Inténtalo de nuevo más tarde -Staking was unsuccessful. Try again later: El staking no tuvo éxito. Inténtalo de nuevo más tarde +Transfer was unsuccessful. Try again later.: La transferencia no tuvo éxito. Inténtalo de nuevo más tarde. +Unstaking was unsuccessful. Try again later.: El retiro no tuvo éxito. Inténtalo de nuevo más tarde. +Staking was unsuccessful. Try again later.: El staking no tuvo éxito. Inténtalo de nuevo más tarde. Invalid amount: Cantidad no válida Invalid address: Dirección no válida Domain is not connected to a wallet: El dominio no está conectado a un monedero @@ -337,7 +338,7 @@ Message is encrypted.: El mensaje está encriptado. $dapp_ledger_warning1: Estás a punto de enviar una transacción multi-direccional utilizando tu monedero **Ledger**. Necesitarás firmar cada transacción subyacente **una por una manualmente**. $dapp_ledger_warning2: Por favor, tómate tu tiempo y no interrumpas el proceso. Agree: Aceptar -Unfortunately, this operation is not yet supported by Ledger wallet: Desafortunadamente, esta operación aún no es compatible con Ledger wallet +Unfortunately, this operation is not yet supported by Ledger wallet.: Desafortunadamente, esta operación aún no es compatible con Ledger wallet. Swap: Intercambiar You sell: Usted vende You buy: Usted compra diff --git a/src/i18n/ru.yaml b/src/i18n/ru.yaml index c531e1ed..58064335 100644 --- a/src/i18n/ru.yaml +++ b/src/i18n/ru.yaml @@ -62,6 +62,7 @@ About: О MyTonWallet Exit: Выйти Remove Wallet: Выход Something went wrong.: Упс, что-то пошло не так. +Something went wrong: Упс, что-то пошло не так Logo: Логотип $about_description1: Безопасно храните криптовалюту, пользуйтесь децентрализованными приложениями и совершайте платежи в блокчейне **со скоростью света**. $about_description2: Кошелёк **управляется только вами**. Разработчики **не имеют доступа** к вашим средствам, истории браузера или любой другой информации. @@ -238,9 +239,9 @@ Staked: Стейкинг Unstake Requested: Запрос депозита Unstaked: Вывод стейка The network fee has slightly changed, try sending again.: Комиссия за сеть немного изменилась, попробуйте отправить ещё раз. -Transfer was unsuccessful. Try again later: С переводом что-то пошло не так. Попробуйте ещё раз. -Unstaking was unsuccessful. Try again later: Не удалось вывести депозит. Попробуйте ещё раз. -Staking was unsuccessful. Try again later: Не удалось внести депозит. Попробуйте ещё раз. +Transfer was unsuccessful. Try again later.: С переводом что-то пошло не так. Попробуйте ещё раз. +Unstaking was unsuccessful. Try again later.: Не удалось вывести депозит. Попробуйте ещё раз. +Staking was unsuccessful. Try again later.: Не удалось внести депозит. Попробуйте ещё раз. Invalid amount: Некорректная сумма Invalid address: Некорректный адрес Domain is not connected to a wallet: Домен не подключён к кошельку @@ -332,7 +333,7 @@ Message is encrypted.: Сообщение зашифровано. $dapp_ledger_warning1: Вы собираетесь отправить многоадресную транзакцию, используя свой кошелёк **Ledger**. Вам нужно будет подписать каждую базовую транзакцию **по одной вручную**. $dapp_ledger_warning2: Пожалуйста, не торопитесь и не прерывайте процесс. Agree: Согласен -Unfortunately, this operation is not yet supported by Ledger wallet: К сожалению, эта операция еще не поддерживается Ledger кошельком +Unfortunately, this operation is not yet supported by Ledger wallet.: К сожалению, эта операция еще не поддерживается Ledger кошельком. Swap: Обмен You sell: Вы продаёте You buy: Вы покупаете diff --git a/src/i18n/tr.yaml b/src/i18n/tr.yaml index c25a49b3..24e1e113 100644 --- a/src/i18n/tr.yaml +++ b/src/i18n/tr.yaml @@ -61,6 +61,7 @@ About: Hakkında Exit: Çıkış Remove Wallet: Cüzdanı kaldırın Something went wrong.: Bir şeyler ters gitti. +Something went wrong: Bir şeyler ters gitti Logo: Logo $about_description1: Kriptoyu güvenle saklayın, merkeziyetsiz uygulamaları keşfedin ve **ışık hızında** blok zinciri ödemeleri yapın. $about_description2: Cüzdan **non-custodial ve güvenli** bir cüzdandır. Geliştiricilerin paranıza, tarayıcı geçmişinize veya diğer bilgilerinize erişimi **yoktur**. @@ -244,9 +245,9 @@ Staked: Stake edildi Unstake Requested: Unstake talep edildi Unstaked: Unstake gerçekleşti The network fee has slightly changed, try sending again.: Ağ ücreti bir miktar değişti, tekrar göndermeyi deneyin. -Transfer was unsuccessful. Try again later: Transfer başarısız oldu. Daha sonra tekrar deneyin -Unstaking was unsuccessful. Try again later: Unstake işlemi başarısız oldu. Daha sonra tekrar deneyin -Staking was unsuccessful. Try again later: Staking işlemi başarısız oldu. Daha sonra tekrar deneyin +Transfer was unsuccessful. Try again later.: Transfer başarısız oldu. Daha sonra tekrar deneyin. +Unstaking was unsuccessful. Try again later.: Unstake işlemi başarısız oldu. Daha sonra tekrar deneyin. +Staking was unsuccessful. Try again later.: Staking işlemi başarısız oldu. Daha sonra tekrar deneyin. Invalid amount: Geçersiz tutar Invalid address: Geçersiz adres Domain is not connected to a wallet: Alan adı bir cüzdana bağlı değil @@ -338,7 +339,7 @@ Message is encrypted.: Mesaj şifrelenmiştir. $dapp_ledger_warning1: "**Ledger** cüzdanınızı kullanarak çok yönlü bir işlem göndermek üzeresiniz. İlgili her işlemi **tek tek manuel olarak** imzalamanız gerekecektir." $dapp_ledger_warning2: Lütfen acele etmeyin ve süreci kesintiye uğratmayın. Agree: Kabul et -Unfortunately, this operation is not yet supported by Ledger wallet: Donanım cüzdanı bu veri biçimini desteklemiyor +Unfortunately, this operation is not yet supported by Ledger wallet.: Donanım cüzdanı bu veri biçimini desteklemiyor. Swap: Takas You sell: Satıyorsunuz You buy: Alıyorsunuz diff --git a/src/i18n/zh-Hans.yaml b/src/i18n/zh-Hans.yaml index b06941b2..51f1b27c 100644 --- a/src/i18n/zh-Hans.yaml +++ b/src/i18n/zh-Hans.yaml @@ -57,6 +57,7 @@ Settings: 设置 About: 关于 Exit: 离开 Remove Wallet: 离开 +Something went wrong.: 什么地方出错了··· Something went wrong: 什么地方出错了··· Logo: Logo $about_description1: 安全地存储加密货币,探索 dAPP 并以**光速**进行区块链支付 @@ -232,9 +233,9 @@ at APY %1$s%: 当前年回报率 %1$s% Staked: 已质押 Unstaked: 已解除质押 The network fee has slightly changed, try sending again.: 网络费用已有细微变动,请尝试重新发送。 -Transfer was unsuccessful. Try again later: 转账未成功。请稍等片刻并再试一次 -Unstaking was unsuccessful. Try again later: 解除质押未成功。请稍等片刻并再试一次 -Staking was unsuccessful. Try again later: 质押未成功。请稍等片刻并再试一次 +Transfer was unsuccessful. Try again later.: 转账未成功。请稍等片刻并再试一次。 +Unstaking was unsuccessful. Try again later.: 解除质押未成功。请稍等片刻并再试一次。 +Staking was unsuccessful. Try again later.: 质押未成功。请稍等片刻并再试一次。 Invalid amount: 非法数额 Invalid address: 非法地址 Domain is not connected to a wallet: 此域名没有链接至任何钱包地址 @@ -323,7 +324,7 @@ Message is encrypted.: 消息已加密。 $dapp_ledger_warning1: 您即将使用您的**Ledger**钱包发送多方交易。您需要手动**逐个**签署每笔底层交易。 $dapp_ledger_warning2: 请慢慢来,不要中断过程。 Agree: 同意 -Unfortunately, this operation is not yet supported by Ledger wallet: 不幸的是,该操作尚未由Ledger Wallet支持 +Unfortunately, this operation is not yet supported by Ledger wallet.: 不幸的是,该操作尚未由Ledger Wallet支持。 Swap: 交换 You sell: 您卖出 You buy: 您购买 diff --git a/src/i18n/zh-Hant.yaml b/src/i18n/zh-Hant.yaml index 19dbe5ed..543b566d 100644 --- a/src/i18n/zh-Hant.yaml +++ b/src/i18n/zh-Hant.yaml @@ -57,7 +57,8 @@ Settings: 設定 About: 關於 Exit: 斷開連結 Remove Wallet: 斷開連結 -Something went wrong: 狀況異常。 +Something went wrong.: 狀況異常。 +Something went wrong: 狀況異常 Logo: Logo $about_description1: 安全地存儲加密貨幣、探索 dAPP 並以**光速**進行區塊鏈支付 $about_description2: 錢包是**非託管且安全的**。開發人員無權使用您的資金、瀏覽器歷史記錄或任何其他資訊 @@ -232,9 +233,9 @@ at APY %1$s%: at APY %1$s% Staked: 已質押 Unstaked: 已解除質押 The network fee has slightly changed, try sending again.: 網路費略有變化,請重新發送交易。 -Transfer was unsuccessful. Try again later: 轉帳未成功,請稍後再試 -Unstaking was unsuccessful. Try again later: 解除質押未成功,請稍後再試 -Staking was unsuccessful. Try again later: 質押未成功,請稍後再試 +Transfer was unsuccessful. Try again later.: 轉帳未成功,請稍後再試。 +Unstaking was unsuccessful. Try again later.: 解除質押未成功,請稍後再試。 +Staking was unsuccessful. Try again later.: 質押未成功,請稍後再試。 Invalid amount: 無效金額 Invalid address: 無效地址 Domain is not connected to a wallet: 域名未與錢包連結 @@ -323,7 +324,7 @@ Message is encrypted.: 消息已加密。 $dapp_ledger_warning1: 您即將使用您的**Ledger**錢包發送多方交易。您需要手動**一一**簽署每筆底層交易。 $dapp_ledger_warning2: 請慢慢來,不要中斷過程。 Agree: 同意 -Unfortunately, this operation is not yet supported by Ledger wallet: 不幸的是,該操作尚未由Ledger Wallet支持 +Unfortunately, this operation is not yet supported by Ledger wallet.: 不幸的是,該操作尚未由Ledger Wallet支持。 Swap: 交換 You sell: 您賣出 You buy: 您購買 diff --git a/src/util/clipboard.ts b/src/util/clipboard.ts index bf5073be..f418c271 100644 --- a/src/util/clipboard.ts +++ b/src/util/clipboard.ts @@ -1,9 +1,6 @@ import { Clipboard } from '@capacitor/clipboard'; import { IS_CAPACITOR } from '../config'; -import { logDebugError } from './logs'; - -export const CLIPBOARD_ITEM_SUPPORTED = window.navigator.clipboard && window.ClipboardItem; const textCopyEl = document.createElement('textarea'); textCopyEl.setAttribute('readonly', ''); @@ -11,43 +8,14 @@ textCopyEl.tabIndex = -1; textCopyEl.className = 'visually-hidden'; export const copyTextToClipboard = (str: string): Promise => { + if (IS_CAPACITOR) { + return Clipboard.write({ + string: str, + }); + } return navigator.clipboard.writeText(str); }; -export const copyImageToClipboard = (imageUrl?: string) => { - if (!imageUrl) return; - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - const imageEl = new Image(); - imageEl.onload = (e: Event) => { - if (ctx && e.currentTarget) { - const img = e.currentTarget as HTMLImageElement; - canvas.width = img.width; - canvas.height = img.height; - ctx.drawImage(img, 0, 0, img.width, img.height); - canvas.toBlob(copyBlobToClipboard, 'image/png', 1); - } - }; - - imageEl.src = imageUrl; -}; - -async function copyBlobToClipboard(pngBlob: Blob | null) { - if (!pngBlob || !CLIPBOARD_ITEM_SUPPORTED) { - return; - } - - try { - await window.navigator.clipboard.write?.([ - new ClipboardItem({ - [pngBlob.type]: pngBlob, - }), - ]); - } catch (err) { - logDebugError('copyBlobToClipboard', err); - } -} - export async function readClipboardContent() { if (IS_CAPACITOR) { const { value, type } = await Clipboard.read(); diff --git a/src/util/fetchWithTimeout.ts b/src/util/fetchWithTimeout.ts new file mode 100644 index 00000000..c6de5c02 --- /dev/null +++ b/src/util/fetchWithTimeout.ts @@ -0,0 +1,19 @@ +import { DEFAULT_API_TIMEOUT } from '../config'; + +async function fetchWithTimeout(url: string | URL, init?: RequestInit, timeout = DEFAULT_API_TIMEOUT) { + const controller = new AbortController(); + const id = setTimeout(() => { + controller.abort(); + }, timeout); + + try { + return await fetch(url, { + ...init, + signal: controller.signal, + }); + } finally { + clearTimeout(id); + } +} + +export default fetchWithTimeout;