
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@rainbow-me/rainbow-button
Advanced tools
[](https://npmjs.org/package/@rainbow-me/rainbow-button) [](https://github.com/rainbow-me/r
Rainbow Button is a react component that renders an opinionated button built on top of WalletConnect v1 which allows you to connect to Rainbow on mobile (via Mobile Deeplinking) and desktop (via QR codes).
yarn add @rainbow-me/rainbow-button
Required peerDependencies:
The following packages also need to be installed along side @rainbow/rainbow-button
.
@walletconnect/client@>=1.6.0
react@>=16
import React from 'react';
import ReactDOM from 'react-dom';
import { RainbowButton } from '@rainbow-me/rainbow-button';
ReactDOM.render(
<RainbowButton
chainId={1}
connectorOptions={{ bridge: 'https://bridge.walletconnect.org' }}
onConnectorInitialized={(connector) => console.log(connector)}
/>,
document.getElementById('rainbowButton')
);
ReactDOM.render(
<RainbowButton
chainId={1}
connectorOptions={{ bridge: 'https://bridge.walletconnect.org' }}
onConnectorInitialized={(connector) => console.log(connector)}
render={() => <button>Custom Rainbow button</button>}
/>,
document.getElementById('rainbowButton')
);
params | value | default value | description |
---|---|---|---|
chainId | number | REQUIRED | Rainbow supported chainId |
connectorOptions | object | REQUIRED | Wallet Connect connector options. bridge param is required |
onConnectorInitialized | function | REQUIRED | Will be called when the button is instantiated, will return the connector object |
render | function | - | Render prop to use a custom element |
animate | boolean | true | Whether or not animate the button |
This callback will return a WalletConnect
connector object, you should store it and use it as a normal WalletConnect
client object.
const onConnectorInitialized = useCallback(
(connector) => {
setConnector(connector);
},
[setConnector]
);
// Subscribe to connection events and update your app accordingly
const subscribeToEvents = useCallback(() => {
connector.on('connect', (error, payload) => {
if (error) {
throw error;
}
// Get provided accounts and chainId
const { accounts, chainId } = payload.params[0];
});
connector.on('session_update', (error, payload) => {
if (error) {
throw error;
}
// Get updated accounts and chainId
const { accounts, chainId } = payload.params[0];
});
connector.on('disconnect', (error, payload) => {
if (error) {
throw error;
}
// Delete connector
setConnector(null);
});
}, [connector]);
More details can be found in the Wallet Connect docs:
import { assets } from '@rainbow-me/rainbow-button';
ReactDOM.render(
<div>
<img src={assets.rainbow} tag="rainbow" />
<img src={assets.rainbow_icon} tag="rainbow icon" />
</div>,
document.getElementById('assets')
);
import { utils } from '@rainbow-me/rainbow-button';
// Triggers a deeplink to go to the app. Only mobile.
utils.goToRainbow();
import { constants } from '@rainbow-me/rainbow-button';
console.log('Rainbow supported chain ids', constants.SUPPORTED_MAIN_CHAIN_IDS);
console.log(
'Rainbow supported test chain ids',
constants.SUPPORTED_TEST_CHAIN_IDS
);
See CONTRIBUTING.md
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.