From 18f998d10bcd74fc4475934624a6e53a18c1a5e6 Mon Sep 17 00:00:00 2001 From: Marc Espin Date: Fri, 13 Dec 2024 11:43:53 +0100 Subject: [PATCH] refactor(wallet-dashboard): Clean up unused components (#4487) --- .../transactions/StakeTransactionCard.tsx | 47 --------------- .../transactions/UnstakeTransactionCard.tsx | 58 ------------------- .../components/transactions/index.ts | 2 - sdk/typescript/src/version.ts | 2 +- 4 files changed, 1 insertion(+), 108 deletions(-) delete mode 100644 apps/wallet-dashboard/components/transactions/StakeTransactionCard.tsx delete mode 100644 apps/wallet-dashboard/components/transactions/UnstakeTransactionCard.tsx diff --git a/apps/wallet-dashboard/components/transactions/StakeTransactionCard.tsx b/apps/wallet-dashboard/components/transactions/StakeTransactionCard.tsx deleted file mode 100644 index adfc74a33ec..00000000000 --- a/apps/wallet-dashboard/components/transactions/StakeTransactionCard.tsx +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// Modifications Copyright (c) 2024 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -import { Box } from '..'; -import { TransactionAmount } from './'; -import { formatPercentageDisplay, useGetValidatorsApy } from '@iota/core'; -import type { IotaEvent } from '@iota/iota-sdk/client'; -import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils'; - -interface StakeTransactionCardProps { - event: IotaEvent; -} - -export default function StakeTransactionCard({ event }: StakeTransactionCardProps) { - const json = event.parsedJson as { amount: string; validator_address: string; epoch: string }; - const validatorAddress = json?.validator_address; - const stakedAmount = json?.amount; - - const { data: rollingAverageApys } = useGetValidatorsApy(); - - const { apy, isApyApproxZero } = rollingAverageApys?.[validatorAddress] ?? { - apy: null, - }; - - return ( - -
- {stakedAmount && ( - - )} -
-
-
- APY -
- {formatPercentageDisplay(apy, '--', isApyApproxZero)} -
-
-
-
- ); -} diff --git a/apps/wallet-dashboard/components/transactions/UnstakeTransactionCard.tsx b/apps/wallet-dashboard/components/transactions/UnstakeTransactionCard.tsx deleted file mode 100644 index 92419a8c3ec..00000000000 --- a/apps/wallet-dashboard/components/transactions/UnstakeTransactionCard.tsx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// Modifications Copyright (c) 2024 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -import { useFormatCoin } from '@iota/core'; -import type { IotaEvent } from '@iota/iota-sdk/client'; -import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils'; -import { Box } from '..'; -import { TransactionAmount } from './'; - -interface UnstakeTransactionCardProps { - event: IotaEvent; -} - -export default function UnstakeTransactionCard({ event }: UnstakeTransactionCardProps) { - const eventJson = event.parsedJson as { - principal_amount?: number; - reward_amount?: number; - validator_address?: string; - }; - const principalAmount = eventJson?.principal_amount || 0; - const rewardAmount = eventJson?.reward_amount || 0; - const totalAmount = Number(principalAmount) + Number(rewardAmount); - const [formatPrinciple, symbol] = useFormatCoin(principalAmount, IOTA_TYPE_ARG); - const [formattedRewards] = useFormatCoin(rewardAmount || 0, IOTA_TYPE_ARG); - - return ( - -
- {totalAmount && ( - - )} - -
-
Your IOTA Stake
- -
- {formatPrinciple} {symbol} -
-
- -
-
- Staking Rewards Earned -
- -
- {formattedRewards} {symbol} -
-
-
-
- ); -} diff --git a/apps/wallet-dashboard/components/transactions/index.ts b/apps/wallet-dashboard/components/transactions/index.ts index 509933e7c10..1dc714be773 100644 --- a/apps/wallet-dashboard/components/transactions/index.ts +++ b/apps/wallet-dashboard/components/transactions/index.ts @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 export { default as TransactionAmount } from './TransactionAmount'; -export { default as StakeTransactionCard } from './StakeTransactionCard'; -export { default as UnstakeTransactionCard } from './UnstakeTransactionCard'; export { default as TransactionSummary } from './TransactionSummary'; export * from './TransactionTile'; export { default as TransactionIcon } from './TransactionIcon'; diff --git a/sdk/typescript/src/version.ts b/sdk/typescript/src/version.ts index 5f991cdfb70..8e619f300a4 100644 --- a/sdk/typescript/src/version.ts +++ b/sdk/typescript/src/version.ts @@ -5,4 +5,4 @@ // This file is generated by genversion.mjs. Do not edit it directly. export const PACKAGE_VERSION = '0.3.1'; -export const TARGETED_RPC_VERSION = '0.7.0-alpha'; +export const TARGETED_RPC_VERSION = '0.8.0-alpha';