@layerzerolabs/lz-definitions 3.0.15 → 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 +6 -0
- package/README.md +376 -0
- package/dist/index.cjs +20 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +340 -4
- package/dist/index.d.ts +340 -4
- package/dist/index.mjs +20 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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",
|
|
@@ -179,19 +185,34 @@ declare enum EvmChain {
|
|
|
179
185
|
ISLANDER = "islander"
|
|
180
186
|
}
|
|
181
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Enum representing different Initia-compatible chains.
|
|
190
|
+
*/
|
|
182
191
|
declare enum InitiaChain {
|
|
183
192
|
INITIA = "initia"
|
|
184
193
|
}
|
|
185
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Enum representing different Solana-compatible chains.
|
|
197
|
+
*/
|
|
186
198
|
declare enum SolanaChain {
|
|
187
199
|
SOLANA = "solana"
|
|
188
200
|
}
|
|
189
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Enum representing different Ton-compatible chains.
|
|
204
|
+
*/
|
|
190
205
|
declare enum TonChain {
|
|
191
206
|
TON = "ton"
|
|
192
207
|
}
|
|
193
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Type representing a union of all supported chains.
|
|
211
|
+
*/
|
|
194
212
|
type Chain = EvmChain | AptosChain | SolanaChain | InitiaChain | TonChain;
|
|
213
|
+
/**
|
|
214
|
+
* Object containing all supported chains.
|
|
215
|
+
*/
|
|
195
216
|
declare const Chain: {
|
|
196
217
|
TON: TonChain.TON;
|
|
197
218
|
INITIA: InitiaChain.INITIA;
|
|
@@ -373,6 +394,9 @@ declare const Chain: {
|
|
|
373
394
|
ISLANDER: EvmChain.ISLANDER;
|
|
374
395
|
};
|
|
375
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Enum representing different chain types.
|
|
399
|
+
*/
|
|
376
400
|
declare enum ChainType {
|
|
377
401
|
UNKNOWN = "unknown",
|
|
378
402
|
EVM = "evm",
|
|
@@ -383,6 +407,9 @@ declare enum ChainType {
|
|
|
383
407
|
}
|
|
384
408
|
|
|
385
409
|
declare const EndpointV2IdBase = 30000;
|
|
410
|
+
/**
|
|
411
|
+
* Enum representing different endpoint ids on mainnet. (Adapt Endpoint V1)
|
|
412
|
+
*/
|
|
386
413
|
declare enum MainnetEndpointId {
|
|
387
414
|
ETHEREUM_MAINNET = 101,
|
|
388
415
|
BSC_MAINNET = 102,
|
|
@@ -492,6 +519,9 @@ declare enum MainnetEndpointId {
|
|
|
492
519
|
HEMI_MAINNET = 329,
|
|
493
520
|
ISLANDER_MAINNET = 330
|
|
494
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* Enum representing different endpoint ids on testnet. (Adapt Endpoint V1)
|
|
524
|
+
*/
|
|
495
525
|
declare enum TestnetEndpointId {
|
|
496
526
|
BSC_TESTNET = 10102,
|
|
497
527
|
AVALANCHE_TESTNET = 10106,
|
|
@@ -652,6 +682,9 @@ declare enum TestnetEndpointId {
|
|
|
652
682
|
MOKSHA_TESTNET = 10342,
|
|
653
683
|
CITREA_TESTNET = 10344
|
|
654
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* Enum representing different endpoint ids on sandbox. (Adapt Endpoint V1)
|
|
687
|
+
*/
|
|
655
688
|
declare enum SandboxEndpointId {
|
|
656
689
|
BSC_SANDBOX = 20102,
|
|
657
690
|
AVALANCHE_SANDBOX = 20106,
|
|
@@ -665,6 +698,9 @@ declare enum SandboxEndpointId {
|
|
|
665
698
|
FANTOM_SANDBOX = 20112,
|
|
666
699
|
METIS_SANDBOX = 20151
|
|
667
700
|
}
|
|
701
|
+
/**
|
|
702
|
+
* Enum representing different endpoint ids on mainnet. (Adapt Endpoint V2)
|
|
703
|
+
*/
|
|
668
704
|
declare enum MainnetV2EndpointId {
|
|
669
705
|
ETHEREUM_V2_MAINNET = 30101,
|
|
670
706
|
BSC_V2_MAINNET = 30102,
|
|
@@ -777,6 +813,9 @@ declare enum MainnetV2EndpointId {
|
|
|
777
813
|
HEMI_V2_MAINNET = 30329,
|
|
778
814
|
ISLANDER_V2_MAINNET = 30330
|
|
779
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Enum representing different endpoint ids on testnet. (Adapt Endpoint V2)
|
|
818
|
+
*/
|
|
780
819
|
declare enum TestnetV2EndpointId {
|
|
781
820
|
AVALANCHE_V2_TESTNET = 40106,
|
|
782
821
|
POLYGON_V2_TESTNET = 40109,
|
|
@@ -938,6 +977,9 @@ declare enum TestnetV2EndpointId {
|
|
|
938
977
|
TON_V2_TESTNET = 40343,
|
|
939
978
|
CITREA_V2_TESTNET = 40344
|
|
940
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
* Enum representing different endpoint ids on sandbox. (Adapt Endpoint V2)
|
|
982
|
+
*/
|
|
941
983
|
declare enum SandboxV2EndpointId {
|
|
942
984
|
ETHEREUM_V2_SANDBOX = 50121,
|
|
943
985
|
POLYGON_V2_SANDBOX = 50109,
|
|
@@ -954,6 +996,10 @@ declare enum SandboxV2EndpointId {
|
|
|
954
996
|
ARBITRUM_V2_SANDBOX = 50143,
|
|
955
997
|
TON_V2_SANDBOX = 50343
|
|
956
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
|
+
*/
|
|
957
1003
|
declare const EndpointId: {
|
|
958
1004
|
[x: number]: string;
|
|
959
1005
|
ETHEREUM_V2_SANDBOX: SandboxV2EndpointId.ETHEREUM_V2_SANDBOX;
|
|
@@ -1516,8 +1562,15 @@ declare const EndpointId: {
|
|
|
1516
1562
|
HEMI_MAINNET: MainnetEndpointId.HEMI_MAINNET;
|
|
1517
1563
|
ISLANDER_MAINNET: MainnetEndpointId.ISLANDER_MAINNET;
|
|
1518
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
|
+
*/
|
|
1519
1569
|
type EndpointId = MainnetEndpointId | TestnetEndpointId | SandboxEndpointId | MainnetV2EndpointId | TestnetV2EndpointId | SandboxV2EndpointId;
|
|
1520
1570
|
|
|
1571
|
+
/**
|
|
1572
|
+
* Enum representing different environment.
|
|
1573
|
+
*/
|
|
1521
1574
|
declare enum Environment {
|
|
1522
1575
|
LOCAL = "local",
|
|
1523
1576
|
DEVNET = "devnet",
|
|
@@ -1525,30 +1578,51 @@ declare enum Environment {
|
|
|
1525
1578
|
MAINNET = "mainnet"
|
|
1526
1579
|
}
|
|
1527
1580
|
|
|
1581
|
+
/**
|
|
1582
|
+
* Enum representing different stages.
|
|
1583
|
+
*/
|
|
1528
1584
|
declare enum Stage {
|
|
1529
1585
|
MAINNET = "mainnet",
|
|
1530
1586
|
TESTNET = "testnet",
|
|
1531
1587
|
SANDBOX = "sandbox"
|
|
1532
1588
|
}
|
|
1533
1589
|
|
|
1590
|
+
/**
|
|
1591
|
+
* Enum representing different Endpoint versions.
|
|
1592
|
+
*/
|
|
1534
1593
|
declare enum EndpointVersion {
|
|
1535
1594
|
V1 = "v1",
|
|
1536
1595
|
V2 = "v2"
|
|
1537
1596
|
}
|
|
1538
1597
|
|
|
1598
|
+
/**
|
|
1599
|
+
* Enum representing the versions for READ MessageLib.
|
|
1600
|
+
*/
|
|
1539
1601
|
declare enum MessageLibCmdRead {
|
|
1540
1602
|
V_10_0_2 = "10.0.2"
|
|
1541
1603
|
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Enum representing the versions of MessageLib that support Endpoint V2.
|
|
1606
|
+
*/
|
|
1542
1607
|
declare enum MessageLibVersionV2 {
|
|
1543
1608
|
SIMPLE = "0.0.2",
|
|
1544
1609
|
ULTRA_LIGHT_NODE_302 = "3.0.2"
|
|
1545
1610
|
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Enum representing the versions of MessageLib that support Endpoint V1.
|
|
1613
|
+
*/
|
|
1546
1614
|
declare enum MessageLibVersionV1 {
|
|
1547
1615
|
ULTRA_LIGHT_NODE_301 = "3.0.1",
|
|
1548
1616
|
ULTRA_LIGHT_NODE_201 = "2.0.1"
|
|
1549
1617
|
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Type representing all possible versions for MessageLib.
|
|
1620
|
+
*/
|
|
1550
1621
|
type MessageLibVersion = MessageLibVersionV2 | MessageLibVersionV1 | MessageLibCmdRead;
|
|
1551
1622
|
|
|
1623
|
+
/**
|
|
1624
|
+
* Enum representing different chain keys.
|
|
1625
|
+
*/
|
|
1552
1626
|
declare enum ChainKey {
|
|
1553
1627
|
ETHEREUM = "ethereum",
|
|
1554
1628
|
GOERLI = "goerli",
|
|
@@ -1836,83 +1910,313 @@ declare enum ChainKey {
|
|
|
1836
1910
|
ISLANDER = "islander"
|
|
1837
1911
|
}
|
|
1838
1912
|
|
|
1913
|
+
/**
|
|
1914
|
+
* Enum representing different read channel ids.
|
|
1915
|
+
*/
|
|
1839
1916
|
declare enum ChannelId {
|
|
1840
1917
|
READ_CHANNEL_1 = 4294967295,
|
|
1841
1918
|
READ_CHANNEL_2 = 4294967294
|
|
1842
1919
|
}
|
|
1843
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
|
+
*/
|
|
1844
1927
|
declare const CHAIN_KEY: {
|
|
1845
1928
|
[endpointId in EndpointId]: ChainKey;
|
|
1846
1929
|
};
|
|
1847
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
|
+
*/
|
|
1848
1937
|
declare const ENVIRONMENT: {
|
|
1849
1938
|
[endpointId in EndpointId]: Environment;
|
|
1850
1939
|
};
|
|
1851
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
|
+
*/
|
|
1852
1947
|
declare const ULN_V1_CHAINS: (MainnetEndpointId | TestnetEndpointId | SandboxEndpointId)[];
|
|
1853
1948
|
|
|
1949
|
+
/**
|
|
1950
|
+
* Enum representing the different versions of ULN (Ultra Light Node).
|
|
1951
|
+
*/
|
|
1854
1952
|
declare enum UlnVersion {
|
|
1855
1953
|
V1 = 1,
|
|
1856
1954
|
V2 = 2,
|
|
1857
1955
|
V3 = 3
|
|
1858
1956
|
}
|
|
1859
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
|
+
*/
|
|
1860
1963
|
type Network = `${Chain}-${Stage}${'-local' | ''}`;
|
|
1964
|
+
/**
|
|
1965
|
+
* Interface representing the specification of an endpoint.
|
|
1966
|
+
*/
|
|
1861
1967
|
interface EndpointSpec {
|
|
1968
|
+
/**
|
|
1969
|
+
* The chain of the endpoint. {@link Chain}
|
|
1970
|
+
*/
|
|
1862
1971
|
chain: Chain;
|
|
1972
|
+
/**
|
|
1973
|
+
* The stage of the endpoint. {@link Stage}
|
|
1974
|
+
*/
|
|
1863
1975
|
stage: Stage;
|
|
1976
|
+
/**
|
|
1977
|
+
* The version of the endpoint. {@link EndpointVersion}
|
|
1978
|
+
*/
|
|
1864
1979
|
version: EndpointVersion;
|
|
1980
|
+
/**
|
|
1981
|
+
* The environment of the endpoint. {@link Environment}
|
|
1982
|
+
*/
|
|
1865
1983
|
env: Environment;
|
|
1866
1984
|
}
|
|
1867
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
|
+
*/
|
|
1868
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
|
+
*/
|
|
1869
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
|
+
*/
|
|
1870
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
|
+
*/
|
|
1871
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
|
+
*/
|
|
1872
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
|
+
*/
|
|
1873
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
|
+
*/
|
|
1874
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
|
+
*/
|
|
1875
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
|
+
*/
|
|
1876
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
|
+
*/
|
|
1877
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
|
+
*/
|
|
1878
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
|
+
*/
|
|
1879
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
|
+
*/
|
|
1880
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
|
+
*/
|
|
1881
2097
|
declare function networkToChainType(network: string): ChainType;
|
|
1882
2098
|
/**
|
|
1883
2099
|
* Returns the chain family for a given chain
|
|
1884
|
-
*
|
|
2100
|
+
*
|
|
2101
|
+
* @param {Chain} chain - The chain.
|
|
2102
|
+
* @returns {ChainType} The corresponding chain type.
|
|
1885
2103
|
*/
|
|
1886
2104
|
declare function chainToChainType(chain: Chain): ChainType;
|
|
1887
2105
|
/**
|
|
1888
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.
|
|
1889
2111
|
*/
|
|
1890
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
|
+
*/
|
|
1891
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
|
+
*/
|
|
1892
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
|
+
*/
|
|
1893
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
|
+
*/
|
|
1894
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
|
+
*/
|
|
1895
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
|
+
*/
|
|
1896
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
|
+
*/
|
|
1897
2166
|
declare function getNetworkForChainId(targetChainId: number): {
|
|
1898
2167
|
chainName: Chain;
|
|
1899
2168
|
env: Stage;
|
|
1900
2169
|
ulnVersion: string;
|
|
1901
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
|
+
*/
|
|
1902
2178
|
declare function isNetworkEndpointIdSupported(network: string, endpointVersion: EndpointVersion): boolean;
|
|
1903
2179
|
/**
|
|
1904
2180
|
* Determine if a chain is zkSync based.
|
|
1905
|
-
*
|
|
2181
|
+
*
|
|
2182
|
+
* @param {Chain} chain - The chain.
|
|
2183
|
+
* @returns {boolean} True if the chain is zkSync based, false otherwise.
|
|
1906
2184
|
*/
|
|
1907
2185
|
declare function isZKSyncBasedChain(chain: Chain): boolean;
|
|
1908
2186
|
/**
|
|
1909
|
-
* Determine if a chain is tron.
|
|
1910
|
-
*
|
|
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.
|
|
1911
2191
|
*/
|
|
1912
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
|
+
*/
|
|
1913
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
|
+
*/
|
|
1914
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
|
+
*/
|
|
1915
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
|
+
*/
|
|
1916
2220
|
declare function isInitiaChain(chain: Chain): boolean;
|
|
1917
2221
|
/**
|
|
1918
2222
|
* Checks if the given value is a valid Chain. {@link Chain}
|
|
@@ -1922,14 +2226,46 @@ declare function isInitiaChain(chain: Chain): boolean;
|
|
|
1922
2226
|
*/
|
|
1923
2227
|
declare function isChain(value: unknown): value is Chain;
|
|
1924
2228
|
|
|
2229
|
+
/**
|
|
2230
|
+
* Interface representing the specification of a blockchain.
|
|
2231
|
+
*/
|
|
1925
2232
|
interface ChainSpec {
|
|
2233
|
+
/**
|
|
2234
|
+
* The chain. {@link Chain}
|
|
2235
|
+
*/
|
|
1926
2236
|
chain?: Chain;
|
|
2237
|
+
/**
|
|
2238
|
+
* The type of the chain. {@link ChainType}
|
|
2239
|
+
*/
|
|
1927
2240
|
chainType: ChainType;
|
|
2241
|
+
/**
|
|
2242
|
+
* The size of the address in bytes.
|
|
2243
|
+
*/
|
|
1928
2244
|
addressSizeInBytes: number;
|
|
2245
|
+
/**
|
|
2246
|
+
* The number of decimals used by the chain.
|
|
2247
|
+
*/
|
|
1929
2248
|
decimals: number;
|
|
1930
2249
|
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Class providing methods to get chain specifications.
|
|
2252
|
+
*/
|
|
1931
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
|
+
*/
|
|
1932
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
|
+
*/
|
|
1933
2269
|
static getChainSpec(chainType: ChainType, chain: Chain | 'default'): ChainSpec;
|
|
1934
2270
|
}
|
|
1935
2271
|
|
package/dist/index.mjs
CHANGED
|
@@ -2394,7 +2394,7 @@ function networkToChain(network) {
|
|
|
2394
2394
|
}
|
|
2395
2395
|
function networkToChainType(network) {
|
|
2396
2396
|
const chain = networkToChain(network);
|
|
2397
|
-
return
|
|
2397
|
+
return chainToChainType(chain);
|
|
2398
2398
|
}
|
|
2399
2399
|
function chainToChainType(chain) {
|
|
2400
2400
|
switch (chain) {
|
|
@@ -2441,7 +2441,7 @@ function endpointIdToStage(endpointId) {
|
|
|
2441
2441
|
}
|
|
2442
2442
|
function endpointIdToChainType(endpointId) {
|
|
2443
2443
|
const chain = endpointIdToChain(endpointId);
|
|
2444
|
-
return
|
|
2444
|
+
return chainToChainType(chain);
|
|
2445
2445
|
}
|
|
2446
2446
|
function getNetworksForStage(stage) {
|
|
2447
2447
|
const networks = [];
|
|
@@ -2519,16 +2519,16 @@ function isTronChain(chain) {
|
|
|
2519
2519
|
return chain === Chain.TRON || chain === Chain.TRONDEV;
|
|
2520
2520
|
}
|
|
2521
2521
|
function isEvmChain(chain) {
|
|
2522
|
-
return
|
|
2522
|
+
return chainToChainType(chain) === "evm" /* EVM */;
|
|
2523
2523
|
}
|
|
2524
2524
|
function isAptosChain(chain) {
|
|
2525
|
-
return
|
|
2525
|
+
return chainToChainType(chain) === "aptos" /* APTOS */;
|
|
2526
2526
|
}
|
|
2527
2527
|
function isSolanaChain(chain) {
|
|
2528
|
-
return
|
|
2528
|
+
return chainToChainType(chain) === "solana" /* SOLANA */;
|
|
2529
2529
|
}
|
|
2530
2530
|
function isInitiaChain(chain) {
|
|
2531
|
-
return
|
|
2531
|
+
return chainToChainType(chain) === "initia" /* INITIA */;
|
|
2532
2532
|
}
|
|
2533
2533
|
function isChain(value) {
|
|
2534
2534
|
return Object.values(Chain).includes(value);
|
|
@@ -2559,9 +2559,23 @@ var chainSpecConfig = {
|
|
|
2559
2559
|
}
|
|
2560
2560
|
};
|
|
2561
2561
|
var ChainSpecs = class {
|
|
2562
|
+
/**
|
|
2563
|
+
* Gets the address size in bytes for a given chain.
|
|
2564
|
+
*
|
|
2565
|
+
* @param {Chain} chain - The chain.
|
|
2566
|
+
* @returns {number} The address size in bytes.
|
|
2567
|
+
*/
|
|
2562
2568
|
static getAddressSizeInBytes(chain) {
|
|
2563
2569
|
return this.getChainSpec(getChainType(chain), chain).addressSizeInBytes;
|
|
2564
2570
|
}
|
|
2571
|
+
/**
|
|
2572
|
+
* Gets the chain specification for a given chain type and chain.
|
|
2573
|
+
*
|
|
2574
|
+
* @param {ChainType} chainType - The type of the chain.
|
|
2575
|
+
* @param {Chain | 'default'} chain - The chain or 'default'.
|
|
2576
|
+
* @returns {ChainSpec} The chain specification.
|
|
2577
|
+
* @throws {Error} If the configuration for the chain type is not found.
|
|
2578
|
+
*/
|
|
2565
2579
|
static getChainSpec(chainType, chain) {
|
|
2566
2580
|
if (chainSpecConfig[chainType] === void 0) {
|
|
2567
2581
|
throw new Error(`config for ${chainType} not found in staticConfig`);
|