diff --git a/apps/extension/src/core/rpcs/chain-connector-evm.ts b/apps/extension/src/core/rpcs/chain-connector-evm.ts index 09894c5aa6..9ffbdb1d13 100644 --- a/apps/extension/src/core/rpcs/chain-connector-evm.ts +++ b/apps/extension/src/core/rpcs/chain-connector-evm.ts @@ -1,4 +1,4 @@ import { chaindataProvider } from "@core/rpcs/chaindata" import { ChainConnectorEvm } from "@talismn/chain-connector-evm" -export const chainConnectorEvm = new ChainConnectorEvm(chaindataProvider, chaindataProvider) +export const chainConnectorEvm = new ChainConnectorEvm(chaindataProvider) diff --git a/packages/chain-connector-evm/src/ChainConnectorEvm.ts b/packages/chain-connector-evm/src/ChainConnectorEvm.ts index 56c4141a72..04c7eaf01a 100644 --- a/packages/chain-connector-evm/src/ChainConnectorEvm.ts +++ b/packages/chain-connector-evm/src/ChainConnectorEvm.ts @@ -10,17 +10,14 @@ export type ChainConnectorEvmOptions = { } export class ChainConnectorEvm { - #chaindataEvmNetworkProvider: ChaindataEvmNetworkProvider - #chaindataTokenProvider: ChaindataTokenProvider + #chaindataProvider: ChaindataEvmNetworkProvider & ChaindataTokenProvider #onfinalityApiKey?: string constructor( - chaindataEvmNetworkProvider: ChaindataEvmNetworkProvider, - chaindataTokenProvider: ChaindataTokenProvider, + chaindataProvider: ChaindataEvmNetworkProvider & ChaindataTokenProvider, options?: ChainConnectorEvmOptions ) { - this.#chaindataEvmNetworkProvider = chaindataEvmNetworkProvider - this.#chaindataTokenProvider = chaindataTokenProvider + this.#chaindataProvider = chaindataProvider this.#onfinalityApiKey = options?.onfinalityApiKey ?? undefined } @@ -32,9 +29,9 @@ export class ChainConnectorEvm { public async getPublicClientForEvmNetwork( evmNetworkId: EvmNetworkId ): Promise { - const network = await this.#chaindataEvmNetworkProvider.getEvmNetwork(evmNetworkId) + const network = await this.#chaindataProvider.getEvmNetwork(evmNetworkId) if (!network?.nativeToken?.id) return null - const nativeToken = await this.#chaindataTokenProvider.getToken(network.nativeToken.id) + const nativeToken = await this.#chaindataProvider.getToken(network.nativeToken.id) if (!nativeToken) return null return getEvmNetworkPublicClient(network, nativeToken, { @@ -46,9 +43,9 @@ export class ChainConnectorEvm { evmNetworkId: EvmNetworkId, account?: `0x${string}` | Account ): Promise { - const network = await this.#chaindataEvmNetworkProvider.getEvmNetwork(evmNetworkId) + const network = await this.#chaindataProvider.getEvmNetwork(evmNetworkId) if (!network?.nativeToken?.id) return null - const nativeToken = await this.#chaindataTokenProvider.getToken(network.nativeToken.id) + const nativeToken = await this.#chaindataProvider.getToken(network.nativeToken.id) if (!nativeToken) return null return getEvmNetworkWalletClient(network, nativeToken, {