Crate pubport

Source
Expand description

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

§Supported formats

  • Descriptors
  • Electrum
  • Wasabi
  • JSON

§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(_)));

Modules§

descriptor
formats
json
key_expression
Parse a key expression string into a KeyExpression, we only support KeyExpressions that contain an XPub, we do not support KeyExpressions that contain a private key or bare compressed or uncompressed public keys.
xpub

Functions§

parse_from_str

Type Aliases§

Error
Format