6 个版本
| 0.2.2 | 2023年10月29日 |
|---|---|
| 0.2.1 | 2023年10月27日 |
| 0.1.2 | 2022年11月20日 |
| 0.1.1 | 2022年8月25日 |
| 0.1.0 | 2022年5月30日 |
#405 in 神奇豆子
2,731 每月下载量
用于 4 个crate (2直接)
35KB
748 行
Rust 的 Ethereum 公共地址实现。
此crate提供了一个用于表示 Ethereum 公共地址的 Address 类型。它实现了 ERC-55 混合大小写校验和的 Display 格式化和解析,使用 Address::from_str_checksum() 进行验证。
此外,还包括了一个 address! 宏,用于编译时验证地址常量。在底层,它使用 const fn 实现,不使用过程宏。
用法
只需将依赖项添加到您的 Cargo.toml
[dependencies]
ethaddr = "*"
有关完整文档,请查看 docs.rs.
lib.rs:
Rust 的 Ethereum 公共地址实现。
此crate提供了一个用于表示 Ethereum 公共地址的 Address 类型。
校验和
地址默认使用 ERC-55 混合大小写校验和编码格式化。在解析时,地址校验和可以选择性验证 [Address::from_str_checksum()]。
address! 宏
此crate导出一个 address! 宏,可用于创建编译时地址常量。在底层,它使用 const fn 实现,不使用过程宏。
特性
- 默认
std:与 Rust 标准库类型的额外集成。特别地,这包括std::error::Error在ParseAddressError类型上的实现以及从Vec<u8>的转换。 serde:为serde包提供的序列化特质。请注意,该实现非常针对 JSON 序列化,与serde_json一起使用。sha3:使用 Rust Crypto Keccak-256 实现(由sha3包提供)而不是内置的实现。请注意,address!宏将始终使用内置的 Keccak-256 实现进行校验和验证,因为sha3没有公开const fnAPI。
依赖项
~0–445KB