@net-protocol/score 0.1.9 → 0.1.10

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 CHANGED
@@ -25,6 +25,7 @@ Net Score is a decentralized on-chain scoring system built on Net Protocol. It a
25
25
  - **Decode upvote messages** from Net protocol (legacy and strategy formats)
26
26
  - **Decode strategy metadata** to inspect vote weight details
27
27
  - **Select strategies** automatically based on pool key availability
28
+ - **Compute token leaderboards** with `getTokenRankings()` — the same time-decayed ranking that powers the website's `/token/<chain>/trending` page (`trending` / `recent` / `top` sorts)
28
29
 
29
30
  This package provides both React hooks (for UI) and a client class (for non-React code).
30
31
 
@@ -128,6 +129,29 @@ const appCounts = await client.getAppKeyScores({
128
129
  });
129
130
  ```
130
131
 
132
+ ### Token Rankings
133
+
134
+ `getTokenRankings()` returns the same leaderboard that powers the website's
135
+ `/token/<chain>/trending` page — read live from chain with no off-chain index.
136
+
137
+ ```typescript
138
+ import { getTokenRankings } from "@net-protocol/score";
139
+
140
+ const tokens = await getTokenRankings({
141
+ chainId: 8453,
142
+ sort: "trending", // "trending" | "recent" | "top"
143
+ maxTokens: 50,
144
+ });
145
+
146
+ for (const t of tokens) {
147
+ console.log(t.symbol, t.upvotes, t.fdv, t.priceInUsdc);
148
+ }
149
+ ```
150
+
151
+ Each call performs ~8 RPC reads. Production callers should cache via HTTP
152
+ `Cache-Control` headers or an edge cache. Only Base (chainId 8453) is
153
+ supported today; other chains throw synchronously.
154
+
131
155
  ## API Reference
132
156
 
133
157
  ### ScoreClient
@@ -139,6 +163,12 @@ const appCounts = await client.getAppKeyScores({
139
163
  | `getStrategyKeyScores(opts)` | Get scores for keys from a specific strategy |
140
164
  | `getAppKeyScores(opts)` | Get scores for keys from a specific app |
141
165
 
166
+ ### Token Rankings
167
+
168
+ | Function | Description |
169
+ |----------|-------------|
170
+ | `getTokenRankings(opts)` | Compute a token leaderboard ranked by upvote activity (`trending` / `recent` / `top`). Mirrors the website's `/token/<chain>/trending` page. |
171
+
142
172
  ### React Hooks
143
173
 
144
174
  | Hook | Description |
package/dist/index.js CHANGED
@@ -2566,8 +2566,10 @@ var MULTI_VERSION_UNISWAP_POOL_INFO_RETRIEVER = {
2566
2566
  var WETH_BY_CHAIN = {
2567
2567
  8453: "0x4200000000000000000000000000000000000006",
2568
2568
  // Base (L2 predeploy)
2569
- 1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
2569
+ 1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
2570
2570
  // Ethereum mainnet
2571
+ 4663: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"
2572
+ // Robinhood Chain (non-standard WETH; not the OP predeploy)
2571
2573
  };
2572
2574
  function getWethAddress(chainId) {
2573
2575
  const addr = WETH_BY_CHAIN[chainId];