util

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// EpochDurationSeconds is the expected duration in seconds of an epoch.
	// Defined at the filecoin spec level.
	EpochDurationSeconds = 30

	// MinDealDuration is the minium deal duration accepted in the Filecoin network.
	// Original calculation: 180 * EpochsInADay.
	MinDealDuration = 180 * (24 * 60 * 60 / EpochDurationSeconds)

	// CidUndef is a magic value to represent an undefined cid as a string.
	CidUndef = "CID_UNDEF"

	// DefaultCidUndef is the string generated by the cid module's String() func for an undefined cid.
	DefaultCidUndef = "b"
)

Variables

View Source
var (
	// AvgBlockTime is the expected duration between block in two consecutive epochs.
	AvgBlockTime = time.Second * time.Duration(EpochDurationSeconds)
)

Functions

func AttoFilToFil added in v1.2.2

func AttoFilToFil(attoFil uint64) string

AttoFilToFil transforms an attoFIL integer value, to a pretty FIL string.

func CidFromString added in v0.2.0

func CidFromString(c string) (cid.Cid, error)

CidFromString converts a string to a cid assuming that an empty string is cid.Undef.

func CidToString added in v0.2.0

func CidToString(c cid.Cid) string

CidToString converts a cid to string, representing cid.Undef as an empty string.

func MustParseAddr

func MustParseAddr(str string) ma.Multiaddr

MustParseAddr returns a parsed Multiaddr, or panics if invalid.

func TCPAddrFromMultiAddr

func TCPAddrFromMultiAddr(maddr ma.Multiaddr) (string, error)

TCPAddrFromMultiAddr converts a multiaddress to a string representation of a tcp address.

Types

This section is empty.

Jump to

Keyboard shortcuts

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