diff --git a/src/frontend/src/eth/components/fee/EthFeePriority.svelte b/src/frontend/src/eth/components/fee/EthFeePriority.svelte index ed55328a2fc..cdc0be0092f 100644 --- a/src/frontend/src/eth/components/fee/EthFeePriority.svelte +++ b/src/frontend/src/eth/components/fee/EthFeePriority.svelte @@ -103,6 +103,7 @@ {priority} selected={priority === $sendEthFeePriority} testId={`${ETH_FEE_PRIORITY_OPTION}-${priority}`} + waitTimeMs={$feePrioritiesStore.waitTimeMs[priority]} /> {/each} diff --git a/src/frontend/src/eth/components/fee/EthFeePriorityOption.svelte b/src/frontend/src/eth/components/fee/EthFeePriorityOption.svelte index b411a71ebd9..9f6e1a9fc52 100644 --- a/src/frontend/src/eth/components/fee/EthFeePriorityOption.svelte +++ b/src/frontend/src/eth/components/fee/EthFeePriorityOption.svelte @@ -1,7 +1,8 @@ diff --git a/src/frontend/src/eth/rest/infura.rest.ts b/src/frontend/src/eth/rest/infura.rest.ts index 03460199d95..6f20b65a63e 100644 --- a/src/frontend/src/eth/rest/infura.rest.ts +++ b/src/frontend/src/eth/rest/infura.rest.ts @@ -40,6 +40,11 @@ export class InfuraGasRest { [EthFeePriority.SLOW]: mapLevel(low), [EthFeePriority.NORMAL]: mapLevel(medium), [EthFeePriority.FAST]: mapLevel(high) + }, + waitTimeMs: { + [EthFeePriority.SLOW]: low.maxWaitTimeEstimate, + [EthFeePriority.NORMAL]: medium.maxWaitTimeEstimate, + [EthFeePriority.FAST]: high.maxWaitTimeEstimate } }; }; diff --git a/src/frontend/src/eth/services/fee.services.ts b/src/frontend/src/eth/services/fee.services.ts index c2c973d323e..a1c05ee5166 100644 --- a/src/frontend/src/eth/services/fee.services.ts +++ b/src/frontend/src/eth/services/fee.services.ts @@ -151,7 +151,7 @@ export const getEthFeeDataWithProvider = async ({ const { getSuggestedFeeData } = new InfuraGasRest(chainId); - const { baseFeePerGas, perPriority } = await getSuggestedFeeData(); + const { baseFeePerGas, perPriority, waitTimeMs } = await getSuggestedFeeData(); const { maxFeePerGas: floorMaxFeePerGas, maxPriorityFeePerGas: floorMaxPriorityFeePerGas } = getGasFeeFloor(chainId); @@ -174,6 +174,7 @@ export const getEthFeeDataWithProvider = async ({ const priorities: EthFeePriorities = { baseFeePerGas, + waitTimeMs, perPriority: { [EthFeePriority.SLOW]: applyFloors(perPriority[EthFeePriority.SLOW]), [EthFeePriority.NORMAL]: applyFloors(perPriority[EthFeePriority.NORMAL]), diff --git a/src/frontend/src/eth/types/fee.ts b/src/frontend/src/eth/types/fee.ts index e8451a2f0fa..c94ed606224 100644 --- a/src/frontend/src/eth/types/fee.ts +++ b/src/frontend/src/eth/types/fee.ts @@ -13,4 +13,7 @@ export type EthFeePerGas = Pick; + // Kept beside `perPriority` rather than inside it: those entries are spread straight into + // `TransactionFeeData`, which has no place for a wait estimate. + waitTimeMs: Record; } diff --git a/src/frontend/src/tests/eth/components/fee/EthFeePriority.spec.ts b/src/frontend/src/tests/eth/components/fee/EthFeePriority.spec.ts index a391b64aef4..b1c7f0a18cb 100644 --- a/src/frontend/src/tests/eth/components/fee/EthFeePriority.spec.ts +++ b/src/frontend/src/tests/eth/components/fee/EthFeePriority.spec.ts @@ -26,6 +26,11 @@ describe('EthFeePriority', () => { [Priority.SLOW]: { maxFeePerGas: 100_000_000_000n, maxPriorityFeePerGas: 1_000_000_000n }, [Priority.NORMAL]: { maxFeePerGas: 100_000_000_000n, maxPriorityFeePerGas: 5_000_000_000n }, [Priority.FAST]: { maxFeePerGas: 100_000_000_000n, maxPriorityFeePerGas: 20_000_000_000n } + }, + waitTimeMs: { + [Priority.SLOW]: 48_000, + [Priority.NORMAL]: 24_000, + [Priority.FAST]: 12_000 } }; diff --git a/src/frontend/src/tests/eth/components/send/EthSendForm.spec.ts b/src/frontend/src/tests/eth/components/send/EthSendForm.spec.ts index 58f126e8742..790f5106e56 100644 --- a/src/frontend/src/tests/eth/components/send/EthSendForm.spec.ts +++ b/src/frontend/src/tests/eth/components/send/EthSendForm.spec.ts @@ -47,6 +47,11 @@ describe('EthSendForm', () => { [EthFeePriority.SLOW]: { maxFeePerGas: 100n, maxPriorityFeePerGas: 1n }, [EthFeePriority.NORMAL]: { maxFeePerGas: 100n, maxPriorityFeePerGas: 5n }, [EthFeePriority.FAST]: { maxFeePerGas: 100n, maxPriorityFeePerGas: 20n } + }, + waitTimeMs: { + [EthFeePriority.SLOW]: 48_000, + [EthFeePriority.NORMAL]: 24_000, + [EthFeePriority.FAST]: 12_000 } }); diff --git a/src/frontend/src/tests/eth/rest/infura.rest.spec.ts b/src/frontend/src/tests/eth/rest/infura.rest.spec.ts index 03ea9445886..8f1008f2550 100644 --- a/src/frontend/src/tests/eth/rest/infura.rest.spec.ts +++ b/src/frontend/src/tests/eth/rest/infura.rest.spec.ts @@ -62,6 +62,11 @@ describe('infura.rest', () => { maxFeePerGas: parseToken({ value: '41.161299308', unitName: 'gwei' }), maxPriorityFeePerGas: parseToken({ value: '0.3', unitName: 'gwei' }) } + }, + waitTimeMs: { + [EthFeePriority.SLOW]: 30000, + [EthFeePriority.NORMAL]: 45000, + [EthFeePriority.FAST]: 60000 } }; diff --git a/src/frontend/src/tests/eth/services/eth-open-crypto-pay.services.spec.ts b/src/frontend/src/tests/eth/services/eth-open-crypto-pay.services.spec.ts index ffc1d50d532..315efb76c33 100644 --- a/src/frontend/src/tests/eth/services/eth-open-crypto-pay.services.spec.ts +++ b/src/frontend/src/tests/eth/services/eth-open-crypto-pay.services.spec.ts @@ -48,6 +48,11 @@ vi.mock('$eth/providers/infura-cketh.providers', () => ({ const mockEthFeePriorities: EthFeePriorities = { baseFeePerGas: 5n, + waitTimeMs: { + [EthFeePriority.SLOW]: 48_000, + [EthFeePriority.NORMAL]: 24_000, + [EthFeePriority.FAST]: 12_000 + }, perPriority: { [EthFeePriority.SLOW]: { maxFeePerGas: 12n, maxPriorityFeePerGas: 7n }, [EthFeePriority.NORMAL]: { maxFeePerGas: 12n, maxPriorityFeePerGas: 7n }, diff --git a/src/frontend/src/tests/eth/services/fee.services.spec.ts b/src/frontend/src/tests/eth/services/fee.services.spec.ts index 54e370156e5..57ba9edf142 100644 --- a/src/frontend/src/tests/eth/services/fee.services.spec.ts +++ b/src/frontend/src/tests/eth/services/fee.services.spec.ts @@ -23,6 +23,11 @@ const mockSuggestedFeeData = ({ maxPriorityFeePerGas }: EthFeePerGas): EthFeePriorities => ({ baseFeePerGas: 5n, + waitTimeMs: { + [EthFeePriority.SLOW]: 48_000, + [EthFeePriority.NORMAL]: 24_000, + [EthFeePriority.FAST]: 12_000 + }, perPriority: { [EthFeePriority.SLOW]: { maxFeePerGas, maxPriorityFeePerGas }, [EthFeePriority.NORMAL]: { maxFeePerGas, maxPriorityFeePerGas },