Skip to content

jon4hz/ethconvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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