Skip to content

Commit

Permalink
chore: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
magiziz committed Jul 30, 2024
1 parent 5cf474d commit a720c5b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@ export function WalletConnectStoreProvider({
// biome-ignore lint/correctness/useExhaustiveDependencies: prevent new reference on every re-render
const wallets = useMemo(() => getWalletsFromConnectors({ connectors }), []);

const walletConnectModalConnector = useMemo(
const createWalletConnectModalConnector = useMemo(
() =>
getWalletConnectWallet({
walletId: 'walletConnect',
wallets,
})?.walletConnectModalConnector,
})?.createWalletConnectModalConnector,
[wallets],
);

// Preload WalletConnect modal
useEffect(() => {
if (walletConnectModalConnector) {
if (createWalletConnectModalConnector) {
walletConnectStore.createWalletConnectModalConnector({
config,
createConnector: walletConnectModalConnector,
createConnector: createWalletConnectModalConnector,
});
}
}, [walletConnectStore, config, walletConnectModalConnector]);
}, [walletConnectStore, config, createWalletConnectModalConnector]);

return (
<WalletConnectStoreContext.Provider value={walletConnectStore}>
Expand Down
2 changes: 1 addition & 1 deletion packages/rainbowkit/src/wallets/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export type RainbowKitDetails = Omit<Wallet, 'createConnector' | 'hidden'> & {
groupName: string;
isRainbowKitConnector: boolean;
// Only used for "walletConnectWallet" connector
walletConnectModalConnector?: CreateConnectorFn;
createWalletConnectModalConnector?: CreateConnectorFn;
};

export type WalletDetailsParams = { rkDetails: RainbowKitDetails };
Expand Down
2 changes: 1 addition & 1 deletion packages/rainbowkit/src/wallets/connectorsForWallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const connectorsForWallets = (
const rkDetails: RainbowKitDetails = { ...metadata };

if (isWalletConnectConnector) {
rkDetails.walletConnectModalConnector = getWalletConnectConnector({
rkDetails.createWalletConnectModalConnector = getWalletConnectConnector({
projectId,
showQrModal: true,
walletConnectParameters: {
Expand Down
6 changes: 3 additions & 3 deletions packages/rainbowkit/src/wallets/useWalletConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ export function useWalletConnectors(
// If WalletConnect URI is not found, then poll for it.
return new Promise((resolve) => {
const intervalId = setInterval(() => {
const _walletConnectUri = getWalletConnectUri();
if (_walletConnectUri) {
const walletConnectUri = getWalletConnectUri();
if (walletConnectUri) {
clearInterval(intervalId);
resolve(
uriConverter ? uriConverter(_walletConnectUri) : _walletConnectUri,
uriConverter ? uriConverter(walletConnectUri) : walletConnectUri,
);
}
}, 1000);
Expand Down

0 comments on commit a720c5b

Please sign in to comment.