macro_rules! bytesn {
($env:expr, [$($x:expr),+ $(,)?] $(,)?) => { ... };
($env:expr, $x:tt $(,)?) => { ... };
}
Expand description
Create a BytesN with an array, or an integer or hex literal.
The first argument in the list must be a reference to an Env.
The second argument can be an u8 array, or an integer literal of unbounded size in any form: base10, hex, etc.
ยงExamples
use soroban_sdk::{Env, bytesn};
let env = Env::default();
let bytes = bytesn!(&env, 0xfded3f55dec47250a52a8c0bb7038e72fa6ffaae33562f77cd2b629ef7fd424d);
assert_eq!(bytes.len(), 32);
use soroban_sdk::{Env, bytesn};
let env = Env::default();
let bytes = bytesn!(&env, [2, 0]);
assert_eq!(bytes.len(), 2);