Skip to content

Fork of rust-bip21 to correctly handle capitalisation in 'bitcoin' scheme

Notifications You must be signed in to change notification settings

get10101/rust-bip21

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-bip21

test

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

Usage

Parse the URI bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=50&label=Luke-Jr&message=Donation for project&req-somethingelseyoudontget=999.

u := bip21::parse(String::from("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=50&label=Luke-Jr&message=Donation for project&req-somethingelseyoudontget=999")).unwrap();

// UriResources { urn_scheme: "bitcoin", address: "175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W", amount: Some(50.0), label: Some("Luke-Jr"), message: Some("Donation for project"), params: Some({"req-somethingelseyoudontget": "999"}) }
println!("{:?}", u);

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

let u = bip21::UriResources::new(
    String::from("bitcoin"),
    String::from("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"),
    Some(100.0),
    Some(String::from("Luke-Jr")),
    Some(String::from("message")),
    Some(HashMap::new()),
);

let uri = u.build_uri().unwrap();

// bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=20.3&label=Luke-Jr
println!("{:?}", uri);

About

Fork of rust-bip21 to correctly handle capitalisation in 'bitcoin' scheme

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%