nexus-elements-common
Nexus Elements - Common
Understand scope
commonis not a standalone widget.- Use it to build custom flows on top of a working
NexusProvider+ SDK initialization path.
Set up foundation first
- Install and wire
nexus-providerbefore usingcommonhooks. - Ensure
useNexus().nexusSDKis initialized before calling SDK-dependent helpers.
Initialize SDK (required once per app)
- On wallet connect, resolve an EIP-1193 provider and call
useNexus().handleInit(provider). - Wait for
useNexus().nexusSDKbefore invoking SDK-backed flow helpers. - Re-run init after reconnect if wallet session resets.
Install source files
commonis bundled via other widget installs.- If needed manually, copy from:
registry/nexus-elements/common/*
Use core exports
import {
usePolling,
useStopwatch,
useDebouncedValue,
useDebouncedCallback,
useTransactionSteps,
useNexusError,
SHORT_CHAIN_NAME,
SWAP_EXPECTED_STEPS,
WidgetErrorBoundary,
} from "@/components/common";
Build custom flow state machines
- Use
useTransactionStepsto seed expected steps and mark completions from SDK events. - Use
usePollingfor intent/simulation refresh loops. - Use
useDebouncedValue/useDebouncedCallbackbefore simulation calls. - Use
useNexusErrorto normalize SDK exceptions into user-facing messages.
SDK events this package is designed around
- Bridge/transfer/bridge-deposit flows:
NEXUS_EVENTS.STEPS_LISTNEXUS_EVENTS.STEP_COMPLETE
- Swap/deposit flows:
NEXUS_EVENTS.SWAP_STEP_COMPLETE
E2E checklist for custom components
- Ensure wallet connects and SDK initializes.
- Seed steps before starting execution.
- Attach event handlers and map them into step state.
- Clear intent/allowance/swapIntent refs on cancel/error.
- Refresh balances after success.
- Reset timers and step state on completion/cancel.
More from availproject/nexus-elements
nexus-elements-deposit
Integrate the Deposit element for swap-plus-execute deposit flows in React/TypeScript apps. Use when installing or debugging destination-fixed deposits, execute call builders, swap-intent confirmation UX, and `sdk.swapAndExecute` progress from quote to completion.
26nexus-elements-overview
End-to-end integration guide for Nexus Elements in any TypeScript/React codebase. Use when setting up Nexus Elements from scratch, choosing which widget to install, wiring NexusProvider + wallet initialization, or validating bridge/transfer/swap/deposit/history behavior in production-like flows.
24nexus-elements-nexus-provider
Install and configure NexusProvider for Nexus Elements with full SDK lifecycle wiring. Use when setting up or debugging SDK initialization, wallet/provider connection, hook attachment (intent/allowance/swapIntent), balance preloads, exchange-rate support, and provider context consumption in React/TypeScript apps.
23nexus-elements-bridge-deposit
Integrate the Bridge Deposit element for bridge-plus-execute deposit flows in React/TypeScript apps. Use when installing or debugging source-chain constrained deposits, bridge+execute simulation, intent/allowance approvals, and `sdk.bridgeAndExecute` transaction execution.
22nexus-elements-fast-bridge
Integrate the FastBridge element for intent-based cross-chain bridge UX in React/TypeScript apps. Use when installing or debugging self-bridge flows, source-chain selection, allowance gating, step progress events, and `sdk.bridge` execution end-to-end.
21nexus-elements-unified-balance
Integrate the UnifiedBalance element for cross-chain token balance views in React/TypeScript apps. Use when installing or debugging bridgeable/swappable balance aggregation, per-chain breakdown rendering, and formatting powered by Nexus SDK balance APIs.
21