macro_rules! address {
($text:literal $(,)?) => { ... };
($payment:expr $(,)?) => { ... };
($payment:expr, $delegation: expr $(,)?) => { ... };
}Expand description
Construct a Mainnet 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!("addr1v83gkkw3nqzakg5xynlurqcfqhgd65vkfvf5xv8tx25ufds2yvy2h");// From a script credential, using yet another macro:
assert_eq!(
address!(script_credential!("bd3ae991b5aafccafe5ca70758bd36a9b2f872f57f6d3a1ffa0eb777")).to_string(),
"addr1wx7n46v3kk40ejh7tjnswk9ax65m97rj74lk6wsllg8twac57dez7",
);// From key credentials, with delegation:
assert_eq!(
address!(
key_credential!("bd3ae991b5aafccafe5ca70758bd36a9b2f872f57f6d3a1ffa0eb777"),
key_credential!("bd3ae991b5aafccafe5ca70758bd36a9b2f872f57f6d3a1ffa0eb777"),
).to_string(),
"addr1qx7n46v3kk40ejh7tjnswk9ax65m97rj74lk6wsllg8twaaa8t5erdd2ln90uh98qavt6d4fktu89atld5apl7swkamst576s8",
);