@rhinestone/shared-configs 1.18.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.
@@ -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": {
@@ -1657,7 +1617,7 @@
1657
1617
  "network": "mainnet",
1658
1618
  "roles": {
1659
1619
  "destination": true,
1660
- "origin": false
1620
+ "origin": true
1661
1621
  },
1662
1622
  "settlementLayers": [],
1663
1623
  "stack": "vanilla",
@@ -55,9 +55,6 @@
55
55
  "DRPC"
56
56
  ]
57
57
  },
58
- "1337": {
59
- "providers": []
60
- },
61
58
  "1868": {
62
59
  "providers": [
63
60
  "soneium-public-rpc",
@@ -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 all three
636
- // HyperCore ids are Hyperliquid — the same branding as HyperEVM.
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, which is not a delivery venue", () => {
35
- // `hypercore:mainnet` is the Core L1 as a deposit SOURCE, so it still
36
- // resolves. What stops it being used as a delivery target is its role,
37
- // not its absence see the roles tests below.
38
- (0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)("hypercore:mainnet")).toBe(1337);
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);
@@ -65,18 +65,37 @@ const TRON_CAIP2 = "tron:mainnet";
65
65
  }
66
66
  });
67
67
  (0, bun_test_1.describe)("chain roles", () => {
68
- (0, bun_test_1.it)("splits HyperCore by direction: Core L1 originates, venues receive", () => {
69
- // Deposits arrive from the Core L1 without naming a venue; a delivery
70
- // must name the account it credits. Declaring it here is what makes a
71
- // perp *deposit source* unrepresentable rather than merely unimplemented,
72
- // and all three ids share the `hypercore:` namespace — so a namespace
73
- // switch could not draw this line at any level of effort.
74
- (0, bun_test_1.expect)((0, index_1.canBeOrigin)(1337)).toBe(true);
75
- (0, bun_test_1.expect)((0, index_1.canBeDestination)(1337)).toBe(false);
76
- for (const venue of [index_1.HYPERCORE_SPOT_CHAIN_ID, index_1.HYPERCORE_PERP_CHAIN_ID]) {
77
- (0, bun_test_1.expect)((0, index_1.canBeOrigin)(venue)).toBe(false);
78
- (0, bun_test_1.expect)((0, index_1.canBeDestination)(venue)).toBe(true);
79
- }
68
+ (0, bun_test_1.it)("splits HyperCore by direction: spot both ways, perp delivery-only", () => {
69
+ // Declaring it here is what makes a perp *deposit source* unrepresentable
70
+ // rather than merely unimplemented, and all three ids share the
71
+ // `hypercore:` namespace so a namespace switch could not draw this line
72
+ // at any level of effort.
73
+ //
74
+ // Spot originates because a HyperCore deposit already IS a spot credit:
75
+ // ingestion admits only an absent `destinationDex` or an explicit
76
+ // `"spot"`. Perp stays delivery-only a managed account cannot sign
77
+ // perp→spot, so a perp deposit would strand.
78
+ (0, bun_test_1.expect)((0, index_1.canBeOrigin)(index_1.HYPERCORE_SPOT_CHAIN_ID)).toBe(true);
79
+ (0, bun_test_1.expect)((0, index_1.canBeDestination)(index_1.HYPERCORE_SPOT_CHAIN_ID)).toBe(true);
80
+ (0, bun_test_1.expect)((0, index_1.canBeOrigin)(index_1.HYPERCORE_PERP_CHAIN_ID)).toBe(false);
81
+ (0, bun_test_1.expect)((0, index_1.canBeDestination)(index_1.HYPERCORE_PERP_CHAIN_ID)).toBe(true);
82
+ });
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);
80
99
  });
81
100
  (0, bun_test_1.it)("defaults both directions for chains that declare no roles", () => {
82
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 `hypercore:mainnet`: deposits arrive from the Core L1 venue-agnostically,
17
- * but a delivery must name the account it credits, so `hypercore:spot` /
18
- * `hypercore:perp` are the only HyperCore destinations. Answering that from data
19
- * is what lets a consumer refuse the ambiguous id without knowing its number.
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 (1337) is a `virtual` registry entry: it's EVM-shaped
24
- * (`vmType === 'evm'`, so `isNonEvmChainId(1337) === false`) and carries the
25
- * `hypercore:mainnet` caip2, but has no RPC / contracts / gas token of its own
26
- * and settles on HyperEVM (999). HyperCore-specific behavior lives behind
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 `hypercore:mainnet`: deposits arrive from the Core L1 venue-agnostically,
50
- * but a delivery must name the account it credits, so `hypercore:spot` /
51
- * `hypercore:perp` are the only HyperCore destinations. Answering that from data
52
- * is what lets a consumer refuse the ambiguous id without knowing its number.
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). */
@@ -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": {
@@ -1741,7 +1700,7 @@ const chains = {
1741
1700
  "network": "mainnet",
1742
1701
  "roles": {
1743
1702
  "destination": true,
1744
- "origin": false
1703
+ "origin": true
1745
1704
  },
1746
1705
  "settlementLayers": [],
1747
1706
  "stack": "vanilla",
@@ -5315,7 +5315,6 @@ declare enum MainnetNetwork {
5315
5315
  GNOSIS,
5316
5316
  BSC,
5317
5317
  HYPEREVM,
5318
- HYPERCORE = 1337,
5319
5318
  HYPERCORE_SPOT = 1337001,
5320
5319
  HYPERCORE_PERP = 1337002,
5321
5320
  MONAD,
@@ -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.18.0";
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 = "1.18.0";
5
+ const PACKAGE_VERSION = "2.0.0";
6
6
  exports.PACKAGE_VERSION = PACKAGE_VERSION;
@@ -18,15 +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 itself (`hypercore:mainnet`) HyperCore as a deposit SOURCE.
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
- * Deposits arrive here with no venue in them, which is what `deposits.chain` and
24
- * the QuickNode webhook already mean, so this stays a live registry entry with
25
- * `roles: { origin: true, destination: false }`.
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.
26
28
  *
27
- * It is deliberately NOT aliased to either venue for delivery: it defaulted to
28
- * perp, so pointing it at spot would silently move funds and pointing it at perp
29
- * would silently keep the bug. `canBeDestination` is what refuses it.
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.
30
32
  */
31
33
  export declare const HYPERCORE_ORIGIN_CHAIN_ID = 1337;
32
34
  /**
@@ -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 (1337)
29
- // is a `virtual` registry entry (`MainnetNetwork.HYPERCORE`): EVM-addressed but
30
- // with no RPC/providers/contracts/gas token of its own. The HyperCore-specific
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,15 +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 itself (`hypercore:mainnet`) HyperCore as a deposit SOURCE.
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
- * Deposits arrive here with no venue in them, which is what `deposits.chain` and
54
- * the QuickNode webhook already mean, so this stays a live registry entry with
55
- * `roles: { origin: true, destination: false }`.
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.
56
59
  *
57
- * It is deliberately NOT aliased to either venue for delivery: it defaulted to
58
- * perp, so pointing it at spot would silently move funds and pointing it at perp
59
- * would silently keep the bug. `canBeDestination` is what refuses it.
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.
60
63
  */
61
64
  exports.HYPERCORE_ORIGIN_CHAIN_ID = 1337;
62
65
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhinestone/shared-configs",
3
- "version": "1.18.0",
3
+ "version": "2.0.0",
4
4
  "description": "Reusable configuration files for Rhinestone services",
5
5
  "author": {
6
6
  "name": "Rhinestone",