Skip to content

yassun/go-bip21

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-bip21

Build Status Coverage Status GoDoc license

go-bip21 is an open source library to handle the URI based on the BIP-21 standard.

Install

$ go get github.com/yassun/go-bip21

Usage

Parse the URI bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&label=Luke-Jr.

u, err := bip21.Parse("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&label=Luke-Jr")
if err != nil {...}

// &{UrnScheme:bitcoin Address:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W Amount:20.3 Label:Luke-Jr Message: Params:map[]}
fmt.Printf("%+v\n", u)

Build the URI bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&label=Luke-Jr

u := &bip21.URIResources{
  UrnScheme: "bitcoin",
  Address:   "175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W",
  Amount:    20.3,
  Label:     "Luke-Jr",
  Message:   "",
  Params:    make(map[string]string),
}

uri, err := u.BuildURI()
if err != nil {...}

// bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&label=Luke-Jr
fmt.Printf("%+v\n", uri)

About

Library to parse and generate BIP21 URI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages