@avaprotocol/protocols 0.2.0 → 0.4.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/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # @avaprotocol/protocols
2
+
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2ea828e: Restructure the token catalog from inline TypeScript objects into per-chain JSON
8
+ data files (`src/tokens/data/<chain>.json`) and port Studio's curated catalogs
9
+ into the new format. Catalog grew from 15 → 65 entries across 5 chains:
10
+ ethereum (5 → 30), sepolia (3 → 6), base (3 → 23), base-sepolia (2 → 4), and
11
+ bnb-mainnet (unchanged at 2).
12
+
13
+ Notable behaviour change worth flagging for consumers: `Tokens.LINK[Sepolia]`
14
+ now resolves to the canonical Sepolia ChainLink Token (`0x779877…4789`) instead
15
+ of the AAVE-V3 faucet variant. The AAVE-V3 faucet LINK still lives at
16
+ `Protocols.aaveV3.tokens.LINK[Chains.Sepolia]` for template consumers — that
17
+ path is unchanged.
18
+
19
+ New: `yarn port:studio` helper for future re-syncs from upstream Studio.
20
+
21
+ `buildTokensFromData` now throws on duplicate `(symbol, chainId)` rows instead
22
+ of silently overwriting.
23
+
24
+ `TokenLinks` extended with the link types Studio's catalog uses (`x`,
25
+ `facebook`, `discord`, `telegram`, `medium`, `docs`, `forum`, `youtube`) and
26
+ drops the now-obsolete `twitter` alias (Studio standardized on `x`).
package/README.md CHANGED
@@ -149,6 +149,85 @@ There's no equivalent multi-protocol + multi-chain + addresses + ABIs + topics p
149
149
 
150
150
  Address verification: link to the canonical source (Etherscan-verified deployment, protocol docs, official address book). PRs that don't cite a source for the addresses won't merge.
151
151
 
152
+ ## Tokens sidecar (for non-TS consumers)
153
+
154
+ `yarn build` writes a per-chain JSON file under `dist/tokens/` alongside the JS + d.ts outputs:
155
+
156
+ ```
157
+ dist/tokens/
158
+ ├── ethereum.json (chain 1)
159
+ ├── sepolia.json (chain 11155111)
160
+ ├── base.json (chain 8453)
161
+ ├── base-sepolia.json (chain 84532)
162
+ ├── bnb-mainnet.json (chain 56)
163
+ └── holesky.json (chain 17000)
164
+ ```
165
+
166
+ Each file is a stable-sorted array of `{ id, name, symbol, decimals }` entries — the same schema the EigenLayer-AVS Go aggregator already consumes under `token_whitelist/*.json`, so a Go service can pick up the catalog without depending on the TS toolchain. `id` is the lowercased address (matching Go's read-side normalization). Metadata fields TS consumers use (`description`, `website`, `logoUrl`, `links`) are intentionally omitted; TS callers import the `Tokens` namespace from source instead.
167
+
168
+ ### When to run it
169
+
170
+ - **Automatically** — `yarn build` invokes `yarn build:tokens-sidecar` as its last step, so any release publishes a fresh sidecar in the npm tarball.
171
+ - **Standalone** — `yarn build:tokens-sidecar` when you've edited `src/tokens/` and want to inspect the generated JSON without rebuilding declarations + JS.
172
+
173
+ ### Adding a new chain
174
+
175
+ The script throws fast if the catalog grows a token on a chain that isn't registered in `CHAIN_FILE_NAMES` inside `scripts/build-tokens-sidecar.ts`:
176
+
177
+ ```
178
+ [tokens-sidecar] no file name registered for chain <id>.
179
+ Add it to CHAIN_FILE_NAMES in scripts/build-tokens-sidecar.ts.
180
+ ```
181
+
182
+ Fix is one line — append `[Chains.NewChain]: "newchain-mainnet"` to the map. The error message points at the exact file so this can't silently ship an incomplete sidecar.
183
+
184
+ ### Consuming the sidecar (Go example)
185
+
186
+ ```go
187
+ // EigenLayer-AVS already does this for its checked-in
188
+ // token_whitelist/*.json; the dist/tokens/*.json from this package
189
+ // match the same schema.
190
+ type tokenEntry struct {
191
+ ID string `json:"id"`
192
+ Name string `json:"name"`
193
+ Symbol string `json:"symbol"`
194
+ Decimals int `json:"decimals"`
195
+ }
196
+
197
+ raw, err := os.ReadFile("path/to/dist/tokens/sepolia.json")
198
+ // ... json.Unmarshal(raw, &entries) ...
199
+ ```
200
+
201
+ ## Releasing
202
+
203
+ This package uses [changesets](https://github.com/changesets/changesets) for versioning. The day-to-day flow:
204
+
205
+ ```bash
206
+ # 1. Make your code changes on a feature branch.
207
+ yarn changeset # interactive prompt; pick bump level + write the changelog entry
208
+ git add .changeset && git commit -m "..."
209
+ git push # open PR as normal
210
+ ```
211
+
212
+ When the PR merges to `main`, the `Release` workflow (`.github/workflows/release.yml`) either:
213
+
214
+ - Opens (or updates) a "Version Packages" PR that runs `yarn changeset version` — bumps `package.json` + writes `CHANGELOG.md`. Review and merge that PR.
215
+ - Or, if there are no pending changesets, runs `yarn release` (`yarn build && yarn changeset publish`) — which publishes to npm with the right dist-tag automatically (stable → `latest`, pre-release → its identifier).
216
+
217
+ ### Publishing manually (escape hatch)
218
+
219
+ If you need to publish without the GitHub Action — e.g. an emergency release from a machine that has `npm login` credentials:
220
+
221
+ ```bash
222
+ yarn build # produces dist/ + tokens sidecar
223
+ npm whoami # verify logged in
224
+ npm publish --access public # for stable versions; goes to `latest`
225
+ # or for a pre-release:
226
+ npm publish --access public --tag dev
227
+ ```
228
+
229
+ `prepublishOnly: yarn build` runs the build chain automatically if you forget, so even `npm publish` alone is safe.
230
+
152
231
  ## Versioning
153
232
 
154
233
  Semver. Until `1.0.0`, breaking changes can land in minor versions (`0.x`), but address corrections are always patches.