@wzrd_sol/eliza-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 ADDED
@@ -0,0 +1,61 @@
1
+ # @wzrd_sol/eliza-plugin
2
+
3
+ ElizaOS plugin for the WZRD Liquid Attention Protocol on Solana. Gives ElizaOS agents the ability to discover AI model velocity, manage attention market positions, deposit USDC, and claim CCM yield.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @wzrd_sol/eliza-plugin
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ Set these in your ElizaOS runtime settings or environment:
14
+
15
+ | Variable | Required | Default | Description |
16
+ |----------|----------|---------|-------------|
17
+ | `SOLANA_PRIVATE_KEY` | Yes (for tx) | — | Base58 keypair for signing deposits/claims |
18
+ | `WZRD_API_URL` | No | `https://api.twzrd.xyz` | WZRD backend endpoint |
19
+ | `SOLANA_RPC_URL` | No | Helius mainnet | Solana RPC for on-chain reads |
20
+
21
+ ## Usage
22
+
23
+ ```typescript
24
+ import { wzrdPlugin } from "@wzrd_sol/eliza-plugin";
25
+
26
+ // Register with your ElizaOS agent
27
+ const agent = new AgentRuntime({
28
+ plugins: [wzrdPlugin],
29
+ // ... other config
30
+ });
31
+ ```
32
+
33
+ ## Actions
34
+
35
+ | Action | Auth | Description |
36
+ |--------|------|-------------|
37
+ | `WZRD_LEADERBOARD` | No | Fetch top markets ranked by velocity EMA |
38
+ | `WZRD_VELOCITY` | No | Classify attention signal strength for a market |
39
+ | `WZRD_PORTFOLIO` | Yes | View positions and accrued yield |
40
+ | `WZRD_DEPOSIT` | Yes | Deposit USDC into an attention market, receive vLOFI |
41
+ | `WZRD_CLAIM` | Yes | Claim accrued CCM via gasless relay or self-signed tx |
42
+
43
+ ### Example prompts
44
+
45
+ - "Show me the top WZRD markets"
46
+ - "What's the velocity signal for market 6?"
47
+ - "Check my WZRD portfolio"
48
+ - "Deposit 1 USDC into market 3"
49
+ - "Claim my CCM rewards"
50
+
51
+ ## Links
52
+
53
+ - [WZRD Protocol](https://twzrd.xyz)
54
+ - [SDK](https://www.npmjs.com/package/@wzrd_sol/sdk)
55
+ - [OpenAPI](https://twzrd.xyz/openapi.json)
56
+ - [MCP Server](https://app.twzrd.xyz/api/mcp)
57
+ - [Agent Discovery](https://twzrd.xyz/llms.txt)
58
+
59
+ ## License
60
+
61
+ MIT
@@ -1,3 +1,9 @@
1
- /** ELIZA Action: WZRD_CLAIM — claim accrued CCM via gasless relay (auth). */
1
+ /**
2
+ * ELIZA Action: WZRD_CLAIM — claim accrued CCM via gasless relay (auth).
3
+ *
4
+ * Agents can check current APR before deciding whether to claim or hold:
5
+ * WzrdClient.getMarketApr(marketId) — projected_total_apr_bps shows current yield rate.
6
+ * WzrdClient.getMarketPreview(marketId) — projected_multiplier_bps for live attention signal.
7
+ */
2
8
  import type { Action } from '@elizaos/core';
3
9
  export declare const claimAction: Action;
@@ -10,7 +10,21 @@ export const claimAction = {
10
10
  validate: async () => true,
11
11
  handler: async (runtime, _msg, _state, _opt, callback) => {
12
12
  const client = getWzrdClient(runtime);
13
- const claims = await client.getClaims();
13
+ let claims;
14
+ try {
15
+ claims = await client.getClaims();
16
+ }
17
+ catch (err) {
18
+ const msg = err instanceof Error ? err.message : String(err);
19
+ if (msg.includes('404')) {
20
+ const text = 'No claims found. Deposit into a market first to start accruing CCM.';
21
+ await callback?.({ text });
22
+ return { success: true, text };
23
+ }
24
+ const text = `Failed to fetch claims: ${msg}`;
25
+ await callback?.({ text });
26
+ return { success: false, error: text };
27
+ }
14
28
  const claimable = claims.cumulative_total - claims.claimed_total;
15
29
  if (claimable <= 0) {
16
30
  const text = `No CCM to claim. Cumulative: ${claims.cumulative_total}, claimed: ${claims.claimed_total}.`;
@@ -1,4 +1,13 @@
1
- /** ELIZA Action: WZRD_DEPOSIT — deposit USDC into attention market, mint vLOFI (auth + keypair). */
1
+ /**
2
+ * ELIZA Action: WZRD_DEPOSIT — deposit USDC into attention market, mint vLOFI (auth + keypair).
3
+ *
4
+ * Before depositing, agents can check expected returns via the APR endpoint:
5
+ * GET /v1/markets/:id/apr — returns base_apr_bps, attention_multiplier_bps,
6
+ * projected_total_apr_bps, tvl_usdc, and the yield formula.
7
+ * GET /v1/markets/:id/preview — returns projected_multiplier_bps and freshness_secs
8
+ * for a live multiplier snapshot before committing capital.
9
+ * Use WzrdClient.getMarketApr(marketId) or WzrdClient.getMarketPreview(marketId).
10
+ */
2
11
  import { Keypair, ComputeBudgetProgram, TransactionMessage, VersionedTransaction, Connection } from '@solana/web3.js';
3
12
  export const depositAction = {
4
13
  name: 'WZRD_DEPOSIT',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wzrd_sol/eliza-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "WZRD Liquid Attention Protocol plugin for ElizaOS — leaderboard, portfolio, deposit, claim, velocity",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "repository": {
50
50
  "type": "git",
51
- "url": "https://github.com/twzrd-sol/wzrd-final",
51
+ "url": "git+https://github.com/twzrd-sol/wzrd-final.git",
52
52
  "directory": "agents/eliza-plugin"
53
53
  },
54
54
  "files": [