Skip to content

Commit

Permalink
Release hotfix to main (#1311)
Browse files Browse the repository at this point in the history
* Ledger dApp Staking V3 Promotion Card  (#1304)

* Ledger dApp Staking v3 promotion card to dApp Staking page

- Add Ledger dApp Staking v3 banner to image folder
- Update dapp_promtions.json file

* Update dapp_promotions.json

* Update dapp_promotions.json

* Update dapp_promotions.json

* dApp staking banner text update (#1308)

* dApp staking banner text update

* Banner text update

* Improve getDapp method error handling (#1307)

* fix recent history link for zkevm (#1312)

* fix recent history link for zkevm

* remove useless console.log

* remove XCM txs in getZkEVMTxHistories function

* refactor castTransferHistory function

* hotfix: disabling xcm for Shiden (#1313)

---------

Co-authored-by: Gaius_sama <[email protected]>
Co-authored-by: Taegeon Alan Go <[email protected]>
Co-authored-by: Roy <[email protected]>
  • Loading branch information
4 people authored Jun 13, 2024
1 parent 06454e2 commit 7b9ddde
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
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

0 comments on commit 7b9ddde

Please sign in to comment.