diff --git a/packages/blockchain-link-types/src/blockbook.ts b/packages/blockchain-link-types/src/blockbook.ts index fe6b312a505f..ba86fff7a1ab 100644 --- a/packages/blockchain-link-types/src/blockbook.ts +++ b/packages/blockchain-link-types/src/blockbook.ts @@ -8,7 +8,7 @@ import type { EstimateFeeParams, AccountInfoParams, } from './params'; -import type { AccountBalanceHistory, FiatRatesLegacy, TokenStandard } from './common'; +import type { AccountBalanceHistory, FiatRatesLegacy, TokenStandard, StakingPool } from './common'; import type { Tx as BlockbookTx, Vin, @@ -103,6 +103,7 @@ export interface AccountInfo { nonce?: string; tokens?: (XPUBAddress | ERC20 | ERC721 | ERC1155)[]; erc20Contract?: ERC20; + stakingPools?: StakingPool[]; } export interface AccountUtxoParams { diff --git a/packages/blockchain-link-types/src/common.ts b/packages/blockchain-link-types/src/common.ts index 21719f3c2a3a..c885ed9d3f61 100644 --- a/packages/blockchain-link-types/src/common.ts +++ b/packages/blockchain-link-types/src/common.ts @@ -164,6 +164,18 @@ export interface TokenInfo { // transfers: number, // total transactions? } +export interface StakingPool { + autocompoundBalance: string; + claimableAmount: string; + contract: string; + depositedBalance: string; + name: string; + pendingBalance: string; + pendingDepositedBalance: string; + restakedReward: string; + withdrawTotalAmount: string; +} + export interface AccountInfo { descriptor: string; balance: string; @@ -209,6 +221,7 @@ export interface AccountInfo { ledger: number; seq: number; }; + stakingPools?: StakingPool[]; } export interface SubscriptionAccountInfo { diff --git a/packages/blockchain-link-utils/src/blockbook.ts b/packages/blockchain-link-utils/src/blockbook.ts index 7644d5260f05..99055c8dbac1 100644 --- a/packages/blockchain-link-utils/src/blockbook.ts +++ b/packages/blockchain-link-utils/src/blockbook.ts @@ -392,6 +392,7 @@ export const transformAccountInfo = (payload: BlockbookAccountInfo): AccountInfo }, misc, page, + stakingPools: payload?.stakingPools, }; }; diff --git a/packages/components/src/components/Image/images.ts b/packages/components/src/components/Image/images.ts index e1a994ea3cdc..9cb5759e1be4 100644 --- a/packages/components/src/components/Image/images.ts +++ b/packages/components/src/components/Image/images.ts @@ -9,6 +9,8 @@ export const SVG_IMAGES = { DEVICE_CONFIRM_TREZOR_T2T1: 'device-confirm-trezor-t2t1.svg', DEVICE_CONFIRM_TREZOR_T2B1: 'device-confirm-trezor-t2b1.svg', SPINNER: 'spinner.svg', + SPINNER_BLACK: 'spinner-black.svg', + SPINNER_GREY: 'spinner-grey.svg', SPINNER_ORANGE: 'spinner-orange.svg', DEVICE_ANOTHER_SESSION: 'device-another-session.svg', CONNECT_DEVICE: 'connect-device.svg', diff --git a/packages/suite-data/files/images/svg/spinner-black.svg b/packages/suite-data/files/images/svg/spinner-black.svg new file mode 100644 index 000000000000..d3c7b4b3e306 --- /dev/null +++ b/packages/suite-data/files/images/svg/spinner-black.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/suite-data/files/images/svg/spinner-grey.svg b/packages/suite-data/files/images/svg/spinner-grey.svg new file mode 100644 index 000000000000..8d697d2eb3a4 --- /dev/null +++ b/packages/suite-data/files/images/svg/spinner-grey.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/suite/src/actions/wallet/stakeActions.ts b/packages/suite/src/actions/wallet/stakeActions.ts index e959094a684e..d6f58cc7c32e 100644 --- a/packages/suite/src/actions/wallet/stakeActions.ts +++ b/packages/suite/src/actions/wallet/stakeActions.ts @@ -61,7 +61,6 @@ const pushTransaction = if (!signedTx || !precomposedTx || !account) return; const sentTx = await TrezorConnect.pushTransaction(signedTx); - // const sentTx = { success: true, payload: { txid: 'ABC ' } }; // close modal regardless result dispatch(modalActions.onCancel()); @@ -75,22 +74,38 @@ const pushTransaction = if (sentTx.success) { const { txid } = sentTx.payload; - const toastType: Record = { - stake: 'tx-staked', - unstake: 'tx-unstaked', - claim: 'tx-claimed', + const notificationPayload = { + formattedAmount, + device, + descriptor: account.descriptor, + symbol: account.symbol, + txid, }; - dispatch( - notificationsActions.addToast({ - type: toastType[stakeType], - formattedAmount, - device, - descriptor: account.descriptor, - symbol: account.symbol, - txid, - }), - ); + if (stakeType === 'stake') { + dispatch( + notificationsActions.addToast({ + type: 'tx-staked', + ...notificationPayload, + }), + ); + } + if (stakeType === 'unstake') { + dispatch( + notificationsActions.addToast({ + type: 'tx-unstaked', + ...notificationPayload, + }), + ); + } + if (stakeType === 'claim') { + dispatch( + notificationsActions.addToast({ + type: 'tx-claimed', + ...notificationPayload, + }), + ); + } if (precomposedTx.prevTxid) { // notification from the backend may be delayed. diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ClaimModal/ClaimEthForm.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ClaimModal/ClaimEthForm.tsx index bb45fa35461e..c2a14c948534 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ClaimModal/ClaimEthForm.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/ClaimModal/ClaimEthForm.tsx @@ -4,9 +4,10 @@ import { Button, P, variables, Warning } from '@trezor/components'; import { Translation, FiatValue, FormattedCryptoAmount } from 'src/components/suite'; import { FeesInfo } from 'src/components/wallet/FeesInfo'; import { mapTestnetSymbol } from 'src/utils/wallet/coinmarket/coinmarketUtils'; +import { useSelector } from 'src/hooks/suite'; import { useClaimEthFormContext } from 'src/hooks/wallet/useClaimEthForm'; +import { selectSelectedAccountEverstakeStakingPool } from 'src/reducers/wallet/selectedAccountReducer'; import { CRYPTO_INPUT } from 'src/types/wallet/stakeForms'; -import { useClaim } from 'src/hooks/wallet/useClaim'; const AmountInfo = styled.div` display: flex; @@ -62,16 +63,11 @@ export const ClaimEthForm = () => { // used instead of formState.isValid, which is sometimes returning false even if there are no errors const formIsValid = Object.keys(errors).length === 0; const transactionInfo = composedLevels?.[selectedFee]; - const { - claim: { readyForClaim }, - } = useClaim(); - - // TODO: Replace with real data. - const claimingPeriod = 'in the next block'; + const { claimableAmount = '0' } = useSelector(selectSelectedAccountEverstakeStakingPool) ?? {}; useEffect(() => { - onClaimChange(readyForClaim.toString()); - }, [onClaimChange, readyForClaim]); + onClaimChange(claimableAmount); + }, [onClaimChange, claimableAmount]); return (
@@ -81,11 +77,11 @@ export const ClaimEthForm = () => {

- +

- +
@@ -105,7 +101,7 @@ export const ClaimEthForm = () => { -
{claimingPeriod}
+