@layerzerolabs/lz-definitions 3.0.15 → 3.0.17
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/CHANGELOG.md +13 -0
- package/README.md +376 -0
- package/dist/index.cjs +37 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +358 -8
- package/dist/index.d.ts +358 -8
- package/dist/index.mjs +37 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing different Aptos-compatible chains.
|
|
3
|
+
*/
|
|
1
4
|
declare enum AptosChain {
|
|
2
5
|
APTOS = "aptos",
|
|
3
6
|
MOVEMENT = "movement"
|
|
4
7
|
}
|
|
5
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Enum representing different EVM-compatible chains.
|
|
11
|
+
*/
|
|
6
12
|
declare enum EvmChain {
|
|
7
13
|
ETHEREUM = "ethereum",
|
|
8
14
|
BSC = "bsc",
|
|
@@ -176,22 +182,39 @@ declare enum EvmChain {
|
|
|
176
182
|
MOKSHA = "moksha",
|
|
177
183
|
EDU = "edu",
|
|
178
184
|
CITREA = "citrea",
|
|
179
|
-
ISLANDER = "islander"
|
|
185
|
+
ISLANDER = "islander",
|
|
186
|
+
BL3 = "bl3",
|
|
187
|
+
MP1 = "mp1"
|
|
180
188
|
}
|
|
181
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Enum representing different Initia-compatible chains.
|
|
192
|
+
*/
|
|
182
193
|
declare enum InitiaChain {
|
|
183
194
|
INITIA = "initia"
|
|
184
195
|
}
|
|
185
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Enum representing different Solana-compatible chains.
|
|
199
|
+
*/
|
|
186
200
|
declare enum SolanaChain {
|
|
187
201
|
SOLANA = "solana"
|
|
188
202
|
}
|
|
189
203
|
|
|
204
|
+
/**
|
|
205
|
+
* Enum representing different Ton-compatible chains.
|
|
206
|
+
*/
|
|
190
207
|
declare enum TonChain {
|
|
191
208
|
TON = "ton"
|
|
192
209
|
}
|
|
193
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Type representing a union of all supported chains.
|
|
213
|
+
*/
|
|
194
214
|
type Chain = EvmChain | AptosChain | SolanaChain | InitiaChain | TonChain;
|
|
215
|
+
/**
|
|
216
|
+
* Object containing all supported chains.
|
|
217
|
+
*/
|
|
195
218
|
declare const Chain: {
|
|
196
219
|
TON: TonChain.TON;
|
|
197
220
|
INITIA: InitiaChain.INITIA;
|
|
@@ -371,8 +394,13 @@ declare const Chain: {
|
|
|
371
394
|
EDU: EvmChain.EDU;
|
|
372
395
|
CITREA: EvmChain.CITREA;
|
|
373
396
|
ISLANDER: EvmChain.ISLANDER;
|
|
397
|
+
BL3: EvmChain.BL3;
|
|
398
|
+
MP1: EvmChain.MP1;
|
|
374
399
|
};
|
|
375
400
|
|
|
401
|
+
/**
|
|
402
|
+
* Enum representing different chain types.
|
|
403
|
+
*/
|
|
376
404
|
declare enum ChainType {
|
|
377
405
|
UNKNOWN = "unknown",
|
|
378
406
|
EVM = "evm",
|
|
@@ -383,6 +411,9 @@ declare enum ChainType {
|
|
|
383
411
|
}
|
|
384
412
|
|
|
385
413
|
declare const EndpointV2IdBase = 30000;
|
|
414
|
+
/**
|
|
415
|
+
* Enum representing different endpoint ids on mainnet. (Adapt Endpoint V1)
|
|
416
|
+
*/
|
|
386
417
|
declare enum MainnetEndpointId {
|
|
387
418
|
ETHEREUM_MAINNET = 101,
|
|
388
419
|
BSC_MAINNET = 102,
|
|
@@ -492,6 +523,9 @@ declare enum MainnetEndpointId {
|
|
|
492
523
|
HEMI_MAINNET = 329,
|
|
493
524
|
ISLANDER_MAINNET = 330
|
|
494
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Enum representing different endpoint ids on testnet. (Adapt Endpoint V1)
|
|
528
|
+
*/
|
|
495
529
|
declare enum TestnetEndpointId {
|
|
496
530
|
BSC_TESTNET = 10102,
|
|
497
531
|
AVALANCHE_TESTNET = 10106,
|
|
@@ -650,8 +684,13 @@ declare enum TestnetEndpointId {
|
|
|
650
684
|
ODYSSEY_TESTNET = 10340,
|
|
651
685
|
SOPHON_TESTNET = 10341,
|
|
652
686
|
MOKSHA_TESTNET = 10342,
|
|
653
|
-
CITREA_TESTNET = 10344
|
|
687
|
+
CITREA_TESTNET = 10344,
|
|
688
|
+
MP1_TESTNET = 10345,
|
|
689
|
+
BL3_TESTNET = 10346
|
|
654
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* Enum representing different endpoint ids on sandbox. (Adapt Endpoint V1)
|
|
693
|
+
*/
|
|
655
694
|
declare enum SandboxEndpointId {
|
|
656
695
|
BSC_SANDBOX = 20102,
|
|
657
696
|
AVALANCHE_SANDBOX = 20106,
|
|
@@ -665,6 +704,9 @@ declare enum SandboxEndpointId {
|
|
|
665
704
|
FANTOM_SANDBOX = 20112,
|
|
666
705
|
METIS_SANDBOX = 20151
|
|
667
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* Enum representing different endpoint ids on mainnet. (Adapt Endpoint V2)
|
|
709
|
+
*/
|
|
668
710
|
declare enum MainnetV2EndpointId {
|
|
669
711
|
ETHEREUM_V2_MAINNET = 30101,
|
|
670
712
|
BSC_V2_MAINNET = 30102,
|
|
@@ -777,6 +819,9 @@ declare enum MainnetV2EndpointId {
|
|
|
777
819
|
HEMI_V2_MAINNET = 30329,
|
|
778
820
|
ISLANDER_V2_MAINNET = 30330
|
|
779
821
|
}
|
|
822
|
+
/**
|
|
823
|
+
* Enum representing different endpoint ids on testnet. (Adapt Endpoint V2)
|
|
824
|
+
*/
|
|
780
825
|
declare enum TestnetV2EndpointId {
|
|
781
826
|
AVALANCHE_V2_TESTNET = 40106,
|
|
782
827
|
POLYGON_V2_TESTNET = 40109,
|
|
@@ -936,8 +981,13 @@ declare enum TestnetV2EndpointId {
|
|
|
936
981
|
SOPHON_V2_TESTNET = 40341,
|
|
937
982
|
MOKSHA_V2_TESTNET = 40342,
|
|
938
983
|
TON_V2_TESTNET = 40343,
|
|
939
|
-
CITREA_V2_TESTNET = 40344
|
|
984
|
+
CITREA_V2_TESTNET = 40344,
|
|
985
|
+
MP1_V2_TESTNET = 40345,
|
|
986
|
+
BL3_V2_TESTNET = 40346
|
|
940
987
|
}
|
|
988
|
+
/**
|
|
989
|
+
* Enum representing different endpoint ids on sandbox. (Adapt Endpoint V2)
|
|
990
|
+
*/
|
|
941
991
|
declare enum SandboxV2EndpointId {
|
|
942
992
|
ETHEREUM_V2_SANDBOX = 50121,
|
|
943
993
|
POLYGON_V2_SANDBOX = 50109,
|
|
@@ -954,6 +1004,10 @@ declare enum SandboxV2EndpointId {
|
|
|
954
1004
|
ARBITRUM_V2_SANDBOX = 50143,
|
|
955
1005
|
TON_V2_SANDBOX = 50343
|
|
956
1006
|
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Object containing all supported endpoint IDs.
|
|
1009
|
+
* This object merges endpoint IDs from mainnet, testnet, and sandbox environments, including both V1 and V2 versions.
|
|
1010
|
+
*/
|
|
957
1011
|
declare const EndpointId: {
|
|
958
1012
|
[x: number]: string;
|
|
959
1013
|
ETHEREUM_V2_SANDBOX: SandboxV2EndpointId.ETHEREUM_V2_SANDBOX;
|
|
@@ -1129,6 +1183,8 @@ declare const EndpointId: {
|
|
|
1129
1183
|
MOKSHA_V2_TESTNET: TestnetV2EndpointId.MOKSHA_V2_TESTNET;
|
|
1130
1184
|
TON_V2_TESTNET: TestnetV2EndpointId.TON_V2_TESTNET;
|
|
1131
1185
|
CITREA_V2_TESTNET: TestnetV2EndpointId.CITREA_V2_TESTNET;
|
|
1186
|
+
MP1_V2_TESTNET: TestnetV2EndpointId.MP1_V2_TESTNET;
|
|
1187
|
+
BL3_V2_TESTNET: TestnetV2EndpointId.BL3_V2_TESTNET;
|
|
1132
1188
|
ETHEREUM_V2_MAINNET: MainnetV2EndpointId.ETHEREUM_V2_MAINNET;
|
|
1133
1189
|
BSC_V2_MAINNET: MainnetV2EndpointId.BSC_V2_MAINNET;
|
|
1134
1190
|
AVALANCHE_V2_MAINNET: MainnetV2EndpointId.AVALANCHE_V2_MAINNET;
|
|
@@ -1408,6 +1464,8 @@ declare const EndpointId: {
|
|
|
1408
1464
|
SOPHON_TESTNET: TestnetEndpointId.SOPHON_TESTNET;
|
|
1409
1465
|
MOKSHA_TESTNET: TestnetEndpointId.MOKSHA_TESTNET;
|
|
1410
1466
|
CITREA_TESTNET: TestnetEndpointId.CITREA_TESTNET;
|
|
1467
|
+
MP1_TESTNET: TestnetEndpointId.MP1_TESTNET;
|
|
1468
|
+
BL3_TESTNET: TestnetEndpointId.BL3_TESTNET;
|
|
1411
1469
|
ETHEREUM_MAINNET: MainnetEndpointId.ETHEREUM_MAINNET;
|
|
1412
1470
|
BSC_MAINNET: MainnetEndpointId.BSC_MAINNET;
|
|
1413
1471
|
AVALANCHE_MAINNET: MainnetEndpointId.AVALANCHE_MAINNET;
|
|
@@ -1516,8 +1574,15 @@ declare const EndpointId: {
|
|
|
1516
1574
|
HEMI_MAINNET: MainnetEndpointId.HEMI_MAINNET;
|
|
1517
1575
|
ISLANDER_MAINNET: MainnetEndpointId.ISLANDER_MAINNET;
|
|
1518
1576
|
};
|
|
1577
|
+
/**
|
|
1578
|
+
* Type representing a union of all supported endpoint IDs.
|
|
1579
|
+
* This type includes endpoint IDs from mainnet, testnet, and sandbox environments, including both V1 and V2 versions.
|
|
1580
|
+
*/
|
|
1519
1581
|
type EndpointId = MainnetEndpointId | TestnetEndpointId | SandboxEndpointId | MainnetV2EndpointId | TestnetV2EndpointId | SandboxV2EndpointId;
|
|
1520
1582
|
|
|
1583
|
+
/**
|
|
1584
|
+
* Enum representing different environment.
|
|
1585
|
+
*/
|
|
1521
1586
|
declare enum Environment {
|
|
1522
1587
|
LOCAL = "local",
|
|
1523
1588
|
DEVNET = "devnet",
|
|
@@ -1525,30 +1590,51 @@ declare enum Environment {
|
|
|
1525
1590
|
MAINNET = "mainnet"
|
|
1526
1591
|
}
|
|
1527
1592
|
|
|
1593
|
+
/**
|
|
1594
|
+
* Enum representing different stages.
|
|
1595
|
+
*/
|
|
1528
1596
|
declare enum Stage {
|
|
1529
1597
|
MAINNET = "mainnet",
|
|
1530
1598
|
TESTNET = "testnet",
|
|
1531
1599
|
SANDBOX = "sandbox"
|
|
1532
1600
|
}
|
|
1533
1601
|
|
|
1602
|
+
/**
|
|
1603
|
+
* Enum representing different Endpoint versions.
|
|
1604
|
+
*/
|
|
1534
1605
|
declare enum EndpointVersion {
|
|
1535
1606
|
V1 = "v1",
|
|
1536
1607
|
V2 = "v2"
|
|
1537
1608
|
}
|
|
1538
1609
|
|
|
1610
|
+
/**
|
|
1611
|
+
* Enum representing the versions for READ MessageLib.
|
|
1612
|
+
*/
|
|
1539
1613
|
declare enum MessageLibCmdRead {
|
|
1540
1614
|
V_10_0_2 = "10.0.2"
|
|
1541
1615
|
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Enum representing the versions of MessageLib that support Endpoint V2.
|
|
1618
|
+
*/
|
|
1542
1619
|
declare enum MessageLibVersionV2 {
|
|
1543
1620
|
SIMPLE = "0.0.2",
|
|
1544
1621
|
ULTRA_LIGHT_NODE_302 = "3.0.2"
|
|
1545
1622
|
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Enum representing the versions of MessageLib that support Endpoint V1.
|
|
1625
|
+
*/
|
|
1546
1626
|
declare enum MessageLibVersionV1 {
|
|
1547
1627
|
ULTRA_LIGHT_NODE_301 = "3.0.1",
|
|
1548
1628
|
ULTRA_LIGHT_NODE_201 = "2.0.1"
|
|
1549
1629
|
}
|
|
1630
|
+
/**
|
|
1631
|
+
* Type representing all possible versions for MessageLib.
|
|
1632
|
+
*/
|
|
1550
1633
|
type MessageLibVersion = MessageLibVersionV2 | MessageLibVersionV1 | MessageLibCmdRead;
|
|
1551
1634
|
|
|
1635
|
+
/**
|
|
1636
|
+
* Enum representing different chain keys.
|
|
1637
|
+
*/
|
|
1552
1638
|
declare enum ChainKey {
|
|
1553
1639
|
ETHEREUM = "ethereum",
|
|
1554
1640
|
GOERLI = "goerli",
|
|
@@ -1833,86 +1919,318 @@ declare enum ChainKey {
|
|
|
1833
1919
|
HEMI_TESTNET = "hemi-testnet",
|
|
1834
1920
|
HEMI = "hemi",
|
|
1835
1921
|
CITREA_TESTNET = "citrea-testnet",
|
|
1836
|
-
ISLANDER = "islander"
|
|
1922
|
+
ISLANDER = "islander",
|
|
1923
|
+
BL3_TESTNET = "bl3-testnet",
|
|
1924
|
+
MP1_TESTNET = "mp1-testnet"
|
|
1837
1925
|
}
|
|
1838
1926
|
|
|
1927
|
+
/**
|
|
1928
|
+
* Enum representing different read channel ids.
|
|
1929
|
+
*/
|
|
1839
1930
|
declare enum ChannelId {
|
|
1840
1931
|
READ_CHANNEL_1 = 4294967295,
|
|
1841
1932
|
READ_CHANNEL_2 = 4294967294
|
|
1842
1933
|
}
|
|
1843
1934
|
|
|
1935
|
+
/**
|
|
1936
|
+
* A mapping of endpoint IDs to chain keys.
|
|
1937
|
+
* This object maps each endpoint ID to its corresponding chain key.
|
|
1938
|
+
*
|
|
1939
|
+
* @type {Object.<EndpointId, ChainKey>}
|
|
1940
|
+
*/
|
|
1844
1941
|
declare const CHAIN_KEY: {
|
|
1845
1942
|
[endpointId in EndpointId]: ChainKey;
|
|
1846
1943
|
};
|
|
1847
1944
|
|
|
1945
|
+
/**
|
|
1946
|
+
* A mapping of endpoint IDs to environments.
|
|
1947
|
+
* This object maps each endpoint ID to its corresponding environment.
|
|
1948
|
+
*
|
|
1949
|
+
* @type {Object.<EndpointId, Environment>}
|
|
1950
|
+
*/
|
|
1848
1951
|
declare const ENVIRONMENT: {
|
|
1849
1952
|
[endpointId in EndpointId]: Environment;
|
|
1850
1953
|
};
|
|
1851
1954
|
|
|
1955
|
+
/**
|
|
1956
|
+
* A list of endpoint IDs that support ULN (Ultra Light Node) version 1.
|
|
1957
|
+
* This array contains the endpoint IDs for various blockchains that are compatible with ULN version 1.
|
|
1958
|
+
*
|
|
1959
|
+
* @type {EndpointId[]}
|
|
1960
|
+
*/
|
|
1852
1961
|
declare const ULN_V1_CHAINS: (MainnetEndpointId | TestnetEndpointId | SandboxEndpointId)[];
|
|
1853
1962
|
|
|
1963
|
+
/**
|
|
1964
|
+
* Enum representing the different versions of ULN (Ultra Light Node).
|
|
1965
|
+
*/
|
|
1854
1966
|
declare enum UlnVersion {
|
|
1855
1967
|
V1 = 1,
|
|
1856
1968
|
V2 = 2,
|
|
1857
1969
|
V3 = 3
|
|
1858
1970
|
}
|
|
1859
1971
|
|
|
1972
|
+
/**
|
|
1973
|
+
* Type representing a network name.
|
|
1974
|
+
* The network name is a template literal type combining the chain, stage, and an optional '-local' suffix.
|
|
1975
|
+
* @see {@link Chain}, {@link Stage}
|
|
1976
|
+
*/
|
|
1860
1977
|
type Network = `${Chain}-${Stage}${'-local' | ''}`;
|
|
1978
|
+
/**
|
|
1979
|
+
* Interface representing the specification of an endpoint.
|
|
1980
|
+
*/
|
|
1861
1981
|
interface EndpointSpec {
|
|
1982
|
+
/**
|
|
1983
|
+
* The chain of the endpoint. {@link Chain}
|
|
1984
|
+
*/
|
|
1862
1985
|
chain: Chain;
|
|
1986
|
+
/**
|
|
1987
|
+
* The stage of the endpoint. {@link Stage}
|
|
1988
|
+
*/
|
|
1863
1989
|
stage: Stage;
|
|
1990
|
+
/**
|
|
1991
|
+
* The version of the endpoint. {@link EndpointVersion}
|
|
1992
|
+
*/
|
|
1864
1993
|
version: EndpointVersion;
|
|
1994
|
+
/**
|
|
1995
|
+
* The environment of the endpoint. {@link Environment}
|
|
1996
|
+
*/
|
|
1865
1997
|
env: Environment;
|
|
1866
1998
|
}
|
|
1867
1999
|
|
|
2000
|
+
/**
|
|
2001
|
+
* Converts a network name and version to an endpoint ID.
|
|
2002
|
+
*
|
|
2003
|
+
* @param {string} network - The network name.
|
|
2004
|
+
* @param {EndpointVersion} version - The endpoint version.
|
|
2005
|
+
* @returns {EndpointId} The corresponding endpoint ID.
|
|
2006
|
+
* @throws {Error} If the network name is invalid.
|
|
2007
|
+
*/
|
|
1868
2008
|
declare function networkToEndpointId(network: string, version: EndpointVersion): EndpointId;
|
|
2009
|
+
/**
|
|
2010
|
+
* Converts a network name and version to an environment.
|
|
2011
|
+
*
|
|
2012
|
+
* @param {string} network - The network name.
|
|
2013
|
+
* @param {EndpointVersion} version - The endpoint version.
|
|
2014
|
+
* @returns {Environment} The corresponding environment.
|
|
2015
|
+
*/
|
|
1869
2016
|
declare function networkToEnv(network: string, version: EndpointVersion): Environment;
|
|
2017
|
+
/**
|
|
2018
|
+
* Converts a network name to a stage.
|
|
2019
|
+
*
|
|
2020
|
+
* @param {string} network - The network name.
|
|
2021
|
+
* @returns {Stage} The corresponding stage.
|
|
2022
|
+
* @throws {Error} If the network name is invalid.
|
|
2023
|
+
*/
|
|
1870
2024
|
declare function networkToStage(network: string): Stage;
|
|
2025
|
+
/**
|
|
2026
|
+
* Converts an endpoint ID to a network name.
|
|
2027
|
+
*
|
|
2028
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2029
|
+
* @param {Environment | boolean} [envOrIsLocal] - The environment or a boolean indicating if it's local.
|
|
2030
|
+
* @returns {Network} The corresponding network name.
|
|
2031
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2032
|
+
*/
|
|
1871
2033
|
declare function endpointIdToNetwork(endpointId: number, envOrIsLocal?: Environment | boolean): Network;
|
|
2034
|
+
/**
|
|
2035
|
+
* Converts an endpoint ID to an endpoint version.
|
|
2036
|
+
*
|
|
2037
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2038
|
+
* @returns {EndpointVersion} The corresponding endpoint version.
|
|
2039
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2040
|
+
*/
|
|
1872
2041
|
declare function endpointIdToVersion(endpointId: number): EndpointVersion;
|
|
2042
|
+
/**
|
|
2043
|
+
* Converts an endpoint ID to a chain key.
|
|
2044
|
+
*
|
|
2045
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2046
|
+
* @returns {ChainKey} The corresponding chain key.
|
|
2047
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2048
|
+
*/
|
|
1873
2049
|
declare function endpointIdToChainKey(endpointId: number): ChainKey;
|
|
2050
|
+
/**
|
|
2051
|
+
* Converts a chain and stage to an endpoint ID.
|
|
2052
|
+
*
|
|
2053
|
+
* @param {Chain} chain - The chain.
|
|
2054
|
+
* @param {Stage} stage - The stage.
|
|
2055
|
+
* @param {EndpointVersion} version - The endpoint version.
|
|
2056
|
+
* @returns {EndpointId} The corresponding endpoint ID.
|
|
2057
|
+
* @throws {Error} If the key is invalid.
|
|
2058
|
+
*/
|
|
1874
2059
|
declare function chainAndStageToEndpointId(chain: Chain, stage: Stage, version: EndpointVersion): EndpointId;
|
|
2060
|
+
/**
|
|
2061
|
+
* Converts a chain and stage to a network name.
|
|
2062
|
+
*
|
|
2063
|
+
* @param {Chain} chain - The chain.
|
|
2064
|
+
* @param {Stage} stage - The stage.
|
|
2065
|
+
* @param {Environment | boolean} [envOrIsLocal] - The environment or a boolean indicating if it's local.
|
|
2066
|
+
* @returns {Network} The corresponding network name.
|
|
2067
|
+
*/
|
|
1875
2068
|
declare function chainAndStageToNetwork(chain: Chain, stage: Stage, envOrIsLocal?: Environment | boolean): Network;
|
|
2069
|
+
/**
|
|
2070
|
+
* Converts an endpoint specification to a network name.
|
|
2071
|
+
*
|
|
2072
|
+
* @param {EndpointSpec} spec - The endpoint specification.
|
|
2073
|
+
* @returns {Network} The corresponding network name.
|
|
2074
|
+
*/
|
|
1876
2075
|
declare function endpointSpecToNetwork(spec: EndpointSpec): Network;
|
|
2076
|
+
/**
|
|
2077
|
+
* Converts an endpoint specification to an environment.
|
|
2078
|
+
*
|
|
2079
|
+
* @param {EndpointSpec} spec - The endpoint specification.
|
|
2080
|
+
* @returns {Environment} The corresponding environment.
|
|
2081
|
+
*/
|
|
1877
2082
|
declare function endpointSpecToEnv(spec: EndpointSpec): Environment;
|
|
2083
|
+
/**
|
|
2084
|
+
* Converts an endpoint specification to an endpoint ID.
|
|
2085
|
+
*
|
|
2086
|
+
* @param {EndpointSpec} spec - The endpoint specification.
|
|
2087
|
+
* @returns {EndpointId} The corresponding endpoint ID.
|
|
2088
|
+
*/
|
|
1878
2089
|
declare function endpointSpecToEndpointId(spec: EndpointSpec): EndpointId;
|
|
2090
|
+
/**
|
|
2091
|
+
* Converts an endpoint ID and environment to an endpoint specification.
|
|
2092
|
+
*
|
|
2093
|
+
* @param {EndpointId} endpointId - The endpoint ID.
|
|
2094
|
+
* @param {Environment} env - The environment.
|
|
2095
|
+
* @returns {EndpointSpec} The corresponding endpoint specification.
|
|
2096
|
+
*/
|
|
1879
2097
|
declare function endpointIdToEndpointSpec(endpointId: EndpointId, env: Environment): EndpointSpec;
|
|
2098
|
+
/**
|
|
2099
|
+
* Converts a network name to a chain.
|
|
2100
|
+
*
|
|
2101
|
+
* @param {string} network - The network name.
|
|
2102
|
+
* @returns {Chain} The corresponding chain.
|
|
2103
|
+
*/
|
|
1880
2104
|
declare function networkToChain(network: string): Chain;
|
|
2105
|
+
/**
|
|
2106
|
+
* Converts a network name to a chain type.
|
|
2107
|
+
*
|
|
2108
|
+
* @param {string} network - The network name.
|
|
2109
|
+
* @returns {ChainType} The corresponding chain type.
|
|
2110
|
+
*/
|
|
1881
2111
|
declare function networkToChainType(network: string): ChainType;
|
|
1882
2112
|
/**
|
|
1883
2113
|
* Returns the chain family for a given chain
|
|
1884
|
-
*
|
|
2114
|
+
*
|
|
2115
|
+
* @param {Chain} chain - The chain.
|
|
2116
|
+
* @returns {ChainType} The corresponding chain type.
|
|
1885
2117
|
*/
|
|
1886
2118
|
declare function chainToChainType(chain: Chain): ChainType;
|
|
1887
2119
|
/**
|
|
1888
2120
|
* @deprecated Use `chainToChainType` instead
|
|
2121
|
+
* Returns the chain type for a given chain.
|
|
2122
|
+
*
|
|
2123
|
+
* @param {Chain} chain - The chain.
|
|
2124
|
+
* @returns {ChainType} The corresponding chain type.
|
|
1889
2125
|
*/
|
|
1890
2126
|
declare function getChainType(chain: Chain): ChainType;
|
|
2127
|
+
/**
|
|
2128
|
+
* Converts an endpoint ID to a chain.
|
|
2129
|
+
*
|
|
2130
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2131
|
+
* @returns {Chain} The corresponding chain.
|
|
2132
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2133
|
+
*/
|
|
1891
2134
|
declare function endpointIdToChain(endpointId: number): Chain;
|
|
2135
|
+
/**
|
|
2136
|
+
* Converts an endpoint ID to a stage.
|
|
2137
|
+
*
|
|
2138
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2139
|
+
* @returns {Stage} The corresponding stage.
|
|
2140
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2141
|
+
*/
|
|
1892
2142
|
declare function endpointIdToStage(endpointId: number): Stage;
|
|
2143
|
+
/**
|
|
2144
|
+
* Converts an endpoint ID to a chain type.
|
|
2145
|
+
*
|
|
2146
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2147
|
+
* @returns {ChainType} The corresponding chain type.
|
|
2148
|
+
*/
|
|
1893
2149
|
declare function endpointIdToChainType(endpointId: number): ChainType;
|
|
2150
|
+
/**
|
|
2151
|
+
* Gets the networks for a given stage.
|
|
2152
|
+
*
|
|
2153
|
+
* @param {Stage} stage - The stage.
|
|
2154
|
+
* @returns {string[]} The corresponding networks.
|
|
2155
|
+
*/
|
|
1894
2156
|
declare function getNetworksForStage(stage: Stage): string[];
|
|
2157
|
+
/**
|
|
2158
|
+
* Gets the endpoint version for a given ULN version.
|
|
2159
|
+
*
|
|
2160
|
+
* @param {string} ulnVersion - The ULN version.
|
|
2161
|
+
* @returns {EndpointVersion} The corresponding endpoint version.
|
|
2162
|
+
* @throws {Error} If the ULN version is invalid.
|
|
2163
|
+
*/
|
|
1895
2164
|
declare const getEndpointVersionForUlnVersion: (ulnVersion: string) => EndpointVersion;
|
|
2165
|
+
/**
|
|
2166
|
+
* Gets the chain ID for a given network.
|
|
2167
|
+
*
|
|
2168
|
+
* @param {string} chain - The chain.
|
|
2169
|
+
* @param {string} stage - The stage.
|
|
2170
|
+
* @param {string} ulnVersion - The ULN version.
|
|
2171
|
+
* @returns {string} The corresponding chain ID.
|
|
2172
|
+
*/
|
|
1896
2173
|
declare function getChainIdForNetwork(chain: string, stage: string, ulnVersion: string): string;
|
|
2174
|
+
/**
|
|
2175
|
+
* Gets the network for a given chain ID.
|
|
2176
|
+
*
|
|
2177
|
+
* @param {number} targetChainId - The target chain ID.
|
|
2178
|
+
* @returns {{ chainName: Chain; env: Stage; ulnVersion: string }} The corresponding network information.
|
|
2179
|
+
*/
|
|
1897
2180
|
declare function getNetworkForChainId(targetChainId: number): {
|
|
1898
2181
|
chainName: Chain;
|
|
1899
2182
|
env: Stage;
|
|
1900
2183
|
ulnVersion: string;
|
|
1901
2184
|
};
|
|
2185
|
+
/**
|
|
2186
|
+
* Checks if a network endpoint ID is supported.
|
|
2187
|
+
*
|
|
2188
|
+
* @param {string} network - The network name.
|
|
2189
|
+
* @param {EndpointVersion} endpointVersion - The endpoint version.
|
|
2190
|
+
* @returns {boolean} True if the network endpoint ID is supported, false otherwise.
|
|
2191
|
+
*/
|
|
1902
2192
|
declare function isNetworkEndpointIdSupported(network: string, endpointVersion: EndpointVersion): boolean;
|
|
1903
2193
|
/**
|
|
1904
2194
|
* Determine if a chain is zkSync based.
|
|
1905
|
-
*
|
|
2195
|
+
*
|
|
2196
|
+
* @param {Chain} chain - The chain.
|
|
2197
|
+
* @returns {boolean} True if the chain is zkSync based, false otherwise.
|
|
1906
2198
|
*/
|
|
1907
2199
|
declare function isZKSyncBasedChain(chain: Chain): boolean;
|
|
1908
2200
|
/**
|
|
1909
|
-
* Determine if a chain is tron.
|
|
1910
|
-
*
|
|
2201
|
+
* Determine if a chain is tron based.
|
|
2202
|
+
*
|
|
2203
|
+
* @param {Chain} chain - The chain.
|
|
2204
|
+
* @returns {boolean} True if the chain is Tron based, false otherwise.
|
|
1911
2205
|
*/
|
|
1912
2206
|
declare function isTronChain(chain: Chain): boolean;
|
|
2207
|
+
/**
|
|
2208
|
+
* Determines if a chain is EVM based.
|
|
2209
|
+
*
|
|
2210
|
+
* @param {Chain} chain - The chain.
|
|
2211
|
+
* @returns {boolean} True if the chain is EVM based, false otherwise.
|
|
2212
|
+
*/
|
|
1913
2213
|
declare function isEvmChain(chain: Chain): boolean;
|
|
2214
|
+
/**
|
|
2215
|
+
* Determines if a chain is Aptos based.
|
|
2216
|
+
*
|
|
2217
|
+
* @param {Chain} chain - The chain.
|
|
2218
|
+
* @returns {boolean} True if the chain is Aptos based, false otherwise.
|
|
2219
|
+
*/
|
|
1914
2220
|
declare function isAptosChain(chain: Chain): boolean;
|
|
2221
|
+
/**
|
|
2222
|
+
* Determines if a chain is Solana based.
|
|
2223
|
+
*
|
|
2224
|
+
* @param {Chain} chain - The chain.
|
|
2225
|
+
* @returns {boolean} True if the chain is Solana based, false otherwise.
|
|
2226
|
+
*/
|
|
1915
2227
|
declare function isSolanaChain(chain: Chain): boolean;
|
|
2228
|
+
/**
|
|
2229
|
+
* Determines if a chain is Initia based.
|
|
2230
|
+
*
|
|
2231
|
+
* @param {Chain} chain - The chain.
|
|
2232
|
+
* @returns {boolean} True if the chain is Initia based, false otherwise.
|
|
2233
|
+
*/
|
|
1916
2234
|
declare function isInitiaChain(chain: Chain): boolean;
|
|
1917
2235
|
/**
|
|
1918
2236
|
* Checks if the given value is a valid Chain. {@link Chain}
|
|
@@ -1922,14 +2240,46 @@ declare function isInitiaChain(chain: Chain): boolean;
|
|
|
1922
2240
|
*/
|
|
1923
2241
|
declare function isChain(value: unknown): value is Chain;
|
|
1924
2242
|
|
|
2243
|
+
/**
|
|
2244
|
+
* Interface representing the specification of a blockchain.
|
|
2245
|
+
*/
|
|
1925
2246
|
interface ChainSpec {
|
|
2247
|
+
/**
|
|
2248
|
+
* The chain. {@link Chain}
|
|
2249
|
+
*/
|
|
1926
2250
|
chain?: Chain;
|
|
2251
|
+
/**
|
|
2252
|
+
* The type of the chain. {@link ChainType}
|
|
2253
|
+
*/
|
|
1927
2254
|
chainType: ChainType;
|
|
2255
|
+
/**
|
|
2256
|
+
* The size of the address in bytes.
|
|
2257
|
+
*/
|
|
1928
2258
|
addressSizeInBytes: number;
|
|
2259
|
+
/**
|
|
2260
|
+
* The number of decimals used by the chain.
|
|
2261
|
+
*/
|
|
1929
2262
|
decimals: number;
|
|
1930
2263
|
}
|
|
2264
|
+
/**
|
|
2265
|
+
* Class providing methods to get chain specifications.
|
|
2266
|
+
*/
|
|
1931
2267
|
declare class ChainSpecs {
|
|
2268
|
+
/**
|
|
2269
|
+
* Gets the address size in bytes for a given chain.
|
|
2270
|
+
*
|
|
2271
|
+
* @param {Chain} chain - The chain.
|
|
2272
|
+
* @returns {number} The address size in bytes.
|
|
2273
|
+
*/
|
|
1932
2274
|
static getAddressSizeInBytes(chain: Chain): number;
|
|
2275
|
+
/**
|
|
2276
|
+
* Gets the chain specification for a given chain type and chain.
|
|
2277
|
+
*
|
|
2278
|
+
* @param {ChainType} chainType - The type of the chain.
|
|
2279
|
+
* @param {Chain | 'default'} chain - The chain or 'default'.
|
|
2280
|
+
* @returns {ChainSpec} The chain specification.
|
|
2281
|
+
* @throws {Error} If the configuration for the chain type is not found.
|
|
2282
|
+
*/
|
|
1933
2283
|
static getChainSpec(chainType: ChainType, chain: Chain | 'default'): ChainSpec;
|
|
1934
2284
|
}
|
|
1935
2285
|
|