@rhinestone/shared-configs 1.10.2 → 1.11.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 +82 -0
- package/dist/configs/mainnets.json +6 -0
- package/dist/scripts/__tests__/validation.test.js +5 -2
- package/dist/scripts/generate.js +3 -0
- package/dist/src/__tests__/chainVirtualization.test.js +71 -18
- package/dist/src/chainVirtualization.d.ts +18 -0
- package/dist/src/chainVirtualization.js +24 -0
- package/dist/src/chains.d.ts +6 -0
- package/dist/src/chains.js +84 -0
- package/dist/src/generated/networks.d.ts +2 -0
- package/dist/src/generated/networks.js +2 -0
- package/dist/src/generated/packageVersion.d.ts +1 -1
- package/dist/src/generated/packageVersion.js +1 -1
- package/dist/src/hypercore.d.ts +51 -15
- package/dist/src/hypercore.js +61 -18
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.js +7 -2
- package/dist/src/types.d.ts +26 -1
- package/package.json +1 -1
package/dist/configs/chains.json
CHANGED
|
@@ -665,6 +665,10 @@
|
|
|
665
665
|
"symbol": "HYPE"
|
|
666
666
|
},
|
|
667
667
|
"network": "mainnet",
|
|
668
|
+
"roles": {
|
|
669
|
+
"destination": false,
|
|
670
|
+
"origin": true
|
|
671
|
+
},
|
|
668
672
|
"settlementLayers": [],
|
|
669
673
|
"stack": "vanilla",
|
|
670
674
|
"swapQuoters": [],
|
|
@@ -1383,6 +1387,84 @@
|
|
|
1383
1387
|
"symbol": "WETH"
|
|
1384
1388
|
}
|
|
1385
1389
|
},
|
|
1390
|
+
"1337001": {
|
|
1391
|
+
"caip2": "hypercore:spot",
|
|
1392
|
+
"explorer": {
|
|
1393
|
+
"addressPath": "/explorer/address/",
|
|
1394
|
+
"txPath": "/explorer/tx/",
|
|
1395
|
+
"url": "https://app.hyperliquid.xyz"
|
|
1396
|
+
},
|
|
1397
|
+
"name": "HyperCore Spot",
|
|
1398
|
+
"nativeToken": {
|
|
1399
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
1400
|
+
"decimals": 18,
|
|
1401
|
+
"symbol": "HYPE"
|
|
1402
|
+
},
|
|
1403
|
+
"network": "mainnet",
|
|
1404
|
+
"roles": {
|
|
1405
|
+
"destination": true,
|
|
1406
|
+
"origin": false
|
|
1407
|
+
},
|
|
1408
|
+
"settlementLayers": [],
|
|
1409
|
+
"stack": "vanilla",
|
|
1410
|
+
"swapQuoters": [],
|
|
1411
|
+
"tokens": [
|
|
1412
|
+
{
|
|
1413
|
+
"address": "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
1414
|
+
"approvalSlot": null,
|
|
1415
|
+
"balanceSlot": null,
|
|
1416
|
+
"decimals": 6,
|
|
1417
|
+
"pegGroup": "USD",
|
|
1418
|
+
"symbol": "USDC"
|
|
1419
|
+
}
|
|
1420
|
+
],
|
|
1421
|
+
"virtual": true,
|
|
1422
|
+
"vmType": "evm",
|
|
1423
|
+
"wrappedNativeToken": {
|
|
1424
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
1425
|
+
"decimals": 18,
|
|
1426
|
+
"symbol": "HYPE"
|
|
1427
|
+
}
|
|
1428
|
+
},
|
|
1429
|
+
"1337002": {
|
|
1430
|
+
"caip2": "hypercore:perp",
|
|
1431
|
+
"explorer": {
|
|
1432
|
+
"addressPath": "/explorer/address/",
|
|
1433
|
+
"txPath": "/explorer/tx/",
|
|
1434
|
+
"url": "https://app.hyperliquid.xyz"
|
|
1435
|
+
},
|
|
1436
|
+
"name": "HyperCore Perp",
|
|
1437
|
+
"nativeToken": {
|
|
1438
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
1439
|
+
"decimals": 18,
|
|
1440
|
+
"symbol": "HYPE"
|
|
1441
|
+
},
|
|
1442
|
+
"network": "mainnet",
|
|
1443
|
+
"roles": {
|
|
1444
|
+
"destination": true,
|
|
1445
|
+
"origin": false
|
|
1446
|
+
},
|
|
1447
|
+
"settlementLayers": [],
|
|
1448
|
+
"stack": "vanilla",
|
|
1449
|
+
"swapQuoters": [],
|
|
1450
|
+
"tokens": [
|
|
1451
|
+
{
|
|
1452
|
+
"address": "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
1453
|
+
"approvalSlot": null,
|
|
1454
|
+
"balanceSlot": null,
|
|
1455
|
+
"decimals": 6,
|
|
1456
|
+
"pegGroup": "USD",
|
|
1457
|
+
"symbol": "USDC"
|
|
1458
|
+
}
|
|
1459
|
+
],
|
|
1460
|
+
"virtual": true,
|
|
1461
|
+
"vmType": "evm",
|
|
1462
|
+
"wrappedNativeToken": {
|
|
1463
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
1464
|
+
"decimals": 18,
|
|
1465
|
+
"symbol": "HYPE"
|
|
1466
|
+
}
|
|
1467
|
+
},
|
|
1386
1468
|
"11155111": {
|
|
1387
1469
|
"caip2": "eip155:11155111",
|
|
1388
1470
|
"explorer": {
|
|
@@ -368,12 +368,15 @@ function errorsFor(chain) {
|
|
|
368
368
|
(0, bun_test_1.it)("leaves every shipped chain with a well-formed explorer", () => {
|
|
369
369
|
// HyperCore was the last null. Its explorer is authored (viem ships no
|
|
370
370
|
// HyperCore chain) and must stay Hyperliquid's own — a HyperCore txHash is
|
|
371
|
-
// a Core L1 hash that a HyperEVM scanner cannot resolve.
|
|
371
|
+
// a Core L1 hash that a HyperEVM scanner cannot resolve. Both delivery
|
|
372
|
+
// venues are the same Core L1, so both carry it.
|
|
372
373
|
const withoutExplorer = Object.entries(index_1.chainRegistry)
|
|
373
374
|
.filter(([, e]) => e.explorer == null)
|
|
374
375
|
.map(([id]) => id);
|
|
375
376
|
(0, bun_test_1.expect)(withoutExplorer).toEqual([]);
|
|
376
|
-
(
|
|
377
|
+
for (const venueId of ["1337001", "1337002"]) {
|
|
378
|
+
(0, bun_test_1.expect)(index_1.chainRegistry[venueId].explorer.url, venueId).toBe("https://app.hyperliquid.xyz");
|
|
379
|
+
}
|
|
377
380
|
for (const [id, entry] of Object.entries(index_1.chainRegistry)) {
|
|
378
381
|
const explorer = entry.explorer;
|
|
379
382
|
if (explorer === null)
|
package/dist/scripts/generate.js
CHANGED
|
@@ -134,6 +134,9 @@ function renderChains(chainRegistry, mainnets, testnets) {
|
|
|
134
134
|
" explorer: Explorer | null;",
|
|
135
135
|
" /** True for virtual chains (e.g. HyperCore) that settle on another chain. */",
|
|
136
136
|
" virtual?: boolean;",
|
|
137
|
+
" /** Which directions of transfer the chain supports; absent means both.",
|
|
138
|
+
" * Read via `canBeOrigin` / `canBeDestination` rather than directly. */",
|
|
139
|
+
" roles?: { origin: boolean; destination: boolean };",
|
|
137
140
|
" nativeToken: NativeToken;",
|
|
138
141
|
" wrappedNativeToken: NativeToken;",
|
|
139
142
|
" tokens: Token[];",
|
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const bun_test_1 = require("bun:test");
|
|
4
4
|
const index_1 = require("../index");
|
|
5
|
-
const
|
|
5
|
+
const HYPERCORE_SPOT_CAIP2 = "hypercore:spot";
|
|
6
|
+
const HYPERCORE_PERP_CAIP2 = "hypercore:perp";
|
|
6
7
|
const SOLANA_CAIP2 = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
7
8
|
const TRON_CAIP2 = "tron:mainnet";
|
|
8
9
|
(0, bun_test_1.describe)("chainVirtualization", () => {
|
|
9
10
|
(0, bun_test_1.describe)("getCaip2", () => {
|
|
10
|
-
(0, bun_test_1.it)("emits
|
|
11
|
-
// Data-driven from the
|
|
12
|
-
//
|
|
13
|
-
|
|
11
|
+
(0, bun_test_1.it)("emits a distinct canonical id per HyperCore venue", () => {
|
|
12
|
+
// Data-driven from the registry entries, exactly like Solana/Tron — no
|
|
13
|
+
// special-casing in the codec. The two must not collapse: the venue is
|
|
14
|
+
// the whole point of splitting them (RHI-5510).
|
|
15
|
+
(0, bun_test_1.expect)((0, index_1.getCaip2)(index_1.HYPERCORE_SPOT_CHAIN_ID)).toBe(HYPERCORE_SPOT_CAIP2);
|
|
16
|
+
(0, bun_test_1.expect)((0, index_1.getCaip2)(index_1.HYPERCORE_PERP_CHAIN_ID)).toBe(HYPERCORE_PERP_CAIP2);
|
|
17
|
+
(0, bun_test_1.expect)(index_1.HYPERCORE_SPOT_CHAIN_ID).not.toBe(index_1.HYPERCORE_PERP_CHAIN_ID);
|
|
14
18
|
});
|
|
15
19
|
(0, bun_test_1.it)("emits the registry caip2 for non-EVM chains", () => {
|
|
16
20
|
(0, bun_test_1.expect)((0, index_1.getCaip2)(index_1.MainnetNetwork.SOLANA)).toBe(SOLANA_CAIP2);
|
|
@@ -23,8 +27,15 @@ const TRON_CAIP2 = "tron:mainnet";
|
|
|
23
27
|
});
|
|
24
28
|
});
|
|
25
29
|
(0, bun_test_1.describe)("chainIdFromCaip2", () => {
|
|
26
|
-
(0, bun_test_1.it)("resolves
|
|
27
|
-
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)(
|
|
30
|
+
(0, bun_test_1.it)("resolves each HyperCore venue back to its own chain id", () => {
|
|
31
|
+
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)(HYPERCORE_SPOT_CAIP2)).toBe(index_1.HYPERCORE_SPOT_CHAIN_ID);
|
|
32
|
+
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)(HYPERCORE_PERP_CAIP2)).toBe(index_1.HYPERCORE_PERP_CHAIN_ID);
|
|
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);
|
|
28
39
|
});
|
|
29
40
|
(0, bun_test_1.it)("resolves registry non-EVM caip2 strings", () => {
|
|
30
41
|
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)(SOLANA_CAIP2)).toBe(index_1.MainnetNetwork.SOLANA);
|
|
@@ -47,22 +58,64 @@ const TRON_CAIP2 = "tron:mainnet";
|
|
|
47
58
|
for (const id of [
|
|
48
59
|
index_1.MainnetNetwork.SOLANA,
|
|
49
60
|
index_1.MainnetNetwork.TRON,
|
|
50
|
-
index_1.
|
|
61
|
+
index_1.HYPERCORE_SPOT_CHAIN_ID,
|
|
62
|
+
index_1.HYPERCORE_PERP_CHAIN_ID,
|
|
51
63
|
]) {
|
|
52
64
|
(0, bun_test_1.expect)((0, index_1.chainIdFromCaip2)((0, index_1.getCaip2)(id))).toBe(id);
|
|
53
65
|
}
|
|
54
66
|
});
|
|
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
|
+
}
|
|
80
|
+
});
|
|
81
|
+
(0, bun_test_1.it)("defaults both directions for chains that declare no roles", () => {
|
|
82
|
+
// Absent `roles` must mean both, so adding the field is a no-op for every
|
|
83
|
+
// chain that predates it. Tron is in this list deliberately: a consumer
|
|
84
|
+
// may advertise less than the registry permits, and one does, but that is
|
|
85
|
+
// the consumer's policy and must not be pushed down here.
|
|
86
|
+
for (const id of [
|
|
87
|
+
index_1.MainnetNetwork.ETHEREUM,
|
|
88
|
+
index_1.MainnetNetwork.BASE,
|
|
89
|
+
index_1.MainnetNetwork.SOLANA,
|
|
90
|
+
index_1.MainnetNetwork.TRON,
|
|
91
|
+
]) {
|
|
92
|
+
(0, bun_test_1.expect)((0, index_1.canBeOrigin)(id)).toBe(true);
|
|
93
|
+
(0, bun_test_1.expect)((0, index_1.canBeDestination)(id)).toBe(true);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
(0, bun_test_1.it)("defaults both directions for an unknown chain id", () => {
|
|
97
|
+
(0, bun_test_1.expect)((0, index_1.canBeOrigin)(999_999_999)).toBe(true);
|
|
98
|
+
(0, bun_test_1.expect)((0, index_1.canBeDestination)(999_999_999)).toBe(true);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
55
101
|
(0, bun_test_1.describe)("HyperCore stays EVM-classified", () => {
|
|
56
|
-
(0, bun_test_1.it)("
|
|
57
|
-
//
|
|
58
|
-
// EVM-addressed and
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
102
|
+
(0, bun_test_1.it)("both venues are virtual EVM registry entries, not non-EVM chains", () => {
|
|
103
|
+
// Splitting by venue must not flip HyperCore's routing — both are
|
|
104
|
+
// EVM-addressed and settle on HyperEVM (999). Classifying either as
|
|
105
|
+
// non-EVM would make `recipient` required and skip address
|
|
106
|
+
// normalisation, neither of which is true here.
|
|
107
|
+
for (const [id, caip2] of [
|
|
108
|
+
[index_1.HYPERCORE_SPOT_CHAIN_ID, HYPERCORE_SPOT_CAIP2],
|
|
109
|
+
[index_1.HYPERCORE_PERP_CHAIN_ID, HYPERCORE_PERP_CAIP2],
|
|
110
|
+
]) {
|
|
111
|
+
const entry = index_1.chainRegistry[String(id)];
|
|
112
|
+
(0, bun_test_1.expect)(entry).toBeDefined();
|
|
113
|
+
(0, bun_test_1.expect)(entry.vmType).toBe("evm");
|
|
114
|
+
(0, bun_test_1.expect)(entry.virtual).toBe(true);
|
|
115
|
+
(0, bun_test_1.expect)(entry.caip2).toBe(caip2);
|
|
116
|
+
(0, bun_test_1.expect)((0, index_1.isNonEvmChainId)(id)).toBe(false);
|
|
117
|
+
(0, bun_test_1.expect)((0, index_1.getNonEvmChainIds)()).not.toContain(id);
|
|
118
|
+
}
|
|
66
119
|
});
|
|
67
120
|
(0, bun_test_1.it)("still classifies genuine non-EVM chains", () => {
|
|
68
121
|
(0, bun_test_1.expect)((0, index_1.isNonEvmChainId)(index_1.MainnetNetwork.SOLANA)).toBe(true);
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import type { VmType } from "./types";
|
|
2
2
|
/** VM kind for a chain id; defaults to `'evm'` for unknown ids. */
|
|
3
3
|
export declare function getVmType(chainId: number): VmType;
|
|
4
|
+
/**
|
|
5
|
+
* Whether funds can ARRIVE from this chain — i.e. it is a valid deposit source.
|
|
6
|
+
*
|
|
7
|
+
* Absent `roles` means both directions, so every ordinary chain answers true
|
|
8
|
+
* without declaring anything. A consumer may narrow this further; it may not
|
|
9
|
+
* widen it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function canBeOrigin(chainId: number): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether funds can be DELIVERED to this chain — i.e. it is a valid intent
|
|
14
|
+
* destination.
|
|
15
|
+
*
|
|
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.
|
|
20
|
+
*/
|
|
21
|
+
export declare function canBeDestination(chainId: number): boolean;
|
|
4
22
|
/** True when the chain id's vmType is not `'evm'` (Solana, Tron today). */
|
|
5
23
|
export declare function isNonEvmChainId(chainId: number): boolean;
|
|
6
24
|
/**
|
|
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getVmType = getVmType;
|
|
7
|
+
exports.canBeOrigin = canBeOrigin;
|
|
8
|
+
exports.canBeDestination = canBeDestination;
|
|
7
9
|
exports.isNonEvmChainId = isNonEvmChainId;
|
|
8
10
|
exports.getNonEvmChainIds = getNonEvmChainIds;
|
|
9
11
|
exports.getCaip2 = getCaip2;
|
|
@@ -30,6 +32,28 @@ const chainRegistry = chains_json_1.default;
|
|
|
30
32
|
function getVmType(chainId) {
|
|
31
33
|
return chainRegistry[String(chainId)]?.vmType ?? "evm";
|
|
32
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Whether funds can ARRIVE from this chain — i.e. it is a valid deposit source.
|
|
37
|
+
*
|
|
38
|
+
* Absent `roles` means both directions, so every ordinary chain answers true
|
|
39
|
+
* without declaring anything. A consumer may narrow this further; it may not
|
|
40
|
+
* widen it.
|
|
41
|
+
*/
|
|
42
|
+
function canBeOrigin(chainId) {
|
|
43
|
+
return chainRegistry[String(chainId)]?.roles?.origin ?? true;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Whether funds can be DELIVERED to this chain — i.e. it is a valid intent
|
|
47
|
+
* destination.
|
|
48
|
+
*
|
|
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.
|
|
53
|
+
*/
|
|
54
|
+
function canBeDestination(chainId) {
|
|
55
|
+
return chainRegistry[String(chainId)]?.roles?.destination ?? true;
|
|
56
|
+
}
|
|
33
57
|
/** True when the chain id's vmType is not `'evm'` (Solana, Tron today). */
|
|
34
58
|
function isNonEvmChainId(chainId) {
|
|
35
59
|
return getVmType(chainId) !== "evm";
|
package/dist/src/chains.d.ts
CHANGED
|
@@ -40,6 +40,12 @@ interface Chain {
|
|
|
40
40
|
explorer: Explorer | null;
|
|
41
41
|
/** True for virtual chains (e.g. HyperCore) that settle on another chain. */
|
|
42
42
|
virtual?: boolean;
|
|
43
|
+
/** Which directions of transfer the chain supports; absent means both.
|
|
44
|
+
* Read via `canBeOrigin` / `canBeDestination` rather than directly. */
|
|
45
|
+
roles?: {
|
|
46
|
+
origin: boolean;
|
|
47
|
+
destination: boolean;
|
|
48
|
+
};
|
|
43
49
|
nativeToken: NativeToken;
|
|
44
50
|
wrappedNativeToken: NativeToken;
|
|
45
51
|
tokens: Token[];
|
package/dist/src/chains.js
CHANGED
|
@@ -706,6 +706,10 @@ const chains = {
|
|
|
706
706
|
"symbol": "HYPE"
|
|
707
707
|
},
|
|
708
708
|
"network": "mainnet",
|
|
709
|
+
"roles": {
|
|
710
|
+
"destination": false,
|
|
711
|
+
"origin": true
|
|
712
|
+
},
|
|
709
713
|
"settlementLayers": [],
|
|
710
714
|
"stack": "vanilla",
|
|
711
715
|
"swapQuoters": [],
|
|
@@ -1467,6 +1471,86 @@ const chains = {
|
|
|
1467
1471
|
"Alchemy"
|
|
1468
1472
|
]
|
|
1469
1473
|
},
|
|
1474
|
+
"1337001": {
|
|
1475
|
+
"caip2": "hypercore:spot",
|
|
1476
|
+
"explorer": {
|
|
1477
|
+
"addressPath": "/explorer/address/",
|
|
1478
|
+
"txPath": "/explorer/tx/",
|
|
1479
|
+
"url": "https://app.hyperliquid.xyz"
|
|
1480
|
+
},
|
|
1481
|
+
"name": "HyperCore Spot",
|
|
1482
|
+
"nativeToken": {
|
|
1483
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
1484
|
+
"decimals": 18,
|
|
1485
|
+
"symbol": "HYPE"
|
|
1486
|
+
},
|
|
1487
|
+
"network": "mainnet",
|
|
1488
|
+
"roles": {
|
|
1489
|
+
"destination": true,
|
|
1490
|
+
"origin": false
|
|
1491
|
+
},
|
|
1492
|
+
"settlementLayers": [],
|
|
1493
|
+
"stack": "vanilla",
|
|
1494
|
+
"swapQuoters": [],
|
|
1495
|
+
"tokens": [
|
|
1496
|
+
{
|
|
1497
|
+
"address": "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
1498
|
+
"approvalSlot": null,
|
|
1499
|
+
"balanceSlot": null,
|
|
1500
|
+
"decimals": 6,
|
|
1501
|
+
"pegGroup": "USD",
|
|
1502
|
+
"symbol": "USDC"
|
|
1503
|
+
}
|
|
1504
|
+
],
|
|
1505
|
+
"virtual": true,
|
|
1506
|
+
"vmType": "evm",
|
|
1507
|
+
"wrappedNativeToken": {
|
|
1508
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
1509
|
+
"decimals": 18,
|
|
1510
|
+
"symbol": "HYPE"
|
|
1511
|
+
},
|
|
1512
|
+
"providers": []
|
|
1513
|
+
},
|
|
1514
|
+
"1337002": {
|
|
1515
|
+
"caip2": "hypercore:perp",
|
|
1516
|
+
"explorer": {
|
|
1517
|
+
"addressPath": "/explorer/address/",
|
|
1518
|
+
"txPath": "/explorer/tx/",
|
|
1519
|
+
"url": "https://app.hyperliquid.xyz"
|
|
1520
|
+
},
|
|
1521
|
+
"name": "HyperCore Perp",
|
|
1522
|
+
"nativeToken": {
|
|
1523
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
1524
|
+
"decimals": 18,
|
|
1525
|
+
"symbol": "HYPE"
|
|
1526
|
+
},
|
|
1527
|
+
"network": "mainnet",
|
|
1528
|
+
"roles": {
|
|
1529
|
+
"destination": true,
|
|
1530
|
+
"origin": false
|
|
1531
|
+
},
|
|
1532
|
+
"settlementLayers": [],
|
|
1533
|
+
"stack": "vanilla",
|
|
1534
|
+
"swapQuoters": [],
|
|
1535
|
+
"tokens": [
|
|
1536
|
+
{
|
|
1537
|
+
"address": "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
|
|
1538
|
+
"approvalSlot": null,
|
|
1539
|
+
"balanceSlot": null,
|
|
1540
|
+
"decimals": 6,
|
|
1541
|
+
"pegGroup": "USD",
|
|
1542
|
+
"symbol": "USDC"
|
|
1543
|
+
}
|
|
1544
|
+
],
|
|
1545
|
+
"virtual": true,
|
|
1546
|
+
"vmType": "evm",
|
|
1547
|
+
"wrappedNativeToken": {
|
|
1548
|
+
"address": "0x0000000000000000000000000000000000000000",
|
|
1549
|
+
"decimals": 18,
|
|
1550
|
+
"symbol": "HYPE"
|
|
1551
|
+
},
|
|
1552
|
+
"providers": []
|
|
1553
|
+
},
|
|
1470
1554
|
"11155111": {
|
|
1471
1555
|
"caip2": "eip155:11155111",
|
|
1472
1556
|
"explorer": {
|
|
@@ -23,6 +23,8 @@ var MainnetNetwork;
|
|
|
23
23
|
MainnetNetwork[MainnetNetwork["BSC"] = chains_1.bsc.id] = "BSC";
|
|
24
24
|
MainnetNetwork[MainnetNetwork["HYPEREVM"] = chains_1.hyperEvm.id] = "HYPEREVM";
|
|
25
25
|
MainnetNetwork[MainnetNetwork["HYPERCORE"] = 1337] = "HYPERCORE";
|
|
26
|
+
MainnetNetwork[MainnetNetwork["HYPERCORE_SPOT"] = 1337001] = "HYPERCORE_SPOT";
|
|
27
|
+
MainnetNetwork[MainnetNetwork["HYPERCORE_PERP"] = 1337002] = "HYPERCORE_PERP";
|
|
26
28
|
MainnetNetwork[MainnetNetwork["MONAD"] = chains_1.monad.id] = "MONAD";
|
|
27
29
|
MainnetNetwork[MainnetNetwork["UNICHAIN"] = chains_1.unichain.id] = "UNICHAIN";
|
|
28
30
|
MainnetNetwork[MainnetNetwork["SOLANA"] = 792703809] = "SOLANA";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const PACKAGE_VERSION = "1.
|
|
1
|
+
declare const PACKAGE_VERSION = "1.11.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.
|
|
5
|
+
const PACKAGE_VERSION = "1.11.0";
|
|
6
6
|
exports.PACKAGE_VERSION = PACKAGE_VERSION;
|
package/dist/src/hypercore.d.ts
CHANGED
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
2
|
import { MainnetNetwork } from "./generated/networks";
|
|
3
3
|
/**
|
|
4
|
-
* Virtual chain
|
|
5
|
-
*
|
|
6
|
-
* payload binds to 999,
|
|
4
|
+
* Virtual chain ids orchestrators use to address HyperCore as a destination —
|
|
5
|
+
* one per DELIVERY VENUE. Both resolve to HyperEVM (999) at the MetaIntent
|
|
6
|
+
* boundary; the signed EIP-712 payload binds to 999, never to these.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* The venue is part of the destination because the two credit different
|
|
9
|
+
* accounts and the wrong one is invisible: the intent completes, the fill
|
|
10
|
+
* succeeds, and only the recipient's Core state shows where the funds went
|
|
11
|
+
* (RHI-5510). Encoding it in the chain id makes it unforgettable and
|
|
12
|
+
* undroppable — unlike the optional `tokenRequests[].balance` flag it replaces,
|
|
13
|
+
* which four separate field-by-field rebuilds each silently discarded.
|
|
14
|
+
*
|
|
15
|
+
* Read the canonical CAIP-2 via `getCaip2(...)` — `eip155:*` would be wrong for
|
|
16
|
+
* either.
|
|
17
|
+
*/
|
|
18
|
+
export declare const HYPERCORE_SPOT_CHAIN_ID = MainnetNetwork.HYPERCORE_SPOT;
|
|
19
|
+
export declare const HYPERCORE_PERP_CHAIN_ID = MainnetNetwork.HYPERCORE_PERP;
|
|
20
|
+
/**
|
|
21
|
+
* The Core L1 itself (`hypercore:mainnet`) — HyperCore as a deposit SOURCE.
|
|
22
|
+
*
|
|
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 }`.
|
|
26
|
+
*
|
|
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.
|
|
12
30
|
*/
|
|
13
|
-
export declare const
|
|
31
|
+
export declare const HYPERCORE_ORIGIN_CHAIN_ID = 1337;
|
|
14
32
|
/**
|
|
15
33
|
* Real EVM settlement chain for HyperCore destinations. HyperCore is a virtual
|
|
16
|
-
* chain id
|
|
34
|
+
* chain id with no RPC of its own; funds land on HyperEVM (999), where
|
|
17
35
|
* `depositFor` runs. Consumers that need the settlement chain (RPC, EIP-712
|
|
18
36
|
* domain `chainId`, contract dispatch) translate at their boundary via
|
|
19
37
|
* `resolveSettlementChainId`.
|
|
@@ -22,12 +40,27 @@ export declare const HYPERCORE_SETTLEMENT_CHAIN_ID: number;
|
|
|
22
40
|
/**
|
|
23
41
|
* Resolves a (possibly virtual) chain id to the real settlement chain where
|
|
24
42
|
* orchestrator EVM operations execute. Identity for first-party EVM chains
|
|
25
|
-
* and non-EVM chains (bridge-terminated); maps
|
|
26
|
-
* `HYPERCORE_SETTLEMENT_CHAIN_ID
|
|
43
|
+
* and non-EVM chains (bridge-terminated); maps either HyperCore venue id →
|
|
44
|
+
* `HYPERCORE_SETTLEMENT_CHAIN_ID`.
|
|
27
45
|
*/
|
|
28
46
|
export declare function resolveSettlementChainId(chainId: number): number;
|
|
29
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* True for either HyperCore DELIVERY VENUE. Deliberately false for
|
|
49
|
+
* `HYPERCORE_ORIGIN_CHAIN_ID`, which names the Core L1 without naming an account
|
|
50
|
+
* — a caller that passes it fails the destination check loudly instead of
|
|
51
|
+
* routing to a guessed venue.
|
|
52
|
+
*/
|
|
30
53
|
export declare function isHyperCoreChainId(chainId: number): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The `uint32 destinationDex` for `CoreDepositWallet.depositFor` — the single
|
|
56
|
+
* value that decides which HyperCore account is credited. Derived from the
|
|
57
|
+
* destination chain id, so it cannot disagree with what the caller addressed.
|
|
58
|
+
*
|
|
59
|
+
* Throws rather than defaulting: every historical incarnation of a default here
|
|
60
|
+
* (the `?? 'perp'` at the MetaIntent boundary, and `getDepositForCall`'s old
|
|
61
|
+
* optional parameter) produced silently misrouted funds.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getHyperCoreDestinationDex(chainId: number): number;
|
|
31
64
|
/**
|
|
32
65
|
* Hyperliquid CoreWriter precompile on HyperEVM. Not used for USDC delivery
|
|
33
66
|
* — kept as a documented constant for future actions (spot send, vault
|
|
@@ -100,7 +133,10 @@ export declare function getApproveCoreDepositWalletCall(usdcAddress: Address, am
|
|
|
100
133
|
* `recipient`'s HyperCore account with `amount` USDC (in HyperEVM 6-decimal
|
|
101
134
|
* units; Hyperliquid handles the wei-precision conversion internally).
|
|
102
135
|
*
|
|
103
|
-
* `destinationDex
|
|
104
|
-
* `
|
|
136
|
+
* `destinationDex` is REQUIRED — derive it from the destination chain id with
|
|
137
|
+
* `getHyperCoreDestinationDex`. It used to default to `HYPERCORE_SPOT_DEX`
|
|
138
|
+
* here while the orchestrator's caller defaulted to the perp dex, so the two
|
|
139
|
+
* sides documented opposite behaviour for the same omission; that disagreement
|
|
140
|
+
* is the shape of the RHI-5510 bug and a default is what allows it.
|
|
105
141
|
*/
|
|
106
|
-
export declare function getDepositForCall(recipient: Address, amount: bigint, destinationDex
|
|
142
|
+
export declare function getDepositForCall(recipient: Address, amount: bigint, destinationDex: number): HyperCoreExecution;
|
package/dist/src/hypercore.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.coreDepositWalletAbi = exports.HYPERCORE_USDC_ACTIVATION_FEE = exports.HYPERCORE_DEFAULT_PERP_DEX = exports.HYPERCORE_SPOT_DEX = exports.CORE_DEPOSIT_WALLET = exports.CORE_WRITER_PRECOMPILE = exports.HYPERCORE_SETTLEMENT_CHAIN_ID = exports.
|
|
3
|
+
exports.coreDepositWalletAbi = exports.HYPERCORE_USDC_ACTIVATION_FEE = exports.HYPERCORE_DEFAULT_PERP_DEX = exports.HYPERCORE_SPOT_DEX = exports.CORE_DEPOSIT_WALLET = exports.CORE_WRITER_PRECOMPILE = exports.HYPERCORE_SETTLEMENT_CHAIN_ID = exports.HYPERCORE_ORIGIN_CHAIN_ID = exports.HYPERCORE_PERP_CHAIN_ID = exports.HYPERCORE_SPOT_CHAIN_ID = void 0;
|
|
4
4
|
exports.resolveSettlementChainId = resolveSettlementChainId;
|
|
5
5
|
exports.isHyperCoreChainId = isHyperCoreChainId;
|
|
6
|
+
exports.getHyperCoreDestinationDex = getHyperCoreDestinationDex;
|
|
6
7
|
exports.getApproveCoreDepositWalletCall = getApproveCoreDepositWalletCall;
|
|
7
8
|
exports.getDepositForCall = getDepositForCall;
|
|
8
9
|
const viem_1 = require("viem");
|
|
@@ -30,19 +31,37 @@ const networks_1 = require("./generated/networks");
|
|
|
30
31
|
// bridging behavior below stays here rather than in the generated registry.
|
|
31
32
|
// ---------------------------------------------------------------------------
|
|
32
33
|
/**
|
|
33
|
-
* Virtual chain
|
|
34
|
-
*
|
|
35
|
-
* payload binds to 999,
|
|
34
|
+
* Virtual chain ids orchestrators use to address HyperCore as a destination —
|
|
35
|
+
* one per DELIVERY VENUE. Both resolve to HyperEVM (999) at the MetaIntent
|
|
36
|
+
* boundary; the signed EIP-712 payload binds to 999, never to these.
|
|
36
37
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
38
|
+
* The venue is part of the destination because the two credit different
|
|
39
|
+
* accounts and the wrong one is invisible: the intent completes, the fill
|
|
40
|
+
* succeeds, and only the recipient's Core state shows where the funds went
|
|
41
|
+
* (RHI-5510). Encoding it in the chain id makes it unforgettable and
|
|
42
|
+
* undroppable — unlike the optional `tokenRequests[].balance` flag it replaces,
|
|
43
|
+
* which four separate field-by-field rebuilds each silently discarded.
|
|
44
|
+
*
|
|
45
|
+
* Read the canonical CAIP-2 via `getCaip2(...)` — `eip155:*` would be wrong for
|
|
46
|
+
* either.
|
|
47
|
+
*/
|
|
48
|
+
exports.HYPERCORE_SPOT_CHAIN_ID = networks_1.MainnetNetwork.HYPERCORE_SPOT;
|
|
49
|
+
exports.HYPERCORE_PERP_CHAIN_ID = networks_1.MainnetNetwork.HYPERCORE_PERP;
|
|
50
|
+
/**
|
|
51
|
+
* The Core L1 itself (`hypercore:mainnet`) — HyperCore as a deposit SOURCE.
|
|
52
|
+
*
|
|
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 }`.
|
|
56
|
+
*
|
|
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.
|
|
41
60
|
*/
|
|
42
|
-
exports.
|
|
61
|
+
exports.HYPERCORE_ORIGIN_CHAIN_ID = 1337;
|
|
43
62
|
/**
|
|
44
63
|
* Real EVM settlement chain for HyperCore destinations. HyperCore is a virtual
|
|
45
|
-
* chain id
|
|
64
|
+
* chain id with no RPC of its own; funds land on HyperEVM (999), where
|
|
46
65
|
* `depositFor` runs. Consumers that need the settlement chain (RPC, EIP-712
|
|
47
66
|
* domain `chainId`, contract dispatch) translate at their boundary via
|
|
48
67
|
* `resolveSettlementChainId`.
|
|
@@ -51,15 +70,36 @@ exports.HYPERCORE_SETTLEMENT_CHAIN_ID = networks_1.MainnetNetwork.HYPEREVM;
|
|
|
51
70
|
/**
|
|
52
71
|
* Resolves a (possibly virtual) chain id to the real settlement chain where
|
|
53
72
|
* orchestrator EVM operations execute. Identity for first-party EVM chains
|
|
54
|
-
* and non-EVM chains (bridge-terminated); maps
|
|
55
|
-
* `HYPERCORE_SETTLEMENT_CHAIN_ID
|
|
73
|
+
* and non-EVM chains (bridge-terminated); maps either HyperCore venue id →
|
|
74
|
+
* `HYPERCORE_SETTLEMENT_CHAIN_ID`.
|
|
56
75
|
*/
|
|
57
76
|
function resolveSettlementChainId(chainId) {
|
|
58
|
-
return chainId
|
|
77
|
+
return isHyperCoreChainId(chainId) ? exports.HYPERCORE_SETTLEMENT_CHAIN_ID : chainId;
|
|
59
78
|
}
|
|
60
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* True for either HyperCore DELIVERY VENUE. Deliberately false for
|
|
81
|
+
* `HYPERCORE_ORIGIN_CHAIN_ID`, which names the Core L1 without naming an account
|
|
82
|
+
* — a caller that passes it fails the destination check loudly instead of
|
|
83
|
+
* routing to a guessed venue.
|
|
84
|
+
*/
|
|
61
85
|
function isHyperCoreChainId(chainId) {
|
|
62
|
-
return chainId === exports.
|
|
86
|
+
return (chainId === exports.HYPERCORE_SPOT_CHAIN_ID || chainId === exports.HYPERCORE_PERP_CHAIN_ID);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The `uint32 destinationDex` for `CoreDepositWallet.depositFor` — the single
|
|
90
|
+
* value that decides which HyperCore account is credited. Derived from the
|
|
91
|
+
* destination chain id, so it cannot disagree with what the caller addressed.
|
|
92
|
+
*
|
|
93
|
+
* Throws rather than defaulting: every historical incarnation of a default here
|
|
94
|
+
* (the `?? 'perp'` at the MetaIntent boundary, and `getDepositForCall`'s old
|
|
95
|
+
* optional parameter) produced silently misrouted funds.
|
|
96
|
+
*/
|
|
97
|
+
function getHyperCoreDestinationDex(chainId) {
|
|
98
|
+
if (chainId === exports.HYPERCORE_SPOT_CHAIN_ID)
|
|
99
|
+
return exports.HYPERCORE_SPOT_DEX;
|
|
100
|
+
if (chainId === exports.HYPERCORE_PERP_CHAIN_ID)
|
|
101
|
+
return exports.HYPERCORE_DEFAULT_PERP_DEX;
|
|
102
|
+
throw new Error(`getHyperCoreDestinationDex: ${chainId} is not a HyperCore venue (expected ${exports.HYPERCORE_SPOT_CHAIN_ID} spot or ${exports.HYPERCORE_PERP_CHAIN_ID} perp)`);
|
|
63
103
|
}
|
|
64
104
|
/**
|
|
65
105
|
* Hyperliquid CoreWriter precompile on HyperEVM. Not used for USDC delivery
|
|
@@ -127,10 +167,13 @@ function getApproveCoreDepositWalletCall(usdcAddress, amount) {
|
|
|
127
167
|
* `recipient`'s HyperCore account with `amount` USDC (in HyperEVM 6-decimal
|
|
128
168
|
* units; Hyperliquid handles the wei-precision conversion internally).
|
|
129
169
|
*
|
|
130
|
-
* `destinationDex
|
|
131
|
-
* `
|
|
170
|
+
* `destinationDex` is REQUIRED — derive it from the destination chain id with
|
|
171
|
+
* `getHyperCoreDestinationDex`. It used to default to `HYPERCORE_SPOT_DEX`
|
|
172
|
+
* here while the orchestrator's caller defaulted to the perp dex, so the two
|
|
173
|
+
* sides documented opposite behaviour for the same omission; that disagreement
|
|
174
|
+
* is the shape of the RHI-5510 bug and a default is what allows it.
|
|
132
175
|
*/
|
|
133
|
-
function getDepositForCall(recipient, amount, destinationDex
|
|
176
|
+
function getDepositForCall(recipient, amount, destinationDex) {
|
|
134
177
|
return {
|
|
135
178
|
to: exports.CORE_DEPOSIT_WALLET,
|
|
136
179
|
value: 0n,
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { contractAddresses } from "./generated/contracts";
|
|
2
2
|
import { contractAddresses as contractAddressesDev } from "./generated/contracts.dev";
|
|
3
|
-
import type { ChainEntry, ChainExplorer, ChainItem, ChainList, ChainNetwork, ChainStack, ChainRegistry, ProviderName, ProviderRegistry, SettlementLayer, SupportedChain, SupportedMainnet, SupportedOPStackMainnet, SupportedOPStackTestnet, SupportedTestnet, SwapQuoter } from "./types";
|
|
3
|
+
import type { ChainEntry, ChainExplorer, ChainItem, ChainList, ChainNetwork, ChainStack, ChainRegistry, ChainRoles, ProviderName, ProviderRegistry, SettlementLayer, SupportedChain, SupportedMainnet, SupportedOPStackMainnet, SupportedOPStackTestnet, SupportedTestnet, SwapQuoter } from "./types";
|
|
4
4
|
import { chains, MainnetNetwork, mainnetChains, OPStackChains, TestnetNetwork, testnetChains } from "./types";
|
|
5
5
|
import type { PegGroup } from "./types";
|
|
6
6
|
import { getOftConfig, getSupportedOftTokens, hasOftSupport, OFT_REGISTRY } from "./oft";
|
|
7
7
|
import type { OftConfig } from "./oft";
|
|
8
|
-
import { CORE_DEPOSIT_WALLET, CORE_WRITER_PRECOMPILE, getApproveCoreDepositWalletCall, getDepositForCall,
|
|
9
|
-
import { chainIdFromCaip2, getCaip2, getNonEvmChainIds, isNonEvmChainId } from "./chainVirtualization";
|
|
8
|
+
import { CORE_DEPOSIT_WALLET, CORE_WRITER_PRECOMPILE, getApproveCoreDepositWalletCall, getDepositForCall, getHyperCoreDestinationDex, HYPERCORE_DEFAULT_PERP_DEX, HYPERCORE_ORIGIN_CHAIN_ID, HYPERCORE_PERP_CHAIN_ID, HYPERCORE_SETTLEMENT_CHAIN_ID, HYPERCORE_SPOT_CHAIN_ID, HYPERCORE_SPOT_DEX, HYPERCORE_USDC_ACTIVATION_FEE, isHyperCoreChainId, resolveSettlementChainId } from "./hypercore";
|
|
9
|
+
import { chainIdFromCaip2, getCaip2, getNonEvmChainIds, canBeDestination, canBeOrigin, isNonEvmChainId } from "./chainVirtualization";
|
|
10
10
|
import { createChainFactsClient } from "./chainFactsClient";
|
|
11
11
|
import { CHAIN_FACTS_LATEST_URL, CHAIN_FACTS_PUBLIC_KEY } from "./generated/chainFactsKey";
|
|
12
12
|
import type { ChainFactsClient, ChainFactsClientOptions, ChainFactsErrorPhase, ChainFactsPayload, ChainFactsSnapshot, ChainFactsSource } from "./chainFactsClient";
|
|
@@ -15,6 +15,6 @@ declare const providerRegistry: ProviderRegistry;
|
|
|
15
15
|
declare const mainnetChainList: ChainList;
|
|
16
16
|
declare const testnetChainList: ChainList;
|
|
17
17
|
declare function chainHasUnpricedTokens(chainId: number): boolean;
|
|
18
|
-
export { chainRegistry, providerRegistry, mainnetChainList, testnetChainList, contractAddresses, contractAddressesDev, chains, mainnetChains, testnetChains, MainnetNetwork, OPStackChains, TestnetNetwork, OFT_REGISTRY, getOftConfig, hasOftSupport, getSupportedOftTokens, chainHasUnpricedTokens,
|
|
19
|
-
export type { ChainEntry, ChainExplorer, ChainItem, ChainList, ChainNetwork, ChainStack, ChainRegistry, ProviderRegistry, ProviderName, SwapQuoter, SupportedMainnet, SupportedTestnet, SupportedChain, SupportedOPStackMainnet, SupportedOPStackTestnet, SettlementLayer, OftConfig, PegGroup, ChainFactsClient, ChainFactsClientOptions, ChainFactsErrorPhase, ChainFactsPayload, ChainFactsSnapshot, ChainFactsSource, };
|
|
18
|
+
export { chainRegistry, providerRegistry, mainnetChainList, testnetChainList, contractAddresses, contractAddressesDev, chains, mainnetChains, testnetChains, MainnetNetwork, OPStackChains, TestnetNetwork, OFT_REGISTRY, getOftConfig, hasOftSupport, getSupportedOftTokens, chainHasUnpricedTokens, HYPERCORE_SPOT_CHAIN_ID, HYPERCORE_PERP_CHAIN_ID, HYPERCORE_ORIGIN_CHAIN_ID, getHyperCoreDestinationDex, HYPERCORE_SETTLEMENT_CHAIN_ID, CORE_WRITER_PRECOMPILE, CORE_DEPOSIT_WALLET, HYPERCORE_SPOT_DEX, HYPERCORE_DEFAULT_PERP_DEX, HYPERCORE_USDC_ACTIVATION_FEE, getApproveCoreDepositWalletCall, getDepositForCall, isHyperCoreChainId, resolveSettlementChainId, canBeOrigin, canBeDestination, isNonEvmChainId, getNonEvmChainIds, getCaip2, chainIdFromCaip2, createChainFactsClient, CHAIN_FACTS_LATEST_URL, CHAIN_FACTS_PUBLIC_KEY, };
|
|
19
|
+
export type { ChainEntry, ChainExplorer, ChainItem, ChainList, ChainNetwork, ChainStack, ChainRegistry, ChainRoles, ProviderRegistry, ProviderName, SwapQuoter, SupportedMainnet, SupportedTestnet, SupportedChain, SupportedOPStackMainnet, SupportedOPStackTestnet, SettlementLayer, OftConfig, PegGroup, ChainFactsClient, ChainFactsClientOptions, ChainFactsErrorPhase, ChainFactsPayload, ChainFactsSnapshot, ChainFactsSource, };
|
|
20
20
|
export * from "./abis";
|
package/dist/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.CHAIN_FACTS_PUBLIC_KEY = exports.CHAIN_FACTS_LATEST_URL = exports.createChainFactsClient = exports.chainIdFromCaip2 = exports.getCaip2 = exports.getNonEvmChainIds = exports.isNonEvmChainId = exports.resolveSettlementChainId = exports.isHyperCoreChainId = exports.getDepositForCall = exports.getApproveCoreDepositWalletCall = exports.HYPERCORE_USDC_ACTIVATION_FEE = exports.HYPERCORE_DEFAULT_PERP_DEX = exports.HYPERCORE_SPOT_DEX = exports.CORE_DEPOSIT_WALLET = exports.CORE_WRITER_PRECOMPILE = exports.HYPERCORE_SETTLEMENT_CHAIN_ID = exports.
|
|
20
|
+
exports.CHAIN_FACTS_PUBLIC_KEY = exports.CHAIN_FACTS_LATEST_URL = exports.createChainFactsClient = exports.chainIdFromCaip2 = exports.getCaip2 = exports.getNonEvmChainIds = exports.isNonEvmChainId = exports.canBeDestination = exports.canBeOrigin = exports.resolveSettlementChainId = exports.isHyperCoreChainId = exports.getDepositForCall = exports.getApproveCoreDepositWalletCall = exports.HYPERCORE_USDC_ACTIVATION_FEE = exports.HYPERCORE_DEFAULT_PERP_DEX = exports.HYPERCORE_SPOT_DEX = exports.CORE_DEPOSIT_WALLET = exports.CORE_WRITER_PRECOMPILE = exports.HYPERCORE_SETTLEMENT_CHAIN_ID = exports.getHyperCoreDestinationDex = exports.HYPERCORE_ORIGIN_CHAIN_ID = exports.HYPERCORE_PERP_CHAIN_ID = exports.HYPERCORE_SPOT_CHAIN_ID = exports.getSupportedOftTokens = exports.hasOftSupport = exports.getOftConfig = exports.OFT_REGISTRY = exports.TestnetNetwork = exports.OPStackChains = exports.MainnetNetwork = exports.testnetChains = exports.mainnetChains = exports.chains = exports.contractAddressesDev = exports.contractAddresses = exports.testnetChainList = exports.mainnetChainList = exports.providerRegistry = exports.chainRegistry = void 0;
|
|
21
21
|
exports.chainHasUnpricedTokens = chainHasUnpricedTokens;
|
|
22
22
|
const chains_json_1 = __importDefault(require("../configs/chains.json"));
|
|
23
23
|
const mainnets_json_1 = __importDefault(require("../configs/mainnets.json"));
|
|
@@ -44,9 +44,12 @@ Object.defineProperty(exports, "CORE_DEPOSIT_WALLET", { enumerable: true, get: f
|
|
|
44
44
|
Object.defineProperty(exports, "CORE_WRITER_PRECOMPILE", { enumerable: true, get: function () { return hypercore_1.CORE_WRITER_PRECOMPILE; } });
|
|
45
45
|
Object.defineProperty(exports, "getApproveCoreDepositWalletCall", { enumerable: true, get: function () { return hypercore_1.getApproveCoreDepositWalletCall; } });
|
|
46
46
|
Object.defineProperty(exports, "getDepositForCall", { enumerable: true, get: function () { return hypercore_1.getDepositForCall; } });
|
|
47
|
-
Object.defineProperty(exports, "
|
|
47
|
+
Object.defineProperty(exports, "getHyperCoreDestinationDex", { enumerable: true, get: function () { return hypercore_1.getHyperCoreDestinationDex; } });
|
|
48
48
|
Object.defineProperty(exports, "HYPERCORE_DEFAULT_PERP_DEX", { enumerable: true, get: function () { return hypercore_1.HYPERCORE_DEFAULT_PERP_DEX; } });
|
|
49
|
+
Object.defineProperty(exports, "HYPERCORE_ORIGIN_CHAIN_ID", { enumerable: true, get: function () { return hypercore_1.HYPERCORE_ORIGIN_CHAIN_ID; } });
|
|
50
|
+
Object.defineProperty(exports, "HYPERCORE_PERP_CHAIN_ID", { enumerable: true, get: function () { return hypercore_1.HYPERCORE_PERP_CHAIN_ID; } });
|
|
49
51
|
Object.defineProperty(exports, "HYPERCORE_SETTLEMENT_CHAIN_ID", { enumerable: true, get: function () { return hypercore_1.HYPERCORE_SETTLEMENT_CHAIN_ID; } });
|
|
52
|
+
Object.defineProperty(exports, "HYPERCORE_SPOT_CHAIN_ID", { enumerable: true, get: function () { return hypercore_1.HYPERCORE_SPOT_CHAIN_ID; } });
|
|
50
53
|
Object.defineProperty(exports, "HYPERCORE_SPOT_DEX", { enumerable: true, get: function () { return hypercore_1.HYPERCORE_SPOT_DEX; } });
|
|
51
54
|
Object.defineProperty(exports, "HYPERCORE_USDC_ACTIVATION_FEE", { enumerable: true, get: function () { return hypercore_1.HYPERCORE_USDC_ACTIVATION_FEE; } });
|
|
52
55
|
Object.defineProperty(exports, "isHyperCoreChainId", { enumerable: true, get: function () { return hypercore_1.isHyperCoreChainId; } });
|
|
@@ -55,6 +58,8 @@ const chainVirtualization_1 = require("./chainVirtualization");
|
|
|
55
58
|
Object.defineProperty(exports, "chainIdFromCaip2", { enumerable: true, get: function () { return chainVirtualization_1.chainIdFromCaip2; } });
|
|
56
59
|
Object.defineProperty(exports, "getCaip2", { enumerable: true, get: function () { return chainVirtualization_1.getCaip2; } });
|
|
57
60
|
Object.defineProperty(exports, "getNonEvmChainIds", { enumerable: true, get: function () { return chainVirtualization_1.getNonEvmChainIds; } });
|
|
61
|
+
Object.defineProperty(exports, "canBeDestination", { enumerable: true, get: function () { return chainVirtualization_1.canBeDestination; } });
|
|
62
|
+
Object.defineProperty(exports, "canBeOrigin", { enumerable: true, get: function () { return chainVirtualization_1.canBeOrigin; } });
|
|
58
63
|
Object.defineProperty(exports, "isNonEvmChainId", { enumerable: true, get: function () { return chainVirtualization_1.isNonEvmChainId; } });
|
|
59
64
|
const chainFactsClient_1 = require("./chainFactsClient");
|
|
60
65
|
Object.defineProperty(exports, "createChainFactsClient", { enumerable: true, get: function () { return chainFactsClient_1.createChainFactsClient; } });
|
package/dist/src/types.d.ts
CHANGED
|
@@ -73,6 +73,10 @@ interface NativeTokenEntry {
|
|
|
73
73
|
interface SwapQuoterConfig {
|
|
74
74
|
slug?: string;
|
|
75
75
|
}
|
|
76
|
+
interface ChainRoles {
|
|
77
|
+
origin: boolean;
|
|
78
|
+
destination: boolean;
|
|
79
|
+
}
|
|
76
80
|
interface ChainEntry {
|
|
77
81
|
name: string;
|
|
78
82
|
vmType: VmType;
|
|
@@ -133,6 +137,27 @@ interface ChainEntry {
|
|
|
133
137
|
* real chains.
|
|
134
138
|
*/
|
|
135
139
|
virtual?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Which directions of value transfer this chain supports.
|
|
142
|
+
*
|
|
143
|
+
* `origin` — funds can ARRIVE from here (a deposit source).
|
|
144
|
+
* `destination` — funds can be DELIVERED here (an intent destination).
|
|
145
|
+
*
|
|
146
|
+
* Omitted means both, so every ordinary chain is unaffected.
|
|
147
|
+
*
|
|
148
|
+
* Declared rather than inferred because the answer varies WITHIN a CAIP-2
|
|
149
|
+
* namespace, which is how consumers currently decide it. The three HyperCore
|
|
150
|
+
* entries are all `hypercore:` and disagree: the Core L1 is a source only, the
|
|
151
|
+
* two venues are destinations only. A `switch (namespace)` cannot express that
|
|
152
|
+
* at all — not awkwardly, but not at all — so without this the split needs a
|
|
153
|
+
* chain-id special case in every consumer that publishes or validates a
|
|
154
|
+
* direction.
|
|
155
|
+
*
|
|
156
|
+
* A consumer may still be MORE restrictive than the registry (a service that
|
|
157
|
+
* can see a chain's deposits but chooses not to advertise them stays free to
|
|
158
|
+
* say so). This is the outer bound: what the chain itself permits.
|
|
159
|
+
*/
|
|
160
|
+
roles?: ChainRoles;
|
|
136
161
|
nativeToken: NativeTokenEntry;
|
|
137
162
|
wrappedNativeToken: NativeTokenEntry;
|
|
138
163
|
tokens: TokenEntry[];
|
|
@@ -184,4 +209,4 @@ interface ErpcConfig {
|
|
|
184
209
|
providerIdPrefix: Record<string, string>;
|
|
185
210
|
}
|
|
186
211
|
export { OPStackChains, MainnetNetwork, TestnetNetwork, mainnetChains, testnetChains, chains, PEG_GROUPS };
|
|
187
|
-
export type { ChainItem, ChainEntry, ChainExplorer, ChainNetwork, ChainRegistry, ChainStack, ChainList, ContractAddresses, ProviderRegistry, ProviderName, SettlementLayer, SupportedTestnet, SupportedMainnet, SupportedOPStackMainnet, SupportedOPStackTestnet, SupportedChain, SwapQuoter, SwapQuoterConfig, PegGroup, VmType, ErpcFailsafe, ErpcChainOverride, ErpcConfig, };
|
|
212
|
+
export type { ChainItem, ChainEntry, ChainExplorer, ChainNetwork, ChainRegistry, ChainRoles, ChainStack, ChainList, ContractAddresses, ProviderRegistry, ProviderName, SettlementLayer, SupportedTestnet, SupportedMainnet, SupportedOPStackMainnet, SupportedOPStackTestnet, SupportedChain, SwapQuoter, SwapQuoterConfig, PegGroup, VmType, ErpcFailsafe, ErpcChainOverride, ErpcConfig, };
|