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

Release/fleek/1.9.1 #730

Merged
merged 16 commits into from
Jun 28, 2022
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
31 changes: 17 additions & 14 deletions src/components/App/Menu/AppInfoPopper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,6 @@ import { app, SocialNetworkLinks, Links } from '@/consts';
export default class AppInfoPopper extends Mixins(TranslationMixin, mixins.LoadingMixin) {
readonly SocialNetworkLinks = SocialNetworkLinks;
readonly app = app;
readonly textLinks: Array<{ title: string; href: string }> = [
{
title: this.t('helpDialog.privacyPolicy'),
href: Links.privacy,
},
{
title: this.t('releaseNotesText'),
href: Links.releaseNotes,
},
{
title: this.t('helpDialog.termsOfService'),
href: Links.terms,
},
];

specVersion: Nullable<number> = null;

Expand All @@ -75,6 +61,23 @@ export default class AppInfoPopper extends Mixins(TranslationMixin, mixins.Loadi
});
}

get textLinks(): Array<{ title: string; href: string }> {
return [
{
title: this.t('helpDialog.privacyPolicy'),
href: Links.privacy,
},
{
title: this.t('releaseNotesText'),
href: Links.releaseNotes,
},
{
title: this.t('helpDialog.termsOfService'),
href: Links.terms,
},
];
}

