| Crates.io | token_address_extractor |
| lib.rs | token_address_extractor |
| version | 1.2.2 |
| created_at | 2025-03-30 13:47:55.596994+00 |
| updated_at | 2025-06-06 08:20:06.144595+00 |
| description | Library for extracting blockchain addresses from text. |
| homepage | https://github.com/diloytte/AddrXtractor |
| repository | https://github.com/diloytte/AddrXtractor |
| max_upload_size | |
| id | 1612382 |
| size | 22,003 |
This Rust crate provides functions to extract blockchain addresses from a given text input. Currently, it supports:
To use this crate in your Rust project, add the following dependency to your Cargo.toml file:
[dependencies]
extract-blockchain-address = "1.2.0"
Below is an example of how to use this crate to extract blockchain addresses from a given text:
use extract_blockchain_address::extract_token_address_from_message_text;
fn main() {
let text = "This message contains an Ethereum address: 0xAb5801a7D398351b8bE11C439e05C5b3259aec9B";
if let Some(address) = extract_token_address_from_message_text(text) {
println!("Found address: {}", address);
} else {
println!("No valid blockchain address found.");
}
}
extract_token_address_from_message_text(text: &str) -> Option<String>This function scans the given text and extracts the first blockchain address found. It supports Ethereum-based, Solana, and Tron addresses.
let text = "Some Solana address: frhb8l7y9qq41qzxyltc2nw8an1rjfllxrf2x9rwllmo";
let result = extract_token_address_from_message_text(text);
assert_eq!(result, Some("frhb8l7y9qq41qzxyltc2nw8an1rjfllxrf2x9rwllmo".to_string()));
This project is licensed under the MIT License.