Skip to content

Commit

Permalink
merge the release-hotfix to main branch (#1025)
Browse files Browse the repository at this point in the history
* fix: enables Snap on the production (#1024)

* Add a link to the docs (#1027)

* fix: words (#1028)

* fix: display the staking list for EVM accounts (#1030)

---------

Co-authored-by: Ayumi Takahashi <ayumee528@gmail.com>
  • Loading branch information
impelcrypto and ayumitk committed Nov 23, 2023
1 parent 95a90b2 commit a0a73d1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
8 changes: 6 additions & 2 deletions src/components/dapp-staking/my-staking/MyRewards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,15 @@
<q-icon name="warning" size="20px" class="q-mr-sm" />
<div>{{ $t('dappStaking.cantClaimWihtoutError') }}</div>
</div>
<!-- TODO: Add a link to the doc -->
<div v-if="isDappDeveloper" class="info--dapps-owners">
<span>{{ $t('new') }}</span>
{{ $t('myReward.dappsOwners') }}
<a href="#" target="_blank" rel="noopener noreferrer">{{ $t('myReward.dappsOwnersLink') }}</a>
<a
href="https://docs.astar.network/docs/build/dapp-staking/for-devs/create-promotion/"
target="_blank"
rel="noopener noreferrer"
>{{ $t('myReward.dappsOwnersLink') }}</a
>
</div>
</div>
</template>
Expand Down
13 changes: 2 additions & 11 deletions src/components/header/modals/ModalConnectWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
<button
v-for="(wallet, index) in nativeWallets"
:key="index"
:disabled="checkIsDisabledWallet(wallet.source) || isZkEvm"
:disabled="isZkEvm"
class="box__row--wallet box--hover--active"
:class="currentWallet === wallet.source && 'border--active'"
@click="!checkIsDisabledWallet(wallet.source) && setSubstrateWalletModal(wallet.source)"
@click="setSubstrateWalletModal(wallet.source)"
>
<div class="box--img">
<img :src="wallet.img" />
Expand Down Expand Up @@ -172,7 +172,6 @@ import { initiatePolkdatodSnap } from 'src/modules/snap';
import { useStore } from 'src/store';
import { SubstrateAccount } from 'src/store/general/state';
import { PropType, computed, defineComponent, ref } from 'vue';
import { productionOrigin } from 'src/links';
export default defineComponent({
props: {
Expand Down Expand Up @@ -224,13 +223,6 @@ export default defineComponent({
props.setCloseModal();
};
const checkIsDisabledWallet = (source: SupportWallet): boolean => {
if (source === SupportWallet.Snap && window.location.origin === productionOrigin) {
return true;
}
return false;
};
const nativeWallets = computed(() => {
return supportWallets
.map((it) => {
Expand Down Expand Up @@ -327,7 +319,6 @@ export default defineComponent({
setEvmWalletModal,
disconnectAccount,
setPolkasafeModal,
checkIsDisabledWallet,
setAccountUnificationModal,
currentNetworkIdx,
endpointKey,
Expand Down
14 changes: 7 additions & 7 deletions src/hooks/dapps-staking/useDispatchGetDapps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { computed, watch } from 'vue';
export function useDispatchGetDapps() {
const store = useStore();
const { isZkEvm, networkNameSubstrate } = useNetworkInfo();
const { currentAccount } = useAccount();
const { senderSs58Account } = useAccount();
const dapps = computed(() => store.getters['dapps/getAllDapps']);

// Memo: invoke this function whenever the users haven't connect to wallets
Expand All @@ -17,30 +17,30 @@ export function useDispatchGetDapps() {

const isBrowsingOnly = !!(
dapps.value.length === 0 &&
!currentAccount.value &&
!senderSs58Account.value &&
networkNameSubstrate.value
);

if (isBrowsingOnly || isZkEvm.value) {
store.dispatch('dapps/getDapps', {
network: networkNameSubstrate.value.toLowerCase(),
currentAccount: '',
senderSs58Account: '',
});
}
};

const getDapps = async (): Promise<void> => {
const isConnectedWallet = networkNameSubstrate.value && currentAccount.value;
const isConnectedWallet = networkNameSubstrate.value && senderSs58Account.value;
if (isConnectedWallet && !isZkEvm.value) {
const address = !currentAccount.value ? '' : currentAccount.value;
const address = !senderSs58Account.value ? '' : senderSs58Account.value;
store.dispatch('dapps/getDapps', {
network: networkNameSubstrate.value.toLowerCase(),
currentAccount: address,
senderSs58Account: address,
});
} else {
getDappsForBrowser();
}
};

watch([currentAccount, networkNameSubstrate], getDapps, { immediate: true });
watch([senderSs58Account, networkNameSubstrate], getDapps, { immediate: true });
}
2 changes: 1 addition & 1 deletion src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export default {
ledgerSPlus: 'Ledger Nano S Plus: 6 eras',
ledgerS: 'Ledger Nano S: 2 eras',
},
dappsOwners: 'dApps owners! We can now help to promote your campaign. Please check',
dappsOwners: 'DApps owners! We can now help to promote your campaign. Please check',
dappsOwnersLink: 'the details.',
},
dappStaking: {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/snap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface SnapConfig {
unit?: UnitConfiguration;
}

export const snapId = process.env.DEV ? 'local:http://localhost:8081' : 'npm:@astar-network/snap';
export const snapId = 'npm:@astar-network/snap';

export async function enablePolkadotSnap(
config: SnapConfig = { networkName: 'shibuya' },
Expand Down
8 changes: 4 additions & 4 deletions src/store/dapp-staking/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const hasExtrinsicFailedEvent = (
const actions: ActionTree<State, StateInterface> = {
async getDapps(
{ commit, dispatch },
{ network, currentAccount }: { network: string; currentAccount: string }
{ network, senderSs58Account }: { network: string; senderSs58Account: string }
) {
const accountUnificationService = container.get<IAccountUnificationService>(
Symbols.AccountUnificationService
Expand All @@ -98,9 +98,9 @@ const actions: ActionTree<State, StateInterface> = {
// Fetch dapps
const dappsUrl = `${TOKEN_API_URL}/v1/${network.toLowerCase()}/dapps-staking/dappssimple`;
const service = container.get<IDappStakingService>(Symbols.DappStakingService);
const address = isValidEvmAddress(currentAccount)
? await accountUnificationService.getMappedNativeAddress(currentAccount)
: currentAccount;
const address = isValidEvmAddress(senderSs58Account)
? await accountUnificationService.getMappedNativeAddress(senderSs58Account)
: senderSs58Account;
const [dapps, combinedInfo] = await Promise.all([
axios.get<DappItem[]>(dappsUrl),
service.getCombinedInfo(address),
Expand Down

0 comments on commit a0a73d1

Please sign in to comment.