File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,13 +26,12 @@ const getDrandInfo = async () => {
2626
2727 const data = await response . json ( )
2828
29- const genesisTime = data . genesis_time
30- const period = data . period
29+ const dataParsed = drandInfoSchema . parse ( data )
3130
32- return drandInfoSchema . parse ( {
33- genesis_time : genesisTime ,
34- period : period ,
35- } )
31+ return {
32+ genesisTime : dataParsed . genesis_time ,
33+ period : dataParsed . period ,
34+ }
3635}
3736const drandRoundSchema = z . object ( {
3837 round : z . number ( ) . transform ( ( value ) => BigInt ( value ) ) ,
@@ -64,7 +63,7 @@ const getDrandRandomnessForRound = async (round: bigint) => {
6463}
6564
6665const drandTimestampToRound = ( timestamp : bigint ) => {
67- return ( timestamp - drandInfo . genesis_time ) / drandInfo . period + 1n
66+ return ( timestamp - drandInfo . genesisTime ) / drandInfo . period + 1n
6867}
6968
7069const drandInfo = await getDrandInfo ( )
You can’t perform that action at this time.
0 commit comments