Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge the release-hotfix to main branch #1025

Merged
merged 4 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading