npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@initia/widget-react

v2.0.0-rc.1

Published

`@initia/widget-react` is a React SDK that provides hooks and components to integrate Initia blockchain wallet connection, bridge functionality, and transaction signing into your React applications.

Readme

@initia/widget-react

@initia/widget-react is a React SDK that provides hooks and components to integrate Initia blockchain wallet connection, bridge functionality, and transaction signing into your React applications.

Simple Example

Below is a minimal example to demonstrate core capabilities: connecting a wallet, opening the wallet drawer, opening the bridge drawer, and sending a transaction.

import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"
import { truncate, useAddress, useInitiaWidget } from "@initia/widget-react"

const Example = () => {
  const address = useAddress()
  const { username, openConnect, openWallet, openBridge, requestTxBlock } = useInitiaWidget()

  if (!address) {
    return <button onClick={openConnect}>Connect</button>
  }

  const send = async () => {
    const messages = [
      {
        typeUrl: "/cosmos.bank.v1beta1.MsgSend",
        value: MsgSend.fromPartial({
          fromAddress: address,
          toAddress: address,
          amount: [{ amount: "1000000", denom: "uinit" }],
        }),
      },
    ]

    const { transactionHash } = await requestTxBlock({ messages })
    console.log(transactionHash)
  }

  return (
    <>
      <header>
        <button
          onClick={() =>
            openBridge({
              srcChainId: "interwoven-1",
              srcDenom: "ibc/6490A7EAB61059BFC1CDDEB05917DD70BDF3A611654162A1A47DB930D40D8AF4",
              dstChainId: "interwoven-1",
              dstDenom: "uinit",
            })
          }
        >
          Bridge
        </button>

        <button onClick={openWallet}>{truncate(username ?? address)}</button>
      </header>

      <main>
        <button onClick={send}>Send</button>
      </main>
    </>
  )
}

Getting Started

Install Dependencies

Install the core widget and required peer dependencies:

pnpm add @initia/widget-react

Provider Setup

You must install a wallet connector to inject a wallet into the app.

pnpm add @tanstack/react-query wagmi

⚠️ Refer to the examples below.

import { InitiaWidgetProvider } from "@initia/widget-react"

const App = () => {
  return (
    <InitiaWidgetProvider defaultChainId="YOUR_CHAIN_ID">
      {/* YOUR APP HERE */}
    </InitiaWidgetProvider>
  )
}

Using a custom chain configuration:

import { ChainSchema } from "@initia/initia-registry-types/zod"
import { InitiaWidgetProvider } from "@initia/widget-react"

const customChain = ChainSchema.parse({
  chain_id: "YOUR_CHAIN_ID",
  chain_name: "YOUR_CHAIN_NAME",
  apis: {
    rpc: [{ address: "YOUR_RPC_URL" }],
    rest: [{ address: "YOUR_LCD_URL" }],
  },
  fees: {
    fee_tokens: [{ denom: "YOUR_FEE_DENOM", fixed_min_gas_price: 0.015 }],
  },
  bech32_prefix: "init",
  network_type: "mainnet",
})

const App = () => {
  return (
    <InitiaWidgetProvider defaultChainId="YOUR_CHAIN_ID" customChain={customChain}>
      {/* YOUR APP HERE */}
    </InitiaWidgetProvider>
  )
}

Configuration Interface

interface Config {
  /** Wallet integration interface. */
  wallet?: {
    meta: { icon?: string; name: string }
    address: string
    getEthereumProvider: () => Promise<Eip1193Provider>
    sign: (message: string) => Promise<string>
    disconnect: () => void
  }

  /** The default chain ID for wallet connection (registered in initia-registry). Defaults to "interwoven-1". */
  defaultChainId?: string

  /** Custom chain configuration when your chain is not registered in initia-registry. */
  customChain?: Chain

  /** Protobuf message types for custom transaction signing. */
  protoTypes?: Iterable<[string, GeneratedType]>

  /** Amino converters for encoding/decoding custom messages. */
  aminoConverters?: AminoConverters

  /** UI theme preference: "light" or "dark". */
  theme?: "light" | "dark"
}

React Hooks API

useInitiaWidget()

Provides core widget state and actions:

interface UseInitiaWidgetResult {
  /** Resolves to either the bech32 or hex address based on the current `minitia` type. */
  address: string

  /** Bech32-formatted Initia wallet address of the connected account. */
  initiaAddress: string

  /** Hex-encoded Ethereum-compatible address of the connected account. */
  hexAddress: string

  /** Optional username associated with the account. */
  username?: string | null

  /** Opens the wallet drawer UI. */
  openWallet(): void

  /** Opens the bridge drawer UI. */
  openBridge(defaultValues: Partial<FormValues>): void

  /** Estimates gas required for a transaction. */
  estimateGas(txRequest: TxRequest): Promise<number>

  /** Signs and broadcasts a transaction, waits for block inclusion, and returns the full transaction response. */
  requestTxBlock(txRequest: TxRequest): Promise<DeliverTxResponse>

  /** Signs and broadcasts a transaction and returns the transaction hash immediately. */
  requestTxSync(txRequest: TxRequest): Promise<string>

  /** Waits for a transaction to be confirmed on-chain. */
  waitForTxConfirmation(params: {
    txHash: string
    chainId?: string
    timeoutSeconds?: number
    intervalSeconds?: number
  }): Promise<IndexedTx>
}

interface TxRequest {
  messages: EncodeObject[]
  memo?: string
  chainId?: string
  gasAdjustment?: number
  gas?: number
  fee?: StdFee | null
}

Usage on Testnet

import { InitiaWidgetProvider, TESTNET } from "@initia/widget-react"

const App = () => {
  return <InitiaWidgetProvider {...TESTNET}>{/* YOUR APP HERE */}</InitiaWidgetProvider>
}

Migrating From v1

To migrate from @initia/react-wallet-widget v1.x to @initia/widget-react, see our official migration guide:

https://github.com/initia-labs/widget/blob/main/packages/widget-react/MIGRATION.md