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 hotfix to main #1311

Merged
merged 6 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export enum HttpCodes {
NotFound = 404,
}
6 changes: 6 additions & 0 deletions src/data/dapp_promotions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[
{
"name": "Ledger - dApp Staking V3",
"shortDescription": "Join dApp Staking V3 with your Ledger device using the new Astar Native app.",
"link": "https://docs.astar.network/docs/build/integrations/wallets/ledger/ledger-native",
"img": "images/dapp_promotions/ledger_dApp_Staking_v3.png"
},
{
"name": "Archisinal",
"shortDescription": "Pioneering Real-World-Assets in the built environment",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ export default {
estimatedRealizedInflationDescription:
'Estimated realized inflation rate at the end of teh current inflation cycle. Check our',
newPeriodWarning:
'New period starting in {days} days. Dont forget to stake during the period and get entitled to bonus!',
"New period starting in {days} days. Don't forget to claim your bonus and re-stake during the voting period and get entitled to bonus again!",
},
bridge: {
selectBridge: 'Select a Bridge',
Expand Down
19 changes: 16 additions & 3 deletions src/staking-v3/logic/repositories/DappStakingRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { Guard } from 'src/v2/common';
import { ethers } from 'ethers';
import { AnyTuple, Codec } from '@polkadot/types/types';
import { u8aToNumber } from '@polkadot/util';
import { HttpCodes } from 'src/constants';

@injectable()
export class DappStakingRepository implements IDappStakingRepository {
Expand All @@ -65,13 +66,25 @@ export class DappStakingRepository implements IDappStakingRepository {
}

//* @inheritdoc
public async getDapp(network: string, dappAddress: string, forEdit = false): Promise<Dapp> {
public async getDapp(
network: string,
dappAddress: string,
forEdit = false
): Promise<Dapp | undefined> {
Guard.ThrowIfUndefined(network, 'network');
Guard.ThrowIfUndefined(dappAddress, 'dappAddress');
const url = `${TOKEN_API_URL}/v1/${network.toLowerCase()}/dapps-staking/dapps/${dappAddress}?forEdit=${forEdit}`;
const response = await axios.get<Dapp>(url);

return response.data;
try {
const response = await axios.get<Dapp>(url);
return response.data;
} catch (error) {
if (axios.isAxiosError(error) && error.response?.status === HttpCodes.NotFound) {
return undefined;
}

throw error;
}
}

//* @inheritdoc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface IDappStakingRepository {
* @param forEdit Flag to indicate if dapp data should be fetched with encoded images.
* @returns A promise that resolves to a dapp data.
*/
getDapp(network: string, dappAddress: string, forEdit?: boolean): Promise<Dapp>;
getDapp(network: string, dappAddress: string, forEdit?: boolean): Promise<Dapp | undefined>;

/**
* Gets protocol state for the given network.
Expand Down
Loading