getSysvarEpochRewardsEncoder function
Returns a fixed-size encoder for the SysvarEpochRewards sysvar.
Implementation
FixedSizeEncoder<SysvarEpochRewards> getSysvarEpochRewardsEncoder() {
final structEncoder =
getStructEncoder([
('distributionStartingBlockHeight', getU64Encoder()),
('numPartitions', getU64Encoder()),
('parentBlockhash', getBlockhashEncoder()),
('totalPoints', getU128Encoder()),
('totalRewards', getDefaultLamportsEncoder()),
('distributedRewards', getDefaultLamportsEncoder()),
('active', getBooleanEncoder()),
])
as FixedSizeEncoder<Map<String, Object?>>;
return FixedSizeEncoder<SysvarEpochRewards>(
fixedSize: sysvarEpochRewardsSize,
write: (value, bytes, offset) {
return structEncoder.write(
{
'distributionStartingBlockHeight':
value.distributionStartingBlockHeight,
'numPartitions': value.numPartitions,
'parentBlockhash': value.parentBlockhash,
'totalPoints': value.totalPoints,
'totalRewards': value.totalRewards,
'distributedRewards': value.distributedRewards,
'active': value.active,
},
bytes,
offset,
);
},
);
}