Skip to content

Commit

Permalink
hotfix: merge release-hotfix to main (#799)
Browse files Browse the repository at this point in the history
* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* hotfix: added Injective assets (ATOM and INJ) on EVM assets page (#759)

* feat: added ATOM and INJ on EVM assets page

* fix: fetch token data from cbridge API

* Update release-hotfix branch (#787)

* Fixed claim tooltip text (#747)

* Create s3-staging.yml

* Create s3-production.yml

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* Release hotfix merge to master (#746)

* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Ehsan <[email protected]>

* add nft menu on sidebar (#749)

* add nft menu on sidebar

* add customized balloon

* clean up

* Fix total dApps count (#751)

* feat: updated theme color (#741)

* feat: updated theme color on Assets page

* feat: updated theme color on Dashboard page

* feat: updated theme color on dApp staking page

* feat: updated sidebar

* fix: tests

* update css

* update css

* update detail css

* feat: updated header background

* fix: updated hero position on dApp staking page

* update css on feedback

* update detail css

* updates on addItemcard

* update color on tags

* update colors

* feat: updated dark theme

* update uilib & colors

* styles: changed astar-blue-dark to astar-blue

* styles: updated Ecosystem icon

* fix: conflicts

* fix: updated styles

* fix: updated header

* fix: updated modals

* fix: updated play icon

* fix: updated styles on transfer assets page

* fix: updated ui liv

---------

Co-authored-by: Will <[email protected]>

* Fix: Use XcmV2WeightLimit in InterlayXcmRepository.ts (#756)

* feat: updated connect wallet drawer (#750)

* feat: updated theme color on Assets page

* feat: updated theme color on Dashboard page

* feat: updated theme color on dApp staking page

* feat: updated sidebar

* fix: tests

* update css

* update css

* update detail css

* feat: updated astar-ui

* feat: updated astar-ui (2)

* feat: updated network modal

* feat: updated 'ip-input' class

* update css on feedback

* update detail css

* updates on addItemcard

* update color on tags

* feat: updated AccountModal logic

* feat: updated account drawer

* feat: updated disconnect button

* feat: updated tests

* fix: test

* fix: conflicts (2)

* fix: store selected address data

* feat: updated drawer

* feat: updated wallet logic

* refactor: clean up

* fix: changed 'disconnect' button position

* feat: store selected theme to local storage

* feat: updated modal drawer

* feat: updated modal drawer

---------

Co-authored-by: Will <[email protected]>

* Added github action for broken links (#761)

* Added github action for broken links

* build and check

* e2e tests with  Zombienet (#752)

* Transfer tokens test

* CI integration

* Use env variable po pass BASE_URL to test script

* yaml fix

* Actions script fix

* Another action script fix

* yet another try

* hardcoded versions

* collator version fix

* Links fix

* Github action fix

* It may run now on CI

* Fixed test runner script

* Add asset to a node

* Moved Zombienet tests and configuration to separate folder.

* Stake test

* Increase Playwright test timeout

* Tests and node setup fixes

* Minor fixes

* All tests run stable

* Updated staking test with input validation test

* release hotfix to main (#760)

* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* hotfix: added Injective assets (ATOM and INJ) on EVM assets page (#759)

* feat: added ATOM and INJ on EVM assets page

* fix: fetch token data from cbridge API

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Bobo <[email protected]>
Co-authored-by: Ehsan <[email protected]>

* fix: send non-native tokens with max amount (#768)

* feat: updated XCM logic to V3 for Shiden, Statemine and Kusama (#758)

* wip: KSM xcm V3

* feat: update sdk-core

* feat: updated XCM logic for Kusama to V3

* feat: updated XCM V3 logic for Shiden

* fix: removed console.log

* fix: updated logic for statemine

* fix: updated subscan link for ctust

* feat: updated Bitfrost version to V3

* feat: updated XCM logic for Phala

* refactor: clean up

* fix: enabled XCM deposit/withdrawal on Shiden (#774)

* fix: enabled XCM deposit/withdrawal on Shiden

* test

* test: lint

* fix: clean up

* Update broken-links.yml (#777)

* removed quasar from broken link report (#767)

* dAapp staking e2e tests (#769)

* Unbond test

* Re-stake on/off test

* Claim rewards test, playwright config updates

* On chain check if claim executed

* Added Metamask extension

* Metamask wallet creation

* Trying to fix heap out of memory

* One more try

* One more try to fix CI out of memory

* On more try to fix out of memory error

* Heap size fix

* command fix

* What to say?

* Metamask removed

* Update pull-request-preview.yml

* Pushing commit to rerun ci

* setting up yarn

* Added Metamask back

* Test run on ubuntu-latest

* tsconfig exclude pattern fix

* Linter fixes

---------

Co-authored-by: Ehsan <[email protected]>
Co-authored-by: Nikhil Ranjan <[email protected]>

* feat: added 'help' button on header (#772)

* fix: display EVM withdraw when users have balance in withdrawal

* fix: added help button on header

* fix: removed release note on the template.md

* fix: test

* fix: test (2)

* fix: display ModalConectionTrouble when app is loading

* fix: reset the staking tab after changing accounts (#779)

* Change warning on EVM local transfer (#783)

* update warning message

* update css & only visible on EVM input

* show prev warning

* only visible isH160

* update warning message

* fix: modified header styling for mobile devices (#782)

* fix: updated connect button

* fix: added separator at the top of assets page for mobile devices

* fix: updated header background for mobile devices

* fix: updated margin size inheader

---------

Co-authored-by: Bobo <[email protected]>
Co-authored-by: Ehsan <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Brendon Votteler <[email protected]>
Co-authored-by: Nikhil Ranjan <[email protected]>

* refactor: updated hotfix branch to V0.0.32 (#791)

* Fixed claim tooltip text (#747)

* Create s3-staging.yml

* Create s3-production.yml

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* Release hotfix merge to master (#746)

* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Ehsan <[email protected]>

* add nft menu on sidebar (#749)

* add nft menu on sidebar

* add customized balloon

* clean up

* Fix total dApps count (#751)

* feat: updated theme color (#741)

* feat: updated theme color on Assets page

* feat: updated theme color on Dashboard page

* feat: updated theme color on dApp staking page

* feat: updated sidebar

* fix: tests

* update css

* update css

* update detail css

* feat: updated header background

* fix: updated hero position on dApp staking page

* update css on feedback

* update detail css

* updates on addItemcard

* update color on tags

* update colors

* feat: updated dark theme

* update uilib & colors

* styles: changed astar-blue-dark to astar-blue

* styles: updated Ecosystem icon

* fix: conflicts

* fix: updated styles

* fix: updated header

* fix: updated modals

* fix: updated play icon

* fix: updated styles on transfer assets page

* fix: updated ui liv

---------

Co-authored-by: Will <[email protected]>

* Fix: Use XcmV2WeightLimit in InterlayXcmRepository.ts (#756)

* feat: updated connect wallet drawer (#750)

* feat: updated theme color on Assets page

* feat: updated theme color on Dashboard page

* feat: updated theme color on dApp staking page

* feat: updated sidebar

* fix: tests

* update css

* update css

* update detail css

* feat: updated astar-ui

* feat: updated astar-ui (2)

* feat: updated network modal

* feat: updated 'ip-input' class

* update css on feedback

* update detail css

* updates on addItemcard

* update color on tags

* feat: updated AccountModal logic

* feat: updated account drawer

* feat: updated disconnect button

* feat: updated tests

* fix: test

* fix: conflicts (2)

* fix: store selected address data

* feat: updated drawer

* feat: updated wallet logic

* refactor: clean up

* fix: changed 'disconnect' button position

* feat: store selected theme to local storage

* feat: updated modal drawer

* feat: updated modal drawer

---------

Co-authored-by: Will <[email protected]>

* Added github action for broken links (#761)

* Added github action for broken links

* build and check

* e2e tests with  Zombienet (#752)

* Transfer tokens test

* CI integration

* Use env variable po pass BASE_URL to test script

* yaml fix

* Actions script fix

* Another action script fix

* yet another try

* hardcoded versions

* collator version fix

* Links fix

* Github action fix

* It may run now on CI

* Fixed test runner script

* Add asset to a node

* Moved Zombienet tests and configuration to separate folder.

* Stake test

* Increase Playwright test timeout

* Tests and node setup fixes

* Minor fixes

* All tests run stable

* Updated staking test with input validation test

* release hotfix to main (#760)

* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* hotfix: added Injective assets (ATOM and INJ) on EVM assets page (#759)

* feat: added ATOM and INJ on EVM assets page

* fix: fetch token data from cbridge API

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Bobo <[email protected]>
Co-authored-by: Ehsan <[email protected]>

* fix: send non-native tokens with max amount (#768)

* feat: updated XCM logic to V3 for Shiden, Statemine and Kusama (#758)

* wip: KSM xcm V3

* feat: update sdk-core

* feat: updated XCM logic for Kusama to V3

* feat: updated XCM V3 logic for Shiden

* fix: removed console.log

* fix: updated logic for statemine

* fix: updated subscan link for ctust

* feat: updated Bitfrost version to V3

* feat: updated XCM logic for Phala

* refactor: clean up

* fix: enabled XCM deposit/withdrawal on Shiden (#774)

* fix: enabled XCM deposit/withdrawal on Shiden

* test

* test: lint

* fix: clean up

* Update broken-links.yml (#777)

* removed quasar from broken link report (#767)

* dAapp staking e2e tests (#769)

* Unbond test

* Re-stake on/off test

* Claim rewards test, playwright config updates

* On chain check if claim executed

* Added Metamask extension

* Metamask wallet creation

* Trying to fix heap out of memory

* One more try

* One more try to fix CI out of memory

* On more try to fix out of memory error

* Heap size fix

* command fix

* What to say?

* Metamask removed

* Update pull-request-preview.yml

* Pushing commit to rerun ci

* setting up yarn

* Added Metamask back

* Test run on ubuntu-latest

* tsconfig exclude pattern fix

* Linter fixes

---------

Co-authored-by: Ehsan <[email protected]>
Co-authored-by: Nikhil Ranjan <[email protected]>

* feat: added 'help' button on header (#772)

* fix: display EVM withdraw when users have balance in withdrawal

* fix: added help button on header

* fix: removed release note on the template.md

* fix: test

* fix: test (2)

* fix: display ModalConectionTrouble when app is loading

* fix: reset the staking tab after changing accounts (#779)

* Change warning on EVM local transfer (#783)

* update warning message

* update css & only visible on EVM input

* show prev warning

* only visible isH160

* update warning message

* fix: modified header styling for mobile devices (#782)

* fix: updated connect button

* fix: added separator at the top of assets page for mobile devices

* fix: updated header background for mobile devices

* fix: updated margin size inheader

* Automatically create PR on regular and hotfix release (#781)

* Fix for tests who are failing from time to time (#785)

* Return Dwellir endpoint to the portal (#788)

* feat: updated claim logic for ledger accounts (#765)

* feat: updated claim logic for ledger account

* refactor: clean up

* debug: log transport

* debug: log 2

* feat: test log

* feat: test log 2

* feat: test log 3

* feat: test log 4

* feat: test log 5

* feat: test log 6

* refactor: removed console logs

* refactor: clean up

* fix: remove HID popup

* fix: remove HID popup (2)

* refactor: clean up

* test: see console

* refacotr: clean up

* Deployment scripts fix (#790)

---------

Co-authored-by: Bobo <[email protected]>
Co-authored-by: Ehsan <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Brendon Votteler <[email protected]>
Co-authored-by: Nikhil Ranjan <[email protected]>

* fix: the way detect the ledger connection (#795)

* fix: detect ledger connection

* refactor: clean up

* test

* feat: update logic

* fix: fixed conflicts in release-hotfix branch (#800)

* Fixed claim tooltip text (#747)

* Create s3-staging.yml

* Create s3-production.yml

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* Release hotfix merge to master (#746)

* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Ehsan <[email protected]>

* add nft menu on sidebar (#749)

* add nft menu on sidebar

* add customized balloon

* clean up

* Fix total dApps count (#751)

* feat: updated theme color (#741)

* feat: updated theme color on Assets page

* feat: updated theme color on Dashboard page

* feat: updated theme color on dApp staking page

* feat: updated sidebar

* fix: tests

* update css

* update css

* update detail css

* feat: updated header background

* fix: updated hero position on dApp staking page

* update css on feedback

* update detail css

* updates on addItemcard

* update color on tags

* update colors

* feat: updated dark theme

* update uilib & colors

* styles: changed astar-blue-dark to astar-blue

* styles: updated Ecosystem icon

* fix: conflicts

* fix: updated styles

* fix: updated header

* fix: updated modals

* fix: updated play icon

* fix: updated styles on transfer assets page

* fix: updated ui liv

---------

Co-authored-by: Will <[email protected]>

* Fix: Use XcmV2WeightLimit in InterlayXcmRepository.ts (#756)

* feat: updated connect wallet drawer (#750)

* feat: updated theme color on Assets page

* feat: updated theme color on Dashboard page

* feat: updated theme color on dApp staking page

* feat: updated sidebar

* fix: tests

* update css

* update css

* update detail css

* feat: updated astar-ui

* feat: updated astar-ui (2)

* feat: updated network modal

* feat: updated 'ip-input' class

* update css on feedback

* update detail css

* updates on addItemcard

* update color on tags

* feat: updated AccountModal logic

* feat: updated account drawer

* feat: updated disconnect button

* feat: updated tests

* fix: test

* fix: conflicts (2)

* fix: store selected address data

* feat: updated drawer

* feat: updated wallet logic

* refactor: clean up

* fix: changed 'disconnect' button position

* feat: store selected theme to local storage

* feat: updated modal drawer

* feat: updated modal drawer

---------

Co-authored-by: Will <[email protected]>

* Added github action for broken links (#761)

* Added github action for broken links

* build and check

* e2e tests with  Zombienet (#752)

* Transfer tokens test

* CI integration

* Use env variable po pass BASE_URL to test script

* yaml fix

* Actions script fix

* Another action script fix

* yet another try

* hardcoded versions

* collator version fix

* Links fix

* Github action fix

* It may run now on CI

* Fixed test runner script

* Add asset to a node

* Moved Zombienet tests and configuration to separate folder.

* Stake test

* Increase Playwright test timeout

* Tests and node setup fixes

* Minor fixes

* All tests run stable

* Updated staking test with input validation test

* release hotfix to main (#760)

* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* hotfix: added Injective assets (ATOM and INJ) on EVM assets page (#759)

* feat: added ATOM and INJ on EVM assets page

* fix: fetch token data from cbridge API

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Bobo <[email protected]>
Co-authored-by: Ehsan <[email protected]>

* fix: send non-native tokens with max amount (#768)

* feat: updated XCM logic to V3 for Shiden, Statemine and Kusama (#758)

* wip: KSM xcm V3

* feat: update sdk-core

* feat: updated XCM logic for Kusama to V3

* feat: updated XCM V3 logic for Shiden

* fix: removed console.log

* fix: updated logic for statemine

* fix: updated subscan link for ctust

* feat: updated Bitfrost version to V3

* feat: updated XCM logic for Phala

* refactor: clean up

* fix: enabled XCM deposit/withdrawal on Shiden (#774)

* fix: enabled XCM deposit/withdrawal on Shiden

* test

* test: lint

* fix: clean up

* Update broken-links.yml (#777)

* removed quasar from broken link report (#767)

* dAapp staking e2e tests (#769)

* Unbond test

* Re-stake on/off test

* Claim rewards test, playwright config updates

* On chain check if claim executed

* Added Metamask extension

* Metamask wallet creation

* Trying to fix heap out of memory

* One more try

* One more try to fix CI out of memory

* On more try to fix out of memory error

* Heap size fix

* command fix

* What to say?

* Metamask removed

* Update pull-request-preview.yml

* Pushing commit to rerun ci

* setting up yarn

* Added Metamask back

* Test run on ubuntu-latest

* tsconfig exclude pattern fix

* Linter fixes

---------

Co-authored-by: Ehsan <[email protected]>
Co-authored-by: Nikhil Ranjan <[email protected]>

* feat: added 'help' button on header (#772)

* fix: display EVM withdraw when users have balance in withdrawal

* fix: added help button on header

* fix: removed release note on the template.md

* fix: test

* fix: test (2)

* fix: display ModalConectionTrouble when app is loading

* fix: reset the staking tab after changing accounts (#779)

* Change warning on EVM local transfer (#783)

* update warning message

* update css & only visible on EVM input

* show prev warning

* only visible isH160

* update warning message

* fix: modified header styling for mobile devices (#782)

* fix: updated connect button

* fix: added separator at the top of assets page for mobile devices

* fix: updated header background for mobile devices

* fix: updated margin size inheader

* Automatically create PR on regular and hotfix release (#781)

* Fix for tests who are failing from time to time (#785)

* Return Dwellir endpoint to the portal (#788)

* feat: updated claim logic for ledger accounts (#765)

* feat: updated claim logic for ledger account

* refactor: clean up

* debug: log transport

* debug: log 2

* feat: test log

* feat: test log 2

* feat: test log 3

* feat: test log 4

* feat: test log 5

* feat: test log 6

* refactor: removed console logs

* refactor: clean up

* fix: remove HID popup

* fix: remove HID popup (2)

* refactor: clean up

* test: see console

* refacotr: clean up

* Deployment scripts fix (#790)

* Update index.template.html (#792)

---------

Co-authored-by: Bobo <[email protected]>
Co-authored-by: Ehsan <[email protected]>
Co-authored-by: Will <[email protected]>
Co-authored-by: Brendon Votteler <[email protected]>
Co-authored-by: Nikhil Ranjan <[email protected]>
Co-authored-by: Josip Š <[email protected]>

---------

Co-authored-by: Will <[email protected]>
Co-authored-by: Bobo <[email protected]>
Co-authored-by: Ehsan <[email protected]>
Co-authored-by: Brendon Votteler <[email protected]>
Co-authored-by: Nikhil Ranjan <[email protected]>
Co-authored-by: Josip Š <[email protected]>
  • Loading branch information
7 people authored May 18, 2023
1 parent e2dedcf commit f259e75
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 67 deletions.
98 changes: 83 additions & 15 deletions src/components/header/modals/ModalAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div>
<selected-wallet :selected-wallet="selectedWallet" />
</div>
<div v-if="isNativeWallet" class="row--balance-option">
<div class="row--balance-option">
<div class="column--balance-option">
<span class="text--option-label">
{{ $t('wallet.showBalance', { token: nativeTokenSymbol }) }}
Expand Down Expand Up @@ -107,8 +107,16 @@
</fieldset>
</div>
<div class="wrapper__row--button">
<div v-if="currentNetworkChain === astarChain.ASTAR" class="row--ledger-check">
<span class="text--is-ledger">
{{ $t('wallet.isLedgerAccount') }}
</span>
<div class="toggle--custom">
<q-toggle v-model="toggleIsLedger" color="#0085ff" />
</div>
</div>
<astar-button
:disabled="(substrateAccounts.length > 0 && !selAccount) || !isNativeWallet"
:disabled="(substrateAccounts.length > 0 && !selAccount) || (isLedger && !isLedgerReady)"
class="btn--connect"
@click="selectAccount(selAccount)"
>
Expand All @@ -133,18 +141,16 @@ import {
wait,
fetchNativeBalance,
} from '@astar-network/astar-sdk-core';
import {
castMobileSource,
checkIsEthereumWallet,
checkIsNativeWallet,
} from 'src/hooks/helper/wallet';
import { castMobileSource, checkIsEthereumWallet } from 'src/hooks/helper/wallet';
import { useStore } from 'src/store';
import { SubstrateAccount } from 'src/store/general/state';
import { computed, defineComponent, PropType, ref, watch, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useExtensions } from 'src/hooks/useExtensions';
import { useMetaExtensions } from 'src/hooks/useMetaExtensions';
import { useAccount, useBreakpoints } from 'src/hooks';
import { useBreakpoints, useNetworkInfo } from 'src/hooks';
import { Ledger } from '@polkadot/hw-ledger';
import { astarChain } from 'src/config/chain';
export default defineComponent({
components: {
Expand Down Expand Up @@ -182,6 +188,8 @@ export default defineComponent({
const isClosing = ref<boolean>(false);
const isShowBalance = ref<boolean>(false);
const isLoadingBalance = ref<boolean>(false);
const toggleIsLedger = ref<boolean>(false);
const isLedgerReady = ref<boolean>(false);
const accountBalanceMap = ref<SubstrateAccount[]>([]);
const closeModal = async (): Promise<void> => {
Expand All @@ -200,8 +208,7 @@ export default defineComponent({
const store = useStore();
const { t } = useI18n();
const { width, screenSize } = useBreakpoints();
const isNativeWallet = computed<boolean>(() => checkIsNativeWallet(props.selectedWallet));
const { currentNetworkChain } = useNetworkInfo();
const substrateAccounts = computed<SubstrateAccount[]>(() => {
const accounts: SubstrateAccount[] = accountBalanceMap.value || [];
Expand All @@ -218,6 +225,7 @@ export default defineComponent({
);
const isLoading = computed<boolean>(() => store.getters['general/isLoading']);
const isLedger = computed<boolean>(() => store.getters['general/isLedger']);
const nativeTokenSymbol = computed<string>(() => {
const chainInfo = store.getters['general/chainInfo'];
Expand Down Expand Up @@ -275,7 +283,7 @@ export default defineComponent({
const windowHeight = ref<number>(window.innerHeight);
const onHeightChange = () => {
const adjustment = width.value > screenSize.sm ? 450 : 320;
const adjustment = width.value > screenSize.sm ? 520 : 390;
windowHeight.value = window.innerHeight - adjustment;
};
Expand Down Expand Up @@ -320,16 +328,72 @@ export default defineComponent({
);
const requestExtensionsIfFirstAccess = (): void => {
if (!isNativeWallet.value) return;
// Memo: displays wallet's authorization popup
const { extensions } = useExtensions($api!!, store);
const { metaExtensions, extensionCount } = useMetaExtensions($api!!, extensions)!!;
store.commit('general/setMetaExtensions', metaExtensions.value);
store.commit('general/setExtensionCount', extensionCount.value);
};
watch([isNativeWallet, props.selectedWallet], requestExtensionsIfFirstAccess, {
immediate: false,
const updateIsLedgerAccount = async (isLedger: boolean): Promise<void> => {
localStorage.setItem(LOCAL_STORAGE.IS_LEDGER, isLedger.toString());
store.commit('general/setIsLedger', isLedger);
if (isLedger) {
try {
// Memo: send a popup request for permission(first time only)
const ledgerData = new Ledger('hid', 'astar');
if (process.env.DEV) {
console.info('ledgerData', ledgerData);
}
const { address } = await ledgerData.getAddress();
if (address) {
isLedgerReady.value = true;
const transport = (ledgerData as any).__internal__app.transport;
transport.close();
}
} catch (error: any) {
console.error(error);
const idLedgerLocked = '0x5515';
const idNotRunningApp = '28161';
let errMsg = '';
if (error.message.includes(idLedgerLocked)) {
errMsg = error.message;
} else if (error.message.includes(idNotRunningApp)) {
errMsg = t('warning.ledgerNotOpened');
}
if (errMsg) {
store.dispatch('general/showAlertMsg', {
msg: errMsg,
alertType: 'error',
});
}
}
} else {
isLedgerReady.value = false;
}
};
watch([props.selectedWallet], requestExtensionsIfFirstAccess);
watch([selAccount], () => {
toggleIsLedger.value = false;
});
watch(
[isLedger],
() => {
toggleIsLedger.value = isLedger.value;
},
{
immediate: true,
}
);
watch([toggleIsLedger], async () => {
await updateIsLedgerAccount(toggleIsLedger.value);
});
onUnmounted(() => {
Expand All @@ -346,7 +410,6 @@ export default defineComponent({
SupportWallet,
currentNetworkIdx,
subScan,
isNativeWallet,
nativeTokenSymbol,
isLoadingBalance,
accountBalanceMap,
Expand All @@ -357,7 +420,12 @@ export default defineComponent({
windowHeight,
isSelected,
isClosing,
toggleIsLedger,
isShowBalance,
currentNetworkChain,
astarChain,
isLedgerReady,
isLedger,
displayBalance,
backModal,
};
Expand Down
18 changes: 16 additions & 2 deletions src/components/header/styles/modal-account.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@

.row--balance-option {
display: flex;
justify-content: center;
justify-content: flex-end;
}

.text--is-ledger {
font-weight: 600;
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 @@ -167,7 +177,7 @@
justify-content: center;
flex-direction: column;
margin-top: 32px;
row-gap: 24px;
row-gap: 20px;
}

.btn--connect {
Expand Down Expand Up @@ -216,6 +226,10 @@
border: 1px solid $gray-3;
}

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

.wrapper--account-detail {
.account-name {
color: $gray-1;
Expand Down
1 change: 1 addition & 0 deletions src/config/localStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export enum LOCAL_STORAGE {
XVM_TX_HISTORIES = 'xvmTxHistories',
BALLOON_NATIVE_TOKEN = 'balloonNativeToken',
THEME_COLOR = 'themeColor',
IS_LEDGER = 'isLedger',
}

// Memo: A helper function to return the account's history data that is stored in the browser
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useClaimAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ export function useClaimAll() {
const dapps = computed<DappCombinedInfo[]>(() => store.getters['dapps/getAllDapps']);
const isH160 = computed<boolean>(() => store.getters['general/isH160Formatted']);
const isSendingTx = computed(() => store.getters['general/isLoading']);
const isLedger = computed<boolean>(() => store.getters['general/isLedger']);
const { t } = useI18n();
const { era } = useCurrentEra();
const { accountData } = useBalance(senderAddress);
const { isLedgerAccount, isLedgerNanoS } = useLedger();
const { isLedgerNanoS } = useLedger();

const maxBatchWeight = computed<BN>(() => {
if (isLedgerAccount.value) {
if (isLedger.value) {
return isLedgerNanoS.value ? MAX_BATCH_WEIGHT_LEDGER_S : MAX_BATCH_WEIGHT_LEDGER;
} else {
return MAX_BATCH_WEIGHT;
Expand Down
23 changes: 20 additions & 3 deletions src/hooks/useConnectWallet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { wait, ASTAR_SS58_FORMAT, checkSumEvmAddress } from '@astar-network/astar-sdk-core';
import {
wait,
ASTAR_SS58_FORMAT,
checkSumEvmAddress,
astarChain,
} from '@astar-network/astar-sdk-core';
import { ETHEREUM_EXTENSION } from 'src/hooks';
import { useEvmAccount } from 'src/hooks/custom-signature/useEvmAccount';
import { $api } from 'boot/api';
Expand Down Expand Up @@ -37,7 +42,7 @@ import {
} from 'src/hooks/helper/wallet';

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

const modalConnectWallet = ref<boolean>(false);
const modalAccountSelect = ref<boolean>(false);
Expand All @@ -57,7 +62,7 @@ export const useConnectWallet = () => {
const isConnectedNetwork = computed<boolean>(
() => store.getters['general/networkStatus'] === 'connected'
);
const { currentNetworkIdx } = useNetworkInfo();
const { currentNetworkIdx, currentNetworkChain } = useNetworkInfo();

const selectedWalletSource = computed(() => {
try {
Expand Down Expand Up @@ -322,6 +327,16 @@ 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 @@ -340,6 +355,8 @@ export const useConnectWallet = () => {
{ immediate: true }
);

watch([currentNetworkChain], handleCheckLedgerEnvironment);

// Memo: triggered after users (who haven't connected to wallet) have clicked 'Connect Wallet' button on dApp staking page
window.addEventListener(WalletModalOption.SelectWallet, openSelectModal);

Expand Down
Loading

0 comments on commit f259e75

Please sign in to comment.