@wzrd_sol/solana-agent-plugin 0.1.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/README.md +70 -0
- package/dist/actions/claim.d.ts +38 -0
- package/dist/actions/claim.js +84 -0
- package/dist/actions/deposit.d.ts +57 -0
- package/dist/actions/deposit.js +134 -0
- package/dist/actions/index.d.ts +5 -0
- package/dist/actions/index.js +5 -0
- package/dist/actions/leaderboard.d.ts +27 -0
- package/dist/actions/leaderboard.js +63 -0
- package/dist/actions/portfolio.d.ts +24 -0
- package/dist/actions/portfolio.js +48 -0
- package/dist/actions/velocity.d.ts +55 -0
- package/dist/actions/velocity.js +118 -0
- package/dist/client.d.ts +82 -0
- package/dist/client.js +131 -0
- package/dist/index.d.ts +297 -0
- package/dist/index.js +44 -0
- package/examples/hello-wzrd.mjs +79 -0
- package/package.json +46 -0
- package/src/actions/claim.ts +98 -0
- package/src/actions/deposit.ts +197 -0
- package/src/actions/index.ts +5 -0
- package/src/actions/leaderboard.ts +81 -0
- package/src/actions/portfolio.ts +62 -0
- package/src/actions/velocity.ts +143 -0
- package/src/client.ts +207 -0
- package/src/index.ts +64 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action: wzrd_velocity
|
|
3
|
+
*
|
|
4
|
+
* Analyze attention velocity across markets — classify signal strength.
|
|
5
|
+
* No auth required. Pure analytics over leaderboard data.
|
|
6
|
+
*
|
|
7
|
+
* Signal tiers:
|
|
8
|
+
* BREAKOUT — top 10% velocity (p90+)
|
|
9
|
+
* MOMENTUM — p70-90
|
|
10
|
+
* EMERGING — new market (<300 snapshots) with above-median velocity
|
|
11
|
+
* STABLE — p40-70
|
|
12
|
+
* COOLING — p20-40
|
|
13
|
+
* WEAK — below p20
|
|
14
|
+
*/
|
|
15
|
+
export const VELOCITY_ACTION = {
|
|
16
|
+
name: 'wzrd_velocity',
|
|
17
|
+
similes: ['wzrd_signal', 'attention_signal', 'market_analysis', 'velocity_check'],
|
|
18
|
+
description: 'Analyze attention velocity across WZRD markets. Classifies each market into ' +
|
|
19
|
+
'signal tiers: BREAKOUT (top 10%), MOMENTUM (70-90th percentile), EMERGING ' +
|
|
20
|
+
'(new + above median), STABLE, COOLING, WEAK. ' +
|
|
21
|
+
'Use this to find the best deposit opportunities — BREAKOUT and MOMENTUM ' +
|
|
22
|
+
'markets have the strongest attention momentum.',
|
|
23
|
+
examples: [
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
user: 'user',
|
|
27
|
+
content: { text: 'What markets have breakout velocity?' },
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
user: 'assistant',
|
|
31
|
+
content: {
|
|
32
|
+
text: 'BREAKOUT signals:\n' +
|
|
33
|
+
'• Qwen 3.5 35B (804K velocity, p95)\n' +
|
|
34
|
+
'MOMENTUM signals:\n' +
|
|
35
|
+
'• Qwen 3.5 9B (769K velocity, p85)\n' +
|
|
36
|
+
'• Qwen 2.5 72B (378K velocity, p72)',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
],
|
|
41
|
+
validate: async () => true,
|
|
42
|
+
handler: async (client, params) => {
|
|
43
|
+
const data = await client.getLeaderboard(50, params.platform);
|
|
44
|
+
const markets = data.markets;
|
|
45
|
+
if (markets.length === 0) {
|
|
46
|
+
return { success: true, text: 'No markets found.', data: { signals: [] } };
|
|
47
|
+
}
|
|
48
|
+
// Sort by velocity for percentile calculation
|
|
49
|
+
const sorted = [...markets].sort((a, b) => a.velocity_ema - b.velocity_ema);
|
|
50
|
+
const signals = markets.map((m) => {
|
|
51
|
+
const rank = sorted.findIndex((s) => s.market_id === m.market_id);
|
|
52
|
+
const percentile = ((rank + 1) / sorted.length) * 100;
|
|
53
|
+
const signal = classify(m, percentile);
|
|
54
|
+
return {
|
|
55
|
+
market_id: m.market_id,
|
|
56
|
+
metric: m.metric,
|
|
57
|
+
platform: m.platform,
|
|
58
|
+
velocity_ema: m.velocity_ema,
|
|
59
|
+
signal,
|
|
60
|
+
percentile: Math.round(percentile),
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
// Filter by minimum signal if requested
|
|
64
|
+
const tierOrder = ['BREAKOUT', 'MOMENTUM', 'EMERGING', 'STABLE', 'COOLING', 'WEAK'];
|
|
65
|
+
const minIdx = params.min_signal
|
|
66
|
+
? tierOrder.indexOf(params.min_signal)
|
|
67
|
+
: tierOrder.length;
|
|
68
|
+
const filtered = minIdx < tierOrder.length
|
|
69
|
+
? signals.filter((s) => tierOrder.indexOf(s.signal) <= minIdx)
|
|
70
|
+
: signals;
|
|
71
|
+
// Group by signal tier
|
|
72
|
+
const grouped = new Map();
|
|
73
|
+
for (const s of filtered) {
|
|
74
|
+
const arr = grouped.get(s.signal) ?? [];
|
|
75
|
+
arr.push(s);
|
|
76
|
+
grouped.set(s.signal, arr);
|
|
77
|
+
}
|
|
78
|
+
const lines = [];
|
|
79
|
+
for (const tier of tierOrder) {
|
|
80
|
+
const group = grouped.get(tier);
|
|
81
|
+
if (!group?.length)
|
|
82
|
+
continue;
|
|
83
|
+
lines.push(`${tier}:`);
|
|
84
|
+
for (const s of group) {
|
|
85
|
+
lines.push(` • ${s.metric} (${formatVelocity(s.velocity_ema)} velocity, p${s.percentile}) [${s.platform}]`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Median velocity
|
|
89
|
+
const medianIdx = Math.floor(sorted.length / 2);
|
|
90
|
+
const medianVelocity = sorted[medianIdx]?.velocity_ema ?? 0;
|
|
91
|
+
return {
|
|
92
|
+
success: true,
|
|
93
|
+
text: `Velocity analysis (${markets.length} markets, ` +
|
|
94
|
+
`median ${formatVelocity(medianVelocity)}):\n${lines.join('\n')}`,
|
|
95
|
+
data: { signals: filtered, median_velocity: medianVelocity },
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
function classify(m, percentile) {
|
|
100
|
+
if (percentile >= 90)
|
|
101
|
+
return 'BREAKOUT';
|
|
102
|
+
if (percentile >= 70)
|
|
103
|
+
return 'MOMENTUM';
|
|
104
|
+
if (m.snapshot_count < 300 && percentile >= 50)
|
|
105
|
+
return 'EMERGING';
|
|
106
|
+
if (percentile >= 40)
|
|
107
|
+
return 'STABLE';
|
|
108
|
+
if (percentile >= 20)
|
|
109
|
+
return 'COOLING';
|
|
110
|
+
return 'WEAK';
|
|
111
|
+
}
|
|
112
|
+
function formatVelocity(v) {
|
|
113
|
+
if (v >= 1_000_000)
|
|
114
|
+
return `${(v / 1_000_000).toFixed(1)}M`;
|
|
115
|
+
if (v >= 1_000)
|
|
116
|
+
return `${(v / 1_000).toFixed(0)}K`;
|
|
117
|
+
return v.toFixed(0);
|
|
118
|
+
}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WZRD API client — handles agent auth (Ed25519 challenge/verify),
|
|
3
|
+
* token caching, and all REST calls.
|
|
4
|
+
*
|
|
5
|
+
* Standalone: no framework dependency. Works with any Keypair holder.
|
|
6
|
+
*/
|
|
7
|
+
import { Keypair } from '@solana/web3.js';
|
|
8
|
+
export interface WzrdMarket {
|
|
9
|
+
market_id: number;
|
|
10
|
+
channel_id: string;
|
|
11
|
+
platform: string;
|
|
12
|
+
metric: string;
|
|
13
|
+
velocity_ema: number;
|
|
14
|
+
multiplier_bps: number;
|
|
15
|
+
position_count: number;
|
|
16
|
+
tvl_usdc: number;
|
|
17
|
+
rank: number;
|
|
18
|
+
status: string;
|
|
19
|
+
snapshot_count: number;
|
|
20
|
+
last_scored_at: string;
|
|
21
|
+
}
|
|
22
|
+
export interface WzrdLeaderboard {
|
|
23
|
+
markets: WzrdMarket[];
|
|
24
|
+
root: {
|
|
25
|
+
root_seq: number;
|
|
26
|
+
root_hash: string;
|
|
27
|
+
published_slot: number;
|
|
28
|
+
};
|
|
29
|
+
total_positions: number;
|
|
30
|
+
total_tvl_usdc: number;
|
|
31
|
+
total_snapshots: number;
|
|
32
|
+
updated_at: string;
|
|
33
|
+
}
|
|
34
|
+
export interface WzrdPosition {
|
|
35
|
+
market_id: number;
|
|
36
|
+
metric: string;
|
|
37
|
+
usdc_deposited: number;
|
|
38
|
+
vlofi_minted: number;
|
|
39
|
+
multiplier_bps: number;
|
|
40
|
+
status: string;
|
|
41
|
+
is_settled: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface WzrdPortfolio {
|
|
44
|
+
positions: WzrdPosition[];
|
|
45
|
+
total_deposited_usdc: number;
|
|
46
|
+
total_vlofi: number;
|
|
47
|
+
total_ccm_earned: number;
|
|
48
|
+
}
|
|
49
|
+
export interface WzrdClaim {
|
|
50
|
+
root_seq: number;
|
|
51
|
+
cumulative_total: number;
|
|
52
|
+
claimed_total: number;
|
|
53
|
+
leaf_index: number;
|
|
54
|
+
proof: string[];
|
|
55
|
+
accounts: Record<string, string>;
|
|
56
|
+
}
|
|
57
|
+
export interface WzrdRelayResult {
|
|
58
|
+
root_seq: number;
|
|
59
|
+
cumulative_total: number;
|
|
60
|
+
tx_sig: string;
|
|
61
|
+
}
|
|
62
|
+
export declare class WzrdClient {
|
|
63
|
+
private readonly keypair;
|
|
64
|
+
private readonly apiUrl;
|
|
65
|
+
private token;
|
|
66
|
+
private tokenExpiresAt;
|
|
67
|
+
constructor(keypair: Keypair, apiUrl?: string);
|
|
68
|
+
get pubkey(): string;
|
|
69
|
+
private authenticate;
|
|
70
|
+
private getToken;
|
|
71
|
+
private authedFetch;
|
|
72
|
+
/** Fetch leaderboard — no auth required. */
|
|
73
|
+
getLeaderboard(limit?: number, platform?: string): Promise<WzrdLeaderboard>;
|
|
74
|
+
/** Fetch authenticated portfolio. */
|
|
75
|
+
getPortfolio(): Promise<WzrdPortfolio>;
|
|
76
|
+
/** Fetch claim data (proof + amounts). */
|
|
77
|
+
getClaims(): Promise<WzrdClaim>;
|
|
78
|
+
/** Execute gasless relay claim — server pays tx fees. */
|
|
79
|
+
claimRelay(): Promise<WzrdRelayResult>;
|
|
80
|
+
/** Fetch system health — no auth required. */
|
|
81
|
+
getHealth(): Promise<Record<string, unknown>>;
|
|
82
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WZRD API client — handles agent auth (Ed25519 challenge/verify),
|
|
3
|
+
* token caching, and all REST calls.
|
|
4
|
+
*
|
|
5
|
+
* Standalone: no framework dependency. Works with any Keypair holder.
|
|
6
|
+
*/
|
|
7
|
+
const DEFAULT_API_URL = 'https://api.twzrd.xyz';
|
|
8
|
+
const TOKEN_REFRESH_MARGIN_MS = 5 * 60 * 1000;
|
|
9
|
+
// ── Base58 encoder (zero-dependency) ────────────────────
|
|
10
|
+
const B58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
11
|
+
function toBase58(bytes) {
|
|
12
|
+
const digits = [0];
|
|
13
|
+
for (const byte of bytes) {
|
|
14
|
+
let carry = byte;
|
|
15
|
+
for (let j = 0; j < digits.length; j++) {
|
|
16
|
+
carry += digits[j] << 8;
|
|
17
|
+
digits[j] = carry % 58;
|
|
18
|
+
carry = (carry / 58) | 0;
|
|
19
|
+
}
|
|
20
|
+
while (carry > 0) {
|
|
21
|
+
digits.push(carry % 58);
|
|
22
|
+
carry = (carry / 58) | 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
let out = '';
|
|
26
|
+
for (const b of bytes) {
|
|
27
|
+
if (b !== 0)
|
|
28
|
+
break;
|
|
29
|
+
out += '1';
|
|
30
|
+
}
|
|
31
|
+
for (let i = digits.length - 1; i >= 0; i--)
|
|
32
|
+
out += B58[digits[i]];
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
// ── Client ──────────────────────────────────────────────
|
|
36
|
+
export class WzrdClient {
|
|
37
|
+
keypair;
|
|
38
|
+
apiUrl;
|
|
39
|
+
token = null;
|
|
40
|
+
tokenExpiresAt = 0;
|
|
41
|
+
constructor(keypair, apiUrl = DEFAULT_API_URL) {
|
|
42
|
+
this.keypair = keypair;
|
|
43
|
+
this.apiUrl = apiUrl;
|
|
44
|
+
}
|
|
45
|
+
get pubkey() {
|
|
46
|
+
return this.keypair.publicKey.toBase58();
|
|
47
|
+
}
|
|
48
|
+
// ── Auth ────────────────────────────────────────────
|
|
49
|
+
async authenticate() {
|
|
50
|
+
// 1. Challenge
|
|
51
|
+
const cr = await fetch(`${this.apiUrl}/v1/agent/challenge`);
|
|
52
|
+
if (!cr.ok)
|
|
53
|
+
throw new Error(`Challenge failed: ${cr.status}`);
|
|
54
|
+
const { nonce } = (await cr.json());
|
|
55
|
+
// 2. Sign with Ed25519
|
|
56
|
+
const message = `wzrd-agent-auth v1 | wallet:${this.pubkey} | nonce:${nonce}`;
|
|
57
|
+
const { default: nacl } = await import('tweetnacl');
|
|
58
|
+
const sig = nacl.sign.detached(new TextEncoder().encode(message), this.keypair.secretKey);
|
|
59
|
+
// 3. Verify
|
|
60
|
+
const vr = await fetch(`${this.apiUrl}/v1/agent/verify`, {
|
|
61
|
+
method: 'POST',
|
|
62
|
+
headers: { 'Content-Type': 'application/json' },
|
|
63
|
+
body: JSON.stringify({
|
|
64
|
+
pubkey: this.pubkey,
|
|
65
|
+
nonce,
|
|
66
|
+
signature: toBase58(sig),
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
if (!vr.ok)
|
|
70
|
+
throw new Error(`Verify failed: ${vr.status} ${await vr.text()}`);
|
|
71
|
+
const { token, expires_at } = (await vr.json());
|
|
72
|
+
this.token = token;
|
|
73
|
+
this.tokenExpiresAt = new Date(expires_at).getTime();
|
|
74
|
+
}
|
|
75
|
+
async getToken() {
|
|
76
|
+
if (!this.token ||
|
|
77
|
+
Date.now() > this.tokenExpiresAt - TOKEN_REFRESH_MARGIN_MS) {
|
|
78
|
+
await this.authenticate();
|
|
79
|
+
}
|
|
80
|
+
return this.token;
|
|
81
|
+
}
|
|
82
|
+
async authedFetch(path, init) {
|
|
83
|
+
const token = await this.getToken();
|
|
84
|
+
return fetch(`${this.apiUrl}${path}`, {
|
|
85
|
+
...init,
|
|
86
|
+
headers: { ...init?.headers, Authorization: `Bearer ${token}` },
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// ── Public API ──────────────────────────────────────
|
|
90
|
+
/** Fetch leaderboard — no auth required. */
|
|
91
|
+
async getLeaderboard(limit = 20, platform) {
|
|
92
|
+
const params = new URLSearchParams({ limit: String(limit) });
|
|
93
|
+
if (platform)
|
|
94
|
+
params.set('platform', platform);
|
|
95
|
+
const res = await fetch(`${this.apiUrl}/v1/leaderboard?${params}`);
|
|
96
|
+
if (!res.ok)
|
|
97
|
+
throw new Error(`Leaderboard failed: ${res.status}`);
|
|
98
|
+
return (await res.json());
|
|
99
|
+
}
|
|
100
|
+
/** Fetch authenticated portfolio. */
|
|
101
|
+
async getPortfolio() {
|
|
102
|
+
const res = await this.authedFetch('/v1/portfolio');
|
|
103
|
+
if (!res.ok)
|
|
104
|
+
throw new Error(`Portfolio failed: ${res.status}`);
|
|
105
|
+
return (await res.json());
|
|
106
|
+
}
|
|
107
|
+
/** Fetch claim data (proof + amounts). */
|
|
108
|
+
async getClaims() {
|
|
109
|
+
const res = await this.authedFetch(`/v1/claims/${this.pubkey}`);
|
|
110
|
+
if (!res.ok)
|
|
111
|
+
throw new Error(`Claims failed: ${res.status}`);
|
|
112
|
+
return (await res.json());
|
|
113
|
+
}
|
|
114
|
+
/** Execute gasless relay claim — server pays tx fees. */
|
|
115
|
+
async claimRelay() {
|
|
116
|
+
const res = await this.authedFetch(`/v1/claims/${this.pubkey}/relay`, {
|
|
117
|
+
method: 'POST',
|
|
118
|
+
headers: { 'Content-Type': 'application/json' },
|
|
119
|
+
});
|
|
120
|
+
if (!res.ok)
|
|
121
|
+
throw new Error(`Relay claim failed: ${res.status} ${await res.text()}`);
|
|
122
|
+
return (await res.json());
|
|
123
|
+
}
|
|
124
|
+
/** Fetch system health — no auth required. */
|
|
125
|
+
async getHealth() {
|
|
126
|
+
const res = await fetch(`${this.apiUrl}/health`);
|
|
127
|
+
if (!res.ok)
|
|
128
|
+
throw new Error(`Health failed: ${res.status}`);
|
|
129
|
+
return (await res.json());
|
|
130
|
+
}
|
|
131
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wzrd_sol/solana-agent-plugin
|
|
3
|
+
*
|
|
4
|
+
* WZRD Liquid Attention Protocol plugin for autonomous Solana agents.
|
|
5
|
+
*
|
|
6
|
+
* 5 actions:
|
|
7
|
+
* wzrd_leaderboard — browse attention markets (no auth)
|
|
8
|
+
* wzrd_velocity — classify signal strength (no auth)
|
|
9
|
+
* wzrd_portfolio — view positions + CCM earned (auth)
|
|
10
|
+
* wzrd_deposit — deposit USDC → mint vLOFI (auth + keypair)
|
|
11
|
+
* wzrd_claim — claim CCM via gasless relay (auth)
|
|
12
|
+
*
|
|
13
|
+
* Works with:
|
|
14
|
+
* - Solana Agent Kit (SendAI) — register as plugin
|
|
15
|
+
* - ElizaOS — wrap actions as ElizaOS Actions
|
|
16
|
+
* - Standalone — use WzrdClient directly
|
|
17
|
+
*
|
|
18
|
+
* Quick start:
|
|
19
|
+
* import { WzrdClient } from '@wzrd_sol/solana-agent-plugin';
|
|
20
|
+
* const client = new WzrdClient(keypair);
|
|
21
|
+
* const leaderboard = await client.getLeaderboard();
|
|
22
|
+
*/
|
|
23
|
+
export { WzrdClient } from './client.js';
|
|
24
|
+
export type { WzrdMarket, WzrdLeaderboard, WzrdPosition, WzrdPortfolio, WzrdClaim, WzrdRelayResult, } from './client.js';
|
|
25
|
+
export { LEADERBOARD_ACTION, PORTFOLIO_ACTION, DEPOSIT_ACTION, CLAIM_ACTION, VELOCITY_ACTION, } from './actions/index.js';
|
|
26
|
+
export declare const WZRD_ACTIONS: readonly [{
|
|
27
|
+
name: string;
|
|
28
|
+
similes: string[];
|
|
29
|
+
description: string;
|
|
30
|
+
examples: {
|
|
31
|
+
user: string;
|
|
32
|
+
content: {
|
|
33
|
+
text: string;
|
|
34
|
+
};
|
|
35
|
+
}[][];
|
|
36
|
+
validate: () => Promise<boolean>;
|
|
37
|
+
handler: (client: import("./client.js").WzrdClient, params: {
|
|
38
|
+
limit?: number;
|
|
39
|
+
platform?: string;
|
|
40
|
+
}) => Promise<{
|
|
41
|
+
success: boolean;
|
|
42
|
+
text: string;
|
|
43
|
+
data: import("./client.js").WzrdLeaderboard;
|
|
44
|
+
}>;
|
|
45
|
+
}, {
|
|
46
|
+
name: string;
|
|
47
|
+
similes: string[];
|
|
48
|
+
description: string;
|
|
49
|
+
examples: {
|
|
50
|
+
user: string;
|
|
51
|
+
content: {
|
|
52
|
+
text: string;
|
|
53
|
+
};
|
|
54
|
+
}[][];
|
|
55
|
+
validate: () => Promise<boolean>;
|
|
56
|
+
handler: (client: import("./client.js").WzrdClient) => Promise<{
|
|
57
|
+
success: boolean;
|
|
58
|
+
text: string;
|
|
59
|
+
data: import("./client.js").WzrdPortfolio;
|
|
60
|
+
}>;
|
|
61
|
+
}, {
|
|
62
|
+
name: string;
|
|
63
|
+
similes: string[];
|
|
64
|
+
description: string;
|
|
65
|
+
examples: {
|
|
66
|
+
user: string;
|
|
67
|
+
content: {
|
|
68
|
+
text: string;
|
|
69
|
+
};
|
|
70
|
+
}[][];
|
|
71
|
+
validate: (_client: import("./client.js").WzrdClient, params: import("./actions/deposit.js").DepositParams) => Promise<boolean>;
|
|
72
|
+
handler: (_client: import("./client.js").WzrdClient, params: import("./actions/deposit.js").DepositParams, connection: import("@solana/web3.js").Connection, wallet: import("@solana/web3.js").Keypair) => Promise<{
|
|
73
|
+
success: boolean;
|
|
74
|
+
text: string;
|
|
75
|
+
data?: undefined;
|
|
76
|
+
} | {
|
|
77
|
+
success: boolean;
|
|
78
|
+
text: string;
|
|
79
|
+
data: {
|
|
80
|
+
logs: string[] | undefined;
|
|
81
|
+
signature?: undefined;
|
|
82
|
+
market_id?: undefined;
|
|
83
|
+
amount_usdc?: undefined;
|
|
84
|
+
cu_used?: undefined;
|
|
85
|
+
elapsed_ms?: undefined;
|
|
86
|
+
explorer?: undefined;
|
|
87
|
+
};
|
|
88
|
+
} | {
|
|
89
|
+
success: boolean;
|
|
90
|
+
text: string;
|
|
91
|
+
data: {
|
|
92
|
+
signature: string;
|
|
93
|
+
market_id: number;
|
|
94
|
+
amount_usdc: number;
|
|
95
|
+
cu_used: number | undefined;
|
|
96
|
+
elapsed_ms: number;
|
|
97
|
+
explorer: string;
|
|
98
|
+
logs?: undefined;
|
|
99
|
+
};
|
|
100
|
+
}>;
|
|
101
|
+
}, {
|
|
102
|
+
name: string;
|
|
103
|
+
similes: string[];
|
|
104
|
+
description: string;
|
|
105
|
+
examples: {
|
|
106
|
+
user: string;
|
|
107
|
+
content: {
|
|
108
|
+
text: string;
|
|
109
|
+
};
|
|
110
|
+
}[][];
|
|
111
|
+
validate: () => Promise<boolean>;
|
|
112
|
+
handler: (client: import("./client.js").WzrdClient, params: {
|
|
113
|
+
execute?: boolean;
|
|
114
|
+
}) => Promise<{
|
|
115
|
+
success: boolean;
|
|
116
|
+
text: string;
|
|
117
|
+
data: import("./client.js").WzrdClaim;
|
|
118
|
+
} | {
|
|
119
|
+
success: boolean;
|
|
120
|
+
text: string;
|
|
121
|
+
data: {
|
|
122
|
+
claimable_before: number;
|
|
123
|
+
explorer: string;
|
|
124
|
+
root_seq: number;
|
|
125
|
+
cumulative_total: number;
|
|
126
|
+
tx_sig: string;
|
|
127
|
+
};
|
|
128
|
+
}>;
|
|
129
|
+
}, {
|
|
130
|
+
name: string;
|
|
131
|
+
similes: string[];
|
|
132
|
+
description: string;
|
|
133
|
+
examples: {
|
|
134
|
+
user: string;
|
|
135
|
+
content: {
|
|
136
|
+
text: string;
|
|
137
|
+
};
|
|
138
|
+
}[][];
|
|
139
|
+
validate: () => Promise<boolean>;
|
|
140
|
+
handler: (client: import("./client.js").WzrdClient, params: {
|
|
141
|
+
platform?: string;
|
|
142
|
+
min_signal?: "BREAKOUT" | "MOMENTUM" | "EMERGING" | "STABLE" | "COOLING" | "WEAK";
|
|
143
|
+
}) => Promise<{
|
|
144
|
+
success: boolean;
|
|
145
|
+
text: string;
|
|
146
|
+
data: {
|
|
147
|
+
signals: never[];
|
|
148
|
+
median_velocity?: undefined;
|
|
149
|
+
};
|
|
150
|
+
} | {
|
|
151
|
+
success: boolean;
|
|
152
|
+
text: string;
|
|
153
|
+
data: {
|
|
154
|
+
signals: import("./actions/velocity.js").MarketSignal[];
|
|
155
|
+
median_velocity: number;
|
|
156
|
+
};
|
|
157
|
+
}>;
|
|
158
|
+
}];
|
|
159
|
+
/** Plugin metadata for framework registration. */
|
|
160
|
+
export declare const WZRD_PLUGIN: {
|
|
161
|
+
name: string;
|
|
162
|
+
description: string;
|
|
163
|
+
actions: readonly [{
|
|
164
|
+
name: string;
|
|
165
|
+
similes: string[];
|
|
166
|
+
description: string;
|
|
167
|
+
examples: {
|
|
168
|
+
user: string;
|
|
169
|
+
content: {
|
|
170
|
+
text: string;
|
|
171
|
+
};
|
|
172
|
+
}[][];
|
|
173
|
+
validate: () => Promise<boolean>;
|
|
174
|
+
handler: (client: import("./client.js").WzrdClient, params: {
|
|
175
|
+
limit?: number;
|
|
176
|
+
platform?: string;
|
|
177
|
+
}) => Promise<{
|
|
178
|
+
success: boolean;
|
|
179
|
+
text: string;
|
|
180
|
+
data: import("./client.js").WzrdLeaderboard;
|
|
181
|
+
}>;
|
|
182
|
+
}, {
|
|
183
|
+
name: string;
|
|
184
|
+
similes: string[];
|
|
185
|
+
description: string;
|
|
186
|
+
examples: {
|
|
187
|
+
user: string;
|
|
188
|
+
content: {
|
|
189
|
+
text: string;
|
|
190
|
+
};
|
|
191
|
+
}[][];
|
|
192
|
+
validate: () => Promise<boolean>;
|
|
193
|
+
handler: (client: import("./client.js").WzrdClient) => Promise<{
|
|
194
|
+
success: boolean;
|
|
195
|
+
text: string;
|
|
196
|
+
data: import("./client.js").WzrdPortfolio;
|
|
197
|
+
}>;
|
|
198
|
+
}, {
|
|
199
|
+
name: string;
|
|
200
|
+
similes: string[];
|
|
201
|
+
description: string;
|
|
202
|
+
examples: {
|
|
203
|
+
user: string;
|
|
204
|
+
content: {
|
|
205
|
+
text: string;
|
|
206
|
+
};
|
|
207
|
+
}[][];
|
|
208
|
+
validate: (_client: import("./client.js").WzrdClient, params: import("./actions/deposit.js").DepositParams) => Promise<boolean>;
|
|
209
|
+
handler: (_client: import("./client.js").WzrdClient, params: import("./actions/deposit.js").DepositParams, connection: import("@solana/web3.js").Connection, wallet: import("@solana/web3.js").Keypair) => Promise<{
|
|
210
|
+
success: boolean;
|
|
211
|
+
text: string;
|
|
212
|
+
data?: undefined;
|
|
213
|
+
} | {
|
|
214
|
+
success: boolean;
|
|
215
|
+
text: string;
|
|
216
|
+
data: {
|
|
217
|
+
logs: string[] | undefined;
|
|
218
|
+
signature?: undefined;
|
|
219
|
+
market_id?: undefined;
|
|
220
|
+
amount_usdc?: undefined;
|
|
221
|
+
cu_used?: undefined;
|
|
222
|
+
elapsed_ms?: undefined;
|
|
223
|
+
explorer?: undefined;
|
|
224
|
+
};
|
|
225
|
+
} | {
|
|
226
|
+
success: boolean;
|
|
227
|
+
text: string;
|
|
228
|
+
data: {
|
|
229
|
+
signature: string;
|
|
230
|
+
market_id: number;
|
|
231
|
+
amount_usdc: number;
|
|
232
|
+
cu_used: number | undefined;
|
|
233
|
+
elapsed_ms: number;
|
|
234
|
+
explorer: string;
|
|
235
|
+
logs?: undefined;
|
|
236
|
+
};
|
|
237
|
+
}>;
|
|
238
|
+
}, {
|
|
239
|
+
name: string;
|
|
240
|
+
similes: string[];
|
|
241
|
+
description: string;
|
|
242
|
+
examples: {
|
|
243
|
+
user: string;
|
|
244
|
+
content: {
|
|
245
|
+
text: string;
|
|
246
|
+
};
|
|
247
|
+
}[][];
|
|
248
|
+
validate: () => Promise<boolean>;
|
|
249
|
+
handler: (client: import("./client.js").WzrdClient, params: {
|
|
250
|
+
execute?: boolean;
|
|
251
|
+
}) => Promise<{
|
|
252
|
+
success: boolean;
|
|
253
|
+
text: string;
|
|
254
|
+
data: import("./client.js").WzrdClaim;
|
|
255
|
+
} | {
|
|
256
|
+
success: boolean;
|
|
257
|
+
text: string;
|
|
258
|
+
data: {
|
|
259
|
+
claimable_before: number;
|
|
260
|
+
explorer: string;
|
|
261
|
+
root_seq: number;
|
|
262
|
+
cumulative_total: number;
|
|
263
|
+
tx_sig: string;
|
|
264
|
+
};
|
|
265
|
+
}>;
|
|
266
|
+
}, {
|
|
267
|
+
name: string;
|
|
268
|
+
similes: string[];
|
|
269
|
+
description: string;
|
|
270
|
+
examples: {
|
|
271
|
+
user: string;
|
|
272
|
+
content: {
|
|
273
|
+
text: string;
|
|
274
|
+
};
|
|
275
|
+
}[][];
|
|
276
|
+
validate: () => Promise<boolean>;
|
|
277
|
+
handler: (client: import("./client.js").WzrdClient, params: {
|
|
278
|
+
platform?: string;
|
|
279
|
+
min_signal?: "BREAKOUT" | "MOMENTUM" | "EMERGING" | "STABLE" | "COOLING" | "WEAK";
|
|
280
|
+
}) => Promise<{
|
|
281
|
+
success: boolean;
|
|
282
|
+
text: string;
|
|
283
|
+
data: {
|
|
284
|
+
signals: never[];
|
|
285
|
+
median_velocity?: undefined;
|
|
286
|
+
};
|
|
287
|
+
} | {
|
|
288
|
+
success: boolean;
|
|
289
|
+
text: string;
|
|
290
|
+
data: {
|
|
291
|
+
signals: import("./actions/velocity.js").MarketSignal[];
|
|
292
|
+
median_velocity: number;
|
|
293
|
+
};
|
|
294
|
+
}>;
|
|
295
|
+
}];
|
|
296
|
+
version: string;
|
|
297
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wzrd_sol/solana-agent-plugin
|
|
3
|
+
*
|
|
4
|
+
* WZRD Liquid Attention Protocol plugin for autonomous Solana agents.
|
|
5
|
+
*
|
|
6
|
+
* 5 actions:
|
|
7
|
+
* wzrd_leaderboard — browse attention markets (no auth)
|
|
8
|
+
* wzrd_velocity — classify signal strength (no auth)
|
|
9
|
+
* wzrd_portfolio — view positions + CCM earned (auth)
|
|
10
|
+
* wzrd_deposit — deposit USDC → mint vLOFI (auth + keypair)
|
|
11
|
+
* wzrd_claim — claim CCM via gasless relay (auth)
|
|
12
|
+
*
|
|
13
|
+
* Works with:
|
|
14
|
+
* - Solana Agent Kit (SendAI) — register as plugin
|
|
15
|
+
* - ElizaOS — wrap actions as ElizaOS Actions
|
|
16
|
+
* - Standalone — use WzrdClient directly
|
|
17
|
+
*
|
|
18
|
+
* Quick start:
|
|
19
|
+
* import { WzrdClient } from '@wzrd_sol/solana-agent-plugin';
|
|
20
|
+
* const client = new WzrdClient(keypair);
|
|
21
|
+
* const leaderboard = await client.getLeaderboard();
|
|
22
|
+
*/
|
|
23
|
+
export { WzrdClient } from './client.js';
|
|
24
|
+
export { LEADERBOARD_ACTION, PORTFOLIO_ACTION, DEPOSIT_ACTION, CLAIM_ACTION, VELOCITY_ACTION, } from './actions/index.js';
|
|
25
|
+
// ── Convenience: all actions as array ────────────────────
|
|
26
|
+
import { LEADERBOARD_ACTION } from './actions/leaderboard.js';
|
|
27
|
+
import { PORTFOLIO_ACTION } from './actions/portfolio.js';
|
|
28
|
+
import { DEPOSIT_ACTION } from './actions/deposit.js';
|
|
29
|
+
import { CLAIM_ACTION } from './actions/claim.js';
|
|
30
|
+
import { VELOCITY_ACTION } from './actions/velocity.js';
|
|
31
|
+
export const WZRD_ACTIONS = [
|
|
32
|
+
LEADERBOARD_ACTION,
|
|
33
|
+
PORTFOLIO_ACTION,
|
|
34
|
+
DEPOSIT_ACTION,
|
|
35
|
+
CLAIM_ACTION,
|
|
36
|
+
VELOCITY_ACTION,
|
|
37
|
+
];
|
|
38
|
+
/** Plugin metadata for framework registration. */
|
|
39
|
+
export const WZRD_PLUGIN = {
|
|
40
|
+
name: 'wzrd',
|
|
41
|
+
description: 'WZRD Liquid Attention Protocol — deposit USDC into AI attention markets, earn CCM yield',
|
|
42
|
+
actions: WZRD_ACTIONS,
|
|
43
|
+
version: '0.1.0',
|
|
44
|
+
};
|