@rhinestone/shared-configs 1.19.0 → 2.0.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 +0 -40
- package/dist/configs/mainnets.json +0 -3
- package/dist/scripts/__tests__/validation.test.js +2 -3
- package/dist/src/__tests__/chainVirtualization.test.js +21 -12
- package/dist/src/chainVirtualization.d.ts +6 -5
- package/dist/src/chainVirtualization.js +32 -9
- package/dist/src/chains.js +0 -41
- package/dist/src/generated/networks.d.ts +0 -1
- package/dist/src/generated/networks.js +0 -1
- package/dist/src/generated/packageVersion.d.ts +1 -1
- package/dist/src/generated/packageVersion.js +1 -1
- package/dist/src/hypercore.d.ts +9 -8
- package/dist/src/hypercore.js +13 -11
- package/package.json +1 -1
package/dist/configs/chains.json
CHANGED
|
@@ -798,46 +798,6 @@
|
|
|
798
798
|
"symbol": "WHYPE"
|
|
799
799
|
}
|
|
800
800
|
},
|
|
801
|
-
"1337": {
|
|
802
|
-
"caip2": "hypercore:mainnet",
|
|
803
|
-
"explorer": {
|
|
804
|
-
"addressPath": "/explorer/address/",
|
|
805
|
-
"txPath": "/explorer/tx/",
|
|
806
|
-
"url": "https://app.hyperliquid.xyz"
|
|
807
|
-
},
|
|
808
|
-
"iconSlug": "hyperevm",
|
|
809
|
-
"name": "HyperCore",
|
|
810
|
-
"nativeToken": {
|
|
811
|
-
"address": "0x0000000000000000000000000000000000000000",
|
|
812
|
-
"decimals": 18,
|
|
813
|
-
"symbol": "HYPE"
|
|
814
|
-
},
|
|
815
|
-
"network": "mainnet",
|
|
816
|
-
"roles": {
|
|
817
|
-
"destination": false,
|
|
818
|
-
"origin": true
|
|
819
|
-
},
|
|
820
|
-
"settlementLayers": [],
|
|
821
|
-
"stack": "vanilla",
|
|
822
|
-
"swapQuoters": [],
|
|
823
|
-
"tokens": [
|
|
824
|
-
{
|
|
825
|
-
"address": "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
826
|
-
"approvalSlot": null,
|
|
827
|
-
"balanceSlot": null,
|
|
828
|
-
"decimals": 6,
|
|
829
|
-
"pegGroup": "USD",
|
|
830
|
-
"symbol": "USDC"
|
|
831
|
-
}
|
|
832
|
-
],
|
|
833
|
-
"virtual": true,
|
|
834
|
-
"vmType": "evm",
|
|
835
|
-
"wrappedNativeToken": {
|
|
836
|
-
"address": "0x0000000000000000000000000000000000000000",
|
|
837
|
-
"decimals": 18,
|
|
838
|
-
"symbol": "HYPE"
|
|
839
|
-
}
|
|
840
|
-
},
|
|
841
801
|
"1868": {
|
|
842
802
|
"caip2": "eip155:1868",
|
|
843
803
|
"explorer": {
|
|
@@ -632,15 +632,14 @@ function errorsFor(chain) {
|
|
|
632
632
|
(0, bun_test_1.expect)(withoutIcon).toEqual([]);
|
|
633
633
|
});
|
|
634
634
|
// Two reuse rules that would otherwise look like copy-paste errors in the
|
|
635
|
-
// jsonnet. A testnet is visually the same chain as its mainnet, and
|
|
636
|
-
// HyperCore
|
|
635
|
+
// jsonnet. A testnet is visually the same chain as its mainnet, and both
|
|
636
|
+
// HyperCore venues are Hyperliquid — the same branding as HyperEVM.
|
|
637
637
|
bun_test_1.it.each([
|
|
638
638
|
["11155111", "1"],
|
|
639
639
|
["11155420", "10"],
|
|
640
640
|
["84532", "8453"],
|
|
641
641
|
["421614", "42161"],
|
|
642
642
|
["9746", "9745"],
|
|
643
|
-
["1337", "999"],
|
|
644
643
|
["1337001", "999"],
|
|
645
644
|
["1337002", "999"],
|
|
646
645
|
])("reuses chain %s's glyph from chain %s", (child, parent) => {
|
|
@@ -31,11 +31,11 @@ const TRON_CAIP2 = "tron:mainnet";
|
|
|
31
31
|
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)(HYPERCORE_SPOT_CAIP2)).toBe(index_1.HYPERCORE_SPOT_CHAIN_ID);
|
|
32
32
|
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)(HYPERCORE_PERP_CAIP2)).toBe(index_1.HYPERCORE_PERP_CHAIN_ID);
|
|
33
33
|
});
|
|
34
|
-
(0, bun_test_1.it)("resolves the origin id
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)("hypercore:mainnet")).
|
|
34
|
+
(0, bun_test_1.it)("no longer resolves the retired origin id", () => {
|
|
35
|
+
// RHI-5606 dropped the entry; `hypercore:spot` carries both directions.
|
|
36
|
+
// Resolving to nothing is what makes a stale caller fail loudly here
|
|
37
|
+
// rather than acquiring a chain with no roles, no tokens and no venue.
|
|
38
|
+
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)("hypercore:mainnet")).toBeUndefined();
|
|
39
39
|
});
|
|
40
40
|
(0, bun_test_1.it)("resolves registry non-EVM caip2 strings", () => {
|
|
41
41
|
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)(SOLANA_CAIP2)).toBe(index_1.MainnetNetwork.SOLANA);
|
|
@@ -80,13 +80,22 @@ const TRON_CAIP2 = "tron:mainnet";
|
|
|
80
80
|
(0, bun_test_1.expect)((0, index_1.canBeOrigin)(index_1.HYPERCORE_PERP_CHAIN_ID)).toBe(false);
|
|
81
81
|
(0, bun_test_1.expect)((0, index_1.canBeDestination)(index_1.HYPERCORE_PERP_CHAIN_ID)).toBe(true);
|
|
82
82
|
});
|
|
83
|
-
(0, bun_test_1.it)("
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
(0, bun_test_1.expect)((
|
|
83
|
+
(0, bun_test_1.it)("refuses the retired origin id in both directions, entry or not", () => {
|
|
84
|
+
// The regression this guards: absent `roles` default to BOTH, so removing
|
|
85
|
+
// 1337's entry would have flipped `canBeDestination` from an explicit
|
|
86
|
+
// `false` to the unknown-id `true` — re-admitting the id that names the
|
|
87
|
+
// Core L1 without naming an account and defaulted to unrecoverable perp
|
|
88
|
+
// margin (RHI-5510). The refusal is not allowed to depend on the entry.
|
|
89
|
+
(0, bun_test_1.expect)(index_1.chainRegistry[String(index_1.HYPERCORE_ORIGIN_CHAIN_ID)]).toBeUndefined();
|
|
90
|
+
(0, bun_test_1.expect)((0, index_1.canBeDestination)(index_1.HYPERCORE_ORIGIN_CHAIN_ID)).toBe(false);
|
|
91
|
+
(0, bun_test_1.expect)((0, index_1.canBeOrigin)(index_1.HYPERCORE_ORIGIN_CHAIN_ID)).toBe(false);
|
|
92
|
+
});
|
|
93
|
+
(0, bun_test_1.it)("still defaults a genuinely unknown id to both", () => {
|
|
94
|
+
// The retired-id list must not become a general "unknown means no".
|
|
95
|
+
// Callers reject ids they do not recognise by their own means; these
|
|
96
|
+
// helpers answer about capability, not existence.
|
|
97
|
+
(0, bun_test_1.expect)((0, index_1.canBeOrigin)(999999999)).toBe(true);
|
|
98
|
+
(0, bun_test_1.expect)((0, index_1.canBeDestination)(999999999)).toBe(true);
|
|
90
99
|
});
|
|
91
100
|
(0, bun_test_1.it)("defaults both directions for chains that declare no roles", () => {
|
|
92
101
|
// Absent `roles` must mean both, so adding the field is a no-op for every
|
|
@@ -6,17 +6,18 @@ export declare function getVmType(chainId: number): VmType;
|
|
|
6
6
|
*
|
|
7
7
|
* Absent `roles` means both directions, so every ordinary chain answers true
|
|
8
8
|
* without declaring anything. A consumer may narrow this further; it may not
|
|
9
|
-
* widen it.
|
|
9
|
+
* widen it. Retired ids are the exception and answer false — see
|
|
10
|
+
* `RETIRED_CHAIN_IDS`.
|
|
10
11
|
*/
|
|
11
12
|
export declare function canBeOrigin(chainId: number): boolean;
|
|
12
13
|
/**
|
|
13
14
|
* Whether funds can be DELIVERED to this chain — i.e. it is a valid intent
|
|
14
15
|
* destination.
|
|
15
16
|
*
|
|
16
|
-
* False for
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* False for `hypercore:mainnet`, which names the Core L1 without naming the
|
|
18
|
+
* account a delivery would credit, so `hypercore:spot` / `hypercore:perp` are
|
|
19
|
+
* the only HyperCore destinations. That answer used to come from the entry's
|
|
20
|
+
* `roles`; the entry is gone and the answer is unchanged.
|
|
20
21
|
*/
|
|
21
22
|
export declare function canBeDestination(chainId: number): boolean;
|
|
22
23
|
/** True when the chain id's vmType is not `'evm'` (Solana, Tron today). */
|
|
@@ -20,14 +20,32 @@ exports.chainIdFromCaip2 = chainIdFromCaip2;
|
|
|
20
20
|
* source of truth). Consumers should NOT keep their own copy of "which
|
|
21
21
|
* chainIds are non-EVM" — read from here.
|
|
22
22
|
*
|
|
23
|
-
* HyperCore (
|
|
24
|
-
* (`vmType === 'evm'`, so `isNonEvmChainId(
|
|
25
|
-
* `hypercore
|
|
26
|
-
* and
|
|
23
|
+
* HyperCore's venues (1337001, 1337002) are `virtual` registry entries: they're
|
|
24
|
+
* EVM-shaped (`vmType === 'evm'`, so `isNonEvmChainId(1337001) === false`) and
|
|
25
|
+
* carry `hypercore:` caip2s, but have no RPC / contracts / gas token of their
|
|
26
|
+
* own and settle on HyperEVM (999). HyperCore-specific behavior lives behind
|
|
27
27
|
* `isHyperCoreChainId` / `resolveSettlementChainId` in `./hypercore.ts`.
|
|
28
28
|
*/
|
|
29
29
|
const chains_json_1 = __importDefault(require("../configs/chains.json"));
|
|
30
|
+
const hypercore_1 = require("./hypercore");
|
|
30
31
|
const chainRegistry = chains_json_1.default;
|
|
32
|
+
/**
|
|
33
|
+
* Ids that are refused in BOTH directions without being registry entries.
|
|
34
|
+
*
|
|
35
|
+
* Absence normally means "unknown chain", which both helpers answer `true` for —
|
|
36
|
+
* the registry is not the id allowlist, and callers reject unknown ids by their
|
|
37
|
+
* own means. A RETIRED id is not unknown: 1337 was `hypercore:mainnet`, whose
|
|
38
|
+
* whole point was `destination: false`, because it names the Core L1 without
|
|
39
|
+
* naming the account a delivery would credit and defaulted to perp margin
|
|
40
|
+
* (RHI-5510) — funds that cannot be recovered. Dropping the entry would have
|
|
41
|
+
* flipped that `false` to the unknown-id `true` and re-opened it.
|
|
42
|
+
*
|
|
43
|
+
* So the refusal outlives the entry. Registry-resident ids still answer from
|
|
44
|
+
* their own `roles`; this list only covers ids deliberately taken out.
|
|
45
|
+
*/
|
|
46
|
+
const RETIRED_CHAIN_IDS = new Set([
|
|
47
|
+
hypercore_1.HYPERCORE_ORIGIN_CHAIN_ID,
|
|
48
|
+
]);
|
|
31
49
|
/** VM kind for a chain id; defaults to `'evm'` for unknown ids. */
|
|
32
50
|
function getVmType(chainId) {
|
|
33
51
|
return chainRegistry[String(chainId)]?.vmType ?? "evm";
|
|
@@ -37,21 +55,26 @@ function getVmType(chainId) {
|
|
|
37
55
|
*
|
|
38
56
|
* Absent `roles` means both directions, so every ordinary chain answers true
|
|
39
57
|
* without declaring anything. A consumer may narrow this further; it may not
|
|
40
|
-
* widen it.
|
|
58
|
+
* widen it. Retired ids are the exception and answer false — see
|
|
59
|
+
* `RETIRED_CHAIN_IDS`.
|
|
41
60
|
*/
|
|
42
61
|
function canBeOrigin(chainId) {
|
|
62
|
+
if (RETIRED_CHAIN_IDS.has(chainId))
|
|
63
|
+
return false;
|
|
43
64
|
return chainRegistry[String(chainId)]?.roles?.origin ?? true;
|
|
44
65
|
}
|
|
45
66
|
/**
|
|
46
67
|
* Whether funds can be DELIVERED to this chain — i.e. it is a valid intent
|
|
47
68
|
* destination.
|
|
48
69
|
*
|
|
49
|
-
* False for
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
70
|
+
* False for `hypercore:mainnet`, which names the Core L1 without naming the
|
|
71
|
+
* account a delivery would credit, so `hypercore:spot` / `hypercore:perp` are
|
|
72
|
+
* the only HyperCore destinations. That answer used to come from the entry's
|
|
73
|
+
* `roles`; the entry is gone and the answer is unchanged.
|
|
53
74
|
*/
|
|
54
75
|
function canBeDestination(chainId) {
|
|
76
|
+
if (RETIRED_CHAIN_IDS.has(chainId))
|
|
77
|
+
return false;
|
|
55
78
|
return chainRegistry[String(chainId)]?.roles?.destination ?? true;
|
|
56
79
|
}
|
|
57
80
|
/** True when the chain id's vmType is not `'evm'` (Solana, Tron today). */
|
package/dist/src/chains.js
CHANGED
|
@@ -839,47 +839,6 @@ const chains = {
|
|
|
839
839
|
"DRPC"
|
|
840
840
|
]
|
|
841
841
|
},
|
|
842
|
-
"1337": {
|
|
843
|
-
"caip2": "hypercore:mainnet",
|
|
844
|
-
"explorer": {
|
|
845
|
-
"addressPath": "/explorer/address/",
|
|
846
|
-
"txPath": "/explorer/tx/",
|
|
847
|
-
"url": "https://app.hyperliquid.xyz"
|
|
848
|
-
},
|
|
849
|
-
"iconSlug": "hyperevm",
|
|
850
|
-
"name": "HyperCore",
|
|
851
|
-
"nativeToken": {
|
|
852
|
-
"address": "0x0000000000000000000000000000000000000000",
|
|
853
|
-
"decimals": 18,
|
|
854
|
-
"symbol": "HYPE"
|
|
855
|
-
},
|
|
856
|
-
"network": "mainnet",
|
|
857
|
-
"roles": {
|
|
858
|
-
"destination": false,
|
|
859
|
-
"origin": true
|
|
860
|
-
},
|
|
861
|
-
"settlementLayers": [],
|
|
862
|
-
"stack": "vanilla",
|
|
863
|
-
"swapQuoters": [],
|
|
864
|
-
"tokens": [
|
|
865
|
-
{
|
|
866
|
-
"address": "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
867
|
-
"approvalSlot": null,
|
|
868
|
-
"balanceSlot": null,
|
|
869
|
-
"decimals": 6,
|
|
870
|
-
"pegGroup": "USD",
|
|
871
|
-
"symbol": "USDC"
|
|
872
|
-
}
|
|
873
|
-
],
|
|
874
|
-
"virtual": true,
|
|
875
|
-
"vmType": "evm",
|
|
876
|
-
"wrappedNativeToken": {
|
|
877
|
-
"address": "0x0000000000000000000000000000000000000000",
|
|
878
|
-
"decimals": 18,
|
|
879
|
-
"symbol": "HYPE"
|
|
880
|
-
},
|
|
881
|
-
"providers": []
|
|
882
|
-
},
|
|
883
842
|
"1868": {
|
|
884
843
|
"caip2": "eip155:1868",
|
|
885
844
|
"explorer": {
|
|
@@ -22,7 +22,6 @@ var MainnetNetwork;
|
|
|
22
22
|
MainnetNetwork[MainnetNetwork["GNOSIS"] = chains_1.gnosis.id] = "GNOSIS";
|
|
23
23
|
MainnetNetwork[MainnetNetwork["BSC"] = chains_1.bsc.id] = "BSC";
|
|
24
24
|
MainnetNetwork[MainnetNetwork["HYPEREVM"] = chains_1.hyperEvm.id] = "HYPEREVM";
|
|
25
|
-
MainnetNetwork[MainnetNetwork["HYPERCORE"] = 1337] = "HYPERCORE";
|
|
26
25
|
MainnetNetwork[MainnetNetwork["HYPERCORE_SPOT"] = 1337001] = "HYPERCORE_SPOT";
|
|
27
26
|
MainnetNetwork[MainnetNetwork["HYPERCORE_PERP"] = 1337002] = "HYPERCORE_PERP";
|
|
28
27
|
MainnetNetwork[MainnetNetwork["MONAD"] = chains_1.monad.id] = "MONAD";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const PACKAGE_VERSION = "
|
|
1
|
+
declare const PACKAGE_VERSION = "2.0.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 = "
|
|
5
|
+
const PACKAGE_VERSION = "2.0.0";
|
|
6
6
|
exports.PACKAGE_VERSION = PACKAGE_VERSION;
|
package/dist/src/hypercore.d.ts
CHANGED
|
@@ -18,16 +18,17 @@ import { MainnetNetwork } from "./generated/networks";
|
|
|
18
18
|
export declare const HYPERCORE_SPOT_CHAIN_ID = MainnetNetwork.HYPERCORE_SPOT;
|
|
19
19
|
export declare const HYPERCORE_PERP_CHAIN_ID = MainnetNetwork.HYPERCORE_PERP;
|
|
20
20
|
/**
|
|
21
|
-
* The Core L1
|
|
21
|
+
* The retired Core L1 id (`hypercore:mainnet`). NOT a registry entry — RHI-5606
|
|
22
|
+
* removed it, and `HYPERCORE_SPOT_CHAIN_ID` now carries both directions.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* Kept as a literal so callers still sending it can be REJECTED with a message
|
|
25
|
+
* naming the venue to use instead. Without it the id falls through to a generic
|
|
26
|
+
* unknown-chain error, which tells someone integrating against the old spelling
|
|
27
|
+
* nothing about what replaced it.
|
|
27
28
|
*
|
|
28
|
-
* It is deliberately
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* It is deliberately not aliased to either venue: it defaulted to perp, so
|
|
30
|
+
* pointing it at spot would silently move funds and pointing it at perp would
|
|
31
|
+
* silently keep the bug.
|
|
31
32
|
*/
|
|
32
33
|
export declare const HYPERCORE_ORIGIN_CHAIN_ID = 1337;
|
|
33
34
|
/**
|
package/dist/src/hypercore.js
CHANGED
|
@@ -25,9 +25,10 @@ const networks_1 = require("./generated/networks");
|
|
|
25
25
|
// hyperliquid-dev/hyper-evm-lib.
|
|
26
26
|
//
|
|
27
27
|
// HyperEVM (999) and its native USDC live in the chain registry
|
|
28
|
-
// (`MainnetNetwork.HYPEREVM` + `chainRegistry[999].tokens`). HyperCore
|
|
29
|
-
//
|
|
30
|
-
//
|
|
28
|
+
// (`MainnetNetwork.HYPEREVM` + `chainRegistry[999].tokens`). HyperCore is a pair
|
|
29
|
+
// of `virtual` registry entries, one per delivery venue
|
|
30
|
+
// (`MainnetNetwork.HYPERCORE_SPOT` / `_PERP`): EVM-addressed but with no
|
|
31
|
+
// RPC/providers/contracts/gas token of their own. The HyperCore-specific
|
|
31
32
|
// bridging behavior below stays here rather than in the generated registry.
|
|
32
33
|
// ---------------------------------------------------------------------------
|
|
33
34
|
/**
|
|
@@ -48,16 +49,17 @@ const networks_1 = require("./generated/networks");
|
|
|
48
49
|
exports.HYPERCORE_SPOT_CHAIN_ID = networks_1.MainnetNetwork.HYPERCORE_SPOT;
|
|
49
50
|
exports.HYPERCORE_PERP_CHAIN_ID = networks_1.MainnetNetwork.HYPERCORE_PERP;
|
|
50
51
|
/**
|
|
51
|
-
* The Core L1
|
|
52
|
+
* The retired Core L1 id (`hypercore:mainnet`). NOT a registry entry — RHI-5606
|
|
53
|
+
* removed it, and `HYPERCORE_SPOT_CHAIN_ID` now carries both directions.
|
|
52
54
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* Kept as a literal so callers still sending it can be REJECTED with a message
|
|
56
|
+
* naming the venue to use instead. Without it the id falls through to a generic
|
|
57
|
+
* unknown-chain error, which tells someone integrating against the old spelling
|
|
58
|
+
* nothing about what replaced it.
|
|
57
59
|
*
|
|
58
|
-
* It is deliberately
|
|
59
|
-
*
|
|
60
|
-
*
|
|
60
|
+
* It is deliberately not aliased to either venue: it defaulted to perp, so
|
|
61
|
+
* pointing it at spot would silently move funds and pointing it at perp would
|
|
62
|
+
* silently keep the bug.
|
|
61
63
|
*/
|
|
62
64
|
exports.HYPERCORE_ORIGIN_CHAIN_ID = 1337;
|
|
63
65
|
/**
|