Skip to content

Commit

Permalink
Merge pull request #506 from casper-ecosystem/CSDK/fix_seigniorage_al…
Browse files Browse the repository at this point in the history
…locations_structure

Fixed seigniorage allocations structure
  • Loading branch information
alexmyshchyshyn authored Feb 5, 2025
2 parents 4d73539 + ee082b3 commit 27a276a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/types/Bid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
12 changes: 9 additions & 3 deletions src/types/EraInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -110,7 +116,7 @@ export class SeigniorageAllocation {
/**
* The allocation for a delegator.
*/
@jsonMember({ name: 'Delegator', constructor: DelegatorAllocation })
@jsonMember({ name: 'DelegatorKind', constructor: DelegatorAllocation })
delegator?: DelegatorAllocation;

/**
Expand Down

0 comments on commit 27a276a

Please sign in to comment.