@@ -81,19 +81,20 @@ export const decodeTransaction = (tx: GenLayerRawTransaction): GenLayerTransacti
8181 txData : tx . txData ,
8282 txDataDecoded : txDataDecoded ,
8383
84- currentTimestamp : tx . currentTimestamp . toString ( ) ,
85- numOfInitialValidators : tx . numOfInitialValidators . toString ( ) ,
86- txSlot : tx . txSlot . toString ( ) ,
87- createdTimestamp : tx . createdTimestamp . toString ( ) ,
88- lastVoteTimestamp : tx . lastVoteTimestamp . toString ( ) ,
89- queuePosition : tx . queuePosition . toString ( ) ,
90- numOfRounds : tx . numOfRounds . toString ( ) ,
84+ currentTimestamp : tx . currentTimestamp ?. toString ( ) ?? "0" ,
85+ // Bradbury uses `initialRotations`; older chains use `numOfInitialValidators`
86+ numOfInitialValidators : ( tx . numOfInitialValidators ?? ( tx as any ) . initialRotations ) ?. toString ( ) ?? "0" ,
87+ txSlot : tx . txSlot ?. toString ( ) ?? "0" ,
88+ createdTimestamp : tx . createdTimestamp ?. toString ( ) ?? "0" ,
89+ lastVoteTimestamp : tx . lastVoteTimestamp ?. toString ( ) ?? "0" ,
90+ queuePosition : tx . queuePosition ?. toString ( ) ?? "0" ,
91+ numOfRounds : tx . numOfRounds ?. toString ( ) ?? "0" ,
9192
9293 readStateBlockRange : {
9394 ...tx . readStateBlockRange ,
94- activationBlock : tx . readStateBlockRange . activationBlock . toString ( ) ,
95- processingBlock : tx . readStateBlockRange . processingBlock . toString ( ) ,
96- proposalBlock : tx . readStateBlockRange . proposalBlock . toString ( ) ,
95+ activationBlock : tx . readStateBlockRange ? .activationBlock ? .toString ( ) ?? "0" ,
96+ processingBlock : tx . readStateBlockRange ? .processingBlock ? .toString ( ) ?? "0" ,
97+ proposalBlock : tx . readStateBlockRange ? .proposalBlock ? .toString ( ) ?? "0" ,
9798 } ,
9899
99100 statusName :
@@ -103,13 +104,13 @@ export const decodeTransaction = (tx: GenLayerRawTransaction): GenLayerTransacti
103104
104105 lastRound : {
105106 ...tx . lastRound ,
106- round : tx . lastRound . round . toString ( ) ,
107- leaderIndex : tx . lastRound . leaderIndex . toString ( ) ,
108- votesCommitted : tx . lastRound . votesCommitted . toString ( ) ,
109- votesRevealed : tx . lastRound . votesRevealed . toString ( ) ,
110- appealBond : tx . lastRound . appealBond . toString ( ) ,
111- rotationsLeft : tx . lastRound . rotationsLeft . toString ( ) ,
112- validatorVotesName : tx . lastRound . validatorVotes . map (
107+ round : tx . lastRound ? .round ? .toString ( ) ?? "0" ,
108+ leaderIndex : tx . lastRound ? .leaderIndex ? .toString ( ) ?? "0" ,
109+ votesCommitted : tx . lastRound ? .votesCommitted ? .toString ( ) ?? "0" ,
110+ votesRevealed : tx . lastRound ? .votesRevealed ? .toString ( ) ?? "0" ,
111+ appealBond : tx . lastRound ? .appealBond ? .toString ( ) ?? "0" ,
112+ rotationsLeft : tx . lastRound ? .rotationsLeft ? .toString ( ) ?? "0" ,
113+ validatorVotesName : ( tx . lastRound ? .validatorVotes ?? [ ] ) . map (
113114 vote => voteTypeNumberToName [ String ( vote ) as keyof typeof voteTypeNumberToName ] ,
114115 ) as VoteType [ ] ,
115116 } ,
0 commit comments