epochutil

package
v0.5.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenesisTimestamp = int32(1598306400)

Functions

func EpochToTime

func EpochToTime(epoch int32) time.Time

func Initialize

func Initialize(ctx context.Context, lotusAPI string, lotusToken string) error

Initialize sets the GenesisTimestamp based on the Lotus API and Token provided. If the Lotus API is from the "https://api.node.glif.io/rpc" endpoint, it sets a hardcoded GenesisTimestamp. Otherwise, it creates a new Lotus client using the provided Lotus API and Token, and fetches the genesis block information from the Lotus node to set the GenesisTimestamp.

Parameters:

  • ctx: The context used to control the lifecycle of the RPC request. If the context is done, the function exits cleanly.
  • lotusAPI: The endpoint of the Lotus JSON-RPC API.
  • lotusToken: The token used to authenticate with the Lotus JSON-RPC API.

Returns:

  • error: An error that represents the failure of the operation, or nil if the operation was successful.

func TimeToEpoch

func TimeToEpoch(t time.Time) abi.ChainEpoch

func UnixToEpoch

func UnixToEpoch(unix int64) abi.ChainEpoch

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL