diff --git a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/UnstakeModal/UnstakeEthForm/UnstakeEthForm.tsx b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/UnstakeModal/UnstakeEthForm/UnstakeEthForm.tsx index 8464e947172b..0752a1c96526 100644 --- a/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/UnstakeModal/UnstakeEthForm/UnstakeEthForm.tsx +++ b/packages/suite/src/components/suite/modals/ReduxModal/UserContextModal/UnstakeModal/UnstakeEthForm/UnstakeEthForm.tsx @@ -11,7 +11,7 @@ import { getUnstakingPeriodInDays } from 'src/utils/suite/stake'; import UnstakeFees from './Fees'; import { selectValidatorsQueueData } from '@suite-common/wallet-core'; import { getAccountEverstakeStakingPool } from '@suite-common/wallet-utils'; -import { ApproximateEthAmount } from 'src/views/wallet/staking/components/EthStakingDashboard/components/ApproximateEthAmount'; +import { ApproximateInstantEthAmount } from 'src/views/wallet/staking/components/EthStakingDashboard/components/ApproximateInstantEthAmount'; import { BigNumber } from '@trezor/utils'; const DividerWrapper = styled.div` @@ -124,7 +124,7 @@ export const UnstakeEthForm = () => { - diff --git a/packages/suite/src/utils/suite/__fixtures__/stake.ts b/packages/suite/src/utils/suite/__fixtures__/stake.ts index e0f4355c5754..c7057a54beb0 100644 --- a/packages/suite/src/utils/suite/__fixtures__/stake.ts +++ b/packages/suite/src/utils/suite/__fixtures__/stake.ts @@ -872,7 +872,7 @@ export const simulateUnstakeFixture = [ from: undefined, symbol: undefined, }, - ethereumCallResult: {}, + blockchainEvmRpcCallResult: {}, result: null, }, { @@ -883,7 +883,7 @@ export const simulateUnstakeFixture = [ to: '0xAFA848357154a6a624686b348303EF9a13F63264', symbol: 'eth', }, - ethereumCallResult: { + blockchainEvmRpcCallResult: { success: true, payload: { data: '0x000000000000000000000000000000000000000000000000016345785d8a0000' }, }, diff --git a/packages/suite/src/utils/suite/__tests__/stake.test.ts b/packages/suite/src/utils/suite/__tests__/stake.test.ts index 496a907c23d6..5e7df7903b99 100644 --- a/packages/suite/src/utils/suite/__tests__/stake.test.ts +++ b/packages/suite/src/utils/suite/__tests__/stake.test.ts @@ -269,14 +269,14 @@ describe('getChangedInternalTx', () => { }); }); -type EthereumCallResult = Unsuccessful | SuccessWithDevice<{ data: string }>; +type BlockchainEvmRpcCallResult = Unsuccessful | SuccessWithDevice<{ data: string }>; type SimulateUnstakeArgs = StakeTxBaseArgs & { amount: string }; describe('simulateUnstake', () => { simulateUnstakeFixture.forEach(test => { it(test.description, async () => { - jest.spyOn(TrezorConnect, 'ethereumCall').mockImplementation(() => - Promise.resolve(test.ethereumCallResult as EthereumCallResult), + jest.spyOn(TrezorConnect, 'blockchainEvmRpcCall').mockImplementation(() => + Promise.resolve(test.blockchainEvmRpcCallResult as BlockchainEvmRpcCallResult), ); const result = await simulateUnstake(test.args as SimulateUnstakeArgs); expect(result).toEqual(test.result); diff --git a/packages/suite/src/utils/suite/stake.ts b/packages/suite/src/utils/suite/stake.ts index f0eb02bd58b5..64b3f37304d9 100644 --- a/packages/suite/src/utils/suite/stake.ts +++ b/packages/suite/src/utils/suite/stake.ts @@ -653,15 +653,14 @@ export const simulateUnstake = async ({ const amountWei = toWei(amount, 'ether'); const interchanges = 0; - const coin = symbol?.toString(); const data = contractPool.methods .unstake(amountWei, interchanges, WALLET_SDK_SOURCE) .encodeABI(); if (!data) return null; - const ethereumData = await TrezorConnect.ethereumCall({ - coin, + const ethereumData = await TrezorConnect.blockchainEvmRpcCall({ + coin: symbol, from, to: poolAddress, data, diff --git a/packages/suite/src/views/wallet/staking/components/EthStakingDashboard/components/ApproximateEthAmount.tsx b/packages/suite/src/views/wallet/staking/components/EthStakingDashboard/components/ApproximateInstantEthAmount.tsx similarity index 81% rename from packages/suite/src/views/wallet/staking/components/EthStakingDashboard/components/ApproximateEthAmount.tsx rename to packages/suite/src/views/wallet/staking/components/EthStakingDashboard/components/ApproximateInstantEthAmount.tsx index f668bb7ab1aa..5f76d3155adf 100644 --- a/packages/suite/src/views/wallet/staking/components/EthStakingDashboard/components/ApproximateEthAmount.tsx +++ b/packages/suite/src/views/wallet/staking/components/EthStakingDashboard/components/ApproximateInstantEthAmount.tsx @@ -2,14 +2,17 @@ import { FormattedCryptoAmount } from 'src/components/suite'; import { Tooltip } from '@trezor/components'; import { BigNumber } from '@trezor/utils/src/bigNumber'; -interface ApproximateEthAmountProps { +interface ApproximateInstantEthAmountProps { value: string | number; symbol: string; } const DEFAULT_MAX_DECIMAL_PLACES = 2; -export const ApproximateEthAmount = ({ value, symbol }: ApproximateEthAmountProps) => { +export const ApproximateInstantEthAmount = ({ + value, + symbol, +}: ApproximateInstantEthAmountProps) => { const hasDecimals = value.toString().includes('.'); if (!hasDecimals) {