Skip to content

Commit

Permalink
fix: Connect widget success event walletconnect types (#1720)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamoftrees authored May 1, 2024
1 parent 0b8d7bc commit 3ef4bc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Checkout,
ConnectWidgetParams,
EIP1193Provider,
EIP6963ProviderInfo,
getMetaMaskProviderDetail,
getPassportProviderDetail,
WalletConnectManager as IWalletConnectManager,
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
ConnectEventType,
WalletProviderName,
WidgetType,
EIP6963ProviderInfo, WalletConnectManager,
WalletConnectManager,
EIP6963ProviderInfo,
} from '@imtbl/checkout-sdk';

import { Web3Provider } from '@ethersproject/providers';
Expand Down

0 comments on commit 3ef4bc9

Please sign in to comment.