Skip to content

Commit

Permalink
feat: removed ledger logic (#1378)
Browse files Browse the repository at this point in the history
  • Loading branch information
impelcrypto authored Aug 26, 2024
1 parent 5f0898d commit 42dcf25
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 203 deletions.
93 changes: 0 additions & 93 deletions src/components/header/ClaimWarningBanner.vue

This file was deleted.

4 changes: 0 additions & 4 deletions src/components/header/modals/SelectAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ import {
wait,
} from '@astar-network/astar-sdk-core';
import { ApiPromise } from '@polkadot/api';
import { Ledger } from '@polkadot/hw-ledger';
import copy from 'copy-to-clipboard';
import { ethers } from 'ethers';
import { $api } from 'src/boot/api';
Expand Down Expand Up @@ -173,8 +172,6 @@ export default defineComponent({
() => store.getters['general/substrateAccounts']
);
const isLedger = computed<boolean>(() => store.getters['general/isLedger']);
const nativeTokenSymbol = computed<string>(() => {
const chainInfo = store.getters['general/chainInfo'];
return chainInfo ? chainInfo.tokenSymbol : '';
Expand Down Expand Up @@ -303,7 +300,6 @@ export default defineComponent({
isShowBalance,
currentNetworkChain,
astarChain,
isLedger,
displayBalance,
backModal,
isClosing,
Expand Down
16 changes: 0 additions & 16 deletions src/components/header/styles/select-account.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@
justify-content: flex-end;
}

.text--is-ledger {
font-weight: 600;
font-size: 13px;
color: $gray-5;
}

.row--ledger-check {
display: flex;
justify-content: space-between;
align-items: center;
}

.box--account {
width: 100%;
display: flex;
Expand Down Expand Up @@ -281,10 +269,6 @@
color: $gray-3;
}

.text--is-ledger {
color: $gray-1;
}

.wrapper--account-detail {
.account-name {
color: $gray-1;
Expand Down
1 change: 0 additions & 1 deletion src/config/localStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export enum LOCAL_STORAGE {
XVM_TX_HISTORIES = 'xvmTxHistories',
BALLOON_NATIVE_TOKEN = 'balloonNativeToken',
THEME_COLOR = 'themeColor',
IS_LEDGER = 'isLedger',
MULTISIG = 'multisig',
CLOSE_DAPP_STAKING_V3_ONBOARDING = 'closeDappStakingV3Onboarding',
DECOMMISSION = 'decommission',
Expand Down
18 changes: 2 additions & 16 deletions src/hooks/useConnectWallet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
ASTAR_SS58_FORMAT,
astarChain,
checkSumEvmAddress,
hasProperty,
wait,
Expand Down Expand Up @@ -40,7 +39,7 @@ import { useRouter } from 'vue-router';
import * as utils from 'src/hooks/custom-signature/utils';

export const useConnectWallet = () => {
const { SELECTED_ADDRESS, IS_LEDGER, SELECTED_WALLET } = LOCAL_STORAGE;
const { SELECTED_ADDRESS, SELECTED_WALLET } = LOCAL_STORAGE;

const modalAccountSelect = ref<boolean>(false);
const modalPolkasafeSelect = ref<boolean>(false);
Expand All @@ -53,8 +52,7 @@ export const useConnectWallet = () => {
const { requestAccounts, requestSignature } = useEvmAccount();
const { currentAccount, currentAccountName, disconnectAccount } = useAccount();
const router = useRouter();
const { currentNetworkIdx, currentNetworkChain, evmNetworkIdx, currentNetworkName } =
useNetworkInfo();
const { evmNetworkIdx, currentNetworkName } = useNetworkInfo();

const currentRouter = computed(() => router.currentRoute.value.matched[0]);
const currentNetworkStatus = computed(() => store.getters['general/networkStatus']);
Expand Down Expand Up @@ -366,16 +364,6 @@ export const useConnectWallet = () => {
});
};

// Memo: Ledger accounts are available on Astar only
const handleCheckLedgerEnvironment = async (): Promise<void> => {
const isLedger = localStorage.getItem(IS_LEDGER) === 'true';
if (isLedger && currentNetworkChain.value && currentNetworkChain.value !== astarChain.ASTAR) {
localStorage.setItem(IS_LEDGER, 'false');
await disconnectAccount();
window.location.reload();
}
};

watch([selectedWallet, currentEcdsaAccount, currentAccount, isH160], changeEvmAccount);

watchEffect(async () => {
Expand All @@ -394,8 +382,6 @@ export const useConnectWallet = () => {
{ immediate: true }
);

watch([currentNetworkChain], handleCheckLedgerEnvironment);

// Memo: check the EVM wallet's connected chainId when users switch the page
watch(
[currentRouter, selectedWallet, isH160],
Expand Down
13 changes: 0 additions & 13 deletions src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export default {
insufficientExistentialDeposit:
'Account balances in {network} network is below than the existential deposit amount',
withdrawalNotSupport: "The portal doesn't support withdrawing to {chain} at this moment",
ledgerNotOpened: 'Ledger has not opened Astar App. Please open it and refresh this page.',
claimRewards:
'DApp Staking V3 is coming early 2024! Make sure to claim your rewards and stay tuned for the release date.',
underDevelopmentShibuyaWarning:
Expand Down Expand Up @@ -202,7 +201,6 @@ export default {
"Switch your network to 'Shiden' in the Math Wallet extension and refresh this page",
},
showBalance: 'Show {token} balance',
isLedgerAccount: 'This is a Ledger account, connected and running Astar app',
switchWalletConnectNetwork: 'Please switch to {network} network in your wallet',
multisig: {
initPolkasafe: 'Initializing PolkaSafe SDK for signature request; this may take a while',
Expand Down Expand Up @@ -320,15 +318,6 @@ export default {
'The number of eras that is shown here is per dApp. You may need to claim multiple times if you have too many unclaimed eras.',
restakeTip:
'By turning on, your rewards will be automatically re-staked when you make a claim.',
claimable: {
limitation:
'There is a limitation on the number of eras that can be claimed in one transaction.',
nativeWallets: 'Native wallets: ≒56 eras',
ledgerX: 'Ledger Nano X: 6 eras',
ledgerSPlus: 'Ledger Nano S Plus: 6 eras',
ledgerS: 'Ledger Nano S: 2 eras',
dcentWallet: "D'CENT Wallet: ≒28 eras",
},
dappsOwners: 'DApps owners! We can now help to promote your campaign. Please check',
dappsOwnersLink: 'the details.',
},
Expand Down Expand Up @@ -580,8 +569,6 @@ export default {
notSendToEvmExchanges:
"I’m NOT sending tokens to Exchange's EVM deposit addresses. I understand that if I do so, the funds will likely be lost.",
understandWarning: 'I understand that if I do so, the funds will likely be lost',
notDestIsLedgerAccount:
'The destination address is neither a ledger native account nor an exchange address. I understand that if I do so, the funds will likely be lost.',
notDestIsExchangeAddress: 'Destination address is not an Exchange address',
youWillReceive: 'You will receive',
faucetNextRequest: 'Time left until the next request',
Expand Down
14 changes: 0 additions & 14 deletions src/i18n/es/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export default {
insufficientExistentialDeposit:
'Los saldos de las cuentas en la red {network} son inferiores al importe del depósito existencial',
withdrawalNotSupport: 'El Portal no admite retiros en la red {chain} en este momento',
ledgerNotOpened:
'Ledger no ha abierto la aplicación Astar. Por favor, ábrala y actualice esta página.',
},
toast: {
transactionFailed: 'Transacción fallida con el error: {message}',
Expand Down Expand Up @@ -166,7 +164,6 @@ export default {
switchNetwork: 'Cambia tu red a "Shiden" en la extensión Math Wallet y actualiza esta página',
},
showBalance: 'Mostrar saldo en {token}',
isLedgerAccount: 'Esta es una cuenta Ledger, conectada y ejecutando la aplicación Astar',
multisig: {
initPolkasafe:
'Inicializando PolkaSafe SDK para la solicitud de firma; esto puede tardar un rato',
Expand Down Expand Up @@ -284,15 +281,6 @@ export default {
'El número de eras que se muestra aquí es por dApp. Es posible que tengas que reclamar varias veces si tienes demasiadas eras sin reclamar.',
restakeTip:
'Al activarlo, tus recompensas se irán a Staking automáticamente cuando hagas una reclamación.',
claimable: {
limitation:
'Existe una limitación en el número de eras que pueden reclamarse en una transacción.',
nativeWallets: 'Billeteras nativas: ≒56 eras',
ledgerX: 'Ledger Nano X: 6 eras',
ledgerSPlus: 'Ledger Nano S Plus: 6 eras',
ledgerS: 'Ledger Nano S: 2 eras',
dcentWallet: "D'CENT Wallet: ≒28 eras",
},
dappsOwners:
'¡Propietarios de dApps! Ahora podemos ayudarles a promocionar sus campañas. Por favor, compruebe',
dappsOwnersLink: 'los detalles.',
Expand Down Expand Up @@ -532,8 +520,6 @@ export default {
notSendToEvmExchanges:
'NO voy a enviar tokens a las direcciones de depósito EVM de Exchange. Entiendo que si lo hago, es probable que los fondos se pierdan.',
understandWarning: 'Entiendo que si lo hago, es probable que los fondos se pierdan',
notDestIsLedgerAccount:
'La dirección de destino no es ni una cuenta nativa de ledger ni una dirección de exchange. Entiendo que si lo hago, es probable que los fondos se pierdan.',
notDestIsExchangeAddress: 'La dirección de destino no es una dirección Exchange',
youWillReceive: 'Recibirás',
faucetNextRequest: 'Tiempo restante hasta la siguiente solicitud',
Expand Down
13 changes: 0 additions & 13 deletions src/i18n/fr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export default {
'Le solde sur le réseau {network} est inférieur au montant du dépôt existentiel',
withdrawalNotSupport:
'Le portail ne prend pas en charge le retrait vers {chain} pour le moment',
ledgerNotOpened: "Ledger n'a pas ouvert l'App Astar. Ouvrez là et rafraichissez la page.",
},
toast: {
transactionFailed: "La transaction a échoué avec l'erreur: {message}",
Expand Down Expand Up @@ -170,7 +169,6 @@ export default {
"Basculez vers le réseau 'Shiden' dans l'extension Math Wallet et rafraîchissez la page",
},
showBalance: 'Afficher le solde des {token}',
isLedgerAccount: "Ceci est un compte Ledger, connecté et en cours d'exécution sur l'app Astar",
multisig: {
initPolkasafe:
'Initialisation du SDK PolkaSafe pour une demande de signature; Ceci peut prendre un moment ',
Expand Down Expand Up @@ -287,15 +285,6 @@ export default {
"Le nombre d'ères affiché ici est par dApp. Vous devrez peut-être réclamer plusieurs fois si vous avez trop d'ères non réclamées.",
restakeTip:
'En activant, vos récompenses seront automatiquement re-investies lorsque vous les récupérer.',
claimable: {
limitation:
"Il existe une limite au nombre d'ères pouvant être réclamées en une seule transaction.",
nativeWallets: 'Portefeuilles natifs: ≒56 ères',
ledgerX: 'Ledger Nano X: 6 ères',
ledgerSPlus: 'Ledger Nano S Plus: 6 ères',
ledgerS: 'Ledger Nano S: 2 ères',
dcentWallet: "D'CENT Wallet: ≒28 ères",
},
dappsOwners:
"Propriétaires de DApps! Nous pouvons désormais vous aider à promouvoir votre campagne. Vérifiez s'il vous plaît",
dappsOwnersLink: 'les détails.',
Expand Down Expand Up @@ -539,8 +528,6 @@ export default {
notSendToEvmExchanges:
"Je n'envoie PAS de jetons aux adresses de dépôt EVM sur un Exchange. Je comprends que si je le fais, les fonds seront probablement perdus.",
understandWarning: 'Je comprends que si je le fais, les fonds seront probablement perdus',
notDestIsLedgerAccount:
"L'adresse de destination n'est ni un compte natif Ledger ni une adresse d'Exchange. Je comprends que si je le fais, les fonds seront probablement perdus.",
notDestIsExchangeAddress: "L'adresse de destination n'est pas l'adresse d'un Exchange",
youWillReceive: 'Vous allez recevoir',
faucetNextRequest: 'Temps restant avant la prochaine demande',
Expand Down
13 changes: 0 additions & 13 deletions src/i18n/ja/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export default {
insufficientExistentialDeposit:
'{network} ネットワークにある残高が existential depositi 以下です。',
withdrawalNotSupport: '現在のところ {chain} への送金はサポートされていません。',
ledgerNotOpened:
'LedgerがAstarアプリを開いていません。アプリを開き、このページを更新してください。',
claimRewards:
'DApp ステーキング V3 は 2024 年初頭に登場します! 必ず報酬を受け取り、リリース日を楽しみにお待ちください。',
},
Expand Down Expand Up @@ -167,7 +165,6 @@ export default {
'Math Walletの拡張機能であなたのネットワークをShidenに切り替え、このページを更新してください。',
},
showBalance: '{token}の残高を表示する',
isLedgerAccount: 'これはLedgerアカウントです。Ledgerを接続し、Astar appが動いています。',
multisig: {
initPolkasafe: '署名要求のためにPolkaSafe SDKを初期化しています。しばらく時間がかかります。',
noAccounts: 'マルチシグアカウントが見つかりません。',
Expand Down Expand Up @@ -282,14 +279,6 @@ export default {
availableToClaimTip2:
'ここに表示されているERA数はdAppごとのものです。未請求のERAが多すぎる場合は、複数回請求する必要があるかもしれません。',
restakeTip: 'オンにすることで、クレーム時に報酬が自動的に再ステークされます。',
claimable: {
limitation: '1回の取引で請求できるERA数には制限があります。',
nativeWallets: 'Native wallets: ≒56 eras',
ledgerX: 'Ledger Nano X: 6 eras',
ledgerSPlus: 'Ledger Nano S Plus: 6 eras',
ledgerS: 'Ledger Nano S: 2 eras',
dcentWallet: "D'CENT Wallet: ≒28 eras",
},
dappsOwners:
'dAppsオーナー!私たちはあなたのキャンペーンを促進するお手伝いをします。ご確認ください。',
dappsOwnersLink: '詳細はこちら',
Expand Down Expand Up @@ -538,8 +527,6 @@ export default {
notSendToEvmExchanges:
'私は取引所のEVM depositアドレスにトークンを送っていません。それをすると、資金が失われる可能性が高いことを理解しているからです。',
understandWarning: 'その場合、資金が失われる可能性が高いことを理解しています。',
notDestIsLedgerAccount:
'宛先のアドレスは、Ledgerネイティブアカウントでも取引所アドレスでもありません。そうであったとすると、資金が失われる可能性が高いことを理解しているからです。',
notDestIsExchangeAddress: '宛先アドレスが取引所アドレスではありません。',
youWillReceive: 'あなたは受け取るでしょう。',
faucetNextRequest: '次のリクエストまでの残り時間',
Expand Down
Loading

0 comments on commit 42dcf25

Please sign in to comment.