@layerzerolabs/lz-definitions 3.0.14 → 3.0.16
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 +12 -0
- package/README.md +376 -0
- package/dist/index.cjs +28 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +351 -8
- package/dist/index.d.ts +351 -8
- package/dist/index.mjs +28 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
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",
|
|
@@ -175,22 +181,38 @@ declare enum EvmChain {
|
|
|
175
181
|
SOPHON = "sophon",
|
|
176
182
|
MOKSHA = "moksha",
|
|
177
183
|
EDU = "edu",
|
|
178
|
-
CITREA = "citrea"
|
|
184
|
+
CITREA = "citrea",
|
|
185
|
+
ISLANDER = "islander"
|
|
179
186
|
}
|
|
180
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Enum representing different Initia-compatible chains.
|
|
190
|
+
*/
|
|
181
191
|
declare enum InitiaChain {
|
|
182
192
|
INITIA = "initia"
|
|
183
193
|
}
|
|
184
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Enum representing different Solana-compatible chains.
|
|
197
|
+
*/
|
|
185
198
|
declare enum SolanaChain {
|
|
186
199
|
SOLANA = "solana"
|
|
187
200
|
}
|
|
188
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Enum representing different Ton-compatible chains.
|
|
204
|
+
*/
|
|
189
205
|
declare enum TonChain {
|
|
190
206
|
TON = "ton"
|
|
191
207
|
}
|
|
192
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Type representing a union of all supported chains.
|
|
211
|
+
*/
|
|
193
212
|
type Chain = EvmChain | AptosChain | SolanaChain | InitiaChain | TonChain;
|
|
213
|
+
/**
|
|
214
|
+
* Object containing all supported chains.
|
|
215
|
+
*/
|
|
194
216
|
declare const Chain: {
|
|
195
217
|
TON: TonChain.TON;
|
|
196
218
|
INITIA: InitiaChain.INITIA;
|
|
@@ -369,8 +391,12 @@ declare const Chain: {
|
|
|
369
391
|
MOKSHA: EvmChain.MOKSHA;
|
|
370
392
|
EDU: EvmChain.EDU;
|
|
371
393
|
CITREA: EvmChain.CITREA;
|
|
394
|
+
ISLANDER: EvmChain.ISLANDER;
|
|
372
395
|
};
|
|
373
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Enum representing different chain types.
|
|
399
|
+
*/
|
|
374
400
|
declare enum ChainType {
|
|
375
401
|
UNKNOWN = "unknown",
|
|
376
402
|
EVM = "evm",
|
|
@@ -381,6 +407,9 @@ declare enum ChainType {
|
|
|
381
407
|
}
|
|
382
408
|
|
|
383
409
|
declare const EndpointV2IdBase = 30000;
|
|
410
|
+
/**
|
|
411
|
+
* Enum representing different endpoint ids on mainnet. (Adapt Endpoint V1)
|
|
412
|
+
*/
|
|
384
413
|
declare enum MainnetEndpointId {
|
|
385
414
|
ETHEREUM_MAINNET = 101,
|
|
386
415
|
BSC_MAINNET = 102,
|
|
@@ -487,8 +516,12 @@ declare enum MainnetEndpointId {
|
|
|
487
516
|
ABSTRACT_MAINNET = 324,
|
|
488
517
|
SUPERPOSITION_MAINNET = 327,
|
|
489
518
|
EDU_MAINNET = 328,
|
|
490
|
-
HEMI_MAINNET = 329
|
|
519
|
+
HEMI_MAINNET = 329,
|
|
520
|
+
ISLANDER_MAINNET = 330
|
|
491
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* Enum representing different endpoint ids on testnet. (Adapt Endpoint V1)
|
|
524
|
+
*/
|
|
492
525
|
declare enum TestnetEndpointId {
|
|
493
526
|
BSC_TESTNET = 10102,
|
|
494
527
|
AVALANCHE_TESTNET = 10106,
|
|
@@ -649,6 +682,9 @@ declare enum TestnetEndpointId {
|
|
|
649
682
|
MOKSHA_TESTNET = 10342,
|
|
650
683
|
CITREA_TESTNET = 10344
|
|
651
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* Enum representing different endpoint ids on sandbox. (Adapt Endpoint V1)
|
|
687
|
+
*/
|
|
652
688
|
declare enum SandboxEndpointId {
|
|
653
689
|
BSC_SANDBOX = 20102,
|
|
654
690
|
AVALANCHE_SANDBOX = 20106,
|
|
@@ -662,6 +698,9 @@ declare enum SandboxEndpointId {
|
|
|
662
698
|
FANTOM_SANDBOX = 20112,
|
|
663
699
|
METIS_SANDBOX = 20151
|
|
664
700
|
}
|
|
701
|
+
/**
|
|
702
|
+
* Enum representing different endpoint ids on mainnet. (Adapt Endpoint V2)
|
|
703
|
+
*/
|
|
665
704
|
declare enum MainnetV2EndpointId {
|
|
666
705
|
ETHEREUM_V2_MAINNET = 30101,
|
|
667
706
|
BSC_V2_MAINNET = 30102,
|
|
@@ -771,8 +810,12 @@ declare enum MainnetV2EndpointId {
|
|
|
771
810
|
SUPERPOSITION_V2_MAINNET = 30327,
|
|
772
811
|
EDU_V2_MAINNET = 30328,
|
|
773
812
|
TON_V2_MAINNET = 30343,
|
|
774
|
-
HEMI_V2_MAINNET = 30329
|
|
813
|
+
HEMI_V2_MAINNET = 30329,
|
|
814
|
+
ISLANDER_V2_MAINNET = 30330
|
|
775
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Enum representing different endpoint ids on testnet. (Adapt Endpoint V2)
|
|
818
|
+
*/
|
|
776
819
|
declare enum TestnetV2EndpointId {
|
|
777
820
|
AVALANCHE_V2_TESTNET = 40106,
|
|
778
821
|
POLYGON_V2_TESTNET = 40109,
|
|
@@ -934,6 +977,9 @@ declare enum TestnetV2EndpointId {
|
|
|
934
977
|
TON_V2_TESTNET = 40343,
|
|
935
978
|
CITREA_V2_TESTNET = 40344
|
|
936
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
* Enum representing different endpoint ids on sandbox. (Adapt Endpoint V2)
|
|
982
|
+
*/
|
|
937
983
|
declare enum SandboxV2EndpointId {
|
|
938
984
|
ETHEREUM_V2_SANDBOX = 50121,
|
|
939
985
|
POLYGON_V2_SANDBOX = 50109,
|
|
@@ -950,6 +996,10 @@ declare enum SandboxV2EndpointId {
|
|
|
950
996
|
ARBITRUM_V2_SANDBOX = 50143,
|
|
951
997
|
TON_V2_SANDBOX = 50343
|
|
952
998
|
}
|
|
999
|
+
/**
|
|
1000
|
+
* Object containing all supported endpoint IDs.
|
|
1001
|
+
* This object merges endpoint IDs from mainnet, testnet, and sandbox environments, including both V1 and V2 versions.
|
|
1002
|
+
*/
|
|
953
1003
|
declare const EndpointId: {
|
|
954
1004
|
[x: number]: string;
|
|
955
1005
|
ETHEREUM_V2_SANDBOX: SandboxV2EndpointId.ETHEREUM_V2_SANDBOX;
|
|
@@ -1234,6 +1284,7 @@ declare const EndpointId: {
|
|
|
1234
1284
|
EDU_V2_MAINNET: MainnetV2EndpointId.EDU_V2_MAINNET;
|
|
1235
1285
|
TON_V2_MAINNET: MainnetV2EndpointId.TON_V2_MAINNET;
|
|
1236
1286
|
HEMI_V2_MAINNET: MainnetV2EndpointId.HEMI_V2_MAINNET;
|
|
1287
|
+
ISLANDER_V2_MAINNET: MainnetV2EndpointId.ISLANDER_V2_MAINNET;
|
|
1237
1288
|
BSC_SANDBOX: SandboxEndpointId.BSC_SANDBOX;
|
|
1238
1289
|
AVALANCHE_SANDBOX: SandboxEndpointId.AVALANCHE_SANDBOX;
|
|
1239
1290
|
POLYGON_SANDBOX: SandboxEndpointId.POLYGON_SANDBOX;
|
|
@@ -1509,9 +1560,17 @@ declare const EndpointId: {
|
|
|
1509
1560
|
SUPERPOSITION_MAINNET: MainnetEndpointId.SUPERPOSITION_MAINNET;
|
|
1510
1561
|
EDU_MAINNET: MainnetEndpointId.EDU_MAINNET;
|
|
1511
1562
|
HEMI_MAINNET: MainnetEndpointId.HEMI_MAINNET;
|
|
1563
|
+
ISLANDER_MAINNET: MainnetEndpointId.ISLANDER_MAINNET;
|
|
1512
1564
|
};
|
|
1565
|
+
/**
|
|
1566
|
+
* Type representing a union of all supported endpoint IDs.
|
|
1567
|
+
* This type includes endpoint IDs from mainnet, testnet, and sandbox environments, including both V1 and V2 versions.
|
|
1568
|
+
*/
|
|
1513
1569
|
type EndpointId = MainnetEndpointId | TestnetEndpointId | SandboxEndpointId | MainnetV2EndpointId | TestnetV2EndpointId | SandboxV2EndpointId;
|
|
1514
1570
|
|
|
1571
|
+
/**
|
|
1572
|
+
* Enum representing different environment.
|
|
1573
|
+
*/
|
|
1515
1574
|
declare enum Environment {
|
|
1516
1575
|
LOCAL = "local",
|
|
1517
1576
|
DEVNET = "devnet",
|
|
@@ -1519,30 +1578,51 @@ declare enum Environment {
|
|
|
1519
1578
|
MAINNET = "mainnet"
|
|
1520
1579
|
}
|
|
1521
1580
|
|
|
1581
|
+
/**
|
|
1582
|
+
* Enum representing different stages.
|
|
1583
|
+
*/
|
|
1522
1584
|
declare enum Stage {
|
|
1523
1585
|
MAINNET = "mainnet",
|
|
1524
1586
|
TESTNET = "testnet",
|
|
1525
1587
|
SANDBOX = "sandbox"
|
|
1526
1588
|
}
|
|
1527
1589
|
|
|
1590
|
+
/**
|
|
1591
|
+
* Enum representing different Endpoint versions.
|
|
1592
|
+
*/
|
|
1528
1593
|
declare enum EndpointVersion {
|
|
1529
1594
|
V1 = "v1",
|
|
1530
1595
|
V2 = "v2"
|
|
1531
1596
|
}
|
|
1532
1597
|
|
|
1598
|
+
/**
|
|
1599
|
+
* Enum representing the versions for READ MessageLib.
|
|
1600
|
+
*/
|
|
1533
1601
|
declare enum MessageLibCmdRead {
|
|
1534
1602
|
V_10_0_2 = "10.0.2"
|
|
1535
1603
|
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Enum representing the versions of MessageLib that support Endpoint V2.
|
|
1606
|
+
*/
|
|
1536
1607
|
declare enum MessageLibVersionV2 {
|
|
1537
1608
|
SIMPLE = "0.0.2",
|
|
1538
1609
|
ULTRA_LIGHT_NODE_302 = "3.0.2"
|
|
1539
1610
|
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Enum representing the versions of MessageLib that support Endpoint V1.
|
|
1613
|
+
*/
|
|
1540
1614
|
declare enum MessageLibVersionV1 {
|
|
1541
1615
|
ULTRA_LIGHT_NODE_301 = "3.0.1",
|
|
1542
1616
|
ULTRA_LIGHT_NODE_201 = "2.0.1"
|
|
1543
1617
|
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Type representing all possible versions for MessageLib.
|
|
1620
|
+
*/
|
|
1544
1621
|
type MessageLibVersion = MessageLibVersionV2 | MessageLibVersionV1 | MessageLibCmdRead;
|
|
1545
1622
|
|
|
1623
|
+
/**
|
|
1624
|
+
* Enum representing different chain keys.
|
|
1625
|
+
*/
|
|
1546
1626
|
declare enum ChainKey {
|
|
1547
1627
|
ETHEREUM = "ethereum",
|
|
1548
1628
|
GOERLI = "goerli",
|
|
@@ -1826,86 +1906,317 @@ declare enum ChainKey {
|
|
|
1826
1906
|
TON_TESTNET = "ton-testnet",
|
|
1827
1907
|
HEMI_TESTNET = "hemi-testnet",
|
|
1828
1908
|
HEMI = "hemi",
|
|
1829
|
-
CITREA_TESTNET = "citrea-testnet"
|
|
1909
|
+
CITREA_TESTNET = "citrea-testnet",
|
|
1910
|
+
ISLANDER = "islander"
|
|
1830
1911
|
}
|
|
1831
1912
|
|
|
1913
|
+
/**
|
|
1914
|
+
* Enum representing different read channel ids.
|
|
1915
|
+
*/
|
|
1832
1916
|
declare enum ChannelId {
|
|
1833
1917
|
READ_CHANNEL_1 = 4294967295,
|
|
1834
1918
|
READ_CHANNEL_2 = 4294967294
|
|
1835
1919
|
}
|
|
1836
1920
|
|
|
1921
|
+
/**
|
|
1922
|
+
* A mapping of endpoint IDs to chain keys.
|
|
1923
|
+
* This object maps each endpoint ID to its corresponding chain key.
|
|
1924
|
+
*
|
|
1925
|
+
* @type {Object.<EndpointId, ChainKey>}
|
|
1926
|
+
*/
|
|
1837
1927
|
declare const CHAIN_KEY: {
|
|
1838
1928
|
[endpointId in EndpointId]: ChainKey;
|
|
1839
1929
|
};
|
|
1840
1930
|
|
|
1931
|
+
/**
|
|
1932
|
+
* A mapping of endpoint IDs to environments.
|
|
1933
|
+
* This object maps each endpoint ID to its corresponding environment.
|
|
1934
|
+
*
|
|
1935
|
+
* @type {Object.<EndpointId, Environment>}
|
|
1936
|
+
*/
|
|
1841
1937
|
declare const ENVIRONMENT: {
|
|
1842
1938
|
[endpointId in EndpointId]: Environment;
|
|
1843
1939
|
};
|
|
1844
1940
|
|
|
1941
|
+
/**
|
|
1942
|
+
* A list of endpoint IDs that support ULN (Ultra Light Node) version 1.
|
|
1943
|
+
* This array contains the endpoint IDs for various blockchains that are compatible with ULN version 1.
|
|
1944
|
+
*
|
|
1945
|
+
* @type {EndpointId[]}
|
|
1946
|
+
*/
|
|
1845
1947
|
declare const ULN_V1_CHAINS: (MainnetEndpointId | TestnetEndpointId | SandboxEndpointId)[];
|
|
1846
1948
|
|
|
1949
|
+
/**
|
|
1950
|
+
* Enum representing the different versions of ULN (Ultra Light Node).
|
|
1951
|
+
*/
|
|
1847
1952
|
declare enum UlnVersion {
|
|
1848
1953
|
V1 = 1,
|
|
1849
1954
|
V2 = 2,
|
|
1850
1955
|
V3 = 3
|
|
1851
1956
|
}
|
|
1852
1957
|
|
|
1958
|
+
/**
|
|
1959
|
+
* Type representing a network name.
|
|
1960
|
+
* The network name is a template literal type combining the chain, stage, and an optional '-local' suffix.
|
|
1961
|
+
* @see {@link Chain}, {@link Stage}
|
|
1962
|
+
*/
|
|
1853
1963
|
type Network = `${Chain}-${Stage}${'-local' | ''}`;
|
|
1964
|
+
/**
|
|
1965
|
+
* Interface representing the specification of an endpoint.
|
|
1966
|
+
*/
|
|
1854
1967
|
interface EndpointSpec {
|
|
1968
|
+
/**
|
|
1969
|
+
* The chain of the endpoint. {@link Chain}
|
|
1970
|
+
*/
|
|
1855
1971
|
chain: Chain;
|
|
1972
|
+
/**
|
|
1973
|
+
* The stage of the endpoint. {@link Stage}
|
|
1974
|
+
*/
|
|
1856
1975
|
stage: Stage;
|
|
1976
|
+
/**
|
|
1977
|
+
* The version of the endpoint. {@link EndpointVersion}
|
|
1978
|
+
*/
|
|
1857
1979
|
version: EndpointVersion;
|
|
1980
|
+
/**
|
|
1981
|
+
* The environment of the endpoint. {@link Environment}
|
|
1982
|
+
*/
|
|
1858
1983
|
env: Environment;
|
|
1859
1984
|
}
|
|
1860
1985
|
|
|
1986
|
+
/**
|
|
1987
|
+
* Converts a network name and version to an endpoint ID.
|
|
1988
|
+
*
|
|
1989
|
+
* @param {string} network - The network name.
|
|
1990
|
+
* @param {EndpointVersion} version - The endpoint version.
|
|
1991
|
+
* @returns {EndpointId} The corresponding endpoint ID.
|
|
1992
|
+
* @throws {Error} If the network name is invalid.
|
|
1993
|
+
*/
|
|
1861
1994
|
declare function networkToEndpointId(network: string, version: EndpointVersion): EndpointId;
|
|
1995
|
+
/**
|
|
1996
|
+
* Converts a network name and version to an environment.
|
|
1997
|
+
*
|
|
1998
|
+
* @param {string} network - The network name.
|
|
1999
|
+
* @param {EndpointVersion} version - The endpoint version.
|
|
2000
|
+
* @returns {Environment} The corresponding environment.
|
|
2001
|
+
*/
|
|
1862
2002
|
declare function networkToEnv(network: string, version: EndpointVersion): Environment;
|
|
2003
|
+
/**
|
|
2004
|
+
* Converts a network name to a stage.
|
|
2005
|
+
*
|
|
2006
|
+
* @param {string} network - The network name.
|
|
2007
|
+
* @returns {Stage} The corresponding stage.
|
|
2008
|
+
* @throws {Error} If the network name is invalid.
|
|
2009
|
+
*/
|
|
1863
2010
|
declare function networkToStage(network: string): Stage;
|
|
2011
|
+
/**
|
|
2012
|
+
* Converts an endpoint ID to a network name.
|
|
2013
|
+
*
|
|
2014
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2015
|
+
* @param {Environment | boolean} [envOrIsLocal] - The environment or a boolean indicating if it's local.
|
|
2016
|
+
* @returns {Network} The corresponding network name.
|
|
2017
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2018
|
+
*/
|
|
1864
2019
|
declare function endpointIdToNetwork(endpointId: number, envOrIsLocal?: Environment | boolean): Network;
|
|
2020
|
+
/**
|
|
2021
|
+
* Converts an endpoint ID to an endpoint version.
|
|
2022
|
+
*
|
|
2023
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2024
|
+
* @returns {EndpointVersion} The corresponding endpoint version.
|
|
2025
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2026
|
+
*/
|
|
1865
2027
|
declare function endpointIdToVersion(endpointId: number): EndpointVersion;
|
|
2028
|
+
/**
|
|
2029
|
+
* Converts an endpoint ID to a chain key.
|
|
2030
|
+
*
|
|
2031
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2032
|
+
* @returns {ChainKey} The corresponding chain key.
|
|
2033
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2034
|
+
*/
|
|
1866
2035
|
declare function endpointIdToChainKey(endpointId: number): ChainKey;
|
|
2036
|
+
/**
|
|
2037
|
+
* Converts a chain and stage to an endpoint ID.
|
|
2038
|
+
*
|
|
2039
|
+
* @param {Chain} chain - The chain.
|
|
2040
|
+
* @param {Stage} stage - The stage.
|
|
2041
|
+
* @param {EndpointVersion} version - The endpoint version.
|
|
2042
|
+
* @returns {EndpointId} The corresponding endpoint ID.
|
|
2043
|
+
* @throws {Error} If the key is invalid.
|
|
2044
|
+
*/
|
|
1867
2045
|
declare function chainAndStageToEndpointId(chain: Chain, stage: Stage, version: EndpointVersion): EndpointId;
|
|
2046
|
+
/**
|
|
2047
|
+
* Converts a chain and stage to a network name.
|
|
2048
|
+
*
|
|
2049
|
+
* @param {Chain} chain - The chain.
|
|
2050
|
+
* @param {Stage} stage - The stage.
|
|
2051
|
+
* @param {Environment | boolean} [envOrIsLocal] - The environment or a boolean indicating if it's local.
|
|
2052
|
+
* @returns {Network} The corresponding network name.
|
|
2053
|
+
*/
|
|
1868
2054
|
declare function chainAndStageToNetwork(chain: Chain, stage: Stage, envOrIsLocal?: Environment | boolean): Network;
|
|
2055
|
+
/**
|
|
2056
|
+
* Converts an endpoint specification to a network name.
|
|
2057
|
+
*
|
|
2058
|
+
* @param {EndpointSpec} spec - The endpoint specification.
|
|
2059
|
+
* @returns {Network} The corresponding network name.
|
|
2060
|
+
*/
|
|
1869
2061
|
declare function endpointSpecToNetwork(spec: EndpointSpec): Network;
|
|
2062
|
+
/**
|
|
2063
|
+
* Converts an endpoint specification to an environment.
|
|
2064
|
+
*
|
|
2065
|
+
* @param {EndpointSpec} spec - The endpoint specification.
|
|
2066
|
+
* @returns {Environment} The corresponding environment.
|
|
2067
|
+
*/
|
|
1870
2068
|
declare function endpointSpecToEnv(spec: EndpointSpec): Environment;
|
|
2069
|
+
/**
|
|
2070
|
+
* Converts an endpoint specification to an endpoint ID.
|
|
2071
|
+
*
|
|
2072
|
+
* @param {EndpointSpec} spec - The endpoint specification.
|
|
2073
|
+
* @returns {EndpointId} The corresponding endpoint ID.
|
|
2074
|
+
*/
|
|
1871
2075
|
declare function endpointSpecToEndpointId(spec: EndpointSpec): EndpointId;
|
|
2076
|
+
/**
|
|
2077
|
+
* Converts an endpoint ID and environment to an endpoint specification.
|
|
2078
|
+
*
|
|
2079
|
+
* @param {EndpointId} endpointId - The endpoint ID.
|
|
2080
|
+
* @param {Environment} env - The environment.
|
|
2081
|
+
* @returns {EndpointSpec} The corresponding endpoint specification.
|
|
2082
|
+
*/
|
|
1872
2083
|
declare function endpointIdToEndpointSpec(endpointId: EndpointId, env: Environment): EndpointSpec;
|
|
2084
|
+
/**
|
|
2085
|
+
* Converts a network name to a chain.
|
|
2086
|
+
*
|
|
2087
|
+
* @param {string} network - The network name.
|
|
2088
|
+
* @returns {Chain} The corresponding chain.
|
|
2089
|
+
*/
|
|
1873
2090
|
declare function networkToChain(network: string): Chain;
|
|
2091
|
+
/**
|
|
2092
|
+
* Converts a network name to a chain type.
|
|
2093
|
+
*
|
|
2094
|
+
* @param {string} network - The network name.
|
|
2095
|
+
* @returns {ChainType} The corresponding chain type.
|
|
2096
|
+
*/
|
|
1874
2097
|
declare function networkToChainType(network: string): ChainType;
|
|
1875
2098
|
/**
|
|
1876
2099
|
* Returns the chain family for a given chain
|
|
1877
|
-
*
|
|
2100
|
+
*
|
|
2101
|
+
* @param {Chain} chain - The chain.
|
|
2102
|
+
* @returns {ChainType} The corresponding chain type.
|
|
1878
2103
|
*/
|
|
1879
2104
|
declare function chainToChainType(chain: Chain): ChainType;
|
|
1880
2105
|
/**
|
|
1881
2106
|
* @deprecated Use `chainToChainType` instead
|
|
2107
|
+
* Returns the chain type for a given chain.
|
|
2108
|
+
*
|
|
2109
|
+
* @param {Chain} chain - The chain.
|
|
2110
|
+
* @returns {ChainType} The corresponding chain type.
|
|
1882
2111
|
*/
|
|
1883
2112
|
declare function getChainType(chain: Chain): ChainType;
|
|
2113
|
+
/**
|
|
2114
|
+
* Converts an endpoint ID to a chain.
|
|
2115
|
+
*
|
|
2116
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2117
|
+
* @returns {Chain} The corresponding chain.
|
|
2118
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2119
|
+
*/
|
|
1884
2120
|
declare function endpointIdToChain(endpointId: number): Chain;
|
|
2121
|
+
/**
|
|
2122
|
+
* Converts an endpoint ID to a stage.
|
|
2123
|
+
*
|
|
2124
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2125
|
+
* @returns {Stage} The corresponding stage.
|
|
2126
|
+
* @throws {Error} If the endpoint ID is invalid.
|
|
2127
|
+
*/
|
|
1885
2128
|
declare function endpointIdToStage(endpointId: number): Stage;
|
|
2129
|
+
/**
|
|
2130
|
+
* Converts an endpoint ID to a chain type.
|
|
2131
|
+
*
|
|
2132
|
+
* @param {number} endpointId - The endpoint ID.
|
|
2133
|
+
* @returns {ChainType} The corresponding chain type.
|
|
2134
|
+
*/
|
|
1886
2135
|
declare function endpointIdToChainType(endpointId: number): ChainType;
|
|
2136
|
+
/**
|
|
2137
|
+
* Gets the networks for a given stage.
|
|
2138
|
+
*
|
|
2139
|
+
* @param {Stage} stage - The stage.
|
|
2140
|
+
* @returns {string[]} The corresponding networks.
|
|
2141
|
+
*/
|
|
1887
2142
|
declare function getNetworksForStage(stage: Stage): string[];
|
|
2143
|
+
/**
|
|
2144
|
+
* Gets the endpoint version for a given ULN version.
|
|
2145
|
+
*
|
|
2146
|
+
* @param {string} ulnVersion - The ULN version.
|
|
2147
|
+
* @returns {EndpointVersion} The corresponding endpoint version.
|
|
2148
|
+
* @throws {Error} If the ULN version is invalid.
|
|
2149
|
+
*/
|
|
1888
2150
|
declare const getEndpointVersionForUlnVersion: (ulnVersion: string) => EndpointVersion;
|
|
2151
|
+
/**
|
|
2152
|
+
* Gets the chain ID for a given network.
|
|
2153
|
+
*
|
|
2154
|
+
* @param {string} chain - The chain.
|
|
2155
|
+
* @param {string} stage - The stage.
|
|
2156
|
+
* @param {string} ulnVersion - The ULN version.
|
|
2157
|
+
* @returns {string} The corresponding chain ID.
|
|
2158
|
+
*/
|
|
1889
2159
|
declare function getChainIdForNetwork(chain: string, stage: string, ulnVersion: string): string;
|
|
2160
|
+
/**
|
|
2161
|
+
* Gets the network for a given chain ID.
|
|
2162
|
+
*
|
|
2163
|
+
* @param {number} targetChainId - The target chain ID.
|
|
2164
|
+
* @returns {{ chainName: Chain; env: Stage; ulnVersion: string }} The corresponding network information.
|
|
2165
|
+
*/
|
|
1890
2166
|
declare function getNetworkForChainId(targetChainId: number): {
|
|
1891
2167
|
chainName: Chain;
|
|
1892
2168
|
env: Stage;
|
|
1893
2169
|
ulnVersion: string;
|
|
1894
2170
|
};
|
|
2171
|
+
/**
|
|
2172
|
+
* Checks if a network endpoint ID is supported.
|
|
2173
|
+
*
|
|
2174
|
+
* @param {string} network - The network name.
|
|
2175
|
+
* @param {EndpointVersion} endpointVersion - The endpoint version.
|
|
2176
|
+
* @returns {boolean} True if the network endpoint ID is supported, false otherwise.
|
|
2177
|
+
*/
|
|
1895
2178
|
declare function isNetworkEndpointIdSupported(network: string, endpointVersion: EndpointVersion): boolean;
|
|
1896
2179
|
/**
|
|
1897
2180
|
* Determine if a chain is zkSync based.
|
|
1898
|
-
*
|
|
2181
|
+
*
|
|
2182
|
+
* @param {Chain} chain - The chain.
|
|
2183
|
+
* @returns {boolean} True if the chain is zkSync based, false otherwise.
|
|
1899
2184
|
*/
|
|
1900
2185
|
declare function isZKSyncBasedChain(chain: Chain): boolean;
|
|
1901
2186
|
/**
|
|
1902
|
-
* Determine if a chain is tron.
|
|
1903
|
-
*
|
|
2187
|
+
* Determine if a chain is tron based.
|
|
2188
|
+
*
|
|
2189
|
+
* @param {Chain} chain - The chain.
|
|
2190
|
+
* @returns {boolean} True if the chain is Tron based, false otherwise.
|
|
1904
2191
|
*/
|
|
1905
2192
|
declare function isTronChain(chain: Chain): boolean;
|
|
2193
|
+
/**
|
|
2194
|
+
* Determines if a chain is EVM based.
|
|
2195
|
+
*
|
|
2196
|
+
* @param {Chain} chain - The chain.
|
|
2197
|
+
* @returns {boolean} True if the chain is EVM based, false otherwise.
|
|
2198
|
+
*/
|
|
1906
2199
|
declare function isEvmChain(chain: Chain): boolean;
|
|
2200
|
+
/**
|
|
2201
|
+
* Determines if a chain is Aptos based.
|
|
2202
|
+
*
|
|
2203
|
+
* @param {Chain} chain - The chain.
|
|
2204
|
+
* @returns {boolean} True if the chain is Aptos based, false otherwise.
|
|
2205
|
+
*/
|
|
1907
2206
|
declare function isAptosChain(chain: Chain): boolean;
|
|
2207
|
+
/**
|
|
2208
|
+
* Determines if a chain is Solana based.
|
|
2209
|
+
*
|
|
2210
|
+
* @param {Chain} chain - The chain.
|
|
2211
|
+
* @returns {boolean} True if the chain is Solana based, false otherwise.
|
|
2212
|
+
*/
|
|
1908
2213
|
declare function isSolanaChain(chain: Chain): boolean;
|
|
2214
|
+
/**
|
|
2215
|
+
* Determines if a chain is Initia based.
|
|
2216
|
+
*
|
|
2217
|
+
* @param {Chain} chain - The chain.
|
|
2218
|
+
* @returns {boolean} True if the chain is Initia based, false otherwise.
|
|
2219
|
+
*/
|
|
1909
2220
|
declare function isInitiaChain(chain: Chain): boolean;
|
|
1910
2221
|
/**
|
|
1911
2222
|
* Checks if the given value is a valid Chain. {@link Chain}
|
|
@@ -1915,14 +2226,46 @@ declare function isInitiaChain(chain: Chain): boolean;
|
|
|
1915
2226
|
*/
|
|
1916
2227
|
declare function isChain(value: unknown): value is Chain;
|
|
1917
2228
|
|
|
2229
|
+
/**
|
|
2230
|
+
* Interface representing the specification of a blockchain.
|
|
2231
|
+
*/
|
|
1918
2232
|
interface ChainSpec {
|
|
2233
|
+
/**
|
|
2234
|
+
* The chain. {@link Chain}
|
|
2235
|
+
*/
|
|
1919
2236
|
chain?: Chain;
|
|
2237
|
+
/**
|
|
2238
|
+
* The type of the chain. {@link ChainType}
|
|
2239
|
+
*/
|
|
1920
2240
|
chainType: ChainType;
|
|
2241
|
+
/**
|
|
2242
|
+
* The size of the address in bytes.
|
|
2243
|
+
*/
|
|
1921
2244
|
addressSizeInBytes: number;
|
|
2245
|
+
/**
|
|
2246
|
+
* The number of decimals used by the chain.
|
|
2247
|
+
*/
|
|
1922
2248
|
decimals: number;
|
|
1923
2249
|
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Class providing methods to get chain specifications.
|
|
2252
|
+
*/
|
|
1924
2253
|
declare class ChainSpecs {
|
|
2254
|
+
/**
|
|
2255
|
+
* Gets the address size in bytes for a given chain.
|
|
2256
|
+
*
|
|
2257
|
+
* @param {Chain} chain - The chain.
|
|
2258
|
+
* @returns {number} The address size in bytes.
|
|
2259
|
+
*/
|
|
1925
2260
|
static getAddressSizeInBytes(chain: Chain): number;
|
|
2261
|
+
/**
|
|
2262
|
+
* Gets the chain specification for a given chain type and chain.
|
|
2263
|
+
*
|
|
2264
|
+
* @param {ChainType} chainType - The type of the chain.
|
|
2265
|
+
* @param {Chain | 'default'} chain - The chain or 'default'.
|
|
2266
|
+
* @returns {ChainSpec} The chain specification.
|
|
2267
|
+
* @throws {Error} If the configuration for the chain type is not found.
|
|
2268
|
+
*/
|
|
1926
2269
|
static getChainSpec(chainType: ChainType, chain: Chain | 'default'): ChainSpec;
|
|
1927
2270
|
}
|
|
1928
2271
|
|