From 9edb183c97fba937e3ea7bde9874b043ba6f17ae Mon Sep 17 00:00:00 2001 From: Nikita Chebykin Date: Mon, 7 Oct 2024 17:47:28 +0200 Subject: [PATCH] Add Support for Nethermind and Besu 'syncing' Subscription Payload Format (#7306) * Add Support for Nethermind and Besu 'syncing' Subscription Payload Formats * Add CHANGELOG note for PR7306 --- CHANGELOG.md | 6 ++++++ packages/web3-eth/src/web3_subscriptions.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46c0eefe645..b07a0730c4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2729,6 +2729,12 @@ If there are any bugs, improvements, optimizations or any new feature proposal f ## [Unreleased] +### Added + +#### web3-eth + +- `syncing` subscription now supports Besu and Nethermind payload format + ### Changed #### web3-eth diff --git a/packages/web3-eth/src/web3_subscriptions.ts b/packages/web3-eth/src/web3_subscriptions.ts index 5838aa9ce2d..31949fc6883 100644 --- a/packages/web3-eth/src/web3_subscriptions.ts +++ b/packages/web3-eth/src/web3_subscriptions.ts @@ -163,7 +163,7 @@ export class SyncingSubscription extends Web3Subscription<{ this.emit('changed', data); } else { const mappedData: SyncOutput = Object.fromEntries( - Object.entries(data.status).map(([key, value]) => [ + Object.entries(data?.status || data).map(([key, value]) => [ key.charAt(0).toLowerCase() + key.substring(1), value, ]),