m2m-sentinel-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/m2m_cli.js +25 -0
- package/csharp/M2MSentinel.csproj +9 -0
- package/csharp/M2MSentinelClient.cs +67 -0
- package/go/client.go +94 -0
- package/go/go.mod +3 -0
- package/index.js +26 -0
- package/java/M2MSentinelClient.java +67 -0
- package/java/pom.xml +20 -0
- package/java/src/main/java/com/m2msentinel/M2MSentinelClient.java +69 -0
- package/kotlin/M2MSentinelClient.kt +59 -0
- package/kotlin/build.gradle.kts +24 -0
- package/m2m_sentinel/__init__.py +3 -0
- package/m2m_sentinel/client.py +16 -0
- package/m2m_sentinel_sdk.js +12 -0
- package/m2m_sentinel_sdk.py +9 -0
- package/package.json +23 -0
- package/php/M2MSentinelClient.php +52 -0
- package/php/composer.json +20 -0
- package/python/dist/m2m_sentinel-0.1.0-py3-none-any.whl +0 -0
- package/python/dist/m2m_sentinel-0.1.0.tar.gz +0 -0
- package/python/m2m_sentinel/__pycache__/client.cpython-314.pyc +0 -0
- package/python/m2m_sentinel/client.py +40 -0
- package/python/m2m_sentinel.egg-info/PKG-INFO +9 -0
- package/python/m2m_sentinel.egg-info/SOURCES.txt +5 -0
- package/python/m2m_sentinel.egg-info/dependency_links.txt +1 -0
- package/python/m2m_sentinel.egg-info/top_level.txt +1 -0
- package/python/setup.py +10 -0
- package/ruby/m2m_sentinel.gemspec +17 -0
- package/ruby/m2m_sentinel.rb +55 -0
- package/rust/Cargo.toml +11 -0
- package/rust/src/lib.rs +61 -0
- package/swift/M2MSentinelClient.swift +65 -0
- package/swift/Package.swift +23 -0
- package/typescript/index.ts +49 -0
- package/typescript/package.json +13 -0
package/cli/m2m_cli.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const command = process.argv[2];
|
|
4
|
+
const address = process.argv[3];
|
|
5
|
+
|
|
6
|
+
if (command === "audit" && address) {
|
|
7
|
+
const url = `https://m2msentinel.vercel.app/v1/audit/${address}`;
|
|
8
|
+
fetch(url)
|
|
9
|
+
.then(res => {
|
|
10
|
+
if (!res.ok) {
|
|
11
|
+
throw new Error(`HTTP error! status: ${res.status}`);
|
|
12
|
+
}
|
|
13
|
+
return res.json();
|
|
14
|
+
})
|
|
15
|
+
.then(data => {
|
|
16
|
+
console.log(JSON.stringify(data, null, 2));
|
|
17
|
+
})
|
|
18
|
+
.catch(err => {
|
|
19
|
+
console.error("Error running audit:", err.message);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
console.log("Usage: npx m2m-cli audit <address>");
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
<PropertyGroup>
|
|
3
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
|
4
|
+
<PackageId>M2MSentinel</PackageId>
|
|
5
|
+
<Version>1.0.0</Version>
|
|
6
|
+
<Authors>M2M Sentinel</Authors>
|
|
7
|
+
<Description>Enterprise C# SDK for M2M Sentinel.</Description>
|
|
8
|
+
</PropertyGroup>
|
|
9
|
+
</Project>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Net.Http;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
using System.Web;
|
|
5
|
+
|
|
6
|
+
namespace M2MSentinel
|
|
7
|
+
{
|
|
8
|
+
public class M2MSentinelClient
|
|
9
|
+
{
|
|
10
|
+
private readonly HttpClient _httpClient;
|
|
11
|
+
private readonly string _baseUrl;
|
|
12
|
+
public readonly string PayoutWallet = "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e";
|
|
13
|
+
|
|
14
|
+
public M2MSentinelClient(string baseUrl = "https://m2msentinel.vercel.app")
|
|
15
|
+
{
|
|
16
|
+
_baseUrl = baseUrl.TrimEnd('/');
|
|
17
|
+
_httpClient = new HttpClient();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private async Task<string> GetAsync(string path)
|
|
21
|
+
{
|
|
22
|
+
var response = await _httpClient.GetAsync($"{_baseUrl}{path}");
|
|
23
|
+
response.EnsureSuccessStatusCode();
|
|
24
|
+
return await response.Content.ReadAsStringAsync();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public Task<string> AuditContractAsync(string address)
|
|
28
|
+
{
|
|
29
|
+
return GetAsync($"/v1/audit/{HttpUtility.UrlEncode(address)}");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public Task<string> GetDexMetricsAsync()
|
|
33
|
+
{
|
|
34
|
+
return GetAsync("/v1/dex/metrics");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public Task<string> GetWhaleSignalsAsync()
|
|
38
|
+
{
|
|
39
|
+
return GetAsync("/v1/whales/signals");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public Task<string> GetTokenPriceAsync(string symbol)
|
|
43
|
+
{
|
|
44
|
+
return GetAsync($"/v1/token/price/{HttpUtility.UrlEncode(symbol)}");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public Task<string> SearchAsync(string query)
|
|
48
|
+
{
|
|
49
|
+
return GetAsync($"/v1/search?q={HttpUtility.UrlEncode(query)}");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public Task<string> TokenAuditMultiAsync()
|
|
53
|
+
{
|
|
54
|
+
return GetAsync("/v1/token/audit/multi");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public Task<string> GetNftFloorAsync(string collection)
|
|
58
|
+
{
|
|
59
|
+
return GetAsync($"/v1/nft/floor?collection={HttpUtility.UrlEncode(collection)}");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public Task<string> GetAiSentimentAsync(string symbol)
|
|
63
|
+
{
|
|
64
|
+
return GetAsync($"/v1/ai/sentiment?symbol={HttpUtility.UrlEncode(symbol)}");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/go/client.go
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
package m2m_sentinel
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"fmt"
|
|
6
|
+
"net/http"
|
|
7
|
+
"net/url"
|
|
8
|
+
"strings"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
type Client struct {
|
|
12
|
+
BaseURL string
|
|
13
|
+
PayoutWallet string
|
|
14
|
+
HTTPClient *http.Client
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
func NewClient(baseURL string) *Client {
|
|
18
|
+
if baseURL == "" {
|
|
19
|
+
baseURL = "https://m2msentinel.vercel.app"
|
|
20
|
+
}
|
|
21
|
+
baseURL = strings.TrimRight(baseURL, "/")
|
|
22
|
+
return &Client{
|
|
23
|
+
BaseURL: baseURL,
|
|
24
|
+
PayoutWallet: "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e",
|
|
25
|
+
HTTPClient: &http.Client{},
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
func (c *Client) get(path string, out interface{}) error {
|
|
30
|
+
req, err := http.NewRequest("GET", c.BaseURL+path, nil)
|
|
31
|
+
if err != nil {
|
|
32
|
+
return err
|
|
33
|
+
}
|
|
34
|
+
resp, err := c.HTTPClient.Do(req)
|
|
35
|
+
if err != nil {
|
|
36
|
+
return err
|
|
37
|
+
}
|
|
38
|
+
defer resp.Body.Close()
|
|
39
|
+
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
|
40
|
+
return fmt.Errorf("HTTP error: %s", resp.Status)
|
|
41
|
+
}
|
|
42
|
+
return json.NewDecoder(resp.Body).Decode(out)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
func (c *Client) AuditContract(address string) (map[string]interface{}, error) {
|
|
46
|
+
var result map[string]interface{}
|
|
47
|
+
err := c.get(fmt.Sprintf("/v1/audit/%s", address), &result)
|
|
48
|
+
return result, err
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func (c *Client) GetDexMetrics() (map[string]interface{}, error) {
|
|
52
|
+
var result map[string]interface{}
|
|
53
|
+
err := c.get("/v1/dex/metrics", &result)
|
|
54
|
+
return result, err
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
func (c *Client) GetWhaleSignals() (map[string]interface{}, error) {
|
|
58
|
+
var result map[string]interface{}
|
|
59
|
+
err := c.get("/v1/whales/signals", &result)
|
|
60
|
+
return result, err
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
func (c *Client) GetTokenPrice(symbol string) (map[string]interface{}, error) {
|
|
64
|
+
var result map[string]interface{}
|
|
65
|
+
err := c.get(fmt.Sprintf("/v1/token/price/%s", symbol), &result)
|
|
66
|
+
return result, err
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
func (c *Client) Search(query string) (map[string]interface{}, error) {
|
|
70
|
+
var result map[string]interface{}
|
|
71
|
+
q := url.QueryEscape(query)
|
|
72
|
+
err := c.get(fmt.Sprintf("/v1/search?q=%s", q), &result)
|
|
73
|
+
return result, err
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
func (c *Client) TokenAuditMulti() (map[string]interface{}, error) {
|
|
77
|
+
var result map[string]interface{}
|
|
78
|
+
err := c.get("/v1/token/audit/multi", &result)
|
|
79
|
+
return result, err
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
func (c *Client) GetNftFloor(collection string) (map[string]interface{}, error) {
|
|
83
|
+
var result map[string]interface{}
|
|
84
|
+
q := url.QueryEscape(collection)
|
|
85
|
+
err := c.get(fmt.Sprintf("/v1/nft/floor?collection=%s", q), &result)
|
|
86
|
+
return result, err
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
func (c *Client) GetAiSentiment(symbol string) (map[string]interface{}, error) {
|
|
90
|
+
var result map[string]interface{}
|
|
91
|
+
q := url.QueryEscape(symbol)
|
|
92
|
+
err := c.get(fmt.Sprintf("/v1/ai/sentiment?symbol=%s", q), &result)
|
|
93
|
+
return result, err
|
|
94
|
+
}
|
package/go/go.mod
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const axios = require('axios');
|
|
2
|
+
|
|
3
|
+
class M2MSentinelClient {
|
|
4
|
+
constructor(apiKey, baseUrl = 'https://m2msentinel.vercel.app') {
|
|
5
|
+
this.apiKey = apiKey;
|
|
6
|
+
this.baseUrl = baseUrl.replace(/\/+$/, '');
|
|
7
|
+
this.client = axios.create({
|
|
8
|
+
baseURL: this.baseUrl,
|
|
9
|
+
headers: {
|
|
10
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
11
|
+
'Content-Type': 'application/json'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async getStatus() {
|
|
17
|
+
try {
|
|
18
|
+
const response = await this.client.get('/v1/status');
|
|
19
|
+
return response.data;
|
|
20
|
+
} catch (error) {
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = { M2MSentinelClient };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import java.io.IOException;
|
|
2
|
+
import java.net.URI;
|
|
3
|
+
import java.net.URLEncoder;
|
|
4
|
+
import java.net.http.HttpClient;
|
|
5
|
+
import java.net.http.HttpRequest;
|
|
6
|
+
import java.net.http.HttpResponse;
|
|
7
|
+
import java.nio.charset.StandardCharsets;
|
|
8
|
+
|
|
9
|
+
public class M2MSentinelClient {
|
|
10
|
+
private final String baseUrl;
|
|
11
|
+
private final HttpClient httpClient;
|
|
12
|
+
public final String PAYOUT_WALLET = "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e";
|
|
13
|
+
|
|
14
|
+
public M2MSentinelClient() {
|
|
15
|
+
this("https://m2msentinel.vercel.app");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public M2MSentinelClient(String baseUrl) {
|
|
19
|
+
if (baseUrl.endsWith("/")) {
|
|
20
|
+
this.baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
|
|
21
|
+
} else {
|
|
22
|
+
this.baseUrl = baseUrl;
|
|
23
|
+
}
|
|
24
|
+
this.httpClient = HttpClient.newHttpClient();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private String get(String path) throws IOException, InterruptedException {
|
|
28
|
+
HttpRequest request = HttpRequest.newBuilder()
|
|
29
|
+
.uri(URI.create(this.baseUrl + path))
|
|
30
|
+
.GET()
|
|
31
|
+
.build();
|
|
32
|
+
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
|
33
|
+
return response.body();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public String auditContract(String address) throws IOException, InterruptedException {
|
|
37
|
+
return get("/v1/audit/" + URLEncoder.encode(address, StandardCharsets.UTF_8));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public String getDexMetrics() throws IOException, InterruptedException {
|
|
41
|
+
return get("/v1/dex/metrics");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public String getWhaleSignals() throws IOException, InterruptedException {
|
|
45
|
+
return get("/v1/whales/signals");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public String getTokenPrice(String symbol) throws IOException, InterruptedException {
|
|
49
|
+
return get("/v1/token/price/" + URLEncoder.encode(symbol, StandardCharsets.UTF_8));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public String search(String query) throws IOException, InterruptedException {
|
|
53
|
+
return get("/v1/search?q=" + URLEncoder.encode(query, StandardCharsets.UTF_8));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public String tokenAuditMulti() throws IOException, InterruptedException {
|
|
57
|
+
return get("/v1/token/audit/multi");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public String getNftFloor(String collection) throws IOException, InterruptedException {
|
|
61
|
+
return get("/v1/nft/floor?collection=" + URLEncoder.encode(collection, StandardCharsets.UTF_8));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public String getAiSentiment(String symbol) throws IOException, InterruptedException {
|
|
65
|
+
return get("/v1/ai/sentiment?symbol=" + URLEncoder.encode(symbol, StandardCharsets.UTF_8));
|
|
66
|
+
}
|
|
67
|
+
}
|
package/java/pom.xml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
5
|
+
<modelVersion>4.0.0</modelVersion>
|
|
6
|
+
|
|
7
|
+
<groupId>com.m2msentinel</groupId>
|
|
8
|
+
<artifactId>m2m-sentinel-client</artifactId>
|
|
9
|
+
<version>1.0.0</version>
|
|
10
|
+
<packaging>jar</packaging>
|
|
11
|
+
|
|
12
|
+
<name>M2M Sentinel Client</name>
|
|
13
|
+
<description>Enterprise Java SDK for M2M Sentinel.</description>
|
|
14
|
+
|
|
15
|
+
<properties>
|
|
16
|
+
<maven.compiler.source>11</maven.compiler.source>
|
|
17
|
+
<maven.compiler.target>11</maven.compiler.target>
|
|
18
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
19
|
+
</properties>
|
|
20
|
+
</project>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
package com.m2msentinel;
|
|
2
|
+
|
|
3
|
+
import java.io.IOException;
|
|
4
|
+
import java.net.URI;
|
|
5
|
+
import java.net.URLEncoder;
|
|
6
|
+
import java.net.http.HttpClient;
|
|
7
|
+
import java.net.http.HttpRequest;
|
|
8
|
+
import java.net.http.HttpResponse;
|
|
9
|
+
import java.nio.charset.StandardCharsets;
|
|
10
|
+
|
|
11
|
+
public class M2MSentinelClient {
|
|
12
|
+
private final String baseUrl;
|
|
13
|
+
private final HttpClient httpClient;
|
|
14
|
+
public final String PAYOUT_WALLET = "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e";
|
|
15
|
+
|
|
16
|
+
public M2MSentinelClient() {
|
|
17
|
+
this("https://m2msentinel.vercel.app");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public M2MSentinelClient(String baseUrl) {
|
|
21
|
+
if (baseUrl.endsWith("/")) {
|
|
22
|
+
this.baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
|
|
23
|
+
} else {
|
|
24
|
+
this.baseUrl = baseUrl;
|
|
25
|
+
}
|
|
26
|
+
this.httpClient = HttpClient.newHttpClient();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private String get(String path) throws IOException, InterruptedException {
|
|
30
|
+
HttpRequest request = HttpRequest.newBuilder()
|
|
31
|
+
.uri(URI.create(this.baseUrl + path))
|
|
32
|
+
.GET()
|
|
33
|
+
.build();
|
|
34
|
+
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
|
35
|
+
return response.body();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public String auditContract(String address) throws IOException, InterruptedException {
|
|
39
|
+
return get("/v1/audit/" + URLEncoder.encode(address, StandardCharsets.UTF_8));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public String getDexMetrics() throws IOException, InterruptedException {
|
|
43
|
+
return get("/v1/dex/metrics");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public String getWhaleSignals() throws IOException, InterruptedException {
|
|
47
|
+
return get("/v1/whales/signals");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public String getTokenPrice(String symbol) throws IOException, InterruptedException {
|
|
51
|
+
return get("/v1/token/price/" + URLEncoder.encode(symbol, StandardCharsets.UTF_8));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public String search(String query) throws IOException, InterruptedException {
|
|
55
|
+
return get("/v1/search?q=" + URLEncoder.encode(query, StandardCharsets.UTF_8));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public String tokenAuditMulti() throws IOException, InterruptedException {
|
|
59
|
+
return get("/v1/token/audit/multi");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public String getNftFloor(String collection) throws IOException, InterruptedException {
|
|
63
|
+
return get("/v1/nft/floor?collection=" + URLEncoder.encode(collection, StandardCharsets.UTF_8));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public String getAiSentiment(String symbol) throws IOException, InterruptedException {
|
|
67
|
+
return get("/v1/ai/sentiment?symbol=" + URLEncoder.encode(symbol, StandardCharsets.UTF_8));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package com.m2msentinel
|
|
2
|
+
|
|
3
|
+
import java.net.URL
|
|
4
|
+
import java.net.HttpURLConnection
|
|
5
|
+
import java.net.URLEncoder
|
|
6
|
+
import java.io.BufferedReader
|
|
7
|
+
import java.io.InputStreamReader
|
|
8
|
+
|
|
9
|
+
class M2MSentinelClient(private val baseUrl: String = "https://m2msentinel.vercel.app") {
|
|
10
|
+
val payoutWallet: String = "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e"
|
|
11
|
+
private val normalizedBaseUrl: String = baseUrl.removeSuffix("/")
|
|
12
|
+
|
|
13
|
+
private fun getRequest(path: String): String {
|
|
14
|
+
val url = URL(normalizedBaseUrl + path)
|
|
15
|
+
val connection = url.openConnection() as HttpURLConnection
|
|
16
|
+
connection.requestMethod = "GET"
|
|
17
|
+
|
|
18
|
+
return if (connection.responseCode in 200..299) {
|
|
19
|
+
BufferedReader(InputStreamReader(connection.inputStream)).use { it.readText() }
|
|
20
|
+
} else {
|
|
21
|
+
BufferedReader(InputStreamReader(connection.errorStream ?: connection.inputStream)).use { it.readText() }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fun auditContract(address: String): String {
|
|
26
|
+
return getRequest("/v1/audit/$address")
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fun getDexMetrics(): String {
|
|
30
|
+
return getRequest("/v1/dex/metrics")
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
fun getWhaleSignals(): String {
|
|
34
|
+
return getRequest("/v1/whales/signals")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fun getTokenPrice(symbol: String): String {
|
|
38
|
+
return getRequest("/v1/token/price/$symbol")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fun search(query: String): String {
|
|
42
|
+
val q = URLEncoder.encode(query, "UTF-8")
|
|
43
|
+
return getRequest("/v1/search?q=$q")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
fun tokenAuditMulti(): String {
|
|
47
|
+
return getRequest("/v1/token/audit/multi")
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fun getNftFloor(collection: String): String {
|
|
51
|
+
val q = URLEncoder.encode(collection, "UTF-8")
|
|
52
|
+
return getRequest("/v1/nft/floor?collection=$q")
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
fun getAiSentiment(symbol: String): String {
|
|
56
|
+
val q = URLEncoder.encode(symbol, "UTF-8")
|
|
57
|
+
return getRequest("/v1/ai/sentiment?symbol=$q")
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
plugins {
|
|
2
|
+
kotlin("jvm") version "1.9.22"
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
group = "com.m2msentinel"
|
|
6
|
+
version = "1.0-SNAPSHOT"
|
|
7
|
+
|
|
8
|
+
repositories {
|
|
9
|
+
mavenCentral()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
java {
|
|
13
|
+
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
14
|
+
targetCompatibility = JavaVersion.VERSION_1_8
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
sourceSets {
|
|
18
|
+
main {
|
|
19
|
+
kotlin {
|
|
20
|
+
srcDir(".")
|
|
21
|
+
exclude("build.gradle.kts")
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class M2MSentinelClient:
|
|
4
|
+
def __init__(self, api_key: str, base_url: str = "https://m2msentinel.vercel.app"):
|
|
5
|
+
self.api_key = api_key
|
|
6
|
+
self.base_url = base_url.rstrip("/")
|
|
7
|
+
self.session = requests.Session()
|
|
8
|
+
self.session.headers.update({
|
|
9
|
+
"Authorization": f"Bearer {self.api_key}",
|
|
10
|
+
"Content-Type": "application/json"
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
def get_status(self):
|
|
14
|
+
response = self.session.get(f"{self.base_url}/v1/status")
|
|
15
|
+
response.raise_for_status()
|
|
16
|
+
return response.json()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class M2MSentinelSDK {
|
|
2
|
+
constructor(apiKey) {
|
|
3
|
+
this.apiKey = apiKey;
|
|
4
|
+
this.baseUrl = 'https://m2msentinel.vercel.app/v1';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
async getTokenPrice() {
|
|
8
|
+
const response = await fetch(`${this.baseUrl}/token/price`);
|
|
9
|
+
return response.json();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
module.exports = M2MSentinelSDK;
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "m2m-sentinel-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official Node.js SDK for M2M Sentinel API",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"m2m-cli": "./cli/m2m_cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"m2m",
|
|
14
|
+
"sentinel",
|
|
15
|
+
"api",
|
|
16
|
+
"sdk"
|
|
17
|
+
],
|
|
18
|
+
"author": "M2M Sentinel",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"axios": "^1.6.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
class M2MSentinelClient {
|
|
4
|
+
public string $base_url;
|
|
5
|
+
public string $payout_wallet;
|
|
6
|
+
|
|
7
|
+
public function __construct(string $base_url = "https://m2msentinel.vercel.app") {
|
|
8
|
+
$this->base_url = rtrim($base_url, "/");
|
|
9
|
+
$this->payout_wallet = "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
private function get(string $path) {
|
|
13
|
+
$url = $this->base_url . $path;
|
|
14
|
+
$response = file_get_contents($url);
|
|
15
|
+
if ($response === false) {
|
|
16
|
+
throw new Exception("Failed to fetch data from API");
|
|
17
|
+
}
|
|
18
|
+
return json_decode($response, true);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public function audit_contract(string $address) {
|
|
22
|
+
return $this->get("/v1/audit/" . urlencode($address));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public function get_dex_metrics() {
|
|
26
|
+
return $this->get("/v1/dex/metrics");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public function get_whale_signals() {
|
|
30
|
+
return $this->get("/v1/whales/signals");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public function get_token_price(string $symbol) {
|
|
34
|
+
return $this->get("/v1/token/price/" . urlencode($symbol));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public function search(string $query) {
|
|
38
|
+
return $this->get("/v1/search?q=" . urlencode($query));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public function token_audit_multi() {
|
|
42
|
+
return $this->get("/v1/token/audit/multi");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public function get_nft_floor(string $collection) {
|
|
46
|
+
return $this->get("/v1/nft/floor?collection=" . urlencode($collection));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public function get_ai_sentiment(string $symbol) {
|
|
50
|
+
return $this->get("/v1/ai/sentiment?symbol=" . urlencode($symbol));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "m2m-sentinel/sdk",
|
|
3
|
+
"description": "PHP SDK for M2M Sentinel API",
|
|
4
|
+
"type": "library",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"authors": [
|
|
7
|
+
{
|
|
8
|
+
"name": "M2M Sentinel",
|
|
9
|
+
"email": "support@m2msentinel.com"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"require": {
|
|
13
|
+
"php": ">=7.4"
|
|
14
|
+
},
|
|
15
|
+
"autoload": {
|
|
16
|
+
"classmap": [
|
|
17
|
+
"M2MSentinelClient.php"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import urllib.parse
|
|
2
|
+
import urllib.request
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
class M2MSentinelClient:
|
|
6
|
+
def __init__(self, base_url="https://m2msentinel.vercel.app"):
|
|
7
|
+
self.base_url = base_url.rstrip("/")
|
|
8
|
+
self.payout_wallet = "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e"
|
|
9
|
+
|
|
10
|
+
def _get(self, path):
|
|
11
|
+
req = urllib.request.Request(f"{self.base_url}{path}")
|
|
12
|
+
with urllib.request.urlopen(req) as response:
|
|
13
|
+
return json.loads(response.read().decode())
|
|
14
|
+
|
|
15
|
+
def audit_contract(self, address: str):
|
|
16
|
+
return self._get(f"/v1/audit/{address}")
|
|
17
|
+
|
|
18
|
+
def get_dex_metrics(self):
|
|
19
|
+
return self._get("/v1/dex/metrics")
|
|
20
|
+
|
|
21
|
+
def get_whale_signals(self):
|
|
22
|
+
return self._get("/v1/whales/signals")
|
|
23
|
+
|
|
24
|
+
def get_token_price(self, symbol: str):
|
|
25
|
+
return self._get(f"/v1/token/price/{symbol}")
|
|
26
|
+
|
|
27
|
+
def search(self, query: str):
|
|
28
|
+
q = urllib.parse.quote(query)
|
|
29
|
+
return self._get(f"/v1/search?q={q}")
|
|
30
|
+
|
|
31
|
+
def token_audit_multi(self):
|
|
32
|
+
return self._get("/v1/token/audit/multi")
|
|
33
|
+
|
|
34
|
+
def get_nft_floor(self, collection: str):
|
|
35
|
+
q = urllib.parse.quote(collection)
|
|
36
|
+
return self._get(f"/v1/nft/floor?collection={q}")
|
|
37
|
+
|
|
38
|
+
def get_ai_sentiment(self, symbol: str):
|
|
39
|
+
q = urllib.parse.quote(symbol)
|
|
40
|
+
return self._get(f"/v1/ai/sentiment?symbol={q}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/python/setup.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Gem::Specification.new do |spec|
|
|
2
|
+
spec.name = "m2m_sentinel"
|
|
3
|
+
spec.version = "0.1.0"
|
|
4
|
+
spec.authors = ["M2M Sentinel"]
|
|
5
|
+
spec.email = ["support@m2msentinel.com"]
|
|
6
|
+
|
|
7
|
+
spec.summary = "Ruby SDK for M2M Sentinel API"
|
|
8
|
+
spec.description = "Client library for the M2M Sentinel API, wrapping endpoints with configured payout wallet."
|
|
9
|
+
spec.homepage = "https://m2msentinel.vercel.app"
|
|
10
|
+
spec.license = "MIT"
|
|
11
|
+
|
|
12
|
+
spec.files = Dir["*.rb"]
|
|
13
|
+
spec.require_paths = ["."]
|
|
14
|
+
|
|
15
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
16
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
17
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
class M2MSentinelClient
|
|
6
|
+
attr_accessor :base_url, :payout_wallet
|
|
7
|
+
|
|
8
|
+
def initialize(base_url = 'https://m2msentinel.vercel.app')
|
|
9
|
+
@base_url = base_url.chomp('/')
|
|
10
|
+
@payout_wallet = '0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def audit_contract(address)
|
|
14
|
+
get("/v1/audit/#{address}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_dex_metrics
|
|
18
|
+
get("/v1/dex/metrics")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_whale_signals
|
|
22
|
+
get("/v1/whales/signals")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def get_token_price(symbol)
|
|
26
|
+
get("/v1/token/price/#{symbol}")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def search(query)
|
|
30
|
+
q = URI.encode_www_form_component(query)
|
|
31
|
+
get("/v1/search?q=#{q}")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def token_audit_multi
|
|
35
|
+
get("/v1/token/audit/multi")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def get_nft_floor(collection)
|
|
39
|
+
q = URI.encode_www_form_component(collection)
|
|
40
|
+
get("/v1/nft/floor?collection=#{q}")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def get_ai_sentiment(symbol)
|
|
44
|
+
q = URI.encode_www_form_component(symbol)
|
|
45
|
+
get("/v1/ai/sentiment?symbol=#{q}")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def get(path)
|
|
51
|
+
uri = URI("#{@base_url}#{path}")
|
|
52
|
+
response = Net::HTTP.get(uri)
|
|
53
|
+
JSON.parse(response)
|
|
54
|
+
end
|
|
55
|
+
end
|
package/rust/Cargo.toml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "m2m_sentinel"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[dependencies]
|
|
7
|
+
reqwest = { version = "0.11", features = ["json"] }
|
|
8
|
+
serde = { version = "1.0", features = ["derive"] }
|
|
9
|
+
serde_json = "1.0"
|
|
10
|
+
tokio = { version = "1", features = ["full"] }
|
|
11
|
+
url = "2.2"
|
package/rust/src/lib.rs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
use reqwest::{Client, Error};
|
|
2
|
+
use serde_json::Value;
|
|
3
|
+
use url::form_urlencoded;
|
|
4
|
+
|
|
5
|
+
pub struct M2MSentinelClient {
|
|
6
|
+
base_url: String,
|
|
7
|
+
pub payout_wallet: String,
|
|
8
|
+
client: Client,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl M2MSentinelClient {
|
|
12
|
+
pub fn new(base_url: Option<&str>) -> Self {
|
|
13
|
+
let base = base_url.unwrap_or("https://m2msentinel.vercel.app").trim_end_matches('/').to_string();
|
|
14
|
+
Self {
|
|
15
|
+
base_url: base,
|
|
16
|
+
payout_wallet: "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e".to_string(),
|
|
17
|
+
client: Client::new(),
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async fn get(&self, path: &str) -> Result<Value, Error> {
|
|
22
|
+
let url = format!("{}{}", self.base_url, path);
|
|
23
|
+
let res = self.client.get(&url).send().await?;
|
|
24
|
+
res.json::<Value>().await
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
pub async fn audit_contract(&self, address: &str) -> Result<Value, Error> {
|
|
28
|
+
self.get(&format!("/v1/audit/{}", address)).await
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
pub async fn get_dex_metrics(&self) -> Result<Value, Error> {
|
|
32
|
+
self.get("/v1/dex/metrics").await
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pub async fn get_whale_signals(&self) -> Result<Value, Error> {
|
|
36
|
+
self.get("/v1/whales/signals").await
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pub async fn get_token_price(&self, symbol: &str) -> Result<Value, Error> {
|
|
40
|
+
self.get(&format!("/v1/token/price/{}", symbol)).await
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pub async fn search(&self, query: &str) -> Result<Value, Error> {
|
|
44
|
+
let encoded: String = form_urlencoded::byte_serialize(query.as_bytes()).collect();
|
|
45
|
+
self.get(&format!("/v1/search?q={}", encoded)).await
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
pub async fn token_audit_multi(&self) -> Result<Value, Error> {
|
|
49
|
+
self.get("/v1/token/audit/multi").await
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
pub async fn get_nft_floor(&self, collection: &str) -> Result<Value, Error> {
|
|
53
|
+
let encoded: String = form_urlencoded::byte_serialize(collection.as_bytes()).collect();
|
|
54
|
+
self.get(&format!("/v1/nft/floor?collection={}", encoded)).await
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
pub async fn get_ai_sentiment(&self, symbol: &str) -> Result<Value, Error> {
|
|
58
|
+
let encoded: String = form_urlencoded::byte_serialize(symbol.as_bytes()).collect();
|
|
59
|
+
self.get(&format!("/v1/ai/sentiment?symbol={}", encoded)).await
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
public class M2MSentinelClient {
|
|
4
|
+
private let baseUrl: String
|
|
5
|
+
public let payoutWallet: String = "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e"
|
|
6
|
+
private let session: URLSession
|
|
7
|
+
|
|
8
|
+
public init(baseUrl: String = "https://m2msentinel.vercel.app", session: URLSession = .shared) {
|
|
9
|
+
var url = baseUrl
|
|
10
|
+
if url.hasSuffix("/") {
|
|
11
|
+
url.removeLast()
|
|
12
|
+
}
|
|
13
|
+
self.baseUrl = url
|
|
14
|
+
self.session = session
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
private func getRequest(path: String) async throws -> Any {
|
|
18
|
+
guard let url = URL(string: baseUrl + path) else {
|
|
19
|
+
throw URLError(.badURL)
|
|
20
|
+
}
|
|
21
|
+
let (data, _) = try await session.data(from: url)
|
|
22
|
+
return try JSONSerialization.jsonObject(with: data, options: [])
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public func auditContract(address: String) async throws -> Any {
|
|
26
|
+
return try await getRequest(path: "/v1/audit/\(address)")
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public func getDexMetrics() async throws -> Any {
|
|
30
|
+
return try await getRequest(path: "/v1/dex/metrics")
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public func getWhaleSignals() async throws -> Any {
|
|
34
|
+
return try await getRequest(path: "/v1/whales/signals")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public func getTokenPrice(symbol: String) async throws -> Any {
|
|
38
|
+
return try await getRequest(path: "/v1/token/price/\(symbol)")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public func search(query: String) async throws -> Any {
|
|
42
|
+
guard let q = query.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
|
|
43
|
+
throw URLError(.badURL)
|
|
44
|
+
}
|
|
45
|
+
return try await getRequest(path: "/v1/search?q=\(q)")
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public func tokenAuditMulti() async throws -> Any {
|
|
49
|
+
return try await getRequest(path: "/v1/token/audit/multi")
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public func getNftFloor(collection: String) async throws -> Any {
|
|
53
|
+
guard let q = collection.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
|
|
54
|
+
throw URLError(.badURL)
|
|
55
|
+
}
|
|
56
|
+
return try await getRequest(path: "/v1/nft/floor?collection=\(q)")
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public func getAiSentiment(symbol: String) async throws -> Any {
|
|
60
|
+
guard let q = symbol.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
|
|
61
|
+
throw URLError(.badURL)
|
|
62
|
+
}
|
|
63
|
+
return try await getRequest(path: "/v1/ai/sentiment?symbol=\(q)")
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// swift-tools-version:5.5
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "M2MSentinel",
|
|
6
|
+
platforms: [
|
|
7
|
+
.iOS(.v13),
|
|
8
|
+
.macOS(.v10_15)
|
|
9
|
+
],
|
|
10
|
+
products: [
|
|
11
|
+
.library(
|
|
12
|
+
name: "M2MSentinel",
|
|
13
|
+
targets: ["M2MSentinel"]),
|
|
14
|
+
],
|
|
15
|
+
dependencies: [],
|
|
16
|
+
targets: [
|
|
17
|
+
.target(
|
|
18
|
+
name: "M2MSentinel",
|
|
19
|
+
dependencies: [],
|
|
20
|
+
path: ".",
|
|
21
|
+
exclude: ["Package.swift"])
|
|
22
|
+
]
|
|
23
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export class M2MSentinelClient {
|
|
2
|
+
private baseUrl: string;
|
|
3
|
+
public readonly payoutWallet: string = "0x1C79BfBFA67Ab140f72f0F6888123a70D9DaC23e";
|
|
4
|
+
|
|
5
|
+
constructor(baseUrl: string = "https://m2msentinel.vercel.app") {
|
|
6
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
private async get<T>(path: string): Promise<T> {
|
|
10
|
+
const response = await fetch(`${this.baseUrl}${path}`);
|
|
11
|
+
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
|
12
|
+
return response.json() as Promise<T>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public async auditContract(address: string) {
|
|
16
|
+
return this.get<any>(`/v1/audit/${address}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public async getDexMetrics() {
|
|
20
|
+
return this.get<any>("/v1/dex/metrics");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async getWhaleSignals() {
|
|
24
|
+
return this.get<any>("/v1/whales/signals");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public async getTokenPrice(symbol: string) {
|
|
28
|
+
return this.get<any>(`/v1/token/price/${symbol}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public async search(query: string) {
|
|
32
|
+
const q = encodeURIComponent(query);
|
|
33
|
+
return this.get<any>(`/v1/search?q=${q}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public async tokenAuditMulti() {
|
|
37
|
+
return this.get<any>("/v1/token/audit/multi");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public async getNftFloor(collection: string) {
|
|
41
|
+
const q = encodeURIComponent(collection);
|
|
42
|
+
return this.get<any>(`/v1/nft/floor?collection=${q}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public async getAiSentiment(symbol: string) {
|
|
46
|
+
const q = encodeURIComponent(symbol);
|
|
47
|
+
return this.get<any>(`/v1/ai/sentiment?symbol=${q}`);
|
|
48
|
+
}
|
|
49
|
+
}
|