
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@relaycc/receiver
Advanced tools
The best way to add Web3 messaging to your site!
Relay Receiver is a React library that makes it easy to add Web3 messaging to your website.
Check out the example using create-react-app and wagmi. You can see it live at https://react.relay.cc, or run it yourself:
git clone https://github.com/relaycc/receiver-example-cra.git
cd receiver-example-cra
npm install
npm start
# Then navigate to http://localhost:3000 in your browser
# with npm
npm install @relaycc/receiver
# with yarn
yarn add @relaycc/receiver
First, wrap your application in the <Receiver /> context provider. For example:
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { Receiver } from '@relaycc/receiver';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<Receiver>
<App />
</Receiver>
</React.StrictMode>
);
Next, provide the user's connected wallet to Receiver. The wallet is used to sign in to the XMTP messaging network. How to access the connected wallet depends on how your application implements wallet connection. Here's an example using the popular wagmi library.
This code only accesses and uses the connected wallet, it assumes the steps to connect a wallet are already implemented. If you'd like to learn more, here's a great place to start.
import { useSigner } from 'wagmi';
import { useWallet } from '@relaycc/receiver';
function MyWalletComponent() {
// Access the user's connected wallet.
const signer = useSigner();
const [wallet, setWallet] = useWallet();
useEffect(() => {
// When the user's connected wallet updates, use setWallet to provide
// the updated wallet to Receiver
setWallet(signer.data || null)
}, [signer.data])
...
}
export default App;
Now you're ready to add the Receiver components. The default configuration adds Receiver as an intercom-style messaging widget. To implement
this configuration, add <Intercom />, <Window /> and <Launcher /> to your app.
import { Intercom, Window, Launcher } from '@relaycc/receiver';
function App() {
return (
<div className="App">
...
<Launcher />
<Intercom>
<Window />
</Intercom>
</div>
);
}
export default App;
The <Launcher /> component, when clicked, will by default open a Receiver <Window /> with the inbox view
active. To instead jump directly into a 1:1 conversation with a specific wallet (the site's support team, for example),
you can pass in the peerAddress prop:
import { Intercom, Window, Launcher } from '@relaycc/receiver';
function App() {
return (
<div className="App">
<Intercom>
<Window />
</Intercom>
<Launcher peerAddress={'0x1800TECHSUPPORT'} />
</div>
);
}
export default App;
You can also use the useLaunch hook to turn any component into a Receiver launcher:
import { Intercom, Window, useLaunch } from '@relaycc/receiver';
function App() {
const launch = useLaunch();
return (
<div className="App">
<Intercom>
<Window />
</Intercom>
<button onClick={() => launch()}>
Open Conversations List
</button>
<button onClick={() => launch('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')}>
Talk to Vitalik
</button>
</div>
);
}
export default App;
The <Intercom /> component is just a utility component that positions the Receiver
window and applies nice default transitions to opening and closing the window.
This means that the <Window /> component can be positioned anywhere you like.
For example, you could center it:
import { Window, Launcher } from '@relaycc/receiver';
import './App.css';
function App() {
return (
<div className="App">
<div className="overlay">
<Window />
<Launcher />
</div>
</div>
);
}
export default App;
/* App.css */
.overlay {
position: fixed;
bottom: 0;
left: 0;
right: 0;
top: 0;
display: flex;
justify-content: center;
align-items: center;
}
The <Window /> component accepts a className prop you can use to apply
custom CSS to the window. In the future, we will provide fine-grained access to
various components. For now, the className prop will work best for applying
basic styling like a border, box-shadow, or custom positioning.
/* App.css */
.bordered {
border: 3px solid black;
}
<Window className="bordered">
For full documentation, visit docs.relay.cc.
Licensed under the MIT License, Copyright © 2022-present Relay.
See LICENSE for more information.
FAQs
The best way to add wallet messaging to your site.
We found that @relaycc/receiver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.