@elizaos/plugin-social-alpha 2.0.0-alpha.3
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/dist/__tests__/e2e/benchmarks/benchmark.utils.d.ts +38 -0
- package/dist/__tests__/e2e/benchmarks/trust_algorithm.benchmark.d.ts +18 -0
- package/dist/__tests__/e2e/events.d.ts +2 -0
- package/dist/__tests__/e2e/index.d.ts +3 -0
- package/dist/__tests__/e2e/scenarios.d.ts +3 -0
- package/dist/__tests__/e2e/service.d.ts +1 -0
- package/dist/__tests__/e2e/socialAlpha.d.ts +2 -0
- package/dist/__tests__/e2e/test-utils.d.ts +12 -0
- package/dist/__tests__/e2e/test.setup.d.ts +2 -0
- package/dist/__tests__/e2e/trustOptimizationE2E.d.ts +4 -0
- package/dist/__tests__/e2e/trustScenariosE2E.d.ts +4 -0
- package/dist/__tests__/e2e/trustScore.d.ts +2 -0
- package/dist/__tests__/mocks/mockPriceService.d.ts +36 -0
- package/dist/assets/index-D088W50X.css +1 -0
- package/dist/assets/index-D32we_nf.js +17204 -0
- package/dist/assets/index-DU6B6kWr.js +17202 -0
- package/dist/clients.d.ts +382 -0
- package/dist/config.d.ts +143 -0
- package/dist/events.d.ts +4 -0
- package/dist/frontend/LeaderboardTable.d.ts +7 -0
- package/dist/frontend/index.d.ts +3 -0
- package/dist/frontend/loader.d.ts +1 -0
- package/dist/frontend/ui/badge.d.ts +11 -0
- package/dist/frontend/ui/button.d.ts +11 -0
- package/dist/frontend/ui/card.d.ts +8 -0
- package/dist/frontend/ui/input.d.ts +3 -0
- package/dist/frontend/ui/table.d.ts +10 -0
- package/dist/frontend/ui/tabs.d.ts +7 -0
- package/dist/frontend/utils.d.ts +2 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.html +14 -0
- package/dist/mockPriceService.d.ts +1 -0
- package/dist/providers/socialAlphaProvider.d.ts +14 -0
- package/dist/reports.d.ts +56 -0
- package/dist/routes.d.ts +2 -0
- package/dist/schemas.d.ts +150 -0
- package/dist/scripts/analyze-trust-scores.d.ts +15 -0
- package/dist/scripts/enrich-price-data.d.ts +15 -0
- package/dist/scripts/optimize-algorithm.d.ts +14 -0
- package/dist/scripts/process-discord-data.d.ts +14 -0
- package/dist/service.d.ts +286 -0
- package/dist/services/PriceDataService.d.ts +34 -0
- package/dist/services/SimulationService.d.ts +31 -0
- package/dist/services/TrustScoreService.d.ts +35 -0
- package/dist/services/balancedTrustScoreCalculator.d.ts +60 -0
- package/dist/services/historicalPriceService.d.ts +58 -0
- package/dist/services/index.d.ts +22 -0
- package/dist/services/priceEnrichmentService.d.ts +112 -0
- package/dist/services/simulationActorsV2.d.ts +53 -0
- package/dist/services/simulationRunner.d.ts +112 -0
- package/dist/services/tokenSimulationService.d.ts +33 -0
- package/dist/services/trustScoreOptimizer.d.ts +109 -0
- package/dist/simulationActors.d.ts +23 -0
- package/dist/tests/index.d.ts +3 -0
- package/dist/types.d.ts +959 -0
- package/dist/utils.d.ts +51 -0
- package/package.json +79 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
import type { DexScreenerData, DexScreenerPair, HolderData, Prices, TokenOverview, TokenSecurityData, TokenTradeData, WalletPortfolio } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Represents the valid types that can be used for query parameters in a URL.
|
|
5
|
+
* It can either be a key-value pair object with string, number, boolean, null or undefined values,
|
|
6
|
+
* or an instance of the URLSearchParams class.
|
|
7
|
+
*/
|
|
8
|
+
type QueryParams = Record<string, string | number | boolean | null | undefined> | URLSearchParams;
|
|
9
|
+
/**
|
|
10
|
+
* Interface representing retry options for a retry mechanism.
|
|
11
|
+
* @typedef {Object} RetryOptions
|
|
12
|
+
* @property {number} [maxRetries] - The maximum number of retries allowed.
|
|
13
|
+
* @property {number} [initialDelay] - The initial delay in milliseconds before the first retry.
|
|
14
|
+
* @property {number} [maxDelay] - The maximum delay in milliseconds between retries.
|
|
15
|
+
* @property {number} [backoffFactor] - The factor by which the delay increases between retries.
|
|
16
|
+
* @property {number[]} [retryableStatuses] - The array of HTTP status codes that are retryable.
|
|
17
|
+
*/
|
|
18
|
+
interface RetryOptions {
|
|
19
|
+
maxRetries?: number;
|
|
20
|
+
initialDelay?: number;
|
|
21
|
+
maxDelay?: number;
|
|
22
|
+
backoffFactor?: number;
|
|
23
|
+
retryableStatuses?: number[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Interface for defining options that can be passed in a request.
|
|
27
|
+
* @template RequestOptions
|
|
28
|
+
* @property {RetryOptions} [retryOptions] - Options for retrying the request
|
|
29
|
+
* @property {QueryParams} [params] - Query parameters for the request
|
|
30
|
+
*/
|
|
31
|
+
interface RequestOptions extends RequestInit {
|
|
32
|
+
retryOptions?: RetryOptions;
|
|
33
|
+
params?: QueryParams;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* HTTP utility functions for making requests and handling responses.
|
|
37
|
+
* @namespace http
|
|
38
|
+
*/
|
|
39
|
+
export declare const http: {
|
|
40
|
+
request(url: string, options?: RequestOptions): Promise<Response>;
|
|
41
|
+
json<T = any>(url: string, options?: RequestOptions): Promise<T>;
|
|
42
|
+
get: {
|
|
43
|
+
request(url: string, params?: QueryParams, options?: RequestInit): Promise<Response>;
|
|
44
|
+
json<T = any>(url: string, params?: QueryParams, options?: RequestInit): Promise<T>;
|
|
45
|
+
};
|
|
46
|
+
post: {
|
|
47
|
+
request(url: string, body: object, options?: RequestOptions): Promise<Response>;
|
|
48
|
+
json<ReturnType = any, Body extends object = object>(url: string, body: Body, options?: RequestOptions): Promise<ReturnType>;
|
|
49
|
+
};
|
|
50
|
+
jsonrpc<_ReturnType = any, Params extends object = object>(url: string, method: string, params: Params, headers?: HeadersInit): Promise<any>;
|
|
51
|
+
graphql<_ReturnType = any, Variables extends object = object>(url: string, query: string, variables: Variables, headers?: HeadersInit): Promise<any>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Class representing a client for interacting with the Jupiter API for swapping tokens.
|
|
55
|
+
*/
|
|
56
|
+
export declare class JupiterClient {
|
|
57
|
+
static baseUrl: string;
|
|
58
|
+
static xApiKey: string;
|
|
59
|
+
/**
|
|
60
|
+
* Fetches a quote for a given input and output mint, amount, and slippage.
|
|
61
|
+
* @param {string} inputMint The mint of the input token.
|
|
62
|
+
* @param {string} outputMint The mint of the output token.
|
|
63
|
+
* @param {string} amount The amount to be swapped.
|
|
64
|
+
* @param {number} [slippageBps=50] The slippage tolerance in basis points (default: 50).
|
|
65
|
+
* @returns {Promise<{inputMint: string, outputMint: string, inAmount: string, outAmount: string, routePlan: unknown[]} | {error: unknown}>} The quote object or an error object.
|
|
66
|
+
*/
|
|
67
|
+
static getQuote(inputMint: string, outputMint: string, amount: string, slippageBps?: number): Promise<{
|
|
68
|
+
inputMint: string;
|
|
69
|
+
outputMint: string;
|
|
70
|
+
inAmount: string;
|
|
71
|
+
outAmount: string;
|
|
72
|
+
routePlan: unknown[];
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* Perform a swap operation using the provided quote data and user's wallet public key.
|
|
76
|
+
* @param {any} quoteData - The data required for the swap operation.
|
|
77
|
+
* @param {string} walletPublicKey - The public key of the user's wallet.
|
|
78
|
+
* @returns {Promise<any>} The result of the swap operation.
|
|
79
|
+
*/
|
|
80
|
+
static swap(quoteData: any, walletPublicKey: string): Promise<any>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Options for Dexscreener.
|
|
84
|
+
* @typedef {Object} DexscreenerOptions
|
|
85
|
+
* @property {string|CacheOptions["expires"]} [expires] - The expiration time for the cache.
|
|
86
|
+
*/
|
|
87
|
+
type DexscreenerOptions = {
|
|
88
|
+
expires?: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Client for interacting with DexScreener API.
|
|
92
|
+
*/
|
|
93
|
+
export declare class DexscreenerClient {
|
|
94
|
+
private runtime;
|
|
95
|
+
/**
|
|
96
|
+
* Constructor for the class.
|
|
97
|
+
* @param {IAgentRuntime} runtime - The runtime passed as a parameter to the constructor.
|
|
98
|
+
*/
|
|
99
|
+
constructor(runtime: IAgentRuntime);
|
|
100
|
+
/**
|
|
101
|
+
* Create a new DexscreenerClient instance using the provided agent runtime.
|
|
102
|
+
*
|
|
103
|
+
* @param {IAgentRuntime} runtime - The agent runtime to use for creating the DexscreenerClient instance.
|
|
104
|
+
* @returns {DexscreenerClient} A new instance of DexscreenerClient.
|
|
105
|
+
*/
|
|
106
|
+
static createFromRuntime(runtime: IAgentRuntime): DexscreenerClient;
|
|
107
|
+
/**
|
|
108
|
+
* Makes an asynchronous HTTP request to the DexScreener API.
|
|
109
|
+
*
|
|
110
|
+
* @template T - The type of data expected to be returned
|
|
111
|
+
* @param {string} path - The endpoint path for the API request
|
|
112
|
+
* @param {QueryParams} [params] - Optional query parameters for the request
|
|
113
|
+
* @param {DexscreenerOptions} [options] - Optional options for the request
|
|
114
|
+
* @returns {Promise<T>} - A promise that resolves with the data returned from the API
|
|
115
|
+
*/
|
|
116
|
+
request<T = any>(path: string, params?: QueryParams, options?: DexscreenerOptions): Promise<T>;
|
|
117
|
+
/**
|
|
118
|
+
* Asynchronously searches for DexScreener data based on the provided address.
|
|
119
|
+
*
|
|
120
|
+
* @param {string} address - The address to search for in DexScreener data.
|
|
121
|
+
* @param {DexscreenerOptions} [options] - Optional parameters for the request.
|
|
122
|
+
* @returns {Promise<DexScreenerData>} A promise that resolves with the DexScreener data.
|
|
123
|
+
*/
|
|
124
|
+
search(address: string, options?: DexscreenerOptions): Promise<DexScreenerData>;
|
|
125
|
+
/**
|
|
126
|
+
* Asynchronously searches for the pair with the highest liquidity based on the given address.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} address The address to search for liquidity pairs from.
|
|
129
|
+
* @param {string} [chain] The chain ID to filter the liquidity pairs by.
|
|
130
|
+
* @param {DexscreenerOptions} [options] Additional options for searching.
|
|
131
|
+
* @returns {Promise<DexScreenerPair | null>} The pair with the highest liquidity, or null if no pairs were found.
|
|
132
|
+
*/
|
|
133
|
+
searchForHighestLiquidityPair(address: string, chain?: string, options?: DexscreenerOptions): Promise<DexScreenerPair | null>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Represents a client for interacting with the Helius API.
|
|
137
|
+
*/
|
|
138
|
+
export declare class HeliusClient {
|
|
139
|
+
private readonly apiKey;
|
|
140
|
+
private runtime;
|
|
141
|
+
/**
|
|
142
|
+
* Constructor for initializing an instance of class.
|
|
143
|
+
*
|
|
144
|
+
* @param apiKey - The API key to be used for authentication.
|
|
145
|
+
* @param _runtime - The runtime environment for the agent.
|
|
146
|
+
*/
|
|
147
|
+
constructor(apiKey: string, runtime: IAgentRuntime);
|
|
148
|
+
/**
|
|
149
|
+
* Creates a new HeliusClient instance using the provided IAgentRuntime.
|
|
150
|
+
*
|
|
151
|
+
* @param {IAgentRuntime} runtime - The IAgentRuntime to use for creating the HeliusClient.
|
|
152
|
+
* @returns {HeliusClient} A new instance of HeliusClient.
|
|
153
|
+
* @throws {Error} Thrown if HELIUS_API_KEY is missing from the runtime settings.
|
|
154
|
+
*/
|
|
155
|
+
static createFromRuntime(runtime: IAgentRuntime): HeliusClient;
|
|
156
|
+
/**
|
|
157
|
+
* Fetches the list of token holders for a given address asynchronously.
|
|
158
|
+
* If the option `expires` is provided and there is a cached version available, it returns the cached data.
|
|
159
|
+
* Otherwise, it fetches the data from the Helius API using the provided address.
|
|
160
|
+
*
|
|
161
|
+
* @param {string} address - The address for which to fetch the list of token holders.
|
|
162
|
+
* @param {Object} [options] - Optional parameters.
|
|
163
|
+
* @param {string | CacheOptions["expires"]} [options.expires] - The expiration date for caching the data.
|
|
164
|
+
*
|
|
165
|
+
* @returns {Promise<HolderData[]>} A promise that resolves to an array of HolderData objects representing the token holders.
|
|
166
|
+
*/
|
|
167
|
+
fetchHolderList(address: string, options?: {
|
|
168
|
+
expires?: string;
|
|
169
|
+
}): Promise<HolderData[]>;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Options for Coingecko API.
|
|
173
|
+
* @typedef {Object} CoingeckoOptions
|
|
174
|
+
* @property {string | CacheOptions["expires"]} [expires] - The expiration date for the cache.
|
|
175
|
+
*/
|
|
176
|
+
type CoingeckoOptions = {
|
|
177
|
+
expires?: string;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* CoingeckoClient class for interacting with the Coingecko API.
|
|
181
|
+
* @constructor
|
|
182
|
+
* @param { string } apiKey - The API key required for accessing the Coingecko API.
|
|
183
|
+
* @param { IAgentRuntime } runtime - The IAgentRuntime object for accessing runtime settings.
|
|
184
|
+
*/
|
|
185
|
+
export declare class CoingeckoClient {
|
|
186
|
+
private readonly apiKey;
|
|
187
|
+
private readonly runtime;
|
|
188
|
+
/**
|
|
189
|
+
* Constructor for initializing a new instance of the class.
|
|
190
|
+
* @param apiKey The API key used for authentication.
|
|
191
|
+
* @param runtime The agent runtime implementation.
|
|
192
|
+
*/
|
|
193
|
+
constructor(apiKey: string, runtime: IAgentRuntime);
|
|
194
|
+
/**
|
|
195
|
+
* Creates a new instance of CoingeckoClient using the apiKey retrieved from the provided runtime.
|
|
196
|
+
* @param {IAgentRuntime} runtime - The runtime object that contains the COINGECKO_API_KEY setting.
|
|
197
|
+
* @throws {Error} If COINGECKO_API_KEY setting is missing in the runtime object.
|
|
198
|
+
* @returns {CoingeckoClient} A new instance of CoingeckoClient initialized with the apiKey and runtime.
|
|
199
|
+
*/
|
|
200
|
+
static createFromRuntime(runtime: IAgentRuntime): CoingeckoClient;
|
|
201
|
+
/**
|
|
202
|
+
* Makes an asynchronous HTTP request to the Coingecko API.
|
|
203
|
+
* @template T
|
|
204
|
+
* @param {string} path - The API endpoint to call.
|
|
205
|
+
* @param {QueryParams} [params] - Optional query parameters to include in the request.
|
|
206
|
+
* @param {CoingeckoOptions} [options] - Additional options for the request.
|
|
207
|
+
* @returns {Promise<T>} The response data from the API.
|
|
208
|
+
*/
|
|
209
|
+
request<T = any>(path: string, params?: QueryParams, options?: CoingeckoOptions): Promise<T>;
|
|
210
|
+
/**
|
|
211
|
+
* Fetches prices for specified cryptocurrencies from the Coingecko API.
|
|
212
|
+
*
|
|
213
|
+
* @param {CoingeckoOptions} [options] The options for the Coingecko API request.
|
|
214
|
+
* @returns {Promise<Prices>} A Promise that resolves to the prices of the specified cryptocurrencies.
|
|
215
|
+
*/
|
|
216
|
+
fetchPrices(options?: CoingeckoOptions): Promise<Prices>;
|
|
217
|
+
/**
|
|
218
|
+
* Asynchronously fetches global data.
|
|
219
|
+
*
|
|
220
|
+
* @returns {Promise} The promise containing the global data.
|
|
221
|
+
*/
|
|
222
|
+
fetchGlobal(): Promise<any>;
|
|
223
|
+
/**
|
|
224
|
+
* Asynchronously fetches a list of coin categories.
|
|
225
|
+
* @returns {Promise} The Promise object representing the result of the fetch operation.
|
|
226
|
+
*/
|
|
227
|
+
fetchCategories(): Promise<any>;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Represents an item in a wallet token list with details such as address, name, symbol, decimals, balance, UI amount, chain ID, logo URI, price in USD, and value in USD.
|
|
231
|
+
* @typedef {Object} WalletTokenListItem
|
|
232
|
+
* @property {string} address - The address of the token
|
|
233
|
+
* @property {string} name - The name of the token
|
|
234
|
+
* @property {string} symbol - The symbol of the token
|
|
235
|
+
* @property {number} decimals - The decimals of the token
|
|
236
|
+
* @property {number} balance - The balance of the token
|
|
237
|
+
* @property {number} uiAmount - The UI amount of the token
|
|
238
|
+
* @property {string} chainId - The chain ID of the token
|
|
239
|
+
* @property {string} logoURI - The logo URI of the token
|
|
240
|
+
* @property {number} priceUsd - The price of the token in USD
|
|
241
|
+
* @property {number} valueUsd - The value of the token in USD
|
|
242
|
+
*/
|
|
243
|
+
type WalletTokenListItem = {
|
|
244
|
+
address: string;
|
|
245
|
+
name: string;
|
|
246
|
+
symbol: string;
|
|
247
|
+
decimals: number;
|
|
248
|
+
balance: number;
|
|
249
|
+
uiAmount: number;
|
|
250
|
+
chainId: string;
|
|
251
|
+
logoURI: string;
|
|
252
|
+
priceUsd: number;
|
|
253
|
+
valueUsd: number;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Defines the structure of a WalletTokenList object, which includes the wallet name, total USD balance,
|
|
257
|
+
* and an array of WalletTokenListItem objects.
|
|
258
|
+
*/
|
|
259
|
+
type WalletTokenList = {
|
|
260
|
+
wallet: string;
|
|
261
|
+
totalUsd: number;
|
|
262
|
+
items: WalletTokenListItem[];
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Represents a type that can either be "solana" or "ethereum" for the BirdeyeXChain.
|
|
266
|
+
*/
|
|
267
|
+
type BirdeyeXChain = "solana" | "ethereum";
|
|
268
|
+
/**
|
|
269
|
+
* Type representing headers for BirdeyeClient.
|
|
270
|
+
* @typedef {Object} BirdeyeClientHeaders
|
|
271
|
+
* @property {BirdeyeXChain} ["x-chain"] - Optional header for BirdeyeXChain.
|
|
272
|
+
*/
|
|
273
|
+
type BirdeyeClientHeaders = {
|
|
274
|
+
"x-chain"?: BirdeyeXChain;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Options for making a Birdeye API request.
|
|
278
|
+
* @typedef {Object} BirdeyeRequestOptions
|
|
279
|
+
* @property {BirdeyeXChain} [chain] - The BirdeyeX chain.
|
|
280
|
+
* @property {string | CacheOptions["expires"]} [expires] - The expiration date for the request.
|
|
281
|
+
*/
|
|
282
|
+
type BirdeyeRequestOptions = {
|
|
283
|
+
chain?: BirdeyeXChain;
|
|
284
|
+
expires?: string;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Class representing a client for interacting with the BirdEye API.
|
|
288
|
+
*/
|
|
289
|
+
export declare class BirdeyeClient {
|
|
290
|
+
private readonly apiKey;
|
|
291
|
+
static readonly url = "https://public-api.birdeye.so/";
|
|
292
|
+
private runtime;
|
|
293
|
+
/**
|
|
294
|
+
* Send a request to the Birdeye API using the provided API key, path, query parameters, and headers.
|
|
295
|
+
*
|
|
296
|
+
* @param {string} apiKey - The API key for authenticating the request.
|
|
297
|
+
* @param {string} path - The endpoint path to send the request to.
|
|
298
|
+
* @param {QueryParams} [params] - Optional query parameters to include in the request.
|
|
299
|
+
* @param {BirdeyeClientHeaders} [headers] - Optional additional headers to include in the request.
|
|
300
|
+
* @returns {Promise<T>} A Promise that resolves with the data received from the API request.
|
|
301
|
+
*/
|
|
302
|
+
static request<T = any>(apiKey: string, path: string, params?: QueryParams, headers?: BirdeyeClientHeaders): Promise<T>;
|
|
303
|
+
/**
|
|
304
|
+
* Constructor for initializing a new instance.
|
|
305
|
+
*
|
|
306
|
+
* @param apiKey The API key to be used.
|
|
307
|
+
* @param runtime The agent runtime for handling communication with the runtime environment.
|
|
308
|
+
*/
|
|
309
|
+
constructor(apiKey: string, runtime: IAgentRuntime);
|
|
310
|
+
/**
|
|
311
|
+
* Create a new BirdeyeClient instance using the provided IAgentRuntime object.
|
|
312
|
+
*
|
|
313
|
+
* @param {IAgentRuntime} runtime - The IAgentRuntime object that provides access to runtime settings.
|
|
314
|
+
* @returns {BirdeyeClient} A new instance of BirdeyeClient initialized with the provided API key and runtime.
|
|
315
|
+
* @throws {Error} Thrown if the BIRDEYE_API_KEY setting is missing in the runtime object.
|
|
316
|
+
*/
|
|
317
|
+
static createFromRuntime(runtime: IAgentRuntime): BirdeyeClient;
|
|
318
|
+
/**
|
|
319
|
+
* Performs a request to the specified path with given query parameters and options.
|
|
320
|
+
* @template T
|
|
321
|
+
* @param {string} path - The path to request.
|
|
322
|
+
* @param {QueryParams} params - The query parameters to include in the request.
|
|
323
|
+
* @param {BirdeyeRequestOptions} [options] - Optional request options.
|
|
324
|
+
* @param {boolean} [forceRefresh] - Flag to force refresh the cache.
|
|
325
|
+
* @returns {Promise<T>} The response data from the request.
|
|
326
|
+
*/
|
|
327
|
+
request<T = any>(path: string, params: QueryParams, options?: BirdeyeRequestOptions, forceRefresh?: boolean): Promise<T>;
|
|
328
|
+
/**
|
|
329
|
+
* Fetches the price for a given address.
|
|
330
|
+
*
|
|
331
|
+
* @param {string} address - The address for which to fetch the price.
|
|
332
|
+
* @param {BirdeyeRequestOptions} [options] - The options for the Birdeye request.
|
|
333
|
+
* @returns {Promise<number>} The price value fetched for the given address.
|
|
334
|
+
*/
|
|
335
|
+
fetchPrice(address: string, options?: BirdeyeRequestOptions): Promise<number>;
|
|
336
|
+
/**
|
|
337
|
+
* Fetches the latest prices for Bitcoin, Ethereum, and Solana in USD from the DeFi API.
|
|
338
|
+
* @returns {Promise<Prices>} The latest prices for Bitcoin, Ethereum, and Solana in USD.
|
|
339
|
+
*/
|
|
340
|
+
fetchPrices(): Promise<Prices>;
|
|
341
|
+
/**
|
|
342
|
+
* Fetches token overview for a specific address.
|
|
343
|
+
*
|
|
344
|
+
* @param {string} address The address of the token for which overview is to be fetched.
|
|
345
|
+
* @param {BirdeyeRequestOptions} [options] Additional options for the Birdeye request.
|
|
346
|
+
* @param {boolean} [forceRefresh=false] Flag to force refresh the data.
|
|
347
|
+
* @returns {Promise<TokenOverview>} Promise that resolves to the token overview.
|
|
348
|
+
*/
|
|
349
|
+
fetchTokenOverview(address: string, options?: BirdeyeRequestOptions, forceRefresh?: boolean): Promise<TokenOverview>;
|
|
350
|
+
/**
|
|
351
|
+
* Fetches token security data from the API for a given address.
|
|
352
|
+
* @param {string} address - The address of the token for which to fetch security data.
|
|
353
|
+
* @param {BirdeyeRequestOptions} [options] - Optional request options.
|
|
354
|
+
* @returns {Promise<TokenSecurityData>} A promise that resolves with the token security data.
|
|
355
|
+
*/
|
|
356
|
+
fetchTokenSecurity(address: string, options?: BirdeyeRequestOptions): Promise<TokenSecurityData>;
|
|
357
|
+
/**
|
|
358
|
+
* Fetches token trade data for a specific address.
|
|
359
|
+
* @param {string} address - The address of the token.
|
|
360
|
+
* @param {BirdeyeRequestOptions} [options] - Optional request options.
|
|
361
|
+
* @returns {Promise<TokenTradeData>} - A promise that resolves with the token trade data.
|
|
362
|
+
*/
|
|
363
|
+
fetchTokenTradeData(address: string, options?: BirdeyeRequestOptions): Promise<TokenTradeData>;
|
|
364
|
+
/**
|
|
365
|
+
* Fetches the wallet token list for a given address.
|
|
366
|
+
*
|
|
367
|
+
* @param {string} address - The address of the wallet to fetch the token list for.
|
|
368
|
+
* @param {BirdeyeRequestOptions} [options] - Additional options for the request.
|
|
369
|
+
* @returns {Promise<WalletTokenList>} The wallet token list for the specified address.
|
|
370
|
+
*/
|
|
371
|
+
fetchWalletTokenList(address: string, options?: BirdeyeRequestOptions): Promise<WalletTokenList>;
|
|
372
|
+
/**
|
|
373
|
+
* Asynchronously fetches the portfolio value for a given address.
|
|
374
|
+
*
|
|
375
|
+
* @param {string} address - The address for which to fetch the portfolio value.
|
|
376
|
+
* @param {BirdeyeRequestOptions} [options] - The optional request options.
|
|
377
|
+
* @returns {Promise<WalletPortfolio>} - A promise that resolves to the wallet portfolio object containing total USD, total SOL, and portfolio items.
|
|
378
|
+
* @throws {Error} - If an error occurs while fetching the portfolio value.
|
|
379
|
+
*/
|
|
380
|
+
fetchPortfolioValue(address: string, options?: BirdeyeRequestOptions): Promise<WalletPortfolio>;
|
|
381
|
+
}
|
|
382
|
+
export {};
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the Community Trader Plugin
|
|
3
|
+
*
|
|
4
|
+
* This file centralizes all configuration options for the trading system.
|
|
5
|
+
*/
|
|
6
|
+
import type { UUID } from "./types";
|
|
7
|
+
/**
|
|
8
|
+
* Buy amount configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface BuyAmountConfig {
|
|
11
|
+
baseAmount: number;
|
|
12
|
+
minAmount: number;
|
|
13
|
+
maxAmount: number;
|
|
14
|
+
trustScoreMultiplier: number;
|
|
15
|
+
convictionMultiplier: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Trading configuration
|
|
19
|
+
*/
|
|
20
|
+
export interface TradingConfig {
|
|
21
|
+
slippageBps: number;
|
|
22
|
+
forceSimulation: boolean;
|
|
23
|
+
defaultChain: string;
|
|
24
|
+
maxPositionsPerToken: number;
|
|
25
|
+
maxPositionsPerRecommender: number;
|
|
26
|
+
minLiquidityUsd: number;
|
|
27
|
+
maxMarketCapUsd: number;
|
|
28
|
+
buyAmountConfig: BuyAmountConfig;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Database configuration
|
|
32
|
+
*/
|
|
33
|
+
export interface DatabaseConfig {
|
|
34
|
+
schemaVersion: string;
|
|
35
|
+
enableCaching: boolean;
|
|
36
|
+
cacheTimeout: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Memory configuration
|
|
40
|
+
*/
|
|
41
|
+
export interface MemoryConfig {
|
|
42
|
+
embeddingModel: string;
|
|
43
|
+
embeddingDimension: number;
|
|
44
|
+
similarityThreshold: number;
|
|
45
|
+
cacheTimeout: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Default trading configuration
|
|
49
|
+
*/
|
|
50
|
+
export declare const DEFAULT_TRADING_CONFIG: TradingConfig;
|
|
51
|
+
/**
|
|
52
|
+
* Default database configuration
|
|
53
|
+
*/
|
|
54
|
+
export declare const DEFAULT_DATABASE_CONFIG: DatabaseConfig;
|
|
55
|
+
/**
|
|
56
|
+
* Default memory configuration
|
|
57
|
+
*/
|
|
58
|
+
export declare const DEFAULT_MEMORY_CONFIG: MemoryConfig;
|
|
59
|
+
/**
|
|
60
|
+
* Conviction levels for recommendations
|
|
61
|
+
* IMPORTANT: Must match the enum in types.ts
|
|
62
|
+
*/
|
|
63
|
+
export declare enum Conviction {
|
|
64
|
+
NONE = "NONE",
|
|
65
|
+
LOW = "LOW",
|
|
66
|
+
MEDIUM = "MEDIUM",
|
|
67
|
+
HIGH = "HIGH",
|
|
68
|
+
VERY_HIGH = "VERY_HIGH",
|
|
69
|
+
NEUTRAL = "NEUTRAL"
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Recommendation types
|
|
73
|
+
* IMPORTANT: Must match the enum in types.ts
|
|
74
|
+
*/
|
|
75
|
+
export declare enum RecommendationType {
|
|
76
|
+
BUY = "BUY",
|
|
77
|
+
DONT_BUY = "DONT_BUY",
|
|
78
|
+
SELL = "SELL",
|
|
79
|
+
DONT_SELL = "DONT_SELL",
|
|
80
|
+
NONE = "NONE",
|
|
81
|
+
HOLD = "HOLD"
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Transaction types
|
|
85
|
+
* IMPORTANT: Must match the enum in types.ts
|
|
86
|
+
*/
|
|
87
|
+
export declare enum TransactionType {
|
|
88
|
+
BUY = "BUY",
|
|
89
|
+
SELL = "SELL",
|
|
90
|
+
TRANSFER_IN = "transfer_in",
|
|
91
|
+
TRANSFER_OUT = "transfer_out"
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Buy signal message interface
|
|
95
|
+
*/
|
|
96
|
+
export interface BuySignalMessage {
|
|
97
|
+
tokenAddress: string;
|
|
98
|
+
chain?: string;
|
|
99
|
+
walletAddress?: string;
|
|
100
|
+
isSimulation?: boolean;
|
|
101
|
+
entityId: UUID;
|
|
102
|
+
recommendationId?: UUID;
|
|
103
|
+
conviction?: Conviction;
|
|
104
|
+
price?: string;
|
|
105
|
+
marketCap?: string;
|
|
106
|
+
liquidity?: string;
|
|
107
|
+
type?: RecommendationType;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Sell signal message interface
|
|
111
|
+
*/
|
|
112
|
+
export interface SellSignalMessage {
|
|
113
|
+
positionId: UUID;
|
|
114
|
+
tokenAddress: string;
|
|
115
|
+
sellRecommenderId: UUID;
|
|
116
|
+
walletAddress?: string;
|
|
117
|
+
isSimulation?: boolean;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Utility functions for configuration
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* Get conviction multiplier
|
|
124
|
+
*/
|
|
125
|
+
export declare function getConvictionMultiplier(conviction: Conviction): number;
|
|
126
|
+
/**
|
|
127
|
+
* Get liquidity multiplier
|
|
128
|
+
*/
|
|
129
|
+
export declare function getLiquidityMultiplier(liquidity: number): number;
|
|
130
|
+
/**
|
|
131
|
+
* Get market cap multiplier
|
|
132
|
+
*/
|
|
133
|
+
export declare function getMarketCapMultiplier(marketCap: number): number;
|
|
134
|
+
/**
|
|
135
|
+
* Get volume multiplier
|
|
136
|
+
*/
|
|
137
|
+
export declare function getVolumeMultiplier(volume: number): number;
|
|
138
|
+
export declare const SOLANA_NETWORK_ID = 1399811149;
|
|
139
|
+
export declare const SOL_ADDRESS = "So11111111111111111111111111111111111111112";
|
|
140
|
+
export declare const USDC_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
141
|
+
export declare const BTC_ADDRESS = "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh";
|
|
142
|
+
export declare const ETH_ADDRESS = "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs";
|
|
143
|
+
export declare const TRUST_LEADERBOARD_WORLD_SEED = "trust-leaderboard-world-v1";
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Loader(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { VariantProps } from "class-variance-authority";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
import type { HTMLAttributes } from "react";
|
|
4
|
+
declare const badgeVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "success" | "secondary" | "destructive" | "outline" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface BadgeProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "link" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
3
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
4
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
5
|
+
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
6
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
7
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
8
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
9
|
+
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Plugin } from "@elizaos/core";
|
|
2
|
+
export { socialAlphaProvider } from "./providers/socialAlphaProvider";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export interface AgentPanel {
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
component: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
public?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Social Alpha Plugin for ElizaOS.
|
|
13
|
+
*
|
|
14
|
+
* Tracks token recommendations ("shills") and criticisms ("FUD") made by
|
|
15
|
+
* users in chat. Builds trust scores for each recommender based on whether
|
|
16
|
+
* following their calls would have been profitable — accounting for:
|
|
17
|
+
*
|
|
18
|
+
* - Buy calls that mooned vs dumped
|
|
19
|
+
* - Sell/FUD calls on tokens that were scams (good call) vs tokens that rallied (bad call)
|
|
20
|
+
* - Conviction level, recency, and consistency
|
|
21
|
+
*
|
|
22
|
+
* Exposes a **Social Alpha Provider** that injects trust data (win rate,
|
|
23
|
+
* rank, P&L history) into the agent's context so it can weigh advice
|
|
24
|
+
* from different users.
|
|
25
|
+
*/
|
|
26
|
+
export declare const socialAlphaPlugin: Plugin;
|
|
27
|
+
/** @deprecated Use `socialAlphaPlugin` instead. */
|
|
28
|
+
export declare const communityInvestorPlugin: Plugin;
|
|
29
|
+
export declare const panels: AgentPanel[];
|
|
30
|
+
export default socialAlphaPlugin;
|
package/dist/index.html
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Agent Plugin View</title>
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-DU6B6kWr.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="./assets/index-D088W50X.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./__tests__/mocks/mockPriceService";
|