Skip to content

jon4hz/ethconvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
jon4hz
Dec 18, 2021
cb410e5 · Dec 18, 2021

History

4 Commits
Dec 18, 2021
Dec 18, 2021
Dec 17, 2021
Dec 18, 2021
Dec 18, 2021
Dec 18, 2021

Repository files navigation

Go Report Card License: MIT

ethconvert

Ethereum unit converter written in go.

Install

go get github.com/jon4hz/ethconvert/pkg/ethconvert

Example usage

package main

import (
	"fmt"

	"github.com/jon4hz/ethconvert/pkg/ethconvert"
	"github.com/shopspring/decimal"
)

func main() {
	amount := decimal.NewFromInt(50)
	gwei, err := ethconvert.Convert(amount, "ether", "gwei")
	if err != nil {
		panic(err)
	}
	fmt.Println(gwei)
}

CLI

Install

go install github.com/jon4hz/ethconvert/cmd/ethconvert@latest

Example

$ ethconvert -i ether -o wei -a 1
1000000000000000000 wei

$ ethconvert 50 wei gwei
0.00000005 gwei

About

ethereum unit converter written in go

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages