Skip to content

Commit 2c490b7

Browse files
committed
fix(contracts-sdk): log resolveLitContract won't work for custom network / locally
1 parent 7e5ab6f commit 2c490b7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/contracts-sdk/src/lib/contracts-sdk.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,19 @@ export class LitContracts {
322322
index = 0
323323
) {
324324
const networkContext = NETWORK_CONTEXT_BY_NETWORK[network];
325+
326+
if (!networkContext) {
327+
throw new WrongNetworkException(
328+
{
329+
info: {
330+
network,
331+
contractName,
332+
},
333+
},
334+
`Contract "${contractName}" not found in network "${network}". Did you mean ${Object.keys(NETWORK_CONTEXT_BY_NETWORK).join(', ')}?`
335+
);
336+
}
337+
325338
const networkData = networkContext.data.find((data) => {
326339
return data.name === contractName;
327340
});
@@ -545,13 +558,13 @@ export class LitContracts {
545558

546559
private static async _getContractsFromResolver(
547560
context: LitContractResolverContext,
548-
provider: ethers.providers.StaticJsonRpcProvider,
561+
signerOrProvider: ethers.Signer | ethers.providers.JsonRpcProvider,
549562
contractNames?: ContractName[]
550563
): Promise<LitContractContext> {
551564
const resolverContract = new ethers.Contract(
552565
context.resolverAddress,
553566
context.abi,
554-
provider
567+
signerOrProvider
555568
);
556569

557570
const getContract = async function (

0 commit comments

Comments
 (0)