Skip to content

Commit

Permalink
Pass INetworkProvider where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
danielailie committed Dec 9, 2024
1 parent fa2b75a commit 17177ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/entrypoints/entrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DelegationController } from "../delegation";
import { ErrInvalidNetworkProviderKind } from "../errors";
import { Message, MessageComputer } from "../message";
import { ApiNetworkProvider, ProxyNetworkProvider } from "../networkProviders";
import { INetworkProvider } from "../networkProviders/interface";
import { RelayedController } from "../relayed/relayedController";
import { SmartContractController } from "../smartContracts/smartContractController";
import { TokenManagementController } from "../tokenManagement";
Expand All @@ -18,7 +19,7 @@ import { UserVerifier } from "../wallet";
import { DevnetEntrypointConfig, MainnetEntrypointConfig, TestnetEntrypointConfig } from "./config";

class NetworkEntrypoint {
private networkProvider: ApiNetworkProvider | ProxyNetworkProvider;
private networkProvider: INetworkProvider;
private chainId: string;

constructor(options: { networkProviderUrl: string; networkProviderKind: string; chainId: string }) {
Expand Down Expand Up @@ -80,7 +81,7 @@ class NetworkEntrypoint {
return transactionAwaiter.awaitCompleted(txHash);
}

createNetworkProvider(): ApiNetworkProvider | ProxyNetworkProvider {
createNetworkProvider(): INetworkProvider {
return this.networkProvider;
}

Expand Down
9 changes: 2 additions & 7 deletions src/smartContracts/smartContractController.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { AbiRegistry, ArgSerializer, isTyped, NativeSerializer } from "../abi";
import { IAccount } from "../accounts/interfaces";
import { Err, ErrSmartContractQuery } from "../errors";
import { ApiNetworkProvider, ProxyNetworkProvider } from "../networkProviders";
import { INetworkProvider } from "../networkProviders/interface";
import { SmartContractQuery, SmartContractQueryInput, SmartContractQueryResponse } from "../smartContractQuery";
import { Transaction } from "../transaction";
Expand All @@ -18,14 +17,10 @@ export class SmartContractController {
private parser: SmartContractTransactionsOutcomeParser;
private transactionWatcher: TransactionWatcher;
private txComputer: TransactionComputer;
private networkProvider: ApiNetworkProvider | ProxyNetworkProvider | INetworkProvider;
private networkProvider: INetworkProvider;
private abi?: AbiRegistry;

constructor(options: {
chainID: string;
networkProvider: ApiNetworkProvider | ProxyNetworkProvider | INetworkProvider;
abi?: AbiRegistry;
}) {
constructor(options: { chainID: string; networkProvider: INetworkProvider; abi?: AbiRegistry }) {
this.factory = new SmartContractTransactionsFactory({
config: new TransactionsFactoryConfig({ chainID: options.chainID }),
abi: options.abi,
Expand Down

0 comments on commit 17177ac

Please sign in to comment.