From 3ef4bc9c90d3da0458048f7a883afdc9548b87e3 Mon Sep 17 00:00:00 2001 From: Charlie McKenzie Date: Wed, 1 May 2024 15:57:57 +1000 Subject: [PATCH] fix: Connect widget success event walletconnect types (#1720) --- .../widgets-lib/src/widgets/connect/ConnectWidget.tsx | 8 ++++++-- .../src/widgets/connect/connectWidgetEvents.ts | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/checkout/widgets-lib/src/widgets/connect/ConnectWidget.tsx b/packages/checkout/widgets-lib/src/widgets/connect/ConnectWidget.tsx index 62b89cfe09..1199eeab04 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/ConnectWidget.tsx +++ b/packages/checkout/widgets-lib/src/widgets/connect/ConnectWidget.tsx @@ -7,6 +7,7 @@ import { Checkout, ConnectWidgetParams, EIP1193Provider, + EIP6963ProviderInfo, getMetaMaskProviderDetail, getPassportProviderDetail, WalletConnectManager as IWalletConnectManager, @@ -177,14 +178,17 @@ export default function ConnectWidget({ sendProviderUpdatedEvent({ provider }); // Find the wallet provider info via injected with Passport and MetaMask fallbacks - let walletProviderInfo; + let walletProviderInfo: EIP6963ProviderInfo | undefined; if (isWalletConnectProvider(provider)) { walletProviderInfo = walletConnectProviderInfo; } else { const injectedProviderDetails = checkout.getInjectedProviders(); - walletProviderInfo = injectedProviderDetails.find((providerDetail) => ( + const walletProviderDetail = injectedProviderDetails.find((providerDetail) => ( providerDetail.provider === provider.provider )); + if (walletProviderDetail) { + walletProviderInfo = walletProviderDetail.info; + } if (!walletProviderInfo) { if (isPassportProvider(provider)) { walletProviderInfo = getPassportProviderDetail(provider.provider as EIP1193Provider).info; diff --git a/packages/checkout/widgets-lib/src/widgets/connect/connectWidgetEvents.ts b/packages/checkout/widgets-lib/src/widgets/connect/connectWidgetEvents.ts index 84abd12120..7b738ef956 100644 --- a/packages/checkout/widgets-lib/src/widgets/connect/connectWidgetEvents.ts +++ b/packages/checkout/widgets-lib/src/widgets/connect/connectWidgetEvents.ts @@ -4,7 +4,8 @@ import { ConnectEventType, WalletProviderName, WidgetType, - EIP6963ProviderInfo, WalletConnectManager, + WalletConnectManager, + EIP6963ProviderInfo, } from '@imtbl/checkout-sdk'; import { Web3Provider } from '@ethersproject/providers';