get sortedTextLinks(): Array<{ title: string; href: string }> {
return this.textLinks.sort((a, b) => {
const nameA = a.title.toUpperCase();
Expand Down
22 changes: 12 additions & 10 deletions src/components/HelpDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,18 @@ export default class HelpDialog extends Mixins(TranslationMixin, DialogMixin) {
readonly appVersion = app.version;
readonly appEmail = app.email;

readonly links: Array<{ title: string; href: string }> = [
{
title: this.t('helpDialog.termsOfService'),
href: Links.terms,
},
{
title: this.t('helpDialog.privacyPolicy'),
href: Links.privacy,
},
];
get links(): Array<{ title: string; href: string }> {
return [
{
title: this.t('helpDialog.termsOfService'),
href: Links.terms,
},
{
title: this.t('helpDialog.privacyPolicy'),
href: Links.privacy,
},
];
}
}
</script>

Expand Down
1 change: 0 additions & 1 deletion src/components/Moonpay/MoonpayBridgeInitMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default class MoonpayBridgeInitMixin extends Mixins(BridgeHistoryMixin, W
async prepareEvmNetwork(networkId = BridgeNetworks.ETH_NETWORK_ID): Promise<void> {
this.setEvmNetwork(networkId); // WalletConnectMixin
await this.setEvmNetworkType(); // WalletConnectMixin
await this.syncExternalAccountWithAppState(); // WalletConnectMixin
}

initMoonpayApi(): void {
Expand Down
8 changes: 4 additions & 4 deletions src/components/mixins/SubscriptionsMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export default class SubscriptionsMixin extends Mixins(mixins.LoadingMixin) {
return this.parentLoading || this.loading;
}

async mounted(): Promise<void> {
await this.updateSubscriptions();
mounted(): void {
this.updateSubscriptions();
}

async beforeDestroy(): Promise<void> {
await this.resetSubscriptions();
beforeDestroy(): void {
this.resetSubscriptions();
}

public setStartSubscriptions(list: AsyncVoidFn[]) {
Expand Down
12 changes: 0 additions & 12 deletions src/components/mixins/WalletConnectMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,4 @@ export default class WalletConnectMixin extends Mixins(TranslationMixin) {
this.resetEvmAddress();
this.resetWeb3Store();
}

async syncExternalAccountWithAppState(): Promise<void> {
try {
const connected = await ethersUtil.checkAccountIsConnected(this.evmAddress);

if (!connected && this.evmAddress) {
this.disconnectExternalAccount();
}
} catch (error) {
this.disconnectExternalAccount();
}
}
}
1 change: 1 addition & 0 deletions src/consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const Links = {
terms: 'https://wiki.sora.org/polkaswap/terms',
privacy: 'https://wiki.sora.org/polkaswap/privacy',
releaseNotes: pkg.repository.url.replace('.git', '/releases/latest'),
demeterFarmingPlatform: 'https://farming.deotoken.io/',
};

export const ObjectInit = () => null;
Expand Down
10 changes: 8 additions & 2 deletions src/modules/demeterFarming/components/PoolCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
</s-button>
</template>

<div class="demeter-pool-card-copyright">{{ t('demeterFarming.poweredBy') }}</div>
<a :href="link" target="_blank" rel="nofollow noopener" class="demeter-pool-card-copyright">
{{ t('demeterFarming.poweredBy') }}
</a>
</template>
</pool-info>
</s-card>
Expand All @@ -88,7 +90,7 @@ import TranslationMixin from '@/components/mixins/TranslationMixin';
import { getter } from '@/store/decorators';

import router, { lazyComponent } from '@/router';
import { Components, PageNames } from '@/consts';
import { Components, PageNames, Links } from '@/consts';

@Component({
components: {
Expand All @@ -102,6 +104,8 @@ export default class PoolCard extends Mixins(PoolMixin, TranslationMixin) {

@getter.wallet.account.isLoggedIn isLoggedIn!: boolean;

readonly link = Links.demeterFarmingPlatform;

get title(): string {
const key = this.activeStatus ? (this.hasStake ? 'active' : 'inactive') : 'stopped';

Expand Down Expand Up @@ -156,6 +160,8 @@ export default class PoolCard extends Mixins(PoolMixin, TranslationMixin) {
line-height: var(--s-line-height-reset);
text-transform: uppercase;
opacity: 0.75;
color: var(--s-color-base-content-primary);
text-decoration: none;
}
}
</style>
4 changes: 2 additions & 2 deletions src/modules/demeterFarming/mixins/PoolMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default class PoolMixin extends Mixins(AccountPoolMixin, TranslationMixin
}

get hasStake(): boolean {
return this.accountPool ? !this.accountPool.pooledTokens.isZero() : false;
return this.accountPool ? !this.lockedFunds.isZero() : false;
}

get baseAsset(): Nullable<AccountAsset> {
Expand Down Expand Up @@ -98,7 +98,7 @@ export default class PoolMixin extends Mixins(AccountPoolMixin, TranslationMixin
}

get availableFunds(): FPNumber {
return this.isFarm ? this.funds.sub(this.lockedFunds) : this.funds;
return this.isFarm ? FPNumber.max(this.lockedFunds, this.funds).sub(this.lockedFunds) : this.funds;
}

get depositDisabled(): boolean {
Expand Down
6 changes: 4 additions & 2 deletions src/store/rewards/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ const actions = defineActions({
if (!internalAddress) return;

try {
const { externalRewardsSelected, claimableRewards } = getters;
const { externalRewardsSelected, claimableRewards, rewardsByAssetsList } = getters;

const rewardsListToRecieve = [...rewardsByAssetsList];

if (externalRewardsSelected && !externalAddress) return;

Expand Down Expand Up @@ -179,7 +181,7 @@ const actions = defineActions({
// update ui to success state if user not changed external account
if (rootState.web3.evmAddress === externalAddress) {
commit.setTxStep(1);
commit.setRewardsReceived(true);
commit.setRewardsReceived(rewardsListToRecieve);
commit.setRewardsClaiming(false);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/store/rewards/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { AccountMarketMakerInfo } from '@sora-substrate/util/build/rewards/

import { initialState } from './state';
import type { RewardsState } from './types';
import type { SelectedRewards, AccountRewards } from '@/types/rewards';
import type { SelectedRewards, AccountRewards, RewardsAmountHeaderItem } from '@/types/rewards';

const mutations = defineMutations<RewardsState>()({
reset(state): void {
Expand Down Expand Up @@ -34,8 +34,8 @@ const mutations = defineMutations<RewardsState>()({
setTxError(state, value: boolean): void {
state.transactionError = value;
},
setRewardsReceived(state, value: boolean): void {
state.rewardsRecieved = value;
setRewardsReceived(state, rewards: RewardsAmountHeaderItem[]): void {
state.recievedRewards = rewards;
},
setSignature(state, value: string): void {
state.signature = value;
Expand Down
2 changes: 1 addition & 1 deletion src/store/rewards/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function initialState(): RewardsState {
// flags
rewardsFetching: false,
rewardsClaiming: false,
rewardsRecieved: false,
recievedRewards: [],
transactionError: false,
transactionStep: 1,
signature: '',
Expand Down
3 changes: 2 additions & 1 deletion src/store/rewards/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Subscription } from '@polkadot/x-rxjs';
import type { CodecString } from '@sora-substrate/util';
import type { RewardInfo, RewardsInfo, AccountMarketMakerInfo } from '@sora-substrate/util/build/rewards/types';
import type { RewardsAmountHeaderItem } from '@/types/rewards';

export type RewardsState = {
// fee
Expand All @@ -19,8 +20,8 @@ export type RewardsState = {
// flags
rewardsFetching: boolean;
rewardsClaiming: boolean;
rewardsRecieved: boolean;
transactionError: boolean;
recievedRewards: RewardsAmountHeaderItem[];
transactionStep: number;
signature: string;
accountMarketMakerInfo: Nullable<AccountMarketMakerInfo>;
Expand Down
2 changes: 0 additions & 2 deletions src/views/BridgeContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export default class BridgeContainer extends Mixins(mixins.LoadingMixin, WalletC

async created(): Promise<void> {
await this.withLoading(async () => {
await this.syncExternalAccountWithAppState();

await this.withParentLoading(async () => {
this.setEvmNetwork(bridgeApi.externalNetwork);
await this.onEvmNetworkTypeChange();
Expand Down
Loading