@rhinestone/shared-configs 2.41.0 → 2.43.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.
@@ -2164,6 +2164,9 @@
2164
2164
  "multiCall": "0x8E60b7b64b63cD56b18ebcECADcb79B04919286e",
2165
2165
  "transferDelegate": "0x60FccB9b58d5E806ca5Cb8BFCe721c2274609dE4"
2166
2166
  },
2167
+ "near": {
2168
+ "prefix": "plasma"
2169
+ },
2167
2170
  "oft": {
2168
2171
  "adapter": "0x02ca37966753bDdDf11216B73B16C1dE756A7CF9",
2169
2172
  "chainKey": "plasma",
@@ -2179,6 +2182,7 @@
2179
2182
  "ECO",
2180
2183
  "RELAY",
2181
2184
  "OFT",
2185
+ "NEAR",
2182
2186
  "RHINO",
2183
2187
  "LZ"
2184
2188
  ],
@@ -2217,6 +2221,7 @@
2217
2221
  "settlementLayers": [
2218
2222
  "ACROSS",
2219
2223
  "ECO",
2224
+ "NEAR",
2220
2225
  "OFT"
2221
2226
  ],
2222
2227
  "symbol": "USDT0"
@@ -45,6 +45,22 @@ function validChain(overrides = {}) {
45
45
  ...overrides,
46
46
  };
47
47
  }
48
+ const etherscan = {
49
+ url: "https://etherscan.io",
50
+ addressPath: "/address/",
51
+ txPath: "/tx/",
52
+ };
53
+ const tronscan = {
54
+ url: "https://tronscan.org",
55
+ addressPath: "/#/address/",
56
+ txPath: "/#/transaction/",
57
+ };
58
+ const solscanDevnet = {
59
+ url: "https://solscan.io",
60
+ addressPath: "/account/",
61
+ txPath: "/tx/",
62
+ query: "cluster=devnet",
63
+ };
48
64
  function errorsFor(chain) {
49
65
  return (0, validation_1.validateChainConfig)({ "1": chain }).issues.filter((i) => i.severity === "error");
50
66
  }
