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 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
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/hooks/xcm/useTransferRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type TransferMode = 'local' | 'xcm';
export const astarNetworks = ['astar', 'shiden', 'shibuya'];
export const astarNativeTokens = ['sdn', 'astr', 'sby'];
// e.g.: endpointKey.SHIDEN;
const disabledXcmChain: endpointKey | undefined = undefined;
const disabledXcmChain: endpointKey | undefined = endpointKey.SHIDEN;

export interface NetworkFromTo {
from: string;
Expand Down
13 changes: 10 additions & 3 deletions src/modules/information/recent-history/transfer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,16 @@ export const castTransferHistory = ({
const timestamp = String(tx.timestamp);
const txType = HistoryTxType.Transfer;
const note = `To ${getShortenAddress(to)}`;
const networkIdx = localStorage.getItem(NETWORK_IDX);
const subscan = providerEndpoints[Number(networkIdx)].subscan;
const explorerUrl = `${subscan}/extrinsic/${hash}`;
const networkIdx = Number(localStorage.getItem(NETWORK_IDX));
let explorerUrl: string = '';

if (networkIdx === endpointKey.ASTAR_ZKEVM || networkIdx === endpointKey.ZKYOTO) {
const blockscount = providerEndpoints[networkIdx].blockscout;
explorerUrl = `${blockscount}/tx/${hash}`;
} else {
const subscan = providerEndpoints[networkIdx].subscan;
explorerUrl = `${subscan}/extrinsic/${hash}`;
}
return { timestamp, txType, amount, symbol, note, explorerUrl };
};

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';

const ERA_LENGTHS = new Map<string, EraLengths>([
[
Expand Down Expand Up @@ -95,13 +96,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