Validates TIP-20 logo URIs by checking byte length and allowed schemes like HTTPS or IPFS to ensure protocol compliance.
// Source: https://github.com/foundry-rs/foundry | License: Apache-2.0 | Copyright 2021 Georgios Konstantopoulos
// Provided via justclaw.it.com; keep this notice with the code.
//! Shared TIP-20 helpers.
use std::fmt;
pub const TIP20_MAX_LOGO_URI_BYTES: usize = 256;
pub const TIP20_ALLOWED_LOGO_URI_SCHEMES: &[&str] = &["https", "http", "ipfs", "data"];
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Tip20LogoUriValidationError {
LogoURITooLong,
InvalidLogoURI,
}
impl fmt::Display for Tip20LogoUriValidationError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::LogoURITooLong => f.write_str("LogoURITooLong"),
Self::InvalidLogoURI => f.write_str("InvalidLogoURI"),
}
}
}
impl std::error::Error fo
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key