collection_id

Macro collection_id 

Source
macro_rules! collection_id {
    () => { ... };
    ($value:tt) => { ... };
}
Expand description

Converts a sequence of string literals containing hex-encoded data into a new CollectionId at compile time.

To create a CollectionId from a string literal (no 0x prefix) at compile time:

use thegraph_core::{collection_id, CollectionId};

const COLLECTION_ID: CollectionId = collection_id!("8f2c4a779f66bde2e9c3d81d4315e91db8a42afee0d5f9947c20ab54be73e611");

If no argument is provided, the macro will create a CollectionId with the zero address:

use thegraph_core::{
    alloy::primitives::FixedBytes,
    collection_id, CollectionId
};

const COLLECTION_ID: CollectionId = collection_id!();

assert_eq!(COLLECTION_ID, FixedBytes::<32>::ZERO);