atp-caip 0.1.3

Chain Agnostic Improvement Proposals (CAIP) implementation for ATP(Account Transfer Protocol)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use lazy_static::lazy_static;
use regex::Regex;

lazy_static! {
    // CAIP-2: namespace:reference (includes wildcard support with *)
    pub static ref CHAIN_ID_REGEX: Regex = Regex::new(r"^([-a-z0-9]{3,8}):([-_a-zA-Z0-9*]{1,32})$").unwrap();

    // CAIP-10: chain_id:account_address (includes wildcard support)
    pub static ref ACCOUNT_ID_REGEX: Regex = Regex::new(r"^([-a-z0-9]{3,8}):([-_a-zA-Z0-9*]{1,32}):([-a-zA-Z0-9]{1,128})$").unwrap();

    // CAIP-19: chain_id/namespace:reference (includes wildcard support)
    pub static ref ASSET_ID_REGEX: Regex = Regex::new(r"^([-a-z0-9]{3,8}):([-a_-zA-Z0-9*]{1,32})/([-a-z0-9]{3,8}):([-a-zA-Z0-9]{1,64})$").unwrap();

    // CAIP-19: namespace:reference
    pub static ref ASSET_ID_BASE_REGEX: Regex = Regex::new(r"^([-a-z0-9]{3,8}):([-a-zA-Z0-9]{1,64})$").unwrap();
}