From ee082b348fa9adaabbd761c4aad7ce6e9a4ed8a0 Mon Sep 17 00:00:00 2001 From: Oleksandr Myshchyshyn Date: Tue, 4 Feb 2025 19:36:53 +0200 Subject: [PATCH] Fixed seigniorage allocations structure --- src/types/Bid.ts | 5 ++++- src/types/EraInfo.ts | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/types/Bid.ts b/src/types/Bid.ts index c68e6fac0..c8beb7b21 100644 --- a/src/types/Bid.ts +++ b/src/types/Bid.ts @@ -120,7 +120,10 @@ export class DelegationKind { @jsonMember({ name: 'PublicKey', constructor: PublicKey, - deserializer: json => PublicKey.fromJSON(json), + deserializer: json => { + if (!json) return; + return PublicKey.fromJSON(json); + }, serializer: value => value.toJSON(), preserveNull: true }) diff --git a/src/types/EraInfo.ts b/src/types/EraInfo.ts index cbc8c440b..b1a7c7b89 100644 --- a/src/types/EraInfo.ts +++ b/src/types/EraInfo.ts @@ -68,7 +68,10 @@ export class ValidatorAllocation { @jsonMember({ name: 'validator_public_key', constructor: PublicKey, - deserializer: json => PublicKey.fromJSON(json), + deserializer: json => { + if (!json) return; + return PublicKey.fromJSON(json); + }, serializer: value => value.toJSON() }) validatorPublicKey: PublicKey; @@ -79,7 +82,10 @@ export class ValidatorAllocation { @jsonMember({ name: 'amount', constructor: CLValueUInt512, - deserializer: json => CLValueUInt512.fromJSON(json), + deserializer: json => { + if (!json) return; + return CLValueUInt512.fromJSON(json); + }, serializer: value => value.toJSON() }) amount: CLValueUInt512; @@ -110,7 +116,7 @@ export class SeigniorageAllocation { /** * The allocation for a delegator. */ - @jsonMember({ name: 'Delegator', constructor: DelegatorAllocation }) + @jsonMember({ name: 'DelegatorKind', constructor: DelegatorAllocation }) delegator?: DelegatorAllocation; /**