### Get LPV3 Locker Infos Request (Go) Source: https://docs.gopluslabs.io/reference/get-lpv3-locker-infos Example Go program to retrieve LPV3 locker information using the standard 'net/http' package. This code makes a GET request to the GoPlusLabs API and prints the response body. ```go package main import ( "fmt" "io" "net/http" ) func main() { url := "https://api.gopluslabs.io/open/api/v1/locks/lpv3s" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("accept", "*/*") client := &http.Client{} res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := io.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Get LPV3 Locker Infos Request (Java) Source: https://docs.gopluslabs.io/reference/get-lpv3-locker-infos Example Java code using the Apache HttpClient library to retrieve LPV3 locker information. This snippet demonstrates constructing and executing a GET request to the GoPlusLabs API. ```java import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; public class GoPlusLabsApi { public static void main(String[] args) throws Exception { String url = "https://api.gopluslabs.io/open/api/v1/locks/lpv3s"; try (CloseableHttpClient client = HttpClients.createDefault()) { HttpGet request = new HttpGet(url); request.addHeader("accept", "*/*"); String responseBody = client.execute(request, response -> EntityUtils.toString(response.getEntity())); System.out.println(responseBody); } } } ``` -------------------------------- ### Java SDK Installation Source: https://docs.gopluslabs.io/reference/getnftinfousingget_1 Instructions on how to install the GoPlus Java SDK as a Maven dependency. ```APIDOC ## Java SDK Installation ### Description This section details how to add the GoPlus Java SDK to your project using Maven. ### Method Dependency Management (Maven) ### Endpoint N/A ### Parameters None ### Request Example ```xml io.gopluslabs goplus-sdk-java 0.1.8 ``` ### Response N/A ``` -------------------------------- ### Get LPV3 Locker Infos Request (Node.js) Source: https://docs.gopluslabs.io/reference/get-lpv3-locker-infos Example Node.js request using the 'axios' library to fetch LPV3 locker information. This snippet demonstrates making a GET request to the GoPlusLabs API and handling the response. ```javascript const axios = require('axios'); const options = { method: 'GET', url: 'https://api.gopluslabs.io/open/api/v1/locks/lpv3s', headers: { 'accept': '*/*' } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); }); ``` -------------------------------- ### Rug-pull Detection API Request Example - Shell Source: https://docs.gopluslabs.io/reference/rug-pull-detection-api-beta This example demonstrates how to call the Rug-pull Detection API using cURL. It specifies the GET request method, the API endpoint with a placeholder for the chain ID, and includes a header for content negotiation. ```shell curl --request GET \ --url https://api.gopluslabs.io/api/v1/rugpull_detecting/chain_id \ --header 'accept: */*' ``` -------------------------------- ### Get Token API Request (Go) Source: https://docs.gopluslabs.io/reference/access-token-api Provides a Go language example for fetching an access token from the GoPlus Labs API. It illustrates how to construct the POST request with appropriate headers and body parameters. ```go // Go example not provided in the source text. ``` -------------------------------- ### PHP: Get Token Security Data using GoPlus SDK Source: https://docs.gopluslabs.io/reference/tokensecurityusingget_1 This PHP code snippet demonstrates fetching token security data with the GoPlus SDK. It shows how to initialize the Token client, with or without an access token, and make the tokenSecurity request. Multiple addresses can be provided in the request, and the timeout can also be configured. Install the SDK using 'composer require goplus/php-sdk'. ```php tokenSecurity("1", "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"); // OR. $accessToken = $auth->getResult()->getAccessToken(); $data = (new Token($accessToken))->tokenSecurity("1", ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"]); // Set timeout. $data = (new Token($accessToken, ['timeout' => 10]))->tokenSecurity("1", ["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"]); ``` -------------------------------- ### Go: Get Token Security Data using GoPlus SDK Source: https://docs.gopluslabs.io/reference/tokensecurityusingget_1 This Go code snippet demonstrates how to use the GoPlus SDK to fetch token security information. It initializes the TokenSecurity client, specifies the chain ID and contract addresses, and processes the response. Error handling is included for API call failures and unsuccessful results. Ensure the GoPlus SDK is installed via 'go get'. ```go package main import ( "fmt" "github.com/GoPlusSecurity/goplus-sdk-go/api/token" "github.com/GoPlusSecurity/goplus-sdk-go/pkg/errorcode" ) func main() { tokenSecurity := token.NewTokenSecurity(nil) chainId := "1" contractAddresses := []string{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"} data, err := tokenSecurity.Run(chainId, contractAddresses) if err != nil { panic(err) } if data.Payload.Code != errorcode.SUCCESS { panic(data.Payload.Message) } value, ok := data.Payload.Result["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"] if ok { fmt.Printf("%+v\n", value.TokenSymbol) } } ``` -------------------------------- ### Rug-pull Detection API Request Example - Go Source: https://docs.gopluslabs.io/reference/rug-pull-detection-api-beta This Go program demonstrates how to make a GET request to the Rug-pull Detection API using the standard 'net/http' package. It includes the 'Authorization' header and handles potential errors during the request and JSON unmarshaling. ```go package main import ( "encoding/json" "fmt" "io/ioutil" "log" "net/http" ) func main() { chainID := "1" // Example: Ethereum mainnet contractAddress := "0x..." // Replace with the contract address apiKey := "YOUR_API_KEY" // Replace with your actual API key url := fmt.Sprintf("https://api.gopluslabs.io/api/v1/rugpull_detecting/%s?contract_addresses=%s", chainID, contractAddress) client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { log.Fatalf("Error creating request: %v", err) } req.Header.Add("accept", "*/*") req.Header.Add("Authorization", "Bearer "+apiKey) resp, err := client.Do(req) if err != nil { log.Fatalf("Error making request: %v", err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatalf("Error reading response body: %v", err) } if resp.StatusCode != http.StatusOK { log.Fatalf("API request failed with status code: %d, body: %s", resp.StatusCode, string(body)) } var result map[string]interface{} if err := json.Unmarshal(body, &result); err != nil { log.Fatalf("Error unmarshalling JSON: %v, body: %s", err, string(body)) } fmt.Println(result) } ``` -------------------------------- ### Get Token Security Data using Node.js Source: https://docs.gopluslabs.io/reference/token-security-api This example shows how to retrieve token security data using Node.js with the 'node-fetch' library. It makes a GET request to the API endpoint and handles the JSON response. Ensure 'node-fetch' is installed. ```javascript const fetch = require('node-fetch'); const options = { method: 'GET', headers: { 'accept': '*/*' } }; fetch('https://api.gopluslabs.io/api/v1/token_security/1', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Install GoPlus Security SDK for Go Source: https://docs.gopluslabs.io/docs/goplus-sdk Install the GoPlus Security SDK for Go applications. This command fetches the latest version of the SDK from the GitHub repository. ```go go get github.com/GoPlusSecurity/goplus-sdk-go ``` -------------------------------- ### Python: Get Token Security Data using GoPlus SDK Source: https://docs.gopluslabs.io/reference/tokensecurityusingget_1 This Python code snippet shows how to retrieve token security data using the GoPlus SDK. It initializes the Token client and calls the token_security method with chain ID and a list of addresses. The example also demonstrates setting a request timeout. Install the SDK using 'pip install goplus'. ```python from goplus.token import Token data = Token(access_token=None).token_security( chain_id="1", addresses=["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"] ) print(data) # set timeout seconds data = Token(access_token=None).token_security( chain_id="1", addresses=["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"], **{"_request_timeout": 10} ) print(data) ``` -------------------------------- ### Transaction Simulation API for Solana Source: https://docs.gopluslabs.io/reference/api-overview Solana Txn pre-run to detect potential risks. ```APIDOC ## POST /preruntxusingpost ### Description Simulates a Solana transaction to detect potential risks before execution. ### Method POST ### Endpoint /preruntxusingpost ### Parameters #### Request Body - **simulation_data** (object) - Required - The transaction simulation data. - **payer** (string) - Required - The payer's public key. - **instructions** (array) - Required - List of transaction instructions. - **program_id** (string) - Required - The program ID. - **data** (string) - Required - The instruction data. - **accounts** (array) - Required - List of accounts involved. - **pubkey** (string) - Required - The account public key. - **is_signer** (boolean) - Required - Whether the account is a signer. - **is_writable** (boolean) - Required - Whether the account is writable. - **recent_blockhash** (string) - Required - The recent blockhash. ### Request Example ```json { "example": { "simulation_data": { "payer": "HpE1Cg8kR43h7t3C4k13Jt98oG6s4k3j3j3j3j3j", "instructions": [ { "program_id": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "data": "...", "accounts": [ { "pubkey": "...", "is_signer": true, "is_writable": true } ] } ], "recent_blockhash": "A1b2C3d4E5f6..." } } } ``` ### Response #### Success Response (200) - **code** (integer) - Response code. - **message** (string) - Response message. - **result** (object) - The transaction simulation result. - **is_risky** (boolean) - Whether the transaction is risky. - **risk_details** (array) - Details about the detected risks. #### Response Example ```json { "code": 200, "message": "Success", "result": { "is_risky": true, "risk_details": [ { "type": "high_gas_fee", "message": "Estimated gas fee is higher than usual." } ] } } ``` ``` -------------------------------- ### Check Phishing Site URL using Node.js Source: https://docs.gopluslabs.io/reference/phishing-site-detection-api This Node.js example shows how to make a GET request to the Go+Labs API to check if a given URL is a phishing site. It utilizes the 'axios' library for making HTTP requests and handles the response to determine the phishing status. Ensure 'axios' is installed (`npm install axios`). ```javascript const axios = require('axios'); async function checkPhishingSite(urlToCheck) { try { const response = await axios.get('https://api.gopluslabs.io/api/v1/phishing_site', { params: { url: urlToCheck }, headers: { 'accept': '*/*' } }); console.log(response.data); return response.data; } catch (error) { console.error('Error checking phishing site:', error); return null; } } // Example usage: // checkPhishingSite('http://example.com'); ``` -------------------------------- ### Go: Analyze Solana Pre-Execution Transaction Risks Source: https://docs.gopluslabs.io/reference/transaction-simulation-for-solana This Go example demonstrates how to perform a POST request to the Solana pre-execution API for risk analysis. It constructs the request body and headers, including authorization. ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "strings" ) func main() { apiKey := "YOUR_API_KEY" // Replace with your API key encodedTransaction := "YOUR_ENCODED_TRANSACTION" // Replace with your encoded transaction requestBody, err := json.Marshal(map[string]interface{}{ "request": map[string]string{ "encoded_transaction": encodedTransaction } }) if err != nil { fmt.Println("Error marshaling request body:", err) return } url := "https://api.gopluslabs.io/pis/api/v1/solana/pre_execution" req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody)) if err != nil { fmt.Println("Error creating request:", err) return } req.Header.Set("Authorization", "Bearer "+apiKey) req.Header.Set("accept", "*/*") req.Header.Set("content-type", "application/json") client := &http.Client{} res, err := client.Do(req) if err != nil { fmt.Println("Error sending request:", err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println("Response status:", res.Status) fmt.Println("Response body:", string(body)) } ``` -------------------------------- ### Get Access Token using GoPlus SDK in PHP Source: https://docs.gopluslabs.io/reference/getaccesstokenusingpost Provides a PHP example for retrieving an access token using the GoPlus SDK. This method uses the Auth class, requiring a key and secret for authentication. The SDK can be installed via Composer. ```php getAccessToken(); ``` -------------------------------- ### Get LPV3 Locker Infos Request (Python) Source: https://docs.gopluslabs.io/reference/get-lpv3-locker-infos Example Python script using the 'requests' library to fetch LPV3 locker information from the GoPlusLabs API. It performs a GET request and prints the JSON response. ```python import requests url = "https://api.gopluslabs.io/open/api/v1/locks/lpv3s" headers = { 'accept': '*/*' } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Install GoPlus Java SDK Source: https://docs.gopluslabs.io/reference/getnftinfousingget_1 Instructions for adding the GoPlus Java SDK to your project using Maven. This dependency allows integration with GoPlus Labs services for data retrieval and analysis. ```xml io.gopluslabs goplus-sdk-java 0.1.8 ``` -------------------------------- ### PHP SDK Usage Source: https://docs.gopluslabs.io/reference/getnftinfousingget_1 Example of how to use the GoPlus PHP SDK to interact with the NFT security endpoint. ```APIDOC ## PHP SDK Usage ### Description This section demonstrates how to install and use the GoPlus PHP SDK, specifically for checking NFT security. ### Method SDK Function Call ### Endpoint N/A (SDK abstracts the endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example #### Installation ```bash composer require goplus/php-sdk ``` #### Usage ```php nftSecurity("1", "0x82f5ef9ddc3d231962ba57a9c2ebb307dc8d26c2"); ?> ``` ### Response #### Success Response (200) Details of the NFT security check (specific fields depend on the SDK's return structure). #### Response Example (Example response structure would be detailed here if available) ``` -------------------------------- ### Transaction Simulation API for EVM Source: https://docs.gopluslabs.io/reference/api-overview EVM Txn pre-run to detect potential risks. ```APIDOC ## POST /transaction-simulation-api ### Description Simulates an EVM transaction to detect potential risks before execution. ### Method POST ### Endpoint /transaction-simulation-api ### Parameters #### Query Parameters - **chain_id** (string) - Required - The chain ID of the EVM network. #### Request Body - **tx_data** (object) - Required - The transaction data. - **from** (string) - Required - The sender's address. - **to** (string) - Required - The recipient's address. - **value** (string) - Optional - The value to send in wei. - **data** (string) - Optional - The transaction call data. - **gas_price** (string) - Optional - The gas price. - **gas_limit** (string) - Optional - The gas limit. ### Request Example ```json { "example": { "chain_id": "1", "tx_data": { "from": "0x123...", "to": "0x456...", "value": "1000000000000000000", "data": "0x...", "gas_price": "50000000000", "gas_limit": "21000" } } } ``` ### Response #### Success Response (200) - **code** (integer) - Response code. - **message** (string) - Response message. - **result** (object) - The transaction simulation result. - **is_risky** (boolean) - Whether the transaction is risky. - **risk_details** (array) - Details about the detected risks. #### Response Example ```json { "code": 200, "message": "Success", "result": { "is_risky": false, "risk_details": [] } } ``` ``` -------------------------------- ### Java: Analyze Solana Pre-Execution Transaction Risks Source: https://docs.gopluslabs.io/reference/transaction-simulation-for-solana This Java example shows how to make an HTTP POST request to the Solana pre-execution API using Apache HttpClient. It demonstrates setting headers and the request body for risk analysis. ```java import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.json.JSONObject; public class SolanaRiskAnalysis { public static void main(String[] args) { String apiKey = "YOUR_API_KEY"; // Replace with your API key String encodedTransaction = "YOUR_ENCODED_TRANSACTION"; // Replace with your encoded transaction try (CloseableHttpClient client = HttpClients.createDefault()) { HttpPost request = new HttpPost("https://api.gopluslabs.io/pis/api/v1/solana/pre_execution"); // Set headers request.setHeader("Authorization", "Bearer " + apiKey); request.setHeader("accept", "*/*"); request.setHeader("content-type", "application/json"); // Create JSON body JSONObject jsonBody = new JSONObject(); JSONObject requestObj = new JSONObject(); requestObj.put("encoded_transaction", encodedTransaction); jsonBody.put("request", requestObj); StringEntity entity = new StringEntity(jsonBody.toString()); request.setEntity(entity); // Execute request try (CloseableHttpResponse response = client.execute(request)) { System.out.println("Response status: " + response.getStatusLine().getStatusCode()); HttpEntity responseEntity = response.getEntity(); if (responseEntity != null) { String responseBody = EntityUtils.toString(responseEntity); System.out.println("Response body: " + responseBody); } } } catch (Exception e) { e.printStackTrace(); } } } ``` -------------------------------- ### Get LPV3 Locker Infos Request (cURL) Source: https://docs.gopluslabs.io/reference/get-lpv3-locker-infos Example cURL request to retrieve LPV3 locker information from the GoPlusLabs API. This command uses the GET method to access the specified endpoint and includes an 'accept' header. ```shell curl --request GET \ --url https://api.gopluslabs.io/open/api/v1/locks/lpv3s \ --header 'accept: */*' ``` -------------------------------- ### Transaction Simulation API for Solana Source: https://docs.gopluslabs.io/reference Solana Txn pre-run to detect potential risks. ```APIDOC ## Transaction Simulation API for Solana ### Description Simulates Solana transactions before execution to detect potential risks. ### Method POST (Assumed, as simulation often involves transaction details) ### Endpoint /solana/simulate-transaction (Assumed endpoint) ### Parameters #### Request Body - **transaction** (object) - Required - The Solana transaction details. - **payer** (string) - Required - The payer's public key. - **instructions** (array) - Required - An array of transaction instructions. - **recent_blockhash** (string) - Required - The recent blockhash. ### Request Example ```json { "example": { "transaction": { "payer": "AcGq2a...", "instructions": [ { "program_id": "Tokenkeg...", "keys": [ {"pubkey": "AcGq2a...", "isSigner": true, "isWritable": true}, {"pubkey": "...", "isSigner": false, "isWritable": true} ], "data": "..." } ], "recent_blockhash": "4t4p..." } } } ``` ### Response #### Success Response (200) - **simulation_result** (object) - The result of the transaction simulation. - **success** (boolean) - Whether the simulation was successful. - **logs** (array) - Logs generated during the simulation. - **errors** (array) - Any errors encountered during simulation. #### Response Example ```json { "example": { "simulation_result": { "success": true, "logs": ["..."], "errors": [] } } } ``` ``` -------------------------------- ### ERC20 Balance Changes Example Source: https://docs.gopluslabs.io/reference/response-detail-copy-2 This example demonstrates the JSON format for ERC20 token balance changes. It details the address, token contract, name, symbol, decimals, and the change in balance. ```json { "erc20_balance_changes": [ { "address": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", "erc20_change": [ { "decimals":"0x12", "token_address": "0x68ca006db91312cd60a2238ce775be5f9f738bba", "token_name": "$ USDCGift.com", "token_symbol": "$ USDCGift.com \<- Visit to claim bonus", "change": "0x100000000000000" } ] } ] } ``` -------------------------------- ### Get LPV4 Locker Infos cURL Request Source: https://docs.gopluslabs.io/reference/get-lpv4-locker-infos This snippet demonstrates how to make a GET request to the GoPlus Labs API to retrieve LPV4 locker information. It specifies the URL and the 'accept' header. The request requires 'pageNum' and 'pageSize' as query parameters, which are not shown in this basic example. ```shell curl --request GET \ --url https://api.gopluslabs.io/open/api/v1/locks/lpv4s \ --header 'accept: */*' ``` -------------------------------- ### Get Supported Chains List (Java) Source: https://docs.gopluslabs.io/reference/supported-blockchains-1 Retrieves the list of supported chains using Java with the Apache HttpClient library. This example demonstrates making an HTTP GET request to the Go+ API. ```java import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; public class GetSupportedChains { public static void main(String[] args) throws Exception { CloseableHttpClient client = HttpClients.createDefault(); HttpGet request = new HttpGet("https://api.gopluslabs.io/api/v1/supported_chains"); request.addHeader("accept", "*/*"); String responseBody = client.execute(request, response -> { return EntityUtils.toString(response.getEntity()); }); System.out.println(responseBody); client.close(); } } ``` -------------------------------- ### Get Token API Request (Shell) Source: https://docs.gopluslabs.io/reference/access-token-api Example of how to make a POST request to the /api/v1/token endpoint using cURL. It includes the URL, headers, and body parameters required to obtain an access token. ```shell curl --request POST \ --url https://api.gopluslabs.io/api/v1/token \ --header 'accept: */*' \ --header 'content-type: application/json' ``` -------------------------------- ### POST /pis/api/v1/solana/pre_execution Source: https://docs.gopluslabs.io/reference/preruntxusingpost Simulates a Solana transaction before execution to identify potential risks and analyze asset changes. Requires an authorization token. ```APIDOC ## POST /pis/api/v1/solana/pre_execution ### Description Simulates a Solana transaction to check for potential risks and analyze asset changes. ### Method POST ### Endpoint /pis/api/v1/solana/pre_execution ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **encoded_transaction** (string) - Required - The Solana transaction encoded in a string format. ### Request Example ```json { "encoded_transaction": "" } ``` ### Response #### Success Response (200) - **code** (integer) - Code 1 indicates success. - **message** (string) - Response message. - **result** (object) - Contains the simulation results. - **allowance_upgrades** (array) - Details on allowance upgrades. - **asset_changes** (object) - Details on asset changes. #### Response Example ```json { "code": 1, "message": "Success", "result": { "allowance_upgrades": [ { "decimals": 6, "mint": "So11111111111111111111111111111111111111112", "name": "Wrapped SOL", "new_allowances": [ { "allowance_change": "+1000000", "owner": "", "post_amount": "1000000", "pre_amount": "0", "risky_spender": 0, "spender": "" } ], "symbol": "WSOL" } ], "asset_changes": {} } } ``` ``` -------------------------------- ### Simulate Transaction (cURL) Source: https://docs.gopluslabs.io/reference/transaction-simulation-api Example cURL request for simulating a transaction. This shows the POST method, URL, and required 'content-type' header. Additional headers like 'accept' are also demonstrated. ```shell curl --request POST \ --url https://api.gopluslabs.io/api/v1/transaction_simulation \ --header 'accept: */*' \ --header 'content-type: application/json' ```