@rhinestone/shared-configs 1.8.0 → 1.10.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/configs/chains.json +348 -0
- package/dist/scripts/__tests__/validation.test.js +166 -0
- package/dist/scripts/generate.js +30 -5
- package/dist/scripts/validation.d.ts +57 -0
- package/dist/scripts/validation.d.ts.map +1 -1
- package/dist/scripts/validation.js +213 -2
- package/dist/src/__tests__/chainFactsClient.test.js +12 -2
- package/dist/src/__tests__/chainVirtualization.test.js +9 -3
- package/dist/src/chainVirtualization.d.ts +10 -8
- package/dist/src/chainVirtualization.d.ts.map +1 -1
- package/dist/src/chainVirtualization.js +11 -12
- package/dist/src/chains.d.ts +16 -3
- package/dist/src/chains.d.ts.map +1 -1
- package/dist/src/chains.js +348 -0
- package/dist/src/generated/packageVersion.d.ts +1 -1
- package/dist/src/generated/packageVersion.d.ts.map +1 -1
- package/dist/src/generated/packageVersion.js +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +49 -6
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chainVirtualization.d.ts","sourceRoot":"","sources":["../../src/chainVirtualization.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,SAAS,CAAC;AAIrD,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAI5C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"chainVirtualization.d.ts","sourceRoot":"","sources":["../../src/chainVirtualization.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,SAAS,CAAC;AAIrD,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAI5C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKlE"}
|
|
@@ -44,22 +44,21 @@ function getNonEvmChainIds() {
|
|
|
44
44
|
.map(([id]) => Number(id));
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Canonical CAIP-2 string for a chain id
|
|
48
|
-
*
|
|
49
|
-
* `eip155:<chainId>` form
|
|
50
|
-
*
|
|
47
|
+
* Canonical CAIP-2 string for a chain id, read straight off the registry —
|
|
48
|
+
* every entry carries one (see `classifyChainCaip2`). Falls back to the
|
|
49
|
+
* `eip155:<chainId>` form for an id the registry does not know, so callers
|
|
50
|
+
* don't need to special-case an absent entry.
|
|
51
51
|
*/
|
|
52
52
|
function getCaip2(chainId) {
|
|
53
|
-
|
|
54
|
-
if (entry?.caip2)
|
|
55
|
-
return entry.caip2;
|
|
56
|
-
return `eip155:${chainId}`;
|
|
53
|
+
return chainRegistry[String(chainId)]?.caip2 ?? `eip155:${chainId}`;
|
|
57
54
|
}
|
|
58
55
|
/**
|
|
59
|
-
* Reverse lookup —
|
|
60
|
-
* `
|
|
61
|
-
*
|
|
62
|
-
*
|
|
56
|
+
* Reverse lookup — the numeric chain id addressed by a CAIP-2 string, or
|
|
57
|
+
* `undefined` if no registry entry uses it.
|
|
58
|
+
*
|
|
59
|
+
* Covers every chain, EVM included: `caip2` is present on all entries, and the
|
|
60
|
+
* generator rejects two chains resolving to the same one, so this is
|
|
61
|
+
* unambiguous.
|
|
63
62
|
*/
|
|
64
63
|
function chainIdFromCaip2(caip2) {
|
|
65
64
|
for (const [id, entry] of Object.entries(chainRegistry)) {
|
package/dist/src/chains.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ interface Token {
|
|
|
8
8
|
pegGroup?: PegGroup;
|
|
9
9
|
balanceSlot: number | null;
|
|
10
10
|
approvalSlot: number | null;
|
|
11
|
+
/** Bridge layers that can carry this token on this chain, when known. */
|
|
12
|
+
settlementLayers?: SettlementLayer[];
|
|
11
13
|
unpriced?: boolean;
|
|
12
14
|
}
|
|
13
15
|
interface NativeToken {
|
|
@@ -16,6 +18,14 @@ interface NativeToken {
|
|
|
16
18
|
symbol: string;
|
|
17
19
|
decimals: number;
|
|
18
20
|
}
|
|
21
|
+
interface Explorer {
|
|
22
|
+
/** Origin, no trailing slash. */
|
|
23
|
+
url: string;
|
|
24
|
+
/** Path to an address page, with both slashes (`/address/`). */
|
|
25
|
+
addressPath: string;
|
|
26
|
+
/** Path to a transaction page, with both slashes (`/tx/`). */
|
|
27
|
+
txPath: string;
|
|
28
|
+
}
|
|
19
29
|
interface Chain {
|
|
20
30
|
name: string;
|
|
21
31
|
vmType: VmType;
|
|
@@ -23,8 +33,11 @@ interface Chain {
|
|
|
23
33
|
network: ChainNetwork;
|
|
24
34
|
/** Execution stack, for consumers that must synthesise a viem `Chain`. */
|
|
25
35
|
stack: ChainStack;
|
|
26
|
-
/** CAIP-2 chain identifier
|
|
27
|
-
|
|
36
|
+
/** CAIP-2 chain identifier. Present on every chain: authored for the
|
|
37
|
+
* non-eip155 ones, derived as `eip155:<chainId>` for the rest. */
|
|
38
|
+
caip2: string;
|
|
39
|
+
/** Block explorer, or null for a chain that has none (render plain text). */
|
|
40
|
+
explorer: Explorer | null;
|
|
28
41
|
/** True for virtual chains (e.g. HyperCore) that settle on another chain. */
|
|
29
42
|
virtual?: boolean;
|
|
30
43
|
nativeToken: NativeToken;
|
|
@@ -37,5 +50,5 @@ interface Chain {
|
|
|
37
50
|
}
|
|
38
51
|
declare const chains: Record<SupportedChain, Chain>;
|
|
39
52
|
export { chains };
|
|
40
|
-
export type { Chain, Token, NativeToken };
|
|
53
|
+
export type { Chain, Token, NativeToken, Explorer };
|
|
41
54
|
//# sourceMappingURL=chains.d.ts.map
|
package/dist/src/chains.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../src/chains.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEvJ,UAAU,KAAK;IACb,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,WAAW;IACnB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,OAAO,EAAE,YAAY,CAAC;IACtB,0EAA0E;IAC1E,KAAK,EAAE,UAAU,CAAC;IAClB
|
|
1
|
+
{"version":3,"file":"chains.d.ts","s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