selector_id!() { /* proc-macro */ }Expand description
Computes the selector of the string and expands into its u32 representation.
§Note
- The computation takes place at compilation time of the crate.
- Requires an ABI parameter as the first argument to specify the selector computation method.
§Arguments
Abi::Ink: Uses ink! ABI (BLAKE-2 256-bit hash)Abi::Sol: Uses Solidity ABI (Keccak-256 hash)
§Example
// ink! ABI (BLAKE-2)
assert_eq!(selector_id!(Abi::Ink, "hello"), 843960066,);
// Solidity ABI (Keccak-256)
assert_eq!(selector_id!(Abi::Sol, "foo()"), 0xc2985578,);