Skip to content

DeOne4eg/eth-unit-converter

Repository files navigation

Github CI/CD Go Report Repository Top Language GitHub go.mod Go version Github Repository Size Github Open Issues Lines of code License GitHub last commit GitHub contributors

Ethereum Unit Converter

It is a simple library for conversion units between themselves. The library is written in Golang.

Install

go get github.com/DeOne4eg/eth-unit-converter

Docs

Usage

// first
amount := ethUnit.NewWei(big.NewInt(1000000000000000000))

fmt.Printf("Wei: %v\n", amount.Wei())
fmt.Printf("GWei: %v\n", amount.GWei())
fmt.Printf("Ether: %v\n", amount.Ether())

// second (the same of first)
amount, err := ethUnit.ParseUnit(big.NewFloat(1000000000000000000), "wei")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("Wei: %v\n", amount.Wei())
fmt.Printf("GWei: %v\n", amount.GWei())
fmt.Printf("Ether: %v\n", amount.Ether())

Tests

  • run with make test

About

Conversion ETH units between themselves

Resources

License

Stars

Watchers

Forks

Packages

No packages published