Documentation
¶
Index ¶
- Constants
- Variables
- func BigPow10(e int32) *big.Float
- func CheckNetworkSupported(ctx context.Context, networkIdentifier *types.NetworkIdentifier, ...) (*types.NetworkStatusResponse, error)
- func ContainsString(arr []string, s string) bool
- func CreateCommandPath(dataDirectory string, cmd string, network *types.NetworkIdentifier) (string, error)
- func CreateTempDir() (string, error)
- func EnsurePathExists(path string) error
- func Equal(a interface{}, b interface{}) bool
- func LoadAndParse(filePath string, output interface{}) error
- func Milliseconds() int64
- func PrettyAmount(amount *big.Int, currency *types.Currency) string
- func RandomNumber(minimum *big.Int, maximum *big.Int) *big.Int
- func RemoveTempDir(dir string)
- func SerializeAndWrite(filePath string, object interface{}) error
- func Zero() *big.Float
Constants ¶
const ( // DefaultFilePermissions specifies that the user can // read and write the file. DefaultFilePermissions = 0600 // AllFilePermissions specifies anyone can do anything // to the file. AllFilePermissions = 0777 // NanosecondsInMillisecond is the number // of nanoseconds in a millisecond. NanosecondsInMillisecond = 1000000 // MillisecondsInSecond is the number // of milliseconds in a second. MillisecondsInSecond = 1000 // OneHundred is the number 100. OneHundred = 100 )
Variables ¶
var ( // OneHundredInt is a big.Int of value 100. OneHundredInt = big.NewInt(OneHundred) // ZeroInt is a big.Int of value 0. ZeroInt = big.NewInt(0) )
Functions ¶
func BigPow10 ¶ added in v0.4.0
BigPow10 computes the value of 10^e. Inspired by: https://steemit.com/tutorial/@gopher23/power-and-root-functions-using-big-float-in-golang
func CheckNetworkSupported ¶ added in v0.4.0
func CheckNetworkSupported( ctx context.Context, networkIdentifier *types.NetworkIdentifier, fetcher *fetcher.Fetcher, ) (*types.NetworkStatusResponse, error)
CheckNetworkSupported checks if a Rosetta implementation supports a given *types.NetworkIdentifier. If it does, the current network status is returned.
func ContainsString ¶ added in v0.4.0
ContainsString returns a boolean indicating whether the string s is in arr.
func CreateCommandPath ¶ added in v0.4.0
func CreateCommandPath( dataDirectory string, cmd string, network *types.NetworkIdentifier, ) (string, error)
CreateCommandPath creates a unique path for a command and network within a data directory. This is used to avoid collision when using multiple commands on multiple networks when the same storage resources are used. If the derived path does not exist, we run os.MkdirAll on the path.
func CreateTempDir ¶
CreateTempDir creates a directory in /tmp for usage within testing.
func EnsurePathExists ¶ added in v0.4.0
EnsurePathExists creates directories along a path if they do not exist.
func Equal ¶
func Equal(a interface{}, b interface{}) bool
Equal returns a boolean indicating if two interfaces are equal.
func LoadAndParse ¶ added in v0.4.0
LoadAndParse reads the file at the provided path and attempts to unmarshal it into output.
func Milliseconds ¶ added in v0.4.0
func Milliseconds() int64
Milliseconds gets the current time in milliseconds.
func PrettyAmount ¶ added in v0.4.0
PrettyAmount returns a currency amount in native format with its symbol.
func RandomNumber ¶ added in v0.4.0
RandomNumber returns some number in the range [minimum, maximum). Source: https://golang.org/pkg/math/big/#Int.Rand
func RemoveTempDir ¶
func RemoveTempDir(dir string)
RemoveTempDir deletes a directory at a provided path for usage within testing.
func SerializeAndWrite ¶ added in v0.4.0
SerializeAndWrite attempts to serialize the provided object into a file at filePath.
Types ¶
This section is empty.