Extract Blockchain Addresses
This Rust crate provides functions to extract blockchain addresses from a given text input. Currently, it supports:
- Ethereum-based addresses (e.g., Ethereum, Binance Smart Chain, etc.)
- Solana addresses
- Tron addresses
Installation
To use this crate in your Rust project, add the following dependency to your Cargo.toml file:
[]
= "1.0.1"
Usage
Below is an example of how to use this crate to extract blockchain addresses from a given text:
use extract_token_address_from_message_text;
Functions
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.
Example
let text = "Some Solana address: frhb8l7y9qq41qzxyltc2nw8an1rjfllxrf2x9rwllmo";
let result = extract_token_address_from_message_text;
assert_eq!;
Notes
- This crate only extracts addresses, not ERC-20/SPL token contract addresses.
- If multiple addresses are present, it returns the first one found in the text.
License
This project is licensed under the MIT License.