@avaprotocol/protocols 0.7.0 → 0.7.1

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @avaprotocol/protocols
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0124250: Guard `buildTokensFromData` against a duplicate `chainId` in `PER_CHAIN`.
8
+
9
+ If the same chain were listed twice (a copy-paste in the array, or two chain modules reporting the same `chainId`), the flatten would silently overwrite the first chain's entries and produce a wrong `Tokens.SYMBOL[chainId]` map with no error at module load. It now throws fast pointing at the duplicate.
10
+
3
11
  ## 0.7.0
4
12
 
5
13
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -2303,7 +2303,14 @@ var PER_CHAIN = Object.freeze([
2303
2303
  ]);
2304
2304
  function buildTokensFromData() {
2305
2305
  const merged = /* @__PURE__ */ Object.create(null);
2306
+ const seenChainIds = /* @__PURE__ */ new Set();
2306
2307
  for (const [chainId6, chainTokens] of PER_CHAIN) {
2308
+ if (seenChainIds.has(chainId6)) {
2309
+ throw new Error(
2310
+ `[@avaprotocol/protocols] chainId ${chainId6} appears more than once in PER_CHAIN \u2014 each chain must be listed exactly once. Merge the duplicate entries.`
2311
+ );
2312
+ }
2313
+ seenChainIds.add(chainId6);
2307
2314
  for (const [symbol, entry] of Object.entries(chainTokens)) {
2308
2315
  if (!Object.prototype.hasOwnProperty.call(merged, symbol)) {
2309
2316
  merged[symbol] = /* @__PURE__ */ Object.create(null);
package/dist/index.js CHANGED
@@ -2257,7 +2257,14 @@ var PER_CHAIN = Object.freeze([
2257
2257
  ]);
2258
2258
  function buildTokensFromData() {
2259
2259
  const merged = /* @__PURE__ */ Object.create(null);
2260
+ const seenChainIds = /* @__PURE__ */ new Set();
2260
2261
  for (const [chainId6, chainTokens] of PER_CHAIN) {
2262
+ if (seenChainIds.has(chainId6)) {
2263
+ throw new Error(
2264
+ `[@avaprotocol/protocols] chainId ${chainId6} appears more than once in PER_CHAIN \u2014 each chain must be listed exactly once. Merge the duplicate entries.`
2265
+ );
2266
+ }
2267
+ seenChainIds.add(chainId6);
2261
2268
  for (const [symbol, entry] of Object.entries(chainTokens)) {
2262
2269
  if (!Object.prototype.hasOwnProperty.call(merged, symbol)) {
2263
2270
  merged[symbol] = /* @__PURE__ */ Object.create(null);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAQlE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA4CzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAwC,CAAC;AAcnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,CAAC,eAAe,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CA6DpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAQlE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAyDzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAwC,CAAC;AAcnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,CAAC,eAAe,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CA6DpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/protocols",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Multi-chain catalog of DeFi protocol contract addresses, ABI fragments, and event topic hashes — covers AAVE V3, Uniswap V3, Chainlink, Lido, Morpho, and more.",
5
5
  "keywords": [
6
6
  "defi",