@wzrd_sol/solana-agent-plugin 0.1.1 → 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/examples/hello-wzrd.mjs +23 -8
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -4,12 +4,37 @@ WZRD Liquid Attention Protocol plugin for autonomous Solana agents. Provides 5 a
|
|
|
4
4
|
|
|
5
5
|
Works standalone, with [Solana Agent Kit](https://github.com/sendAI/solana-agent-kit), or as a base for ElizaOS action wrappers.
|
|
6
6
|
|
|
7
|
+
## 30-Second Test
|
|
8
|
+
|
|
9
|
+
No Solana Agent Kit dependency is required for the first smoke test. The package is ESM-first, so use `type: "module"` and `import`.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
mkdir wzrd-agent && cd wzrd-agent
|
|
13
|
+
printf '{\"name\":\"wzrd-agent\",\"type\":\"module\",\"private\":true}\n' > package.json
|
|
14
|
+
npm install @wzrd_sol/solana-agent-plugin @solana/web3.js
|
|
15
|
+
curl -O https://raw.githubusercontent.com/twzrd-sol/wzrd-final/main/agents/solana-agent-kit-plugin/examples/hello-wzrd.mjs
|
|
16
|
+
solana-keygen new -o /tmp/agent.json --no-bip39-passphrase
|
|
17
|
+
WZRD_KEYPAIR_PATH=/tmp/agent.json node hello-wzrd.mjs
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
What you should see:
|
|
21
|
+
- top markets
|
|
22
|
+
- successful Ed25519 agent auth
|
|
23
|
+
- portfolio or signup-bonus path
|
|
24
|
+
- claimable CCM state
|
|
25
|
+
|
|
7
26
|
## Install
|
|
8
27
|
|
|
9
28
|
```bash
|
|
10
29
|
npm install @wzrd_sol/solana-agent-plugin
|
|
11
30
|
```
|
|
12
31
|
|
|
32
|
+
Install with Solana Agent Kit only when you are ready to execute through its action system:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @wzrd_sol/solana-agent-plugin solana-agent-kit
|
|
36
|
+
```
|
|
37
|
+
|
|
13
38
|
## Quick Start
|
|
14
39
|
|
|
15
40
|
```typescript
|
|
@@ -30,6 +55,18 @@ const claims = await client.getClaims();
|
|
|
30
55
|
const result = await client.claimRelay(); // gasless CCM claim
|
|
31
56
|
```
|
|
32
57
|
|
|
58
|
+
## Solana Agent Kit
|
|
59
|
+
|
|
60
|
+
The package works standalone or as a Solana Agent Kit plugin.
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { SolanaAgentKit } from 'solana-agent-kit';
|
|
64
|
+
import { WZRD_PLUGIN } from '@wzrd_sol/solana-agent-plugin';
|
|
65
|
+
|
|
66
|
+
const agent = new SolanaAgentKit(/* wallet + rpc + model config */);
|
|
67
|
+
agent.use(WZRD_PLUGIN);
|
|
68
|
+
```
|
|
69
|
+
|
|
33
70
|
## Actions
|
|
34
71
|
|
|
35
72
|
The plugin exports 5 actions that follow the Solana Agent Kit action interface:
|
|
@@ -38,7 +75,7 @@ The plugin exports 5 actions that follow the Solana Agent Kit action interface:
|
|
|
38
75
|
|--------|------|-------------|
|
|
39
76
|
| `LEADERBOARD_ACTION` | No | Fetch ranked attention markets |
|
|
40
77
|
| `VELOCITY_ACTION` | No | Classify signal strength (BREAKOUT / MOMENTUM / EMERGING / STABLE / COOLING / WEAK) |
|
|
41
|
-
| `PORTFOLIO_ACTION` | Yes | View positions
|
|
78
|
+
| `PORTFOLIO_ACTION` | Yes | View portfolio positions |
|
|
42
79
|
| `DEPOSIT_ACTION` | Yes | Deposit USDC into a market, receive vLOFI |
|
|
43
80
|
| `CLAIM_ACTION` | Yes | Claim CCM via server-paid gasless relay |
|
|
44
81
|
|
|
@@ -65,6 +102,11 @@ Creates a client instance. The keypair is used for Ed25519 agent authentication.
|
|
|
65
102
|
|
|
66
103
|
Auth is handled automatically: the client requests a challenge nonce, signs it with the keypair, and caches the bearer token (24h TTL, auto-refreshes).
|
|
67
104
|
|
|
105
|
+
For an end-to-end smoke test, use [`examples/hello-wzrd.mjs`](./examples/hello-wzrd.mjs). It works with just:
|
|
106
|
+
- `@wzrd_sol/solana-agent-plugin`
|
|
107
|
+
- `@solana/web3.js`
|
|
108
|
+
- `WZRD_KEYPAIR_PATH=/path/to/keypair.json`
|
|
109
|
+
|
|
68
110
|
## License
|
|
69
111
|
|
|
70
112
|
MIT
|
package/examples/hello-wzrd.mjs
CHANGED
|
@@ -7,13 +7,14 @@
|
|
|
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';
|
|
@@ -21,6 +22,7 @@ import { Keypair } from '@solana/web3.js';
|
|
|
21
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,6 +1,6 @@
|
|
|
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",
|
|
@@ -45,8 +45,11 @@
|
|
|
45
45
|
"solana-agent-kit"
|
|
46
46
|
],
|
|
47
47
|
"license": "MIT",
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
48
51
|
"repository": {
|
|
49
52
|
"type": "git",
|
|
50
|
-
"url": "https://github.com/twzrd-sol/wzrd-final"
|
|
53
|
+
"url": "git+https://github.com/twzrd-sol/wzrd-final.git"
|
|
51
54
|
}
|
|
52
55
|
}
|