pubport

Crates.iopubport
lib.rspubport
version0.4.0
created_at2025-03-05 19:21:22.0729+00
updated_at2025-04-23 16:15:58.193876+00
descriptionA library for parsing hardware wallet export formats
homepagehttps://github.com/bitcoinppl/pubport
repositoryhttps://github.com/bitcoinppl/pubport
max_upload_size
id1579466
size113,235
Praveen Perera (praveenperera)

documentation

https://docs.rs/pubport

README

PubPort

Crate Info Apache-2.0 Licensed CI Status Docs

A tool to import a wallet public key with descriptors from many different formats seamlessly

Supported formats

  • Descriptors
  • Electrum
  • Wasabi
  • JSON
  • Bare XPUB
  • BIP380 Key Expressions
    • note: XPUBs only, key expressions with private keys, bare compressed or uncompressed public keys are not supported)

Supported descriptors

  • Single Sig

Examples

Import in generic JSON format used by many wallets

use pubport::Format;

let string = std::fs::read_to_string("test/data/sparrow-export.json").unwrap();
let format = Format::try_new_from_str(&string);

assert!(format.is_ok());

let format = format.unwrap();
assert!(matches!(format, Format::Json(_)));

Import from file containing descriptors

note: need external and internal descriptors, but can be single descriptor or multiple descriptor format

use pubport::Format;

let string = std::fs::read_to_string("test/data/descriptor.txt").unwrap();
let format = Format::try_new_from_str(&string);

assert!(format.is_ok());

let format = format.unwrap();
assert!(matches!(format, Format::Descriptor(_)));

Import from wasabi wallet format

use pubport::Format;

let string = std::fs::read_to_string("test/data/new-wasabi.json").unwrap();
let format = Format::try_new_from_str(&string);

assert!(format.is_ok());

let format = format.unwrap();
assert!(matches!(format, Format::Wasabi(_)));

Import from electrum wallet format

use pubport::Format;

let string = std::fs::read_to_string("test/data/new-electrum.json").unwrap();
let format = Format::try_new_from_str(&string);

assert!(format.is_ok());

let format = format.unwrap();
assert!(matches!(format, Format::Electrum(_)));
Commit count: 63

cargo fmt