Skip to content

A header only BIP21 compatible URL encoding utility library

Notifications You must be signed in to change notification settings

sdmg15/bip21-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BIP 21 utility library

#include "bip21.hpp"


using namespace sk::bip21;
auto main() -> int {

    // Decoding 
    std::string s{"bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH"};
    auto [res, err] = decode(s);

    std::cout << res;

    // Encoding 
    Component c = { {"amount", "0.23"}, {"label", "foobar"}, {"message", "donation"} };
    const auto encoded =  encode("1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH", std::nullopt, c);

    std::cout << encoded; // bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=0.23&label=foobar&message=donation
}

About

A header only BIP21 compatible URL encoding utility library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published