Skip to content
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"dependencies": {
"@ensdomains/address-encoder": "^0.1.8",
"@githubprimer/octicons-react": "^8.5.0",
"@rsksmart/rlogin-essentials": "1.0.5",
"@rsksmart/rlogin": "^1.6.1",
"@rsksmart/rns": "^1.9.0",
"@rsksmart/rns-suite": "^1.1.0",
"@walletconnect/web3-provider": "^1.8.0",
Comment thread
jessgusclark marked this conversation as resolved.
Outdated
"bootstrap": "^4.3.1",
"cbor": "^5.0.2",
"connected-react-router": "^6.3.1",
Expand Down
49 changes: 36 additions & 13 deletions src/app/rLogin/rLogin.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
import { createRLogin } from '@rsksmart/rlogin-essentials';
import RLogin from '@rsksmart/rlogin';
import WalletConnectProvider from '@walletconnect/web3-provider';
Comment thread
jessgusclark marked this conversation as resolved.
Outdated
// import { trezorProviderOptions } from '@rsksmart/rlogin-trezor-provider';
// import { ledgerProviderOptions } from '@rsksmart/rlogin-ledger-provider';

const trezorOptions = {
manifestEmail: 'info@iovlabs.org',
manifestAppUrl: process.env.REACT_APP_URL,
};
const createRLogin = () => {
const rpcUrls = process.env.REACT_APP_ENVIRONMENT_ID === '30' ? {
30: 'https://public-node.rsk.co',
} : {
31: 'https://public-node.testnet.rsk.co',
};

const isMainnet = process.env.REACT_APP_ENVIRONMENT_ID === '30';
const providerOptions = Object.assign({
walletconnect: {
package: WalletConnectProvider,
options: {
rpcUrls,
bridge: 'https://walletconnect-bridge.rifos.org/',
},
},
/* 'custom-ledger': ledgerProviderOptions,
'custom-trezor': {
...trezorProviderOptions,
options: {
manifestEmail: 'info@iovlabs.org',
manifestAppUrl: process.env.REACT_APP_URL,
},
}, */
});

const rpcUrls = isMainnet ? {
30: 'https://public-node.rsk.co',
} : {
31: 'https://public-node.testnet.rsk.co',
};
const supportedChains = Object.keys(rpcUrls).map(Number);

const rLogin = createRLogin(rpcUrls, trezorOptions);
return new RLogin(({
cacheProvider: false,
providerOptions,
rpcUrls,
supportedChains,
}));
Comment thread
jessgusclark marked this conversation as resolved.
Outdated
};

export default rLogin;
export default createRLogin();

Copilot AI Dec 17, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The createRLogin() function is called at module load time, which means the RLogin instance is created immediately when this module is imported. This could cause issues if environment variables change or if the module needs to be re-initialized. Consider exporting the factory function instead and calling it where needed, or document why immediate initialization is required.

Suggested change
export default createRLogin();
export default createRLogin;

Copilot uses AI. Check for mistakes.
Loading
Loading