solagent_plugin_goplus/
lib.rs

1// Copyright 2025 zTgx
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15pub async fn get_token_security_info(
16    chain_id: &str,
17    contract_address: &str,
18) -> Result<serde_json::Value, reqwest::Error> {
19    let url =
20        format!("https://api.gopluslabs.io/api/v1/token_security/{}?contract_addresses={}", chain_id, contract_address);
21
22    let client = reqwest::Client::new();
23    let response = client.get(url).header("Content-Type", "application/json").send().await?;
24
25    let data = response.json::<serde_json::Value>().await?;
26    Ok(data)
27}
28
29pub async fn get_solana_token_security_info(contract_address: &str) -> Result<serde_json::Value, reqwest::Error> {
30    let url = format!("https://api.gopluslabs.io/api/v1/solana/token_security?contract_addresses={}", contract_address);
31
32    let client = reqwest::Client::new();
33    let response = client.get(url).header("Content-Type", "application/json").send().await?;
34
35    let data = response.json::<serde_json::Value>().await?;
36    Ok(data)
37}
38
39pub async fn get_token_malicious_info(chain_id: &str, address: &str) -> Result<serde_json::Value, reqwest::Error> {
40    let url = format!("https://api.gopluslabs.io/api/v1/address_security/{}?chain_id={}", address, chain_id);
41
42    let client = reqwest::Client::new();
43    let response = client.get(url).header("Content-Type", "application/json").send().await?;
44
45    let data = response.json::<serde_json::Value>().await?;
46    Ok(data)
47}
48
49pub async fn get_token_phishing_site_info(url: &str) -> Result<serde_json::Value, reqwest::Error> {
50    let url = format!("https://api.gopluslabs.io/api/v1/aphishing_site?url={}", url);
51
52    let client = reqwest::Client::new();
53    let response = client.get(url).header("Content-Type", "application/json").send().await?;
54
55    let data = response.json::<serde_json::Value>().await?;
56    Ok(data)
57}