@@ -391,31 +391,37 @@ def get_leadership_schedule(
391
391
392
392
return schedule
393
393
394
- def get_slot_no (self ) -> int :
394
+ def get_slot_no (self , tip : dict [ str , tp . Any ] | None = None ) -> int :
395
395
"""Return slot number of last block that was successfully applied to the ledger."""
396
+ tip = tip or self .get_tip ()
396
397
return int (self .get_tip ()["slot" ])
397
398
398
- def get_block_no (self ) -> int :
399
+ def get_block_no (self , tip : dict [ str , tp . Any ] | None = None ) -> int :
399
400
"""Return block number of last block that was successfully applied to the ledger."""
401
+ tip = tip or self .get_tip ()
400
402
return int (self .get_tip ()["block" ])
401
403
402
- def get_epoch (self ) -> int :
404
+ def get_epoch (self , tip : dict [ str , tp . Any ] | None = None ) -> int :
403
405
"""Return epoch of last block that was successfully applied to the ledger."""
406
+ tip = tip or self .get_tip ()
404
407
return int (self .get_tip ()["epoch" ])
405
408
406
- def get_epoch_slot_no (self ) -> int :
409
+ def get_epoch_slot_no (self , tip : dict [ str , tp . Any ] | None = None ) -> int :
407
410
"""Return slot number within a given epoch.
408
411
409
412
(of last block successfully applied to the ledger)
410
413
"""
414
+ tip = tip or self .get_tip ()
411
415
return int (self .get_tip ()["slotInEpoch" ])
412
416
413
- def get_slots_to_epoch_end (self ) -> int :
417
+ def get_slots_to_epoch_end (self , tip : dict [ str , tp . Any ] | None = None ) -> int :
414
418
"""Return the number of slots left until the epoch end."""
419
+ tip = tip or self .get_tip ()
415
420
return int (self .get_tip ()["slotsToEpochEnd" ])
416
421
417
- def get_era (self ) -> str :
422
+ def get_era (self , tip : dict [ str , tp . Any ] | None = None ) -> str :
418
423
"""Return network era."""
424
+ tip = tip or self .get_tip ()
419
425
era : str = self .get_tip ()["era" ]
420
426
return era
421
427
0 commit comments