@wzrd_sol/solana-agent-plugin 0.1.1 → 0.2.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/dist/client.d.ts CHANGED
@@ -2,6 +2,9 @@
2
2
  * WZRD API client — handles agent auth (Ed25519 challenge/verify),
3
3
  * token caching, and all REST calls.
4
4
  *
5
+ * Auth flow: challenge → sign → verify → Bearer token (24h TTL)
6
+ * Earn flow: infer → report(execution_id) → claim
7
+ *
5
8
  * Standalone: no framework dependency. Works with a Keypair or any wallet
6
9
  * implementation that supports `publicKey` + `signMessage()`.
7
10
  */
@@ -12,62 +15,61 @@ export interface WzrdSigner {
12
15
  signMessage?: (message: Uint8Array) => Promise<Uint8Array>;
13
16
  secretKey?: Uint8Array;
14
17
  }
15
- export interface WzrdMarket {
18
+ export interface InferResult {
19
+ execution_id: string;
20
+ model: string;
21
+ provider: string;
22
+ quality_score: number;
23
+ response: string;
24
+ latency_ms: number;
25
+ prompt_tokens?: number;
26
+ completion_tokens?: number;
27
+ }
28
+ export interface ReportResult {
29
+ contribution_id: number;
30
+ verification_state: string;
31
+ quality_score: number | null;
32
+ model_id: string;
33
+ }
34
+ export interface RewardsBalance {
35
+ pending_ccm: number;
36
+ total_rewarded_ccm: number;
37
+ rank: number | null;
38
+ contribution_count: number;
39
+ }
40
+ export interface ClaimResult {
41
+ tx_sig: string | null;
42
+ root_seq: number;
43
+ cumulative_total: number;
44
+ status: string;
45
+ }
46
+ export interface ClaimStatus {
47
+ cumulative_total: number;
48
+ claimed_total: number;
49
+ claimable: number;
50
+ }
51
+ export interface LeaderboardMarket {
16
52
  market_id: number;
53
+ /** Metric label for the market (e.g. "downloads", "stars"). NOT a model id. */
54
+ metric: string;
55
+ /** Server-resolvable model id — pass this as `model` to infer. */
17
56
  channel_id: string;
18
57
  platform: string;
19
- metric: string;
20
58
  velocity_ema: number;
21
59
  multiplier_bps: number;
22
- position_count: number;
23
- tvl_usdc: number;
24
- rank: number;
25
- status: string;
26
60
  snapshot_count: number;
27
- last_scored_at: string;
28
- depositable: boolean;
61
+ position_count?: number;
62
+ tvl_usdc?: number;
29
63
  }
30
- export interface WzrdLeaderboard {
31
- markets: WzrdMarket[];
64
+ export interface LeaderboardResult {
65
+ markets: LeaderboardMarket[];
32
66
  root: {
33
67
  root_seq: number;
34
- root_hash: string;
35
- published_slot: number;
68
+ root_hash?: string;
69
+ published_slot?: number;
36
70
  };
37
- total_positions: number;
38
- total_tvl_usdc: number;
39
- total_snapshots: number;
40
- updated_at: string;
41
- }
42
- export interface WzrdPosition {
43
- market_id: number;
44
- metric: string;
45
- usdc_deposited: number;
46
- vlofi_minted: number;
47
- multiplier_bps: number;
48
- status: string;
49
- is_settled: boolean;
50
- }
51
- export interface WzrdPortfolio {
52
- positions: WzrdPosition[];
53
- total_deposited_usdc: number;
54
- total_vlofi: number;
55
- total_ccm_earned: number;
56
- }
57
- export interface WzrdClaim {
58
- root_seq: number;
59
- cumulative_total: number;
60
- claimed_total: number;
61
- leaf_index: number;
62
- proof: string[];
63
- accounts: Record<string, string>;
64
- }
65
- export interface WzrdRelayResult {
66
- root_seq: number;
67
- cumulative_total: number;
68
- claimed_total?: number;
69
- tx_sig?: string;
70
- status?: 'already_claimed';
71
+ total_positions?: number;
72
+ total_tvl_usdc?: number;
71
73
  }
72
74
  export declare class WzrdClient {
73
75
  private readonly signer;
@@ -82,14 +84,29 @@ export declare class WzrdClient {
82
84
  private authenticate;
83
85
  private getToken;
84
86
  private authedFetch;
87
+ /**
88
+ * Pick a model from the leaderboard — returns the top market's `channel_id`,
89
+ * which is the server-resolvable model id accepted by `infer`. The leaderboard
90
+ * is not task-segmented, so the top market is returned regardless of task type
91
+ * (pass `task_type` to `infer` to steer the provider cascade instead).
92
+ */
93
+ pickModel(): Promise<string>;
94
+ /** Server-witnessed inference — WZRD calls the provider, grades quality */
95
+ infer(prompt: string, model?: string, taskType?: string): Promise<InferResult>;
96
+ /** Report model pick with execution_id for verified rewards */
97
+ report(params: {
98
+ model_id: string;
99
+ execution_id: string;
100
+ task_type?: string;
101
+ quality_score?: number;
102
+ latency_ms?: number;
103
+ }): Promise<ReportResult>;
104
+ /** Check pending + total rewards */
105
+ getRewards(): Promise<RewardsBalance>;
106
+ /** Gasless CCM claim via server relay */
107
+ claimRelay(): Promise<ClaimResult>;
108
+ /** Check claims status */
109
+ getClaimStatus(): Promise<ClaimStatus>;
85
110
  /** Fetch leaderboard — no auth required. */
86
- getLeaderboard(limit?: number, platform?: string): Promise<WzrdLeaderboard>;
87
- /** Fetch authenticated portfolio. */
88
- getPortfolio(): Promise<WzrdPortfolio>;
89
- /** Fetch claim data (proof + amounts). */
90
- getClaims(): Promise<WzrdClaim>;
91
- /** Execute gasless relay claim — server pays tx fees. */
92
- claimRelay(): Promise<WzrdRelayResult>;
93
- /** Fetch system health — no auth required. */
94
- getHealth(): Promise<Record<string, unknown>>;
111
+ getLeaderboard(limit?: number): Promise<LeaderboardResult>;
95
112
  }
package/dist/client.js CHANGED
@@ -2,12 +2,15 @@
2
2
  * WZRD API client — handles agent auth (Ed25519 challenge/verify),
3
3
  * token caching, and all REST calls.
4
4
  *
5
+ * Auth flow: challenge → sign → verify → Bearer token (24h TTL)
6
+ * Earn flow: infer → report(execution_id) → claim
7
+ *
5
8
  * Standalone: no framework dependency. Works with a Keypair or any wallet
6
9
  * implementation that supports `publicKey` + `signMessage()`.
7
10
  */
8
11
  import { Keypair } from '@solana/web3.js';
9
12
  export const DEFAULT_API_URL = 'https://api.twzrd.xyz';
10
- const TOKEN_REFRESH_MARGIN_MS = 5 * 60 * 1000;
13
+ const TOKEN_REFRESH_MARGIN_MS = 60 * 60 * 1000; // refresh 1h before expiry
11
14
  // ── Base58 encoder (zero-dependency) ────────────────────
12
15
  const B58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
13
16
  function toBase58(bytes) {
@@ -66,7 +69,7 @@ export class WzrdClient {
66
69
  // ── Auth ────────────────────────────────────────────
67
70
  async authenticate() {
68
71
  // 1. Challenge
69
- const cr = await fetch(`${this.apiUrl}/v1/agent/challenge`);
72
+ const cr = await fetch(`${this.apiUrl}/v1/agent/challenge?pubkey=${this.pubkey}`);
70
73
  if (!cr.ok)
71
74
  throw new Error(`Challenge failed: ${cr.status}`);
72
75
  const { nonce } = (await cr.json());
@@ -87,7 +90,9 @@ export class WzrdClient {
87
90
  throw new Error(`Verify failed: ${vr.status} ${await vr.text()}`);
88
91
  const { token, expires_at } = (await vr.json());
89
92
  this.token = token;
90
- this.tokenExpiresAt = new Date(expires_at).getTime();
93
+ this.tokenExpiresAt = expires_at
94
+ ? new Date(expires_at).getTime()
95
+ : Date.now() + 23 * 60 * 60 * 1000;
91
96
  }
92
97
  async getToken() {
93
98
  if (!this.token ||
@@ -98,51 +103,92 @@ export class WzrdClient {
98
103
  }
99
104
  async authedFetch(path, init) {
100
105
  const token = await this.getToken();
101
- return fetch(`${this.apiUrl}${path}`, {
102
- ...init,
103
- headers: { ...init?.headers, Authorization: `Bearer ${token}` },
104
- });
106
+ const headers = new Headers(init?.headers);
107
+ headers.set('Authorization', `Bearer ${token}`);
108
+ headers.set('Content-Type', 'application/json');
109
+ return fetch(`${this.apiUrl}${path}`, { ...init, headers });
105
110
  }
106
- // ── Public API ──────────────────────────────────────
107
- /** Fetch leaderboard — no auth required. */
108
- async getLeaderboard(limit = 20, platform) {
109
- const params = new URLSearchParams({ limit: String(limit) });
110
- if (platform)
111
- params.set('platform', platform);
112
- const res = await fetch(`${this.apiUrl}/v1/leaderboard?${params}`);
113
- if (!res.ok)
114
- throw new Error(`Leaderboard failed: ${res.status}`);
115
- return (await res.json());
111
+ // ── Earn Loop API ─────────────────────────────────
112
+ /**
113
+ * Pick a model from the leaderboard — returns the top market's `channel_id`,
114
+ * which is the server-resolvable model id accepted by `infer`. The leaderboard
115
+ * is not task-segmented, so the top market is returned regardless of task type
116
+ * (pass `task_type` to `infer` to steer the provider cascade instead).
117
+ */
118
+ async pickModel() {
119
+ const lb = await this.getLeaderboard(10);
120
+ if (!lb.markets.length)
121
+ throw new Error('No models available on leaderboard');
122
+ return lb.markets[0].channel_id;
116
123
  }
117
- /** Fetch authenticated portfolio. */
118
- async getPortfolio() {
119
- const res = await this.authedFetch('/v1/portfolio');
120
- if (!res.ok)
121
- throw new Error(`Portfolio failed: ${res.status}`);
122
- return (await res.json());
124
+ /** Server-witnessed inference WZRD calls the provider, grades quality */
125
+ async infer(prompt, model, taskType) {
126
+ const resolvedModel = model || await this.pickModel();
127
+ const res = await this.authedFetch('/v1/agent/infer', {
128
+ method: 'POST',
129
+ body: JSON.stringify({ model: resolvedModel, prompt, task_type: taskType || 'chat' }),
130
+ });
131
+ if (!res.ok) {
132
+ const body = await res.text().catch(() => '');
133
+ throw new Error(`Infer failed (${res.status}): ${body}`);
134
+ }
135
+ return res.json();
123
136
  }
124
- /** Fetch claim data (proof + amounts). */
125
- async getClaims() {
126
- const res = await this.authedFetch(`/v1/claims/${this.pubkey}`);
137
+ /** Report model pick with execution_id for verified rewards */
138
+ async report(params) {
139
+ const res = await this.authedFetch('/v1/agent/report', {
140
+ method: 'POST',
141
+ body: JSON.stringify(params),
142
+ });
143
+ if (!res.ok) {
144
+ const body = await res.text().catch(() => '');
145
+ throw new Error(`Report failed (${res.status}): ${body}`);
146
+ }
147
+ return res.json();
148
+ }
149
+ /** Check pending + total rewards */
150
+ async getRewards() {
151
+ const res = await this.authedFetch('/v1/agent/earned');
127
152
  if (!res.ok)
128
- throw new Error(`Claims failed: ${res.status}`);
129
- return (await res.json());
153
+ throw new Error(`Rewards check failed: ${res.status}`);
154
+ const data = await res.json();
155
+ const economy = data.economy;
156
+ const routing = data.routing;
157
+ return {
158
+ pending_ccm: Number(economy?.pending_ccm ?? 0),
159
+ total_rewarded_ccm: Number(economy?.earned_ccm ?? 0),
160
+ rank: null,
161
+ contribution_count: Number(routing?.lifetime_contributions ?? 0),
162
+ };
130
163
  }
131
- /** Execute gasless relay claim server pays tx fees. */
164
+ /** Gasless CCM claim via server relay */
132
165
  async claimRelay() {
133
166
  const res = await this.authedFetch(`/v1/claims/${this.pubkey}/relay`, {
134
167
  method: 'POST',
135
- headers: { 'Content-Type': 'application/json' },
136
168
  });
137
- if (!res.ok)
138
- throw new Error(`Relay claim failed: ${res.status} ${await res.text()}`);
139
- return (await res.json());
169
+ if (!res.ok) {
170
+ const body = await res.text().catch(() => '');
171
+ throw new Error(`Relay claim failed (${res.status}): ${body}`);
172
+ }
173
+ return res.json();
174
+ }
175
+ /** Check claims status */
176
+ async getClaimStatus() {
177
+ const res = await this.authedFetch(`/v1/claims/${this.pubkey}`);
178
+ if (!res.ok) {
179
+ if (res.status === 404)
180
+ return { cumulative_total: 0, claimed_total: 0, claimable: 0 };
181
+ throw new Error(`Claim status failed: ${res.status}`);
182
+ }
183
+ const data = (await res.json());
184
+ return { ...data, claimable: data.cumulative_total - data.claimed_total };
140
185
  }
141
- /** Fetch system health — no auth required. */
142
- async getHealth() {
143
- const res = await fetch(`${this.apiUrl}/health`);
186
+ // ── Public API ──────────────────────────────────────
187
+ /** Fetch leaderboard — no auth required. */
188
+ async getLeaderboard(limit = 20) {
189
+ const res = await fetch(`${this.apiUrl}/v1/leaderboard?limit=${limit}`);
144
190
  if (!res.ok)
145
- throw new Error(`Health failed: ${res.status}`);
191
+ throw new Error(`Leaderboard failed: ${res.status}`);
146
192
  return (await res.json());
147
193
  }
148
194
  }
package/dist/index.d.ts CHANGED
@@ -1,41 +1,38 @@
1
1
  /**
2
2
  * @wzrd_sol/solana-agent-plugin
3
3
  *
4
- * WZRD Liquid Attention Protocol plugin for autonomous Solana agents.
4
+ * WZRD Liquid Attention Protocol plugin for Solana Agent Kit.
5
+ * Server-witnessed inference earn loop — infer, report, claim CCM.
5
6
  *
6
7
  * 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_depositdeposit USDC → mint vLOFI (auth + keypair)
11
- * wzrd_claim claim CCM via gasless relay (auth)
8
+ * wzrd_earn full earn cycle (one-shot)
9
+ * wzrd_infer server-witnessed inference
10
+ * wzrd_report report with execution receipt
11
+ * wzrd_claimgasless CCM claim
12
+ * wzrd_rewards check pending + lifetime rewards
12
13
  *
13
14
  * Works with:
14
15
  * - Solana Agent Kit (SendAI) — register as plugin
15
- * - ElizaOS — wrap actions as ELIZA-style actions
16
16
  * - Standalone — use WzrdClient directly
17
17
  *
18
18
  * Quick start:
19
19
  * import { WzrdClient } from '@wzrd_sol/solana-agent-plugin';
20
20
  * const client = new WzrdClient(keypair);
21
- * const leaderboard = await client.getLeaderboard();
21
+ * const result = await client.infer('Write a Python quicksort');
22
22
  */
23
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 type { MarketSignal } from './actions/index.js';
24
+ export type { WzrdSigner, InferResult, ReportResult, RewardsBalance, ClaimResult, ClaimStatus, LeaderboardMarket, LeaderboardResult, } from './client.js';
25
+ export { EARN_ACTION, INFER_ACTION, REPORT_ACTION, CLAIM_ACTION, REWARDS_ACTION, } from './actions/index.js';
27
26
  import type { Plugin } from 'solana-agent-kit';
28
- import { getClaimsData, getClientForAgent, getLeaderboardData } from './runtime.js';
29
- import { type MarketSignal } from './actions/velocity.js';
27
+ import { getClientForAgent } from './runtime.js';
30
28
  export declare const WZRD_ACTIONS: Plugin["actions"];
31
29
  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
30
  wzrdClient(): ReturnType<typeof getClientForAgent>;
31
+ wzrdEarn(taskType?: string, prompt?: string): Promise<Record<string, unknown>>;
32
+ wzrdInfer(prompt: string, model?: string, taskType?: string): Promise<Record<string, unknown>>;
33
+ wzrdReport(modelId: string, executionId: string, taskType?: string, qualityScore?: number, latencyMs?: number): Promise<Record<string, unknown>>;
34
+ wzrdClaim(): Promise<Record<string, unknown>>;
35
+ wzrdRewards(): Promise<Record<string, unknown>>;
39
36
  }
40
37
  export declare function createWzrdPlugin(): Plugin;
41
38
  /** Default plugin instance for direct registration via `agent.use(...)`. */
package/dist/index.js CHANGED
@@ -1,39 +1,39 @@
1
1
  /**
2
2
  * @wzrd_sol/solana-agent-plugin
3
3
  *
4
- * WZRD Liquid Attention Protocol plugin for autonomous Solana agents.
4
+ * WZRD Liquid Attention Protocol plugin for Solana Agent Kit.
5
+ * Server-witnessed inference earn loop — infer, report, claim CCM.
5
6
  *
6
7
  * 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_depositdeposit USDC → mint vLOFI (auth + keypair)
11
- * wzrd_claim claim CCM via gasless relay (auth)
8
+ * wzrd_earn full earn cycle (one-shot)
9
+ * wzrd_infer server-witnessed inference
10
+ * wzrd_report report with execution receipt
11
+ * wzrd_claimgasless CCM claim
12
+ * wzrd_rewards check pending + lifetime rewards
12
13
  *
13
14
  * Works with:
14
15
  * - Solana Agent Kit (SendAI) — register as plugin
15
- * - ElizaOS — wrap actions as ELIZA-style actions
16
16
  * - Standalone — use WzrdClient directly
17
17
  *
18
18
  * Quick start:
19
19
  * import { WzrdClient } from '@wzrd_sol/solana-agent-plugin';
20
20
  * const client = new WzrdClient(keypair);
21
- * const leaderboard = await client.getLeaderboard();
21
+ * const result = await client.infer('Write a Python quicksort');
22
22
  */
23
23
  export { WzrdClient } from './client.js';
24
- export { LEADERBOARD_ACTION, PORTFOLIO_ACTION, DEPOSIT_ACTION, CLAIM_ACTION, VELOCITY_ACTION, } from './actions/index.js';
25
- import { getClaimsData, getClientForAgent, getLeaderboardData } from './runtime.js';
26
- import { LEADERBOARD_ACTION } from './actions/leaderboard.js';
27
- import { PORTFOLIO_ACTION } from './actions/portfolio.js';
28
- import { DEPOSIT_ACTION, depositHandler } from './actions/deposit.js';
24
+ export { EARN_ACTION, INFER_ACTION, REPORT_ACTION, CLAIM_ACTION, REWARDS_ACTION, } from './actions/index.js';
25
+ import { getClientForAgent } from './runtime.js';
26
+ import { EARN_ACTION, earnHandler } from './actions/earn.js';
27
+ import { INFER_ACTION, inferHandler } from './actions/infer.js';
28
+ import { REPORT_ACTION, reportHandler } from './actions/report.js';
29
29
  import { CLAIM_ACTION, claimHandler } from './actions/claim.js';
30
- import { VELOCITY_ACTION, velocityHandler } from './actions/velocity.js';
30
+ import { REWARDS_ACTION, rewardsHandler } from './actions/rewards.js';
31
31
  export const WZRD_ACTIONS = [
32
- LEADERBOARD_ACTION,
33
- PORTFOLIO_ACTION,
34
- DEPOSIT_ACTION,
32
+ EARN_ACTION,
33
+ INFER_ACTION,
34
+ REPORT_ACTION,
35
35
  CLAIM_ACTION,
36
- VELOCITY_ACTION,
36
+ REWARDS_ACTION,
37
37
  ];
38
38
  export function createWzrdPlugin() {
39
39
  let agentRef = null;
@@ -52,30 +52,26 @@ export function createWzrdPlugin() {
52
52
  wzrdClient() {
53
53
  return getClientForAgent(requireAgent());
54
54
  },
55
- async wzrdLeaderboard(limit = 20, platform) {
56
- return getLeaderboardData(requireAgent(), { limit, platform });
55
+ async wzrdEarn(taskType, prompt) {
56
+ return earnHandler(requireAgent(), { task_type: taskType, prompt });
57
57
  },
58
- async wzrdPortfolio() {
59
- return getClientForAgent(requireAgent()).getPortfolio();
58
+ async wzrdInfer(prompt, model, taskType) {
59
+ return inferHandler(requireAgent(), { prompt, model, task_type: taskType });
60
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,
61
+ async wzrdReport(modelId, executionId, taskType, qualityScore, latencyMs) {
62
+ return reportHandler(requireAgent(), {
63
+ model_id: modelId,
64
+ execution_id: executionId,
65
+ task_type: taskType,
66
+ quality_score: qualityScore,
67
+ latency_ms: latencyMs,
69
68
  });
70
69
  },
71
- async wzrdClaim(execute = true) {
72
- return claimHandler(requireAgent(), { execute });
70
+ async wzrdClaim() {
71
+ return claimHandler(requireAgent(), {});
73
72
  },
74
- async wzrdVelocity(platform, minSignal) {
75
- return velocityHandler(requireAgent(), {
76
- platform,
77
- min_signal: minSignal,
78
- });
73
+ async wzrdRewards() {
74
+ return rewardsHandler(requireAgent(), {});
79
75
  },
80
76
  },
81
77
  actions: WZRD_ACTIONS,
package/dist/runtime.d.ts CHANGED
@@ -1,16 +1,5 @@
1
- import { PublicKey } from '@solana/web3.js';
2
1
  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';
2
+ import { WzrdClient } from './client.js';
5
3
  export declare function resolveApiUrl(explicit?: string): string;
6
4
  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
5
  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 CHANGED
@@ -1,4 +1,4 @@
1
- import { DEFAULT_API_URL, WzrdClient, } from './client.js';
1
+ import { DEFAULT_API_URL, WzrdClient } from './client.js';
2
2
  export function resolveApiUrl(explicit) {
3
3
  const envUrl = process.env.WZRD_API_URL?.trim();
4
4
  return explicit?.trim() || envUrl || DEFAULT_API_URL;
@@ -6,28 +6,6 @@ export function resolveApiUrl(explicit) {
6
6
  export function getClientForAgent(agent, apiUrl) {
7
7
  return new WzrdClient(agent.wallet, resolveApiUrl(apiUrl));
8
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
9
  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();
10
+ return (Number(nativeAmount) / 1e9).toFixed(2);
33
11
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wzrd_sol/solana-agent-plugin",
3
- "version": "0.1.1",
4
- "description": "WZRD Liquid Attention Protocol plugin for Solana Agent Kit — deposit, claim, leaderboard, portfolio, velocity signal",
3
+ "version": "0.2.0",
4
+ "description": "WZRD Liquid Attention Protocol plugin for Solana Agent Kit — server-witnessed inference, verified CCM rewards, gasless claims",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -14,11 +14,16 @@
14
14
  },
15
15
  "scripts": {
16
16
  "build": "tsc",
17
- "prepublishOnly": "npm run build"
17
+ "typecheck": "tsc --noEmit",
18
+ "prepublishOnly": "npm run build",
19
+ "prepack": "npm run build"
18
20
  },
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
19
25
  "dependencies": {
20
26
  "@solana/web3.js": "^1.95.0",
21
- "@wzrd_sol/sdk": "^0.1.1",
22
27
  "tweetnacl": "^1.0.3",
23
28
  "zod": "^3.25.76"
24
29
  },
@@ -38,15 +43,19 @@
38
43
  "solana",
39
44
  "agent",
40
45
  "wzrd",
41
- "attention",
42
- "defi",
43
- "mcp",
46
+ "ccm",
47
+ "inference",
48
+ "earn",
44
49
  "ai-agent",
45
50
  "solana-agent-kit"
46
51
  ],
47
52
  "license": "MIT",
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
48
56
  "repository": {
49
57
  "type": "git",
50
- "url": "https://github.com/twzrd-sol/wzrd-final"
58
+ "url": "git+https://github.com/twzrd-sol/wzrd-velocity.git",
59
+ "directory": "agents/solana-agent-kit-plugin"
51
60
  }
52
61
  }
@@ -1,26 +0,0 @@
1
- /**
2
- * Action: wzrd_deposit
3
- *
4
- * Deposit USDC into a WZRD attention market → mint vLOFI tokens.
5
- * Requires: Keypair with USDC balance + SOL for tx fees.
6
- *
7
- * The agent picks a market_id (from leaderboard), specifies USDC amount,
8
- * and the handler builds + signs + sends the deposit transaction.
9
- */
10
- import { z } from 'zod';
11
- import type { Action, SolanaAgentKit } from 'solana-agent-kit';
12
- export declare const depositSchema: z.ZodObject<{
13
- market_id: z.ZodNumber;
14
- amount_usdc: z.ZodNumber;
15
- priority_fee: z.ZodOptional<z.ZodNumber>;
16
- }, "strip", z.ZodTypeAny, {
17
- market_id: number;
18
- amount_usdc: number;
19
- priority_fee?: number | undefined;
20
- }, {
21
- market_id: number;
22
- amount_usdc: number;
23
- priority_fee?: number | undefined;
24
- }>;
25
- export declare function depositHandler(agent: SolanaAgentKit, input: z.infer<typeof depositSchema>): Promise<Record<string, unknown>>;
26
- export declare const DEPOSIT_ACTION: Action;