@@ -152,6 +168,25 @@ function errorsFor(chain) {
152
168
  ["an explorer url with a trailing slash", {
153
169
  explorer: { url: "https://etherscan.io/", addressPath: "/address/", txPath: "/tx/" },
154
170
  }],
171
+ ["an explorer query with a leading ?", { explorer: { ...etherscan, query: "?cluster=devnet" } }],
172
+ ["an explorer query containing #", { explorer: { ...etherscan, query: "cluster=devnet#x" } }],
173
+ ["an explorer query with whitespace", { explorer: { ...etherscan, query: "cluster=dev net" } }],
174
+ ["an empty explorer query", { explorer: { ...etherscan, query: "" } }],
175
+ ["a non-string explorer query", { explorer: { ...etherscan, query: 42 } }],
176
+ ["a null explorer query", { explorer: { ...etherscan, query: null } }],
177
+ ["an explorer query with an empty pair", { explorer: { ...etherscan, query: "a=1&&b=2" } }],
178
+ ["an explorer query with a trailing &", { explorer: { ...etherscan, query: "a=1&" } }],
179
+ ["an explorer query without =", { explorer: { ...etherscan, query: "devnet" } }],
180
+ ["an explorer query with an empty key", { explorer: { ...etherscan, query: "=devnet" } }],
181
+ ["an explorer query with an empty value", { explorer: { ...etherscan, query: "cluster=" } }],
182
+ ["an explorer query with a malformed escape", { explorer: { ...etherscan, query: "a=%zz" } }],
183
+ ["an explorer query on a fragment-routed explorer", {
184
+ explorer: { ...tronscan, query: "network=shasta" },
185
+ }],
186
+ ["an explorer url containing ?", { explorer: { ...etherscan, url: "https://etherscan.io?x=1" } }],
187
+ ["an explorer url containing #", { explorer: { ...etherscan, url: "https://etherscan.io#x" } }],
188
+ ["an explorer path containing ?", { explorer: { ...etherscan, txPath: "/tx?cluster=devnet/" } }],
189
+ ["an unknown explorer key", { explorer: { ...etherscan, queryString: "cluster=devnet" } }],
155
190
  // A stem, not a path or a URL — the whole point of publishing a slug is that
156
191
  // the artifact says nothing about where the file is served from.
157
192
  ["an iconSlug that is a full URL", { iconSlug: "https://s3.rhinestone.dev/chains/base.svg" }],
@@ -171,6 +206,38 @@ function errorsFor(chain) {
171
206
  (0, bun_test_1.it)("accepts a null explorer, the answer for a chain that has none", () => {
172
207
  (0, bun_test_1.expect)(errorsFor(validChain({ explorer: null }))).toEqual([]);
173
208
  });
209
+ bun_test_1.it.each([
210
+ ["a query-bearing explorer (Solscan Devnet)", solscanDevnet],
211
+ ["a multi-pair query", { ...etherscan, query: "a=1&b=2" }],
212
+ ["a percent-encoded query value", { ...etherscan, query: "a=b%20c" }],
213
+ ["a fragment-routed explorer (Tronscan)", tronscan],
214
+ ["a prefixed-route explorer (HyperCore)", {
215
+ url: "https://app.hyperliquid.xyz",
216
+ addressPath: "/explorer/address/",
217
+ txPath: "/explorer/tx/",
218
+ }],
219
+ ["a prefixed-route explorer (Stellar)", {
220
+ url: "https://stellar.expert",
221
+ addressPath: "/explorer/public/account/",
222
+ txPath: "/explorer/public/tx/",
223
+ }],
224
+ ["a prefixed-route explorer (OKLink)", {
225
+ url: "https://www.oklink.com",
226
+ addressPath: "/x-layer/evm/address/",
227
+ txPath: "/x-layer/evm/tx/",
228
+ }],
229
+ ])("accepts %s", (_label, explorer) => {
230
+ (0, bun_test_1.expect)((0, validation_1.chainExplorerProblems)(explorer)).toEqual([]);
231
+ (0, bun_test_1.expect)(errorsFor(validChain({ explorer }))).toEqual([]);
232
+ });
233
+ (0, bun_test_1.it)("names the specific explorer problem", () => {
234
+ (0, bun_test_1.expect)((0, validation_1.chainExplorerProblems)({ ...etherscan, query: "?cluster=devnet" })).toEqual([
235
+ 'explorer.query must not start with "?"',
236
+ ]);
237
+ (0, bun_test_1.expect)((0, validation_1.chainExplorerProblems)({ ...etherscan, extra: 1 })).toEqual([
238
+ 'explorer has unknown key "extra"',
239
+ ]);
240
+ });
174
241
  // Katana is exactly this: Alchemy serves it over RPC but Address Activity
175
242
  // does not carry it, so ingestion is Zerion's alone.
176
243
  (0, bun_test_1.it)("accepts a null vendor id, the answer for a vendor that does not serve the chain", () => {
@@ -1096,11 +1163,6 @@ function validIndexerEntry(overrides = {}) {
1096
1163
  (0, bun_test_1.expect)(chains["1337"].explorer).toBeNull();
1097
1164
  });
1098
1165
  (0, bun_test_1.it)("lets an authored explorer win, for paths viem cannot express", () => {
1099
- const tronscan = {
1100
- url: "https://tronscan.org",
1101
- addressPath: "/#/address/",
1102
- txPath: "/#/transaction/",
1103
- };
1104
1166
  const { chains, issues } = (0, validation_1.classifyChainExplorers)({
1105
1167
  "728126428": validChain({
1106
1168
  name: "Tron",
@@ -1116,6 +1178,22 @@ function validIndexerEntry(overrides = {}) {
1116
1178
  (0, bun_test_1.expect)(issues).toHaveLength(1);
1117
1179
  (0, bun_test_1.expect)(issues[0].severity).toBe("error");
1118
1180
  });
1181
+ (0, bun_test_1.it)("passes an authored query-bearing explorer through verbatim", () => {
1182
+ const { chains, issues } = (0, validation_1.classifyChainExplorers)({ "792703810": validChain({ name: "Solana Devnet", explorer: solscanDevnet }) }, nets([], [{ id: 792703810 }]));
1183
+ (0, bun_test_1.expect)(chains["792703810"].explorer).toEqual(solscanDevnet);
1184
+ (0, bun_test_1.expect)(issues).toEqual([]);
1185
+ });
1186
+ (0, bun_test_1.it)("errors on an authored explorer with a malformed query", () => {
1187
+ const { issues } = (0, validation_1.classifyChainExplorers)({
1188
+ "792703810": validChain({
1189
+ name: "Solana Devnet",
1190
+ explorer: { ...solscanDevnet, query: "?cluster=devnet" },
1191
+ }),
1192
+ }, nets([], [{ id: 792703810 }]));
1193
+ (0, bun_test_1.expect)(issues).toHaveLength(1);
1194
+ (0, bun_test_1.expect)(issues[0].severity).toBe("error");
1195
+ (0, bun_test_1.expect)(issues[0].message).toContain("query");
1196
+ });
1119
1197
  // A missing explorer costs a hyperlink, not a wrong answer, so it warns
1120
1198
  // rather than failing the build.
1121
1199
  (0, bun_test_1.it)("warns rather than errors when nothing can supply one", () => {
@@ -1134,8 +1212,9 @@ function validIndexerEntry(overrides = {}) {
1134
1212
  const withoutExplorer = Object.entries(index_1.chainRegistry)
1135
1213
  .filter(([, e]) => e.explorer == null)
1136
1214
  .map(([id]) => id);
1137
- // Solana Devnet deliberately omits an explorer: Solscan's Devnet cluster
1138
- // selector is an appended query that the origin-plus-path schema cannot express.
1215
+ // Solana Devnet stays unlinked until every consumer honours `query`:
1216
+ // authoring its Solscan explorer is a cross-service activation step, not a
1217
+ // registry edit.
1139
1218
  (0, bun_test_1.expect)(withoutExplorer).toEqual(["792703810"]);
1140
1219
  for (const venueId of ["1337001", "1337002"]) {
1141
1220
  (0, bun_test_1.expect)(index_1.chainRegistry[venueId].explorer.url, venueId).toBe("https://app.hyperliquid.xyz");
@@ -1147,6 +1226,9 @@ function validIndexerEntry(overrides = {}) {
1147
1226
  (0, bun_test_1.expect)(explorer.url, id).toMatch(/^https:\/\/[^/]+$/);
1148
1227
  (0, bun_test_1.expect)(explorer.addressPath, id).toMatch(/^\/.*\/$/);
1149
1228
  (0, bun_test_1.expect)(explorer.txPath, id).toMatch(/^\/.*\/$/);
1229
+ (0, bun_test_1.expect)((0, validation_1.chainExplorerProblems)(explorer), id).toEqual([]);
1230
+ // The first shipped query is that same activation step.
1231
+ (0, bun_test_1.expect)("query" in explorer, id).toBe(false);
1150
1232
  }
1151
1233
  });
1152
1234
  });
@@ -141,6 +141,8 @@ function renderChains(chainRegistry, mainnets, testnets) {
141
141
  " addressPath: string;",
142
142
  " /** Path to a transaction page, with both slashes (`/tx/`). */",
143
143
  " txPath: string;",
144
+ " /** Query without the leading `?`, appended as `?<query>` after the value. Absent means none. */",
145
+ " query?: string;",
144
146
  "}",
145
147
  "",
146
148
  "interface Chain {",
@@ -92,13 +92,17 @@ export declare function classifyChainCaip2(chains: ChainRegistry): {
92
92
  /**
93
93
  * Where a chain's transactions and addresses can be looked at by a human.
94
94
  * `url` has no trailing slash; the paths carry their own leading and trailing
95
- * ones, so a link is `${url}${addressPath}${value}`.
95
+ * ones, so a link is `${url}${addressPath}${value}`, plus `?${query}` when
96
+ * `query` is present.
96
97
  */
97
98
  export interface ChainExplorer {
98
99
  url: string;
99
100
  addressPath: string;
100
101
  txPath: string;
102
+ /** URL query content without the leading `?` (`cluster=devnet`). Absent means none. */
103
+ query?: string;
101
104
  }
105
+ export declare function chainExplorerProblems(value: unknown): string[];
102
106
  /**
103
107
  * Stamps every chain with its block explorer, derived from the chain's viem
104
108
  * definition where it has one and authored in the jsonnet where it does not.
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.classifyChainNetworks = classifyChainNetworks;
37
37
  exports.classifyChainCaip2 = classifyChainCaip2;
38
+ exports.chainExplorerProblems = chainExplorerProblems;
38
39
  exports.classifyChainExplorers = classifyChainExplorers;
39
40
  exports.validateChainIconSlugs = validateChainIconSlugs;
40
41
  exports.classifyChainPublicRpcUrls = classifyChainPublicRpcUrls;
@@ -363,8 +364,11 @@ function structuralProblems(registryChainId, chain) {
363
364
  if (!('explorer' in chain)) {
364
365
  problems.push('explorer is missing (use null for a chain with no explorer)');
365
366
  }
366
- else if (chain.explorer !== null && !isChainExplorer(chain.explorer)) {
367
- problems.push(`explorer ${JSON.stringify(chain.explorer)} is not null or { url (no trailing slash), addressPath, txPath (both slash-wrapped) }`);
367
+ else if (chain.explorer !== null) {
368
+ const explorerProblems = chainExplorerProblems(chain.explorer);
369
+ if (explorerProblems.length > 0) {
370
+ problems.push(`explorer ${JSON.stringify(chain.explorer)} is malformed: ${explorerProblems.join('; ')}`);
371
+ }
368
372
  }
369
373
  // Optional, like publicRpcUrl below: a chain with no mark renders as a
370
374
  // coloured initial chip. Only the shape is checked here — whether a chain is
@@ -835,17 +839,59 @@ function classifyChainCaip2(chains) {
835
839
  // forks all use these). Tronscan is the exception, and authors its own.
836
840
  const DEFAULT_ADDRESS_PATH = '/address/';
837
841
  const DEFAULT_TX_PATH = '/tx/';
838
- // The slash convention is enforced, not assumed: a link is built by plain
839
- // concatenation, so a path missing its leading slash or a url carrying a
840
- // trailing one produces a subtly wrong URL rather than an obviously broken one.
841
- function isChainExplorer(value) {
842
- const hasSlashes = (v) => typeof v === 'string' && /^\/.*\/$/.test(v);
843
- return (isObject(value) &&
844
- typeof value.url === 'string' &&
845
- value.url.length > 0 &&
846
- !value.url.endsWith('/') &&
847
- hasSlashes(value.addressPath) &&
848
- hasSlashes(value.txPath));
842
+ const EXPLORER_KEYS = new Set(['url', 'addressPath', 'txPath', 'query']);
843
+ // `key=value` pairs joined by `&`, each side unreserved characters or %XX.
844
+ const EXPLORER_QUERY_CHAR = '(?:[A-Za-z0-9._~-]|%[0-9A-Fa-f]{2})';
845
+ const EXPLORER_QUERY_PAIR = `${EXPLORER_QUERY_CHAR}+=${EXPLORER_QUERY_CHAR}+`;
846
+ const EXPLORER_QUERY = new RegExp(`^${EXPLORER_QUERY_PAIR}(?:&${EXPLORER_QUERY_PAIR})*$`);
847
+ // The shape is enforced, not assumed: a link is built by plain concatenation,
848
+ // so a misplaced slash, `?` or `#` produces a subtly wrong URL — often one on
849
+ // the wrong network — rather than an obviously broken one.
850
+ function chainExplorerProblems(value) {
851
+ if (!isObject(value))
852
+ return ['explorer must be an object'];
853
+ const problems = [];
854
+ for (const key of Object.keys(value)) {
855
+ if (!EXPLORER_KEYS.has(key)) {
856
+ problems.push(`explorer has unknown key ${JSON.stringify(key)}`);
857
+ }
858
+ }
859
+ const { url } = value;
860
+ if (typeof url !== 'string' || url.length === 0) {
861
+ problems.push('explorer.url must be a non-empty string');
862
+ }
863
+ else {
864
+ if (url.endsWith('/'))
865
+ problems.push('explorer.url must not end with "/"');
866
+ if (/[?#]/.test(url))
867
+ problems.push('explorer.url must not contain "?" or "#"');
868
+ }
869
+ for (const key of ['addressPath', 'txPath']) {
870
+ const path = value[key];
871
+ if (typeof path !== 'string' || !/^\/.*\/$/.test(path)) {
872
+ problems.push(`explorer.${key} must be a string starting and ending with "/"`);
873
+ }
874
+ else if (path.includes('?')) {
875
+ problems.push(`explorer.${key} must not contain "?" (use explorer.query)`);
876
+ }
877
+ }
878
+ if ('query' in value) {
879
+ const { query } = value;
880
+ if (typeof query !== 'string') {
881
+ problems.push('explorer.query must be a string when present (omit it for none)');
882
+ }
883
+ else if (query.startsWith('?')) {
884
+ problems.push('explorer.query must not start with "?"');
885
+ }
886
+ else if (!EXPLORER_QUERY.test(query)) {
887
+ problems.push('explorer.query must be key=value pairs joined by "&", using unreserved characters or %XX escapes');
888
+ }
889
+ const fragmentRouted = [value.addressPath, value.txPath].some((path) => typeof path === 'string' && path.includes('#'));
890
+ if (fragmentRouted) {
891
+ problems.push('explorer.query is not allowed on a fragment-routed ("#") explorer — it would land inside the fragment');
892
+ }
893
+ }
894
+ return problems;
849
895
  }
850
896
  /**
851
897
  * Stamps every chain with its block explorer, derived from the chain's viem
@@ -880,12 +926,13 @@ function classifyChainExplorers(chains, networks) {
880
926
  // the only place a non-default path (Tronscan's `/#/address/`) or a
881
927
  // preferred explorer among several can be expressed.
882
928
  if (authored !== undefined) {
883
- if (!isChainExplorer(authored)) {
929
+ const explorerProblems = chainExplorerProblems(authored);
930
+ if (explorerProblems.length > 0) {
884
931
  issues.push({
885
932
  severity: 'error',
886
933
  chainId,
887
934
  chainName,
888
- message: `declares a malformed explorer ${JSON.stringify(authored)} — expected { url, addressPath, txPath }`,
935
+ message: `declares a malformed explorer ${JSON.stringify(authored)}: ${explorerProblems.join('; ')}`,
889
936
  });
890
937
  stamped[chainId] = withSortedKeys({ ...chain });
891
938
  continue;
@@ -45,6 +45,8 @@ interface Explorer {
45
45
  addressPath: string;
46
46
  /** Path to a transaction page, with both slashes (`/tx/`). */
47
47
  txPath: string;
48
+ /** Query without the leading `?`, appended as `?<query>` after the value. Absent means none. */
49
+ query?: string;
48
50
  }
49
51
  interface Chain {
50
52
  name: string;
@@ -2238,6 +2238,9 @@ const chains = {
2238
2238
  "multiCall": "0x8E60b7b64b63cD56b18ebcECADcb79B04919286e",
2239
2239
  "transferDelegate": "0x60FccB9b58d5E806ca5Cb8BFCe721c2274609dE4"
2240
2240
  },
2241
+ "near": {
2242
+ "prefix": "plasma"
2243
+ },
2241
2244
  "oft": {
2242
2245
  "adapter": "0x02ca37966753bDdDf11216B73B16C1dE756A7CF9",
2243
2246
  "chainKey": "plasma",
@@ -2253,6 +2256,7 @@ const chains = {
2253
2256
  "ECO",
2254
2257
  "RELAY",
2255
2258
  "OFT",
2259
+ "NEAR",
2256
2260
  "RHINO",
2257
2261
  "LZ"
2258
2262
  ],
@@ -2291,6 +2295,7 @@ const chains = {
2291
2295
  "settlementLayers": [
2292
2296
  "ACROSS",
2293
2297
  "ECO",
2298
+ "NEAR",
2294
2299
  "OFT"
2295
2300
  ],
2296
2301
  "symbol": "USDT0"
@@ -1,2 +1,2 @@
1
- declare const PACKAGE_VERSION = "2.41.0";
1
+ declare const PACKAGE_VERSION = "2.43.0";
2
2
  export { PACKAGE_VERSION };
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_VERSION = void 0;
4
4
  // Auto-generated by scripts/generate.ts. Do not edit manually.
5
- const PACKAGE_VERSION = "2.41.0";
5
+ const PACKAGE_VERSION = "2.43.0";
6
6
  exports.PACKAGE_VERSION = PACKAGE_VERSION;
@@ -173,6 +173,12 @@ interface ChainExplorer {
173
173
  addressPath: string;
174
174
  /** Path from `url` to a transaction page, with both slashes (`/tx/`). */
175
175
  txPath: string;
176
+ /**
177
+ * URL query content without the leading `?` (Solscan's `cluster=devnet`),
178
+ * appended as `?${query}` after the linked value. `key=value` pairs joined by
179
+ * `&`; never on a fragment-routed explorer. Absent means no query.
180
+ */
181
+ query?: string;
176
182
  }
177
183
  interface NativeTokenEntry {
178
184
  symbol: string;
@@ -348,9 +354,12 @@ interface ChainEntry {
348
354
  * plain text rather than a link in that case.
349
355
  *
350
356
  * `url` carries no trailing slash and the paths carry their own, so a link is
351
- * `${url}${addressPath}${value}`. The paths exist because they are not
352
- * universal: Tronscan routes under a fragment (`/#/address/`) and calls a
353
- * transaction `transaction`, not `tx`.
357
+ * `${url}${addressPath}${value}`, plus `?${query}` when `query` is present.
358
+ * The paths exist because they are not universal: Tronscan routes under a
359
+ * fragment (`/#/address/`) and calls a transaction `transaction`, not `tx`.
360
+ *
361
+ * A consumer that cannot append `query` must treat the explorer as absent
362
+ * (plain text), never drop it: without it the link opens the wrong network.
354
363
  *
355
364
  * Derived from the chain's viem definition where it has one, authored in the
356
365
  * jsonnet where it does not — see `classifyChainExplorers`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinestone/shared-configs",
3
- "version": "2.41.0",
3
+ "version": "2.43.0",
4
4
  "description": "Reusable configuration files for Rhinestone services",
5
5
  "author": {
6
6
  "name": "Rhinestone",