11import depd from 'depd' ;
2- import { z } from 'zod' ;
3-
4- import {
5- LITChain ,
6- LITCosmosChain ,
7- LITEVMChain ,
8- LITSVMChain ,
9- } from '@lit-protocol/types' ;
102
113const deprecated = depd ( 'lit-js-sdk:constants:constants' ) ;
124
@@ -15,8 +7,6 @@ const deprecated = depd('lit-js-sdk:constants:constants');
157 */
168export const NETWORK_PUB_KEY =
179 '9971e835a1fe1a4d78e381eebbe0ddc84fde5119169db816900de796d10187f3c53d65c1202ac083d099a517f34a9b62' ;
18- export const NetworkPubKeySchema = z . literal ( NETWORK_PUB_KEY ) . readonly ( ) ;
19- export type NETWORK_PUB_KEY_TYPE = z . infer < typeof NetworkPubKeySchema > ;
2010
2111// you can either pass a "chain" param to lit functions, which it uses to tell which network your sig came from.
2212// or, you can pass a authSig that has and of these keys in it to tell which network your sig came from.
@@ -26,19 +16,9 @@ export const LIT_AUTH_SIG_CHAIN_KEYS = [
2616 'cosmos' ,
2717 'kyve' ,
2818] as const ;
29- export const LitAuthSigChainKeysSchema = z
30- . enum ( LIT_AUTH_SIG_CHAIN_KEYS )
31- . readonly ( ) ;
32- export type LIT_AUTH_SIG_CHAIN_KEYS_TYPE = z . infer <
33- typeof LitAuthSigChainKeysSchema
34- > ;
3519
3620export const AUTH_SIGNATURE_BODY =
3721 'I am creating an account to use Lit Protocol at {{timestamp}}' ;
38- export const AuthSignatureBodySchema = z
39- . literal ( AUTH_SIGNATURE_BODY )
40- . readonly ( ) ;
41- export type AUTH_SIGNATURE_BODY_TYPE = z . infer < typeof AuthSignatureBodySchema > ;
4222
4323const yellowstoneChain = {
4424 contractAddress : null ,
@@ -51,31 +31,15 @@ const yellowstoneChain = {
5131 blockExplorerUrls : [ 'https://yellowstone-explorer.litprotocol.com/' ] as const ,
5232 type : null ,
5333 vmType : 'EVM' ,
54- } ;
55- export const EVMChainSchema = z
56- . object ( {
57- name : z . string ( ) ,
58- symbol : z . string ( ) ,
59- decimals : z . number ( ) ,
60- rpcUrls : z . array ( z . string ( ) ) . nonempty ( ) . readonly ( ) ,
61- blockExplorerUrls : z . array ( z . string ( ) ) . nonempty ( ) . readonly ( ) ,
62- vmType : z . literal ( yellowstoneChain . vmType ) ,
63- // Properties for EVM
64- chainId : z . number ( ) ,
65- contractAddress : z . union ( [ z . string ( ) . optional ( ) , z . null ( ) ] ) ,
66- type : z . union ( [ z . string ( ) . optional ( ) , z . null ( ) ] ) ,
67- extra : z . boolean ( ) . optional ( ) , // What is this? Only yellowstone has it and is not used anywhere
68- } )
69- . readonly ( ) ;
70- export type YELLOWSTONE_CHAIN_TYPE = z . infer < typeof EVMChainSchema > ;
34+ } as const ;
7135
7236/**
7337 * EVM Chains supported by the LIT protocol. Each chain includes an optional pre-deployed token contract that you may use for minting LITs. These are ERC1155 contracts that let you mint any quantity of a given token. Use the chain name as a key in this object.
7438 * @constant
7539 * @type { LITEVMChain }
7640 * @default
7741 */
78- export const LIT_CHAINS : LITChain < LITEVMChain > = {
42+ export const LIT_CHAINS : { [ key : string ] : any } = {
7943 ethereum : {
8044 contractAddress : '0xA54F7579fFb3F98bd8649fF02813F575f9b3d353' ,
8145 chainId : 1 ,
@@ -790,10 +754,7 @@ export const LIT_CHAINS: LITChain<LITEVMChain> = {
790754 type : null ,
791755 vmType : 'EVM' ,
792756 } ,
793- } ;
794- export const LitEvmChainsSchema = z . record ( z . string ( ) , EVMChainSchema ) ;
795- export type LitEVMChains = z . infer < typeof LitEvmChainsSchema > ;
796-
757+ } as const ;
797758export const LIT_EVM_CHAINS = LIT_CHAINS ;
798759
799760/**
@@ -815,24 +776,7 @@ export const METAMASK_CHAIN_INFO = {
815776 blockExplorerUrls : LIT_CHAINS [ 'yellowstone' ] . blockExplorerUrls ,
816777 iconUrls : [ 'future' ] as const ,
817778 } ,
818- } ;
819- const MetamaskChainInfoSchema = z . object ( {
820- yellowstone : z
821- . object ( {
822- chainId : z . number ( ) ,
823- chainName : z . string ( ) ,
824- nativeCurrency : z . object ( {
825- name : z . string ( ) ,
826- symbol : z . string ( ) ,
827- decimals : z . number ( ) ,
828- } ) ,
829- rpcUrls : z . array ( z . string ( ) ) ,
830- blockExplorerUrls : z . array ( z . string ( ) ) ,
831- iconUrls : z . enum ( METAMASK_CHAIN_INFO . yellowstone . iconUrls ) ,
832- } )
833- . readonly ( ) ,
834- } ) ;
835- export type MetamaskChainInfo = z . infer < typeof MetamaskChainInfoSchema > ;
779+ } as const ;
836780
837781/**
838782 * @deprecated Will be removed - Use METAMASK_CHAIN_INFO instead
@@ -863,11 +807,6 @@ export const LIT_RPC = {
863807 */
864808 CHRONICLE_YELLOWSTONE : 'https://yellowstone-rpc.litprotocol.com' ,
865809} as const ;
866- const LitRpcSchema = z . object ( {
867- LOCAL_ANVIL : z . literal ( LIT_RPC . LOCAL_ANVIL ) ,
868- CHRONICLE_YELLOWSTONE : z . literal ( LIT_RPC . CHRONICLE_YELLOWSTONE ) ,
869- } ) ;
870- export type LitRpc = z . infer < typeof LitRpcSchema > ;
871810
872811/**
873812 * Represents the Lit Network constants.
@@ -878,13 +817,6 @@ export const LIT_NETWORK = {
878817 Datil : 'datil' ,
879818 Custom : 'custom' ,
880819} as const ;
881- const LitNetworkSchema = z . object ( {
882- DatilDev : z . literal ( LIT_NETWORK . DatilDev ) ,
883- DatilTest : z . literal ( LIT_NETWORK . DatilTest ) ,
884- Datil : z . literal ( LIT_NETWORK . Datil ) ,
885- Custom : z . literal ( LIT_NETWORK . Custom ) ,
886- } ) ;
887- export type LitNetwork = z . infer < typeof LitNetworkSchema > ;
888820/**
889821 * @deprecated Will be removed. - Use LIT_NETWORK instead
890822 * Alias for LIT_NETWORK. Added for backwards compatibility.
@@ -919,14 +851,7 @@ export const RPC_URL_BY_NETWORK: { [key in LIT_NETWORK_VALUES]: string } = {
919851 'datil-test' : LIT_RPC . CHRONICLE_YELLOWSTONE ,
920852 datil : LIT_RPC . CHRONICLE_YELLOWSTONE ,
921853 custom : LIT_RPC . LOCAL_ANVIL ,
922- } ;
923- export const RpcUlrByNetworkSchema = z . object ( {
924- 'datil-dev' : z . literal ( LIT_RPC . CHRONICLE_YELLOWSTONE ) ,
925- 'datil-test' : z . literal ( LIT_RPC . CHRONICLE_YELLOWSTONE ) ,
926- datil : z . literal ( LIT_RPC . CHRONICLE_YELLOWSTONE ) ,
927- custom : z . literal ( LIT_RPC . LOCAL_ANVIL ) ,
928- } ) ;
929- export type RpcUlrByNetwork = z . infer < typeof RpcUlrByNetworkSchema > ;
854+ } as const ;
930855
931856/**
932857 * Mapping of network names to their corresponding relayer URLs.
@@ -938,14 +863,7 @@ export const RELAYER_URL_BY_NETWORK: {
938863 'datil-test' : 'https://datil-test-relayer.getlit.dev' ,
939864 datil : 'https://datil-relayer.getlit.dev' ,
940865 custom : 'http://localhost:3000' ,
941- } ;
942- export const RelayerUrlByNetworkSchema = z . object ( {
943- 'datil-dev' : z . literal ( 'https://datil-dev-relayer.getlit.dev' ) ,
944- 'datil-test' : z . literal ( 'https://datil-test-relayer.getlit.dev' ) ,
945- datil : z . literal ( 'https://datil-relayer.getlit.dev' ) ,
946- custom : z . literal ( 'http://localhost:3000' ) ,
947- } ) ;
948- export type RelayerUrlByNetwork = z . infer < typeof RelayerUrlByNetworkSchema > ;
866+ } as const ;
949867
950868/**
951869 * Mapping of network values to corresponding Metamask chain info.
@@ -958,16 +876,7 @@ export const METAMASK_CHAIN_INFO_BY_NETWORK: Record<
958876 'datil-test' : METAMASK_CHAIN_INFO . yellowstone ,
959877 datil : METAMASK_CHAIN_INFO . yellowstone ,
960878 custom : METAMASK_CHAIN_INFO . yellowstone ,
961- } ;
962- export const MetamaskChainInfoByNetworkSchema = z . object ( {
963- 'datil-dev' : MetamaskChainInfoSchema . shape . yellowstone ,
964- 'datil-test' : MetamaskChainInfoSchema . shape . yellowstone ,
965- datil : MetamaskChainInfoSchema . shape . yellowstone ,
966- custom : MetamaskChainInfoSchema . shape . yellowstone ,
967- } ) ;
968- export type MetamaskChainInfoByNetwork = z . infer <
969- typeof MetamaskChainInfoByNetworkSchema
970- > ;
879+ } as const ;
971880
972881export const HTTP = 'http://' ;
973882export const HTTPS = 'https://' ;
@@ -983,7 +892,7 @@ export const HTTP_BY_NETWORK: Record<
983892 'datil-test' : HTTPS ,
984893 datil : HTTPS ,
985894 custom : HTTP , // default, can be changed by config
986- } ;
895+ } as const ;
987896
988897/**
989898 * Mapping of network values to their corresponding centralisation status.
@@ -1004,116 +913,114 @@ export const CENTRALISATION_BY_NETWORK: Record<
1004913 * @type { LITSVMChain }
1005914 * @default
1006915 */
1007- export const LIT_SVM_CHAINS : LITChain < LITSVMChain > = {
916+ export const LIT_SVM_CHAINS : { [ key : string ] : any } = {
1008917 solana : {
1009918 name : 'Solana' ,
1010919 symbol : 'SOL' ,
1011920 decimals : 9 ,
1012- rpcUrls : [ 'https://api.mainnet-beta.solana.com' ] ,
1013- blockExplorerUrls : [ 'https://explorer.solana.com/' ] ,
921+ rpcUrls : [ 'https://api.mainnet-beta.solana.com' ] as const ,
922+ blockExplorerUrls : [ 'https://explorer.solana.com/' ] as const ,
1014923 vmType : 'SVM' ,
1015924 } ,
1016925 solanaDevnet : {
1017926 name : 'Solana Devnet' ,
1018927 symbol : 'SOL' ,
1019928 decimals : 9 ,
1020- rpcUrls : [ 'https://api.devnet.solana.com' ] ,
1021- blockExplorerUrls : [ 'https://explorer.solana.com/' ] ,
929+ rpcUrls : [ 'https://api.devnet.solana.com' ] as const ,
930+ blockExplorerUrls : [ 'https://explorer.solana.com/' ] as const ,
1022931 vmType : 'SVM' ,
1023932 } ,
1024933 solanaTestnet : {
1025934 name : 'Solana Testnet' ,
1026935 symbol : 'SOL' ,
1027936 decimals : 9 ,
1028- rpcUrls : [ 'https://api.testnet.solana.com' ] ,
1029- blockExplorerUrls : [ 'https://explorer.solana.com/' ] ,
937+ rpcUrls : [ 'https://api.testnet.solana.com' ] as const ,
938+ blockExplorerUrls : [ 'https://explorer.solana.com/' ] as const ,
1030939 vmType : 'SVM' ,
1031940 } ,
1032- } ;
941+ } as const ;
1033942
1034943/**
1035944 * Cosmos Chains supported by the LIT protocol. Use the chain name as a key in this object.
1036945 * @constant
1037946 * @type { LITCosmosChain }
1038947 * @default
1039948 */
1040- export const LIT_COSMOS_CHAINS : LITChain < LITCosmosChain > = {
949+ export const LIT_COSMOS_CHAINS : { [ key : string ] : any } = {
1041950 cosmos : {
1042951 name : 'Cosmos' ,
1043952 symbol : 'ATOM' ,
1044953 decimals : 6 ,
1045954 chainId : 'cosmoshub-4' ,
1046- rpcUrls : [ 'https://lcd-cosmoshub.keplr.app' ] ,
1047- blockExplorerUrls : [ 'https://atomscan.com/' ] ,
955+ rpcUrls : [ 'https://lcd-cosmoshub.keplr.app' ] as const ,
956+ blockExplorerUrls : [ 'https://atomscan.com/' ] as const ,
1048957 vmType : 'CVM' ,
1049958 } ,
1050959 kyve : {
1051960 name : 'Kyve' ,
1052961 symbol : 'KYVE' ,
1053962 decimals : 6 ,
1054963 chainId : 'korellia' ,
1055- rpcUrls : [ 'https://api.korellia.kyve.network' ] ,
1056- blockExplorerUrls : [ 'https://explorer.kyve.network/' ] ,
964+ rpcUrls : [ 'https://api.korellia.kyve.network' ] as const ,
965+ blockExplorerUrls : [ 'https://explorer.kyve.network/' ] as const ,
1057966 vmType : 'CVM' ,
1058967 } ,
1059968 evmosCosmos : {
1060969 name : 'EVMOS Cosmos' ,
1061970 symbol : 'EVMOS' ,
1062971 decimals : 18 ,
1063972 chainId : 'evmos_9001-2' ,
1064- rpcUrls : [ 'https://rest.bd.evmos.org:1317' ] ,
1065- blockExplorerUrls : [ 'https://evmos.bigdipper.live' ] ,
973+ rpcUrls : [ 'https://rest.bd.evmos.org:1317' ] as const ,
974+ blockExplorerUrls : [ 'https://evmos.bigdipper.live' ] as const ,
1066975 vmType : 'CVM' ,
1067976 } ,
1068977 evmosCosmosTestnet : {
1069978 name : 'Evmos Cosmos Testnet' ,
1070979 symbol : 'EVMOS' ,
1071980 decimals : 18 ,
1072981 chainId : 'evmos_9000-4' ,
1073- rpcUrls : [ 'https://rest.bd.evmos.dev:1317' ] ,
1074- blockExplorerUrls : [ 'https://testnet.bigdipper.live' ] ,
982+ rpcUrls : [ 'https://rest.bd.evmos.dev:1317' ] as const ,
983+ blockExplorerUrls : [ 'https://testnet.bigdipper.live' ] as const ,
1075984 vmType : 'CVM' ,
1076985 } ,
1077986 cheqdMainnet : {
1078987 name : 'Cheqd Mainnet' ,
1079988 symbol : 'CHEQ' ,
1080989 decimals : 9 ,
1081990 chainId : 'cheqd-mainnet-1' ,
1082- rpcUrls : [ 'https://api.cheqd.net' ] ,
1083- blockExplorerUrls : [ 'https://explorer.cheqd.io' ] ,
991+ rpcUrls : [ 'https://api.cheqd.net' ] as const ,
992+ blockExplorerUrls : [ 'https://explorer.cheqd.io' ] as const ,
1084993 vmType : 'CVM' ,
1085994 } ,
1086995 cheqdTestnet : {
1087996 name : 'Cheqd Testnet' ,
1088997 symbol : 'CHEQ' ,
1089998 decimals : 9 ,
1090999 chainId : 'cheqd-testnet-6' ,
1091- rpcUrls : [ 'https://api.cheqd.network' ] ,
1092- blockExplorerUrls : [ 'https://testnet-explorer.cheqd.io' ] ,
1000+ rpcUrls : [ 'https://api.cheqd.network' ] as const ,
1001+ blockExplorerUrls : [ 'https://testnet-explorer.cheqd.io' ] as const ,
10931002 vmType : 'CVM' ,
10941003 } ,
10951004 juno : {
10961005 name : 'Juno' ,
10971006 symbol : 'JUNO' ,
10981007 decimals : 6 ,
10991008 chainId : 'juno-1' ,
1100- rpcUrls : [ 'https://rest.cosmos.directory/juno' ] ,
1101- blockExplorerUrls : [ 'https://www.mintscan.io/juno' ] ,
1009+ rpcUrls : [ 'https://rest.cosmos.directory/juno' ] as const ,
1010+ blockExplorerUrls : [ 'https://www.mintscan.io/juno' ] as const ,
11021011 vmType : 'CVM' ,
11031012 } ,
1104- } ;
1013+ } as const ;
11051014
11061015/**
11071016 * All Chains supported by the LIT protocol. Use the chain name as a key in this object.
11081017 * @type { LITChain<LITEVMChain | LITSVMChain | LITCosmosChain> }
11091018 */
1110- export const ALL_LIT_CHAINS : LITChain <
1111- LITEVMChain | LITSVMChain | LITCosmosChain
1112- > = {
1019+ export const ALL_LIT_CHAINS : { [ key : string ] : any } = {
11131020 ...LIT_CHAINS ,
11141021 ...LIT_SVM_CHAINS ,
11151022 ...LIT_COSMOS_CHAINS ,
1116- } ;
1023+ } as const ;
11171024
11181025/**
11191026 * Local storage key constants
@@ -1126,15 +1033,15 @@ export const LOCAL_STORAGE_KEYS = {
11261033 KEY_PAIR : 'lit-comms-keypair' ,
11271034 SESSION_KEY : 'lit-session-key' ,
11281035 WALLET_SIGNATURE : 'lit-wallet-sig' ,
1129- } ;
1036+ } as const ;
11301037
11311038/**
11321039 * Symmetric key algorithm parameters
11331040 */
11341041export const SYMM_KEY_ALGO_PARAMS = {
11351042 name : 'AES-CBC' ,
11361043 length : 256 ,
1137- } ;
1044+ } as const ;
11381045
11391046/**
11401047 * Default node URLs for each LIT network
@@ -1146,10 +1053,10 @@ export const LIT_NETWORKS: { [key in LIT_NETWORK_VALUES]: string[] } = {
11461053 'datil-test' : [ ] ,
11471054 datil : [ ] ,
11481055 custom : [ ] ,
1149- } ;
1056+ } as const ;
11501057
11511058// ========== Lit Sessions ==========
1152- export const LIT_SESSION_KEY_URI = 'lit:session:' ;
1059+ export const LIT_SESSION_KEY_URI = 'lit:session:' as const ;
11531060
11541061// ========== Lit Auth Methods ==========
11551062
@@ -1158,17 +1065,17 @@ export const AUTH_METHOD_TYPE_IDS = {
11581065 DISCORD : 4 ,
11591066 GOOGLE : 5 ,
11601067 GOOGLE_JWT : 6 ,
1161- } ;
1068+ } as const ;
11621069
11631070// ========== PKP Client ==========
1164- export const PKP_CLIENT_SUPPORTED_CHAINS = [ 'eth' , 'cosmos' ] ;
1071+ export const PKP_CLIENT_SUPPORTED_CHAINS = [ 'eth' , 'cosmos' ] as const ;
11651072
11661073// ========== RLI Delegation ==========
1167- export const SIWE_DELEGATION_URI = 'lit:capability:delegation' ;
1074+ export const SIWE_DELEGATION_URI = 'lit:capability:delegation' as const ;
11681075
11691076// ========== Lit Actions ==========
11701077export const LIT_ACTION_IPFS_HASH =
1171- 'QmUjX8MW6StQ7NKNdaS6g4RMkvN5hcgtKmEi8Mca6oX4t3' ;
1078+ 'QmUjX8MW6StQ7NKNdaS6g4RMkvN5hcgtKmEi8Mca6oX4t3' as const ;
11721079
11731080// ========== Chains ==========
11741081export const VMTYPE = {
0 commit comments