@wzrd_sol/solana-agent-plugin 0.1.0 → 0.1.2
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 +43 -1
- package/dist/actions/claim.d.ts +11 -30
- package/dist/actions/claim.js +57 -60
- package/dist/actions/deposit.d.ts +15 -46
- package/dist/actions/deposit.js +148 -105
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/leaderboard.d.ts +14 -21
- package/dist/actions/leaderboard.js +26 -42
- package/dist/actions/portfolio.d.ts +5 -18
- package/dist/actions/portfolio.js +28 -28
- package/dist/actions/velocity.d.ts +15 -33
- package/dist/actions/velocity.js +67 -75
- package/dist/client.d.ts +18 -5
- package/dist/client.js +25 -8
- package/dist/index.d.ts +18 -273
- package/dist/index.js +53 -12
- package/dist/runtime.d.ts +16 -0
- package/dist/runtime.js +33 -0
- package/examples/hello-wzrd.mjs +24 -9
- package/package.json +14 -5
- package/src/actions/claim.ts +74 -71
- package/src/actions/deposit.ts +189 -157
- package/src/actions/index.ts +1 -0
- package/src/actions/leaderboard.ts +40 -57
- package/src/actions/portfolio.ts +41 -39
- package/src/actions/velocity.ts +84 -91
- package/src/client.ts +42 -11
- package/src/index.ts +70 -12
- package/src/runtime.ts +60 -0
- package/type-smoke-Cvxu.ts +8 -0
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Works with:
|
|
14
14
|
* - Solana Agent Kit (SendAI) — register as plugin
|
|
15
|
-
* - ElizaOS — wrap actions as
|
|
15
|
+
* - ElizaOS — wrap actions as ELIZA-style actions
|
|
16
16
|
* - Standalone — use WzrdClient directly
|
|
17
17
|
*
|
|
18
18
|
* Quick start:
|
|
@@ -23,275 +23,20 @@
|
|
|
23
23
|
export { WzrdClient } from './client.js';
|
|
24
24
|
export type { WzrdMarket, WzrdLeaderboard, WzrdPosition, WzrdPortfolio, WzrdClaim, WzrdRelayResult, } from './client.js';
|
|
25
25
|
export { LEADERBOARD_ACTION, PORTFOLIO_ACTION, DEPOSIT_ACTION, CLAIM_ACTION, VELOCITY_ACTION, } from './actions/index.js';
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
};
|
|
26
|
+
export type { MarketSignal } from './actions/index.js';
|
|
27
|
+
import type { Plugin } from 'solana-agent-kit';
|
|
28
|
+
import { getClaimsData, getClientForAgent, getLeaderboardData } from './runtime.js';
|
|
29
|
+
import { type MarketSignal } from './actions/velocity.js';
|
|
30
|
+
export declare const WZRD_ACTIONS: Plugin["actions"];
|
|
31
|
+
export interface WzrdPluginMethods {
|
|
32
|
+
wzrdLeaderboard(limit?: number, platform?: string): Promise<ReturnType<typeof getLeaderboardData>>;
|
|
33
|
+
wzrdPortfolio(): Promise<ReturnType<typeof getClientForAgent>['getPortfolio']>;
|
|
34
|
+
wzrdClaims(): Promise<ReturnType<typeof getClaimsData>>;
|
|
35
|
+
wzrdDeposit(marketId: number, amountUsdc: number, priorityFee?: number): Promise<Record<string, unknown>>;
|
|
36
|
+
wzrdClaim(execute?: boolean): Promise<Record<string, unknown>>;
|
|
37
|
+
wzrdVelocity(platform?: string, minSignal?: MarketSignal['signal']): Promise<Record<string, unknown>>;
|
|
38
|
+
wzrdClient(): ReturnType<typeof getClientForAgent>;
|
|
39
|
+
}
|
|
40
|
+
export declare function createWzrdPlugin(): Plugin;
|
|
41
|
+
/** Default plugin instance for direct registration via `agent.use(...)`. */
|
|
42
|
+
export declare const WZRD_PLUGIN: Plugin;
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Works with:
|
|
14
14
|
* - Solana Agent Kit (SendAI) — register as plugin
|
|
15
|
-
* - ElizaOS — wrap actions as
|
|
15
|
+
* - ElizaOS — wrap actions as ELIZA-style actions
|
|
16
16
|
* - Standalone — use WzrdClient directly
|
|
17
17
|
*
|
|
18
18
|
* Quick start:
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
*/
|
|
23
23
|
export { WzrdClient } from './client.js';
|
|
24
24
|
export { LEADERBOARD_ACTION, PORTFOLIO_ACTION, DEPOSIT_ACTION, CLAIM_ACTION, VELOCITY_ACTION, } from './actions/index.js';
|
|
25
|
-
|
|
25
|
+
import { getClaimsData, getClientForAgent, getLeaderboardData } from './runtime.js';
|
|
26
26
|
import { LEADERBOARD_ACTION } from './actions/leaderboard.js';
|
|
27
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';
|
|
28
|
+
import { DEPOSIT_ACTION, depositHandler } from './actions/deposit.js';
|
|
29
|
+
import { CLAIM_ACTION, claimHandler } from './actions/claim.js';
|
|
30
|
+
import { VELOCITY_ACTION, velocityHandler } from './actions/velocity.js';
|
|
31
31
|
export const WZRD_ACTIONS = [
|
|
32
32
|
LEADERBOARD_ACTION,
|
|
33
33
|
PORTFOLIO_ACTION,
|
|
@@ -35,10 +35,51 @@ export const WZRD_ACTIONS = [
|
|
|
35
35
|
CLAIM_ACTION,
|
|
36
36
|
VELOCITY_ACTION,
|
|
37
37
|
];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
export function createWzrdPlugin() {
|
|
39
|
+
let agentRef = null;
|
|
40
|
+
const requireAgent = () => {
|
|
41
|
+
if (!agentRef) {
|
|
42
|
+
throw new Error('WZRD plugin has not been initialized with a SolanaAgentKit instance');
|
|
43
|
+
}
|
|
44
|
+
return agentRef;
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
name: 'wzrd',
|
|
48
|
+
initialize(agent) {
|
|
49
|
+
agentRef = agent;
|
|
50
|
+
},
|
|
51
|
+
methods: {
|
|
52
|
+
wzrdClient() {
|
|
53
|
+
return getClientForAgent(requireAgent());
|
|
54
|
+
},
|
|
55
|
+
async wzrdLeaderboard(limit = 20, platform) {
|
|
56
|
+
return getLeaderboardData(requireAgent(), { limit, platform });
|
|
57
|
+
},
|
|
58
|
+
async wzrdPortfolio() {
|
|
59
|
+
return getClientForAgent(requireAgent()).getPortfolio();
|
|
60
|
+
},
|
|
61
|
+
async wzrdClaims() {
|
|
62
|
+
return getClaimsData(requireAgent());
|
|
63
|
+
},
|
|
64
|
+
async wzrdDeposit(marketId, amountUsdc, priorityFee) {
|
|
65
|
+
return depositHandler(requireAgent(), {
|
|
66
|
+
market_id: marketId,
|
|
67
|
+
amount_usdc: amountUsdc,
|
|
68
|
+
priority_fee: priorityFee,
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
async wzrdClaim(execute = true) {
|
|
72
|
+
return claimHandler(requireAgent(), { execute });
|
|
73
|
+
},
|
|
74
|
+
async wzrdVelocity(platform, minSignal) {
|
|
75
|
+
return velocityHandler(requireAgent(), {
|
|
76
|
+
platform,
|
|
77
|
+
min_signal: minSignal,
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
actions: WZRD_ACTIONS,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Default plugin instance for direct registration via `agent.use(...)`. */
|
|
85
|
+
export const WZRD_PLUGIN = createWzrdPlugin();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PublicKey } from '@solana/web3.js';
|
|
2
|
+
import type { SolanaAgentKit } from 'solana-agent-kit';
|
|
3
|
+
import { WzrdClient, type WzrdClaim, type WzrdLeaderboard, type WzrdPortfolio } from './client.js';
|
|
4
|
+
export type SignalTier = 'BREAKOUT' | 'MOMENTUM' | 'EMERGING' | 'STABLE' | 'COOLING' | 'WEAK';
|
|
5
|
+
export declare function resolveApiUrl(explicit?: string): string;
|
|
6
|
+
export declare function getClientForAgent(agent: SolanaAgentKit, apiUrl?: string): WzrdClient;
|
|
7
|
+
export declare function getWalletPublicKey(agent: SolanaAgentKit): PublicKey;
|
|
8
|
+
export declare function formatVelocity(v: number): string;
|
|
9
|
+
export declare function formatUsdc(nativeAmount: number | bigint): string;
|
|
10
|
+
export declare function formatCcm(nativeAmount: number | bigint): string;
|
|
11
|
+
export declare function getLeaderboardData(agent: SolanaAgentKit, input: {
|
|
12
|
+
limit?: number;
|
|
13
|
+
platform?: string;
|
|
14
|
+
}): Promise<WzrdLeaderboard>;
|
|
15
|
+
export declare function getPortfolioData(agent: SolanaAgentKit): Promise<WzrdPortfolio>;
|
|
16
|
+
export declare function getClaimsData(agent: SolanaAgentKit): Promise<WzrdClaim>;
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DEFAULT_API_URL, WzrdClient, } from './client.js';
|
|
2
|
+
export function resolveApiUrl(explicit) {
|
|
3
|
+
const envUrl = process.env.WZRD_API_URL?.trim();
|
|
4
|
+
return explicit?.trim() || envUrl || DEFAULT_API_URL;
|
|
5
|
+
}
|
|
6
|
+
export function getClientForAgent(agent, apiUrl) {
|
|
7
|
+
return new WzrdClient(agent.wallet, resolveApiUrl(apiUrl));
|
|
8
|
+
}
|
|
9
|
+
export function getWalletPublicKey(agent) {
|
|
10
|
+
return agent.wallet.publicKey;
|
|
11
|
+
}
|
|
12
|
+
export function formatVelocity(v) {
|
|
13
|
+
if (v >= 1_000_000)
|
|
14
|
+
return `${(v / 1_000_000).toFixed(1)}M`;
|
|
15
|
+
if (v >= 1_000)
|
|
16
|
+
return `${(v / 1_000).toFixed(0)}K`;
|
|
17
|
+
return v.toFixed(0);
|
|
18
|
+
}
|
|
19
|
+
export function formatUsdc(nativeAmount) {
|
|
20
|
+
return (Number(nativeAmount) / 1_000_000).toFixed(4);
|
|
21
|
+
}
|
|
22
|
+
export function formatCcm(nativeAmount) {
|
|
23
|
+
return (Number(nativeAmount) / 1_000_000).toFixed(4);
|
|
24
|
+
}
|
|
25
|
+
export async function getLeaderboardData(agent, input) {
|
|
26
|
+
return getClientForAgent(agent).getLeaderboard(input.limit ?? 10, input.platform);
|
|
27
|
+
}
|
|
28
|
+
export async function getPortfolioData(agent) {
|
|
29
|
+
return getClientForAgent(agent).getPortfolio();
|
|
30
|
+
}
|
|
31
|
+
export async function getClaimsData(agent) {
|
|
32
|
+
return getClientForAgent(agent).getClaims();
|
|
33
|
+
}
|
package/examples/hello-wzrd.mjs
CHANGED
|
@@ -7,20 +7,22 @@
|
|
|
7
7
|
* 2. Authenticate with Ed25519 (no browser, 1 second)
|
|
8
8
|
* 3. Check portfolio (what do I hold?)
|
|
9
9
|
* 4. Check claimable CCM (any rewards ready?)
|
|
10
|
+
* 5. Optionally claim via gasless relay (--claim)
|
|
10
11
|
*
|
|
11
12
|
* Usage:
|
|
12
|
-
*
|
|
13
|
+
* WZRD_KEYPAIR_PATH=~/.config/solana/id.json node hello-wzrd.mjs
|
|
13
14
|
*
|
|
14
15
|
* Or generate a fresh keypair:
|
|
15
16
|
* solana-keygen new -o /tmp/agent.json --no-bip39-passphrase
|
|
16
|
-
*
|
|
17
|
+
* WZRD_KEYPAIR_PATH=/tmp/agent.json node hello-wzrd.mjs
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
import { readFileSync } from 'node:fs';
|
|
20
21
|
import { Keypair } from '@solana/web3.js';
|
|
21
|
-
import { WzrdClient } from '
|
|
22
|
+
import { WzrdClient } from '@wzrd_sol/solana-agent-plugin';
|
|
22
23
|
|
|
23
24
|
const KEYPAIR_PATH = process.env.WZRD_KEYPAIR_PATH;
|
|
25
|
+
const SHOULD_CLAIM = process.argv.includes('--claim');
|
|
24
26
|
if (!KEYPAIR_PATH) {
|
|
25
27
|
console.log('Usage: WZRD_KEYPAIR_PATH=/path/to/keypair.json node hello-wzrd.mjs');
|
|
26
28
|
console.log('Generate one: solana-keygen new -o /tmp/agent.json --no-bip39-passphrase');
|
|
@@ -36,9 +38,11 @@ console.log(`Agent: ${wallet.publicKey.toBase58()}\n`);
|
|
|
36
38
|
|
|
37
39
|
// 1. Leaderboard (public, no auth)
|
|
38
40
|
console.log('→ Fetching leaderboard...');
|
|
39
|
-
const board = await client.getLeaderboard(
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
const board = await client.getLeaderboard(20);
|
|
42
|
+
const visibleMarketIds = new Set(board.markets.map(m => m.market_id));
|
|
43
|
+
const topMarkets = board.markets.slice(0, 5);
|
|
44
|
+
console.log(` ${topMarkets.length} markets, root_seq=${board.root.root_seq}`);
|
|
45
|
+
for (const m of topMarkets) {
|
|
42
46
|
const vel = m.velocity_ema >= 1000 ? `${(m.velocity_ema/1000).toFixed(0)}K` : m.velocity_ema.toFixed(0);
|
|
43
47
|
console.log(` #${m.market_id} ${m.metric} — ${vel} velocity (${m.platform})`);
|
|
44
48
|
}
|
|
@@ -50,7 +54,10 @@ try {
|
|
|
50
54
|
const open = portfolio.positions.filter(p => !p.is_settled);
|
|
51
55
|
console.log(` ${open.length} open positions, ${(portfolio.total_deposited_usdc / 1e6).toFixed(4)} USDC total`);
|
|
52
56
|
for (const p of open) {
|
|
53
|
-
|
|
57
|
+
const legacyTag = visibleMarketIds.has(p.market_id) ? '' : ' [legacy/not listed]';
|
|
58
|
+
console.log(
|
|
59
|
+
` • Market #${p.market_id}: ${(p.usdc_deposited / 1e6).toFixed(4)} USDC, ${(p.multiplier_bps / 10000).toFixed(1)}x${legacyTag}`,
|
|
60
|
+
);
|
|
54
61
|
}
|
|
55
62
|
} catch (e) {
|
|
56
63
|
console.log(` No portfolio yet (${e instanceof Error ? e.message : e})`);
|
|
@@ -65,7 +72,15 @@ try {
|
|
|
65
72
|
console.log(` Cumulative: ${claims.cumulative_total}, Claimed: ${claims.claimed_total}`);
|
|
66
73
|
console.log(` Claimable now: ${claimable > 0 ? claimable : 'none'}`);
|
|
67
74
|
if (claimable > 0) {
|
|
68
|
-
|
|
75
|
+
if (SHOULD_CLAIM) {
|
|
76
|
+
const result = await client.claimRelay();
|
|
77
|
+
console.log(` Claim relay result: ${result.status}`);
|
|
78
|
+
if (result.signature) {
|
|
79
|
+
console.log(` Signature: ${result.signature}`);
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
console.log(' → Run with --claim to harvest via gasless relay');
|
|
83
|
+
}
|
|
69
84
|
}
|
|
70
85
|
} catch (e) {
|
|
71
86
|
console.log(` No claims data yet (${e instanceof Error ? e.message : e})`);
|
|
@@ -75,5 +90,5 @@ console.log('\n=== Done ===');
|
|
|
75
90
|
console.log('Next steps:');
|
|
76
91
|
console.log(' 1. Fund your wallet with USDC (even 0.01 is enough)');
|
|
77
92
|
console.log(' 2. Use wzrd_deposit to enter a market');
|
|
78
|
-
console.log(' 3. Wait ~
|
|
93
|
+
console.log(' 3. Wait ~5 min for scoring cycle');
|
|
79
94
|
console.log(' 4. Use wzrd_claim to harvest CCM (gasless — no SOL needed)');
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzrd_sol/solana-agent-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "WZRD Liquid Attention Protocol plugin for Solana Agent Kit — deposit, claim, leaderboard, portfolio, velocity signal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"import": "./dist/index.js",
|
|
11
|
-
"
|
|
12
|
+
"default": "./dist/index.js"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
"scripts": {
|
|
@@ -17,8 +18,9 @@
|
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"@solana/web3.js": "^1.95.0",
|
|
20
|
-
"@wzrd_sol/sdk": "^0.1.
|
|
21
|
-
"tweetnacl": "^1.0.3"
|
|
21
|
+
"@wzrd_sol/sdk": "^0.1.1",
|
|
22
|
+
"tweetnacl": "^1.0.3",
|
|
23
|
+
"zod": "^3.25.76"
|
|
22
24
|
},
|
|
23
25
|
"peerDependencies": {
|
|
24
26
|
"solana-agent-kit": "^2.0.0"
|
|
@@ -28,6 +30,10 @@
|
|
|
28
30
|
"optional": true
|
|
29
31
|
}
|
|
30
32
|
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"solana-agent-kit": "^2.0.10",
|
|
35
|
+
"typescript": "^5.6.3"
|
|
36
|
+
},
|
|
31
37
|
"keywords": [
|
|
32
38
|
"solana",
|
|
33
39
|
"agent",
|
|
@@ -39,8 +45,11 @@
|
|
|
39
45
|
"solana-agent-kit"
|
|
40
46
|
],
|
|
41
47
|
"license": "MIT",
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
42
51
|
"repository": {
|
|
43
52
|
"type": "git",
|
|
44
|
-
"url": "https://github.com/twzrd-sol/wzrd-final"
|
|
53
|
+
"url": "git+https://github.com/twzrd-sol/wzrd-final.git"
|
|
45
54
|
}
|
|
46
55
|
}
|