Socket
Book a DemoInstallSign in
Socket

@river-build/react-sdk

Package Overview
Dependencies
Maintainers
0
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@river-build/react-sdk

React Hooks for River SDK

0.0.189
latest
Source
npmnpm
Version published
Weekly downloads
192
1645.45%
Maintainers
0
Weekly downloads
 
Created
Source

@river-build/react-sdk

React Hooks for River SDK.

Installation

in the future:

yarn add @river-build/react-sdk

Usage

Connect to River

@river-build/react-sdk suggests you to use Wagmi to connect to River. Wrap your app with RiverSyncProvider and use the useAgentConnection hook to connect to River.

[!NOTE] You'll need to use useEthersSigner to get the signer from viem wallet client. You can get the hook from wagmi docs.

import { RiverSyncProvider, useAgentConnection } from "@river-build/react-sdk";
import { makeRiverConfig } from "@river-build/sdk";
import { WagmiProvider } from "wagmi";
import { useEthersSigner } from "./utils/viem-to-ethers";
import { wagmiConfig } from "./config/wagmi";

const riverConfig = makeRiverConfig("gamma");

const App = ({ children }: { children: React.ReactNode }) => {
  return (
    <WagmiProvider config={wagmiConfig}>
      <RiverSyncProvider>{children}</RiverSyncProvider>
    </WagmiProvider>
  );
};

const ConnectRiver = () => {
  const { connect, isConnecting, isConnected } = useAgentConnection();
  const signer = useEthersSigner();

  return (
    <>
      <button
        onClick={async () => {
          if (!signer) {
            return;
          }
          connect(signer, { riverConfig });
        }}
      >
        {isConnecting ? "Disconnect" : "Connect"}
      </button>
      {isConnected && <span>Connected!</span>}
    </>
  );
};

Get information about an account

Post messages to a stream

Subscribe to a stream

Addding persistance

Keywords

hooks

FAQs

Package last updated on 13 Mar 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.