Skip to content

Commit

Permalink
refactor: roninWallet (#1906)
Browse files Browse the repository at this point in the history
Co-authored-by: Magomed Khamidov <53529533+KosmosKey@users.noreply.github.com>
  • Loading branch information
magiziz and magiziz committed Apr 3, 2024
1 parent 78cc087 commit fc4d7e1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-students-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Resolved a bug where if `multiInjectedProviderDiscovery` was set to `false` the `roninWallet` would prevent showing `Opening Ronin Wallet...` UI in the connect modal.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export const roninWallet = ({
namespace: 'ronin.provider',
});

const shouldUseWalletConnect = !isRoninInjected;

const getUri = (uri: string) => {
return `roninwallet://wc?uri=${encodeURIComponent(uri)}`;
};

return {
id: 'ronin',
name: 'Ronin Wallet',
Expand All @@ -35,32 +41,36 @@ export const roninWallet = ({
qrCode: 'https://wallet.roninchain.com/',
},
mobile: {
getUri: (uri: string) =>
`roninwallet://wc?uri=${encodeURIComponent(uri)}`,
getUri: shouldUseWalletConnect ? getUri : undefined,
},
qrCode: {
getUri: (uri: string) => uri,
instructions: {
learnMoreUrl: 'https://wallet.roninchain.com/',
steps: [
{
description: 'wallet_connectors.ronin.qr_code.step1.description',
step: 'install',
title: 'wallet_connectors.ronin.qr_code.step1.title',
qrCode: shouldUseWalletConnect
? {
getUri: (uri: string) => uri,
instructions: {
learnMoreUrl: 'https://wallet.roninchain.com/',
steps: [
{
description:
'wallet_connectors.ronin.qr_code.step1.description',
step: 'install',
title: 'wallet_connectors.ronin.qr_code.step1.title',
},
{
description:
'wallet_connectors.ronin.qr_code.step2.description',
step: 'create',
title: 'wallet_connectors.ronin.qr_code.step2.title',
},
{
description:
'wallet_connectors.ronin.qr_code.step3.description',
step: 'scan',
title: 'wallet_connectors.ronin.qr_code.step3.title',
},
],
},
{
description: 'wallet_connectors.ronin.qr_code.step2.description',
step: 'create',
title: 'wallet_connectors.ronin.qr_code.step2.title',
},
{
description: 'wallet_connectors.ronin.qr_code.step3.description',
step: 'scan',
title: 'wallet_connectors.ronin.qr_code.step3.title',
},
],
},
},
}
: undefined,
extension: {
instructions: {
learnMoreUrl: 'https://wallet.roninchain.com/',
Expand All @@ -83,11 +93,11 @@ export const roninWallet = ({
],
},
},
createConnector: isRoninInjected
? getInjectedConnector({ namespace: 'ronin.provider' })
: getWalletConnectConnector({
createConnector: shouldUseWalletConnect
? getWalletConnectConnector({
projectId,
walletConnectParameters,
}),
})
: getInjectedConnector({ namespace: 'ronin.provider' }),
};
};

0 comments on commit fc4d7e1

Please sign in to comment.