Skip to main content
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 with UI modal, returning the transaction hash immediately without waiting for block inclusion.
submitTxSync
(txParams: TxParams) => Promise<string>
Signs and broadcasts a transaction directly without UI modal, returning the transaction hash immediately. Requires explicit fee.
submitTxBlock
(txParams: TxParams) => Promise<DeliverTxResponse>
Signs, broadcasts, and waits for transaction block inclusion directly without UI modal. Returns complete transaction response. Requires explicit fee.
submitTxBlock
(txParams: TxParams) => Promise<DeliverTxResponse>
Signs, broadcasts, and waits for block inclusion with pre-calculated fee, returning the complete transaction response.
submitTxSync
(txParams: TxParams) => Promise<string>
Signs and broadcasts a transaction with pre-calculated fee, 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.
InterwovenKit UI methods: Use requestTxSync and requestTxBlock for applications using InterwovenKit’s fee selection modal. Direct wallet methods: Use submitTxSync and submitTxBlock for custom transaction UX that skips InterwovenKit’s modal and goes directly to browser wallet confirmation.

Transaction Method Comparison

MethodInterwovenKit UIFee RequiredUse Case
requestTxSync✅ Yes❌ OptionalStandard UX, get hash
requestTxBlock✅ Yes❌ OptionalStandard UX, need full results
submitTxSync❌ Skipped✅ RequiredCustom UX, get hash
submitTxBlock❌ Skipped✅ RequiredCustom UX, need full results

When to Use Each Method

Use requestTx* methods when:
  • Building standard applications with InterwovenKit UI
  • You want InterwovenKit’s built-in fee selection UI
  • Users should choose fees through InterwovenKit modal
Use submitTx* methods when:
  • You want to skip InterwovenKit’s modal
  • Building custom transaction confirmation UI
  • You need control over fee calculation and display
  • Want direct browser wallet confirmation

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
}