From ca88b627f5ed276df905b8c62b4a9607a499069d Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Mon, 3 Mar 2025 14:07:51 +0100 Subject: [PATCH 1/3] feat: update utils --- src/intl/compiled/en.json | 36 ++++++++++++++++++++++++------------ src/intl/en.json | 18 ++++++++++++------ src/utils/beaconchain.ts | 26 +++++++++++++++++++++++--- 3 files changed, 59 insertions(+), 21 deletions(-) diff --git a/src/intl/compiled/en.json b/src/intl/compiled/en.json index 484b57d7..299c9f88 100644 --- a/src/intl/compiled/en.json +++ b/src/intl/compiled/en.json @@ -2079,6 +2079,12 @@ "value": "Exiting" } ], + "Ab1qjD": [ + { + "type": 0, + "value": "Confirm on execution layer" + } + ], "AbBgEs": [ { "type": 0, @@ -2287,6 +2293,12 @@ "value": "Proof of stake" } ], + "CFjSbY": [ + { + "type": 0, + "value": "Available to withdrawal" + } + ], "CPl2hh": [ { "type": 0, @@ -3125,6 +3137,12 @@ "value": "Formerly TurboGeth, Erigon is an Ethereum client built to enable performance optimizations." } ], + "I7N/DN": [ + { + "type": 0, + "value": "Confirmation on the execution layer does not guarantee that the request will be valid on the consensus layer. Please check the beacon explorer to confirm if the request is successful after 13 minutes (under normal finalization period)." + } + ], "ICbItT": [ { "type": 0, @@ -3381,12 +3399,6 @@ "value": "Further reading" } ], - "Jge1Sx": [ - { - "type": 0, - "value": "Force exit" - } - ], "JhUYU3": [ { "type": 0, @@ -6223,6 +6235,12 @@ "value": "Setup" } ], + "dyfKG1": [ + { + "type": 0, + "value": "Exit fully" + } + ], "dzdAcD": [ { "type": 0, @@ -7343,12 +7361,6 @@ "value": "Advisories" } ], - "l5kq/q": [ - { - "type": 0, - "value": "Confirm on-chain" - } - ], "l6OJpv": [ { "type": 0, diff --git a/src/intl/en.json b/src/intl/en.json index affd2069..4404d734 100644 --- a/src/intl/en.json +++ b/src/intl/en.json @@ -765,6 +765,9 @@ "AZaw+B": { "message": "Exiting" }, + "Ab1qjD": { + "message": "Confirm on execution layer" + }, "AbBgEs": { "message": "understanding validator effective balance" }, @@ -856,6 +859,9 @@ "CF9vMR": { "message": "Proof of stake" }, + "CFjSbY": { + "message": "Available to withdrawal" + }, "CPl2hh": { "message": "I have reviewed the checklist and understand how withdrawals work." }, @@ -1184,6 +1190,9 @@ "I7MjRD": { "message": "Formerly TurboGeth, Erigon is an Ethereum client built to enable performance optimizations." }, + "I7N/DN": { + "message": "Confirmation on the execution layer does not guarantee that the request will be valid on the consensus layer. Please check the beacon explorer to confirm if the request is successful after 13 minutes (under normal finalization period)." + }, "ICbItT": { "message": "This approach creates a single compounding account. Requires at least {MIN_ACTIVATION_BALANCE} {TICKER_NAME}, and can hold up to {MAX_EFFECTIVE_BALANCE}." }, @@ -1265,9 +1274,6 @@ "Ja5vXW": { "message": "Further reading" }, - "Jge1Sx": { - "message": "Force exit" - }, "JhUYU3": { "message": "Download CLI app" }, @@ -2352,6 +2358,9 @@ "dvr19k": { "message": "Setup" }, + "dyfKG1": { + "message": "Exit fully" + }, "dzdAcD": { "message": "Default Port" }, @@ -2785,9 +2794,6 @@ "l5XCJW": { "message": "Advisories" }, - "l5kq/q": { - "message": "Confirm on-chain" - }, "l6OJpv": { "message": "First, create a venv virtualenv under repository directory:" }, diff --git a/src/utils/beaconchain.ts b/src/utils/beaconchain.ts index 757ddfdf..360b9d9a 100644 --- a/src/utils/beaconchain.ts +++ b/src/utils/beaconchain.ts @@ -4,13 +4,33 @@ import { SLOTS_PER_EPOCH, } from './envVars'; +export const getEpochMsSinceGenesis = (epoch: number) => + epoch * SLOTS_PER_EPOCH * MS_PER_SLOT; + /** * Converts an epoch number to it's unix time in ms * * @param epoch - The epoch number to convert. * @returns The corresponding unix time in ms. */ -export const epochToDate = (epoch: number): Date => { - const msSinceGenesis = epoch * SLOTS_PER_EPOCH * MS_PER_SLOT; - return new Date(BEACON_CHAIN_GENESIS_TIME + msSinceGenesis); +export const epochToDate = (epoch: number): Date => + new Date(BEACON_CHAIN_GENESIS_TIME + getEpochMsSinceGenesis(epoch)); + +/** + * Calculate current epoch using current time + * + * @returns The current epoch number + */ +export const getCurrentEpoch = (): number => { + const msElapsed = Date.now() - BEACON_CHAIN_GENESIS_TIME; + return Math.floor(msElapsed / MS_PER_SLOT / SLOTS_PER_EPOCH); }; + +/** + * Calculate current epoch using current time + * + * @returns The current epoch number + */ +export const currentEpoch = Math.floor( + (Date.now() - BEACON_CHAIN_GENESIS_TIME) / MS_PER_SLOT / SLOTS_PER_EPOCH +); From eef3f5a2b1024505bf8c443d1cab10e9a1018153 Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Mon, 3 Mar 2025 14:08:15 +0100 Subject: [PATCH 2/3] chore: update copy --- .../TransactionProgress.tsx | 15 ++++++++++----- src/pages/Actions/components/ForceExit.tsx | 4 ++-- src/pages/Actions/components/PartialWithdraw.tsx | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/components/TransactionStatusModal/TransactionProgress.tsx b/src/components/TransactionStatusModal/TransactionProgress.tsx index 6b7faac5..4fc2ad02 100644 --- a/src/components/TransactionStatusModal/TransactionProgress.tsx +++ b/src/components/TransactionStatusModal/TransactionProgress.tsx @@ -118,12 +118,17 @@ export const TransactionProgress: React.FC = ({ - - - - +
+ + + + + + + + - +
); }; diff --git a/src/pages/Actions/components/ForceExit.tsx b/src/pages/Actions/components/ForceExit.tsx index 0511723a..5977e5a5 100644 --- a/src/pages/Actions/components/ForceExit.tsx +++ b/src/pages/Actions/components/ForceExit.tsx @@ -78,7 +78,7 @@ const ForceExit: React.FC = ({ validator }) => { const walletProvider = await (connector as AbstractConnector).getProvider(); const web3 = new Web3(walletProvider); - // Force exits have withdrawal amount of 0 + // Full exits have withdrawal amount of 0 const { transactionParams, queue: withdrawalQueue, @@ -111,7 +111,7 @@ const ForceExit: React.FC = ({ validator }) => { return ( <>