1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! # sourcify
//!
//! A lightweight read-only wrapper for [Sourcify](https://sourcify.dev),
//! including the Sourcify v2 API and Sourcify 4byte signature API.
//!
//! ## Supported APIs
//!
//! - [`v2::Client`] wraps the Sourcify v2 contract data API.
//! - [API Docs](https://docs.sourcify.dev/docs/api/#server-api-documentation)
//! - [OpenAPI](https://sourcify.dev/server/api-docs/swagger.json)
//! - [`four_byte::Client`] wraps the Sourcify 4byte signature API.
//! - [API Docs](https://docs.sourcify.dev/docs/api/#4byte-signature-service-api-documentation)
//! - [OpenAPI](https://api.4byte.sourcify.dev/api-docs/swagger.json)
//!
//! ## Limitations
//!
//! The crate is intentionally small: use [`Sourcify::v2`] to retrieve verified
//! contract data, source files, ABI, and metadata by chain ID and address, and
//! use [`Sourcify::four_byte`] to resolve function selectors or event topics.
//!
//! ## Contract Source Lookup
//!
//! ```rust,no_run
//! use sourcify::{v2, Sourcify};
//!
//! #[tokio::main]
//! async fn main() -> sourcify::Result<()> {
//! let client = Sourcify::new();
//! let contract = client
//! .v2()
//! .get_contract_with_fields(
//! 1,
//! "0xdAC17F958D2ee523a2206206994597C13D831ec7",
//! &[v2::field::SOURCES, v2::field::ABI, v2::field::METADATA],
//! )
//! .await?;
//!
//! if let Some(contract) = contract {
//! println!("verified on chain {}", contract.chain_id);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## 4byte Lookup
//!
//! ```rust,no_run
//! use sourcify::Sourcify;
//!
//! #[tokio::main]
//! async fn main() -> sourcify::Result<()> {
//! let client = Sourcify::new();
//! let signatures = client.four_byte().lookup_function("0xa9059cbb").await?;
//!
//! for signature in signatures {
//! println!("{}", signature.name);
//! }
//!
//! Ok(())
//! }
//! ```
//!
pub use ;
use Client as HttpClient;
use Arc;
/// Shared entry point for the Sourcify v2 and 4byte clients.