Next.js - React Server Component

By using cookies, supporting RSCs becomes possible, and there are various utilities available to ease their integration with the App router.

Notice

This functionality requires a version of @quirks/store >= 0.25.0

getConnect

Returns information about the current wallet and about the status of the connection.

import {  } from "@quirks/next";
 
const {
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
} = ();

getChain

If you use the name of a previously configured chain as parameter, it will return information about that chain. If the wallet is connected, it will also return the address for that wallet/chain pair.

Note

The list of supported chains depends on the wallet you are using; not all wallets allow you to add custom chains. Therefore, it may not be possible to get information for some chains.

import {  } from "@quirks/next";
 
/**
 * The name of the chain for which you want to obtain information
 * corresponds to the one you have used in the Config object.
 */
const  = "osmosis";
 
const { ,  } = ();

getChains

Returns information about all connected chains. If the wallet is connected, it will also return the address for that wallet/chain pairs.

import {  } from "@quirks/next";
 
const { , , ,  } = ();

Example

/app/server-component-example.tsx
import { ,  } from "@quirks/next";
 
export const  = () => {
  const {  } = ();
  const {  } = ("osmosis");
 
  if (!) {
    return <>Disconnected</>;
  }
 
  return (
    <>
      Server Component
      <>Chain Name: Osmosis</>
      <>Address: {}</>
    </>
  );
};

On this page