Skip to content

Commit c92dc39

Browse files
authored
Merge pull request #523 from LIT-Protocol/feature/lit-3549-js-sdk-add-datiltest-support
Feature/lit 3549 js sdk add datiltest support
2 parents f555777 + 28972a5 commit c92dc39

File tree

13 files changed

+328
-175
lines changed

13 files changed

+328
-175
lines changed

local-tests/setup/tinny-config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export enum LIT_TESTNET {
66
MANZANO = 'manzano',
77
CAYENNE = 'cayenne',
88
DATIL_DEV = 'datil-dev',
9+
DATIL_TEST = 'datil-test',
910
}
1011

1112
export enum LIT_RPC {
@@ -22,6 +23,7 @@ export const RPC_MAP = {
2223
[LIT_TESTNET.MANZANO]: LIT_RPC.CHRONICLE,
2324
[LIT_TESTNET.CAYENNE]: LIT_RPC.CHRONICLE,
2425
[LIT_TESTNET.DATIL_DEV]: LIT_RPC.VESUVIUS,
26+
[LIT_TESTNET.DATIL_TEST]: LIT_RPC.VESUVIUS,
2527
};
2628

2729
export interface ProcessEnvs {

local-tests/tests/wrapped-keys/util.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ export function getChainForNetwork(network: LIT_NETWORKS_KEYS): {
1616
chainId: LIT_CHAINS['chronicleTestnet'].chainId,
1717
};
1818
case 'datil-dev':
19-
return { chain: 'vesuvius', chainId: LIT_CHAINS['datilDevnet'].chainId };
19+
return {
20+
chain: 'vesuvius',
21+
chainId: LIT_CHAINS['chronicleVesuviusTestnet'].chainId,
22+
};
23+
case 'datil-test':
24+
return {
25+
chain: 'vesuvius',
26+
chainId: LIT_CHAINS['chronicleVesuviusTestnet'].chainId,
27+
};
2028
default:
2129
throw new Error(`Cannot identify chain params for ${network}`);
2230
}
@@ -36,6 +44,8 @@ export function getGasParamsForNetwork(network: LIT_NETWORKS_KEYS): {
3644
};
3745
case 'datil-dev':
3846
return { gasLimit: 5000000 };
47+
case 'datil-test':
48+
return { gasLimit: 5000000 };
3949
default:
4050
throw new Error(`Cannot identify chain params for ${network}`);
4151
}

packages/constants/src/lib/constants/constants.ts

Lines changed: 214 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -466,22 +466,50 @@ export const LIT_CHAINS: LITChain<LITEVMChain> = {
466466
type: null,
467467
vmType: 'EVM',
468468
},
469+
470+
/**
471+
* Chainlist entry for the Chronicle Testnet.
472+
* https://chainlist.org/chain/175177
473+
*/
469474
chronicleTestnet: {
470475
contractAddress: null,
471476
chainId: 175177,
472477
name: 'Chronicle - Lit Protocol Testnet',
473-
symbol: 'testLPX',
478+
symbol: 'tstLIT',
474479
decimals: 18,
475-
rpcUrls: ['https://lit-protocol.calderachain.xyz/replica-http'],
480+
rpcUrls: [
481+
'https://lit-protocol.calderachain.xyz/replica-http',
482+
'https://chain-rpc.litprotocol.com/http',
483+
],
476484
blockExplorerUrls: ['https://chain.litprotocol.com/'],
477485
type: null,
478486
vmType: 'EVM',
479487
},
488+
489+
/**
490+
* @deprecated Will be removed in version 7.x. - Use `chronicleVesuviusTestnet` instead.
491+
*/
480492
datilDevnet: {
481493
contractAddress: null,
482494
chainId: 2311,
483-
name: 'Vesuvius - Lit Protocol Devnet',
484-
symbol: 'testLIT',
495+
name: 'Chronicle Vesuvius - Lit Protocol Testnet',
496+
symbol: 'tstLPX',
497+
decimals: 18,
498+
rpcUrls: ['https://vesuvius-rpc.litprotocol.com/'],
499+
blockExplorerUrls: ['https://vesuvius-explorer.litprotocol.com/'],
500+
type: null,
501+
vmType: 'EVM',
502+
},
503+
504+
/**
505+
* Chainlist entry for the Chronicle Vesuvius Testnet.
506+
* https://chainlist.org/chain/2311
507+
*/
508+
chronicleVesuviusTestnet: {
509+
contractAddress: null,
510+
chainId: 2311,
511+
name: 'Chronicle Vesuvius - Lit Protocol Testnet',
512+
symbol: 'tstLPX',
485513
decimals: 18,
486514
rpcUrls: ['https://vesuvius-rpc.litprotocol.com/'],
487515
blockExplorerUrls: ['https://vesuvius-explorer.litprotocol.com/'],
@@ -492,9 +520,12 @@ export const LIT_CHAINS: LITChain<LITEVMChain> = {
492520
contractAddress: null,
493521
chainId: 175177,
494522
name: 'Chronicle - Lit Protocol Testnet',
495-
symbol: 'testLPX',
523+
symbol: 'tstLIT',
496524
decimals: 18,
497-
rpcUrls: ['https://lit-protocol.calderachain.xyz/replica-http'],
525+
rpcUrls: [
526+
'https://lit-protocol.calderachain.xyz/replica-http',
527+
'https://chain-rpc.litprotocol.com/http',
528+
],
498529
blockExplorerUrls: ['https://chain.litprotocol.com/'],
499530
type: null,
500531
vmType: 'EVM',
@@ -611,30 +642,179 @@ export const LIT_CHAINS: LITChain<LITEVMChain> = {
611642
},
612643
};
613644

645+
/**
646+
* @deprecated Will be removed in version 7.x. - This is using the OLD chornicle testnet. `LIT_CHAINS['chronicleTestnet']` instead, or use `LIT_CHAINS['chronicleVesuviusTestnet']` for the new Chronicle Vesuvius Testnet (Jul 2024).
647+
*/
614648
export const LIT_CHAIN_RPC_URL = LIT_CHAINS['chronicleTestnet'].rpcUrls[0];
615649

616650
/**
617-
* Enum representing the available LIT RPC endpoints.
651+
* Object containing information to submit to Metamask
652+
*/
653+
export const metamaskChainInfo = {
654+
/**
655+
* Information about the "chronicle" chain.
656+
*/
657+
chronicle: {
658+
chainId: LIT_CHAINS['chronicleTestnet'].chainId,
659+
chainName: LIT_CHAINS['chronicleTestnet'].name,
660+
nativeCurrency: {
661+
name: LIT_CHAINS['chronicleTestnet'].symbol,
662+
symbol: LIT_CHAINS['chronicleTestnet'].symbol,
663+
decimals: LIT_CHAINS['chronicleTestnet'].decimals,
664+
},
665+
rpcUrls: LIT_CHAINS['chronicleTestnet'].rpcUrls,
666+
blockExplorerUrls: LIT_CHAINS['chronicleTestnet'].blockExplorerUrls,
667+
iconUrls: ['future'],
668+
},
669+
/**
670+
* Information about the "chronicleVesuvius" chain.
671+
*/
672+
chronicleVesuvius: {
673+
chainId: LIT_CHAINS['chronicleVesuviusTestnet'].chainId,
674+
chainName: LIT_CHAINS['chronicleVesuviusTestnet'].name,
675+
nativeCurrency: {
676+
name: LIT_CHAINS['chronicleVesuviusTestnet'].symbol,
677+
symbol: LIT_CHAINS['chronicleVesuviusTestnet'].symbol,
678+
decimals: LIT_CHAINS['chronicleVesuviusTestnet'].decimals,
679+
},
680+
rpcUrls: LIT_CHAINS['chronicleVesuviusTestnet'].rpcUrls,
681+
blockExplorerUrls: LIT_CHAINS['chronicleVesuviusTestnet'].blockExplorerUrls,
682+
iconUrls: ['future'],
683+
},
684+
};
685+
686+
/**
687+
* Constants representing the available LIT RPC endpoints.
618688
*/
619-
export enum LIT_RPC {
689+
export const LIT_RPC = {
620690
/**
621691
* Local Anvil RPC endpoint.
622692
*/
623-
LOCAL_ANVIL = 'http://127.0.0.1:8545',
693+
LOCAL_ANVIL: 'http://127.0.0.1:8545',
624694

625695
/**
626696
* Chronicle RPC endpoint - Used for Cayenne, Manzano, Habanero
627697
*/
628-
CHRONICLE = 'https://chain-rpc.litprotocol.com/http',
698+
CHRONICLE: 'https://chain-rpc.litprotocol.com/http',
629699

630700
/**
631-
* Vesuvius RPC endpoint - used for >= Datil-dev
701+
* Chronicle Vesuvius RPC endpoint - used for >= Datil-dev, Datil-test
702+
* @deprecated Will be removed in version 7.x. - Use CHRONICLE_VESUVIUS instead
632703
*/
633-
VESUVIUS = 'https://vesuvius-rpc.litprotocol.com',
634-
}
704+
VESUVIUS: 'https://vesuvius-rpc.litprotocol.com',
705+
706+
/**
707+
* Chronicle Vesuvius RPC endpoint - used for >= Datil-dev, Datil-test
708+
*/
709+
CHRONICLE_VESUVIUS: 'https://vesuvius-rpc.litprotocol.com',
710+
} as const;
635711

636712
export const LIT_EVM_CHAINS = LIT_CHAINS;
637713

714+
/**
715+
* Represents the Lit Network constants.
716+
*/
717+
export const LIT_NETWORK = {
718+
Cayenne: 'cayenne',
719+
Manzano: 'manzano',
720+
Habanero: 'habanero',
721+
DatilDev: 'datil-dev',
722+
DatilTest: 'datil-test',
723+
Custom: 'custom',
724+
Localhost: 'localhost',
725+
};
726+
727+
/**
728+
* The type representing the keys of the LIT_NETWORK object.
729+
*/
730+
export type LIT_NETWORK_TYPES = keyof typeof LIT_NETWORK;
731+
732+
/**
733+
* The type representing the values of the LIT_NETWORK object.
734+
*/
735+
export type LIT_NETWORK_VALUES = (typeof LIT_NETWORK)[keyof typeof LIT_NETWORK];
736+
737+
/**
738+
* RPC URL by Network
739+
*
740+
* A mapping of network names to their corresponding RPC URLs.
741+
*/
742+
export const RPC_URL_BY_NETWORK: { [key in LIT_NETWORK_VALUES]: string } = {
743+
cayenne: LIT_RPC.CHRONICLE,
744+
manzano: LIT_RPC.CHRONICLE,
745+
habanero: LIT_RPC.CHRONICLE,
746+
'datil-dev': LIT_RPC.CHRONICLE_VESUVIUS,
747+
'datil-test': LIT_RPC.CHRONICLE_VESUVIUS,
748+
custom: LIT_RPC.LOCAL_ANVIL,
749+
localhost: LIT_RPC.LOCAL_ANVIL,
750+
};
751+
752+
/**
753+
* Mapping of network names to their corresponding relayer URLs.
754+
*/
755+
export const RELAYER_URL_BY_NETWORK: {
756+
[key in LIT_NETWORK_VALUES]: string;
757+
} = {
758+
cayenne: 'https://relayer-server-staging-cayenne.getlit.dev',
759+
manzano: 'https://manzano-relayer.getlit.dev',
760+
habanero: 'https://habanero-relayer.getlit.dev',
761+
'datil-dev': 'https://datil-dev-relayer.getlit.dev',
762+
'datil-test': 'https://datil-test-relayer.getlit.dev',
763+
custom: 'http://localhost:3000',
764+
localhost: 'http://localhost:3000',
765+
};
766+
767+
/**
768+
* URL mappings for general worker URLs by network.
769+
*/
770+
export const GENERAL_WORKER_URL_BY_NETWORK: {
771+
[key in LIT_NETWORK_VALUES]: string;
772+
} = {
773+
cayenne: 'https://apis.getlit.dev/cayenne/contracts',
774+
manzano: 'https://apis.getlit.dev/manzano/contracts',
775+
habanero: 'https://apis.getlit.dev/habanero/contracts',
776+
'datil-dev': 'https://apis.getlit.dev/datil-dev/contracts',
777+
'datil-test': 'https://apis.getlit.dev/datil-test/contracts',
778+
779+
// just use cayenne abis for custom and localhost
780+
custom: 'https://apis.getlit.dev/cayenne/contracts',
781+
localhost: 'https://apis.getlit.dev/cayenne/contracts',
782+
};
783+
784+
/**
785+
* URL constants for the staging worker by network.
786+
*/
787+
export const GENERAL_STAGING_WORKER_URL_BY_NETWORK: {
788+
[key in LIT_NETWORK_VALUES]: string;
789+
} = {
790+
cayenne: 'https://staging.apis.getlit.dev/cayenne/contracts',
791+
manzano: 'https://staging.apis.getlit.dev/manzano/contracts',
792+
habanero: 'https://staging.apis.getlit.dev/habanero/contracts',
793+
'datil-dev': 'https://staging.apis.getlit.dev/datil-dev/contracts',
794+
'datil-test': 'https://staging.apis.getlit.dev/datil-test/contracts',
795+
796+
// just use cayenne abis for custom and localhost
797+
custom: 'https://apis.getlit.dev/cayenne/contracts',
798+
localhost: 'https://apis.getlit.dev/cayenne/contracts',
799+
};
800+
801+
/**
802+
* Mapping of network values to corresponding Metamask chain info.
803+
*/
804+
export const METAMASK_CHAIN_INFO_BY_NETWORK: Record<
805+
LIT_NETWORK_VALUES,
806+
| typeof metamaskChainInfo.chronicle
807+
| typeof metamaskChainInfo.chronicleVesuvius
808+
> = {
809+
cayenne: metamaskChainInfo.chronicle,
810+
manzano: metamaskChainInfo.chronicle,
811+
habanero: metamaskChainInfo.chronicle,
812+
'datil-dev': metamaskChainInfo.chronicleVesuvius,
813+
'datil-test': metamaskChainInfo.chronicleVesuvius,
814+
custom: metamaskChainInfo.chronicleVesuvius,
815+
localhost: metamaskChainInfo.chronicleVesuvius,
816+
};
817+
638818
/**
639819
* Solana Chains supported by the LIT protocol. Use the chain name as a key in this object.
640820
* @constant
@@ -790,6 +970,7 @@ export const LIT_NETWORKS: { [key in LitNetwork]: string[] } & {
790970
[LitNetwork.Cayenne]: [],
791971
[LitNetwork.Manzano]: [],
792972
[LitNetwork.DatilDev]: [],
973+
[LitNetwork.DatilTest]: [],
793974
[LitNetwork.Habanero]: [],
794975
[LitNetwork.Custom]: [],
795976
// FIXME: Remove localhost and internalDev; replaced with 'custom' type networks
@@ -827,12 +1008,32 @@ export const TELEM_API_URL = 'https://lit-general-worker.getlit.dev';
8271008
// ========== RLI Delegation ==========
8281009
export const SIWE_DELEGATION_URI = 'lit:capability:delegation';
8291010

1011+
/**
1012+
* @deprecated Will be removed in version 7.x. - Use RELAYER_URL_BY_NETWORK.Cayenne instead
1013+
*/
8301014
export const RELAY_URL_CAYENNE =
8311015
'https://relayer-server-staging-cayenne.getlit.dev';
1016+
1017+
/**
1018+
* @deprecated Will be removed in version 7.x. - Use RELAYER_URL_BY_NETWORK.Habanero instead
1019+
*/
8321020
export const RELAY_URL_HABANERO = 'https://habanero-relayer.getlit.dev';
1021+
1022+
/**
1023+
* @deprecated Will be removed in version 7.x. - Use RELAYER_URL_BY_NETWORK.Manzano instead
1024+
*/
8331025
export const RELAY_URL_MANZANO = 'https://manzano-relayer.getlit.dev';
1026+
1027+
/**
1028+
* @deprecated Will be removed in version 7.x. - Use RELAYER_URL_BY_NETWORK.DatilDev instead
1029+
*/
8341030
export const RELAY_URL_DATIL_DEV = 'https://datil-dev-relayer.getlit.dev';
8351031

1032+
/**
1033+
* @deprecated Will be removed in version 7.x. - Use RELAYER_URL_BY_NETWORK.DatilTest instead
1034+
*/
1035+
export const RELAY_URL_DATIL_TEST = 'https://datil-test-relayer.getlit.dev';
1036+
8361037
// ========== Lit Actions ==========
8371038
export const LIT_ACTION_IPFS_HASH =
8381039
'QmUjX8MW6StQ7NKNdaS6g4RMkvN5hcgtKmEi8Mca6oX4t3';

packages/constants/src/lib/enums.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export enum LitNetwork {
5959
Habanero = 'habanero',
6060
Custom = 'custom',
6161
DatilDev = 'datil-dev',
62+
DatilTest = 'datil-test',
6263
}
6364

6465
/**

0 commit comments

Comments
 (0)