The useInterwovenKit hook provides access to wallet connection state, account information, UI controls, and transaction utilities for interacting with the Initia blockchain.
This hook must be used within a component wrapped by InterwovenKitProvider to access wallet functionality.

Account Information

The hook provides multiple address formats and account details for the currently connected wallet:
address
string
Current address in either Bech32 or hex format, depending on the configured minitia type.
initiaAddress
string
Bech32-formatted Initia wallet address of the connected account.
hexAddress
string
Hex-encoded Ethereum-compatible address of the connected account.
username
string | null
Optional username linked to the account. Returns null if no username is associated.
export default function Home() {
  const { address, initiaAddress, hexAddress, username } = useInterwovenKit()

  return (
    <>
      <div>{address}</div>
      <div>{initiaAddress}</div>
      <div>{hexAddress}</div>
      <div>{username}</div>
    </>
  )
}

UI Controls

The hook provides methods for controlling wallet-related UI components:
openConnect
() => void
Opens a drawer for connecting an external wallet.
openWallet
() => void
Opens the main wallet drawer showing balances for the connected account.
openBridge
(defaultValues?: Partial<BridgeFormValues>) => void
Opens the bridge drawer to onboard assets with optional pre-populated values.

Bridge Form Interface

The BridgeFormValues interface defines the optional parameters for pre-populating the bridge form:
srcChainId
string
Source chain ID for the bridge transaction.
srcDenom
string
Source token denomination to bridge from.
dstChainId
string
Destination chain ID for the bridge transaction.
dstDenom
string
Destination token denomination to bridge to.
quantity
string
Initial bridge amount as entered by the user. Use human-readable values (e.g., “1” for 1 INIT, not “1000000”).
All bridge form values are optional. You can pre-populate any subset of fields to improve the user experience.
interface BridgeFormValues {
  srcChainId?: string
  srcDenom?: string
  dstChainId?: string
  dstDenom?: string
  quantity?: string
}

Example Usage

export default function Home() {
  const { openConnect, openWallet, openBridge } = useInterwovenKit()

  return (
    <>
      <button onClick={openConnect}>Connect</button>
      <button onClick={openWallet}>Wallet</button>
      <button onClick={() => openBridge({ srcChainId: 'chain-id', srcDenom: 'denom', dstChainId: 'chain-id', dstDenom: 'denom', quantity: '100' })}>
        Bridge
      </button>
    </>
  )
}

Transaction Methods

The hook provides utilities for estimating, signing, and sending transactions on the blockchain:
estimateGas
(txRequest: TxRequest) => Promise<number>
Estimates the gas required for a transaction before execution.
requestTxBlock
(txRequest: TxRequest) => Promise<DeliverTxResponse>
Signs, broadcasts, and waits for block inclusion, returning the complete transaction response.
requestTxSync
(txRequest: TxRequest) => Promise<string>
Signs and broadcasts a transaction, returning the transaction hash immediately without waiting for block inclusion.
waitForTxConfirmation
(params: TxQuery) => Promise<IndexedTx>
Polls for transaction confirmation on-chain using a transaction hash.
Use requestTxSync for better UX when you want to show immediate feedback, then use waitForTxConfirmation to track the final transaction status. Use requestTxBlock when you need the complete transaction result immediately.

Transaction Request Interface

The TxRequest interface defines the parameters for transaction operations:
messages
EncodeObject[]
required
Array of encoded transaction messages to include in the transaction.
memo
string
Optional memo to attach to the transaction.
chainId
string
Target chain ID for the transaction. Defaults to the provider’s defaultChainId.
gasAdjustment
number
default:"1.4"
Multiplier applied to the estimated gas amount for safety margin.
gas
number
Explicit gas limit for the transaction. If provided, skips gas estimation.
fee
StdFee | null
Explicit fee for the transaction. If provided, skips the fee denomination selection UI.

Transaction Query Interface

The TxQuery interface defines parameters for tracking transaction confirmation:
txHash
string
required
Hash of the transaction to track for confirmation.
chainId
string
Chain ID where the transaction was broadcast.
timeoutSeconds
number
default:"30"
Maximum time to wait for transaction confirmation before failing.
intervalSeconds
number
default:"1"
Polling interval in seconds for checking transaction status.

Type Definitions

import type { EncodeObject } from '@cosmjs/proto-signing'
import type { DeliverTxResponse, IndexedTx } from '@cosmjs/stargate'

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

interface TxQuery {
  txHash: string
  chainId?: string
  timeoutSeconds?: number
  intervalSeconds?: number
}