address_test

Macro address_test 

Source
macro_rules! address_test {
    ($text:literal $(,)?) => { ... };
    ($payment:expr $(,)?) => { ... };
    ($payment:expr, $delegation: expr $(,)?) => { ... };
}
Expand description

Construct a Testnet address from a literal or from its constituents.

Panics when given anything invalid.

Note that the first variation returns an Address<Any>, whereas the two other returns a Address<Shelley>.

ยงexamples

// From a string literal:
let my_address: Address<kind::Any> =
  address_test!("addr_test1vr3gkkw3nqzakg5xynlurqcfqhgd65vkfvf5xv8tx25ufds3vcc9j");
// From a script credential, using yet another macro:
assert_eq!(
  address_test!(script_credential!("bd3ae991b5aafccafe5ca70758bd36a9b2f872f57f6d3a1ffa0eb777")).to_string(),
  "addr_test1wz7n46v3kk40ejh7tjnswk9ax65m97rj74lk6wsllg8twac0ke9dm",
);
// From key credentials, with delegation:
assert_eq!(
  address_test!(
    key_credential!("bd3ae991b5aafccafe5ca70758bd36a9b2f872f57f6d3a1ffa0eb777"),
    key_credential!("bd3ae991b5aafccafe5ca70758bd36a9b2f872f57f6d3a1ffa0eb777"),
  ).to_string(),
  "addr_test1qz7n46v3kk40ejh7tjnswk9ax65m97rj74lk6wsllg8twaaa8t5erdd2ln90uh98qavt6d4fktu89atld5apl7swkamsgzr6uc",
);