From 83c73821c54b071781f58c95076269b1a7a628cb Mon Sep 17 00:00:00 2001 From: Anson Date: Fri, 28 Jun 2024 19:04:54 +0100 Subject: [PATCH] fix(contracts-sdk): correct rpc for browser --- .../contracts-sdk/src/lib/contracts-sdk.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/contracts-sdk/src/lib/contracts-sdk.ts b/packages/contracts-sdk/src/lib/contracts-sdk.ts index 70ae20b4e9..d12b4a9282 100644 --- a/packages/contracts-sdk/src/lib/contracts-sdk.ts +++ b/packages/contracts-sdk/src/lib/contracts-sdk.ts @@ -74,8 +74,6 @@ import { minStakingAbi } from '../abis/minAbi/minStakingAbi'; // const DEFAULT_RPC = 'https://lit-protocol.calderachain.xyz/replica-http'; // const DEFAULT_READ_RPC = 'https://lit-protocol.calderachain.xyz/replica-http'; -const BLOCK_EXPLORER = 'https://chain.litprotocol.com/'; - // This function asynchronously executes a provided callback function for each item in the given array. // The callback function is awaited before continuing to the next iteration. // The resulting array of callback return values is then returned. @@ -280,15 +278,27 @@ export class LitContracts { throw new Error(msg); } - const chainInfo = { + const chronicleChainInfo = { chainId: '0x2AC49', chainName: 'Chronicle - Lit Protocol Testnet', nativeCurrency: { name: 'LIT', symbol: 'LIT', decimals: 18 }, rpcUrls: this.rpcs, - blockExplorerUrls: [BLOCK_EXPLORER], + blockExplorerUrls: ['https://chain.litprotocol.com/'], + iconUrls: ['future'], + }; + + const vesuviusChainInfo = { + chainId: '0x907', + chainName: 'Vesuvius - Lit Protocol Devnet', + nativeCurrency: { name: 'testLit', symbol: 'testLit', decimals: 18 }, + rpcUrls: this.rpcs, + blockExplorerUrls: ['https://vesuvius-explorer.litprotocol.com/'], iconUrls: ['future'], }; + const chainInfo = + this.network === 'datil-dev' ? vesuviusChainInfo : chronicleChainInfo; + try { await web3Provider.send('wallet_switchEthereumChain', [ { chainId: chainInfo.chainId },