Parse wallet public-key exports into descriptors
Pubport accepts common single-sig wallet export formats and converts them
into external and internal output descriptors. Use [parse_from_str] or
[Format::try_new_from_str] when you have an unknown export string, then
match on [Format] to inspect the parsed descriptors
- 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)
- Single Sig
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(_)));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(_)));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(_)));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(_)));