Module ssi::caip2

source ·
Expand description

CAIP-2 Blockchain IDs

This module provides a struct ChainId to represent a CAIP-2 blockchain id, that can be converted to and from a string.

Example

Round-trip parse and serialize a CAIP-2 string.

use ssi_caips::caip2::ChainId;
use std::str::FromStr;

let chain_id_str = "chainstd:8c3444cf8970a9e41a706fab93e7a6c4";
let chain_id = ChainId::from_str(&chain_id_str)?;
assert_eq!(chain_id.to_string(), chain_id_str);

More test cases may be found in the [CAIP-2 specification] test cases.

Structs

Enums