skills/nexus-elements-swaps/SKILL.md
Integrate the SwapWidget element for cross-chain exact-in and exact-out swaps in React/TypeScript apps. Use when installing or debugging swap simulations, source selection for exact-out mode, swap intent approvals, and event-driven progress using `sdk.swapWithExactIn`/`sdk.swapWithExactOut`.
npx skillsauth add availproject/nexus-elements nexus-elements-swapsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
npx shadcn@latest add @nexus-elements/swapsNexusProvider is installed and initialized before rendering.useNexus().nexusSDK is initialized.swapBalance is fetched (fetchSwapBalance is called by hook if missing).useNexus().handleInit(provider).useNexus().nexusSDK before swap simulation starts."use client";
import SwapWidget from "@/components/swaps/swap-widget";
export function SwapPanel() {
return (
<SwapWidget
onStart={() => {
// swap started
}}
onComplete={(amount) => {
console.log("Destination amount:", amount);
}}
onError={() => {
console.error("Swap failed");
}}
/>
);
}
onStart?(): voidonComplete?(amount?: string): voidonError?(): void (component signature currently ignores message argument)ExactInSwapInputsdk.swapWithExactIn(input, { onEvent })ExactOutSwapInputfromSources comes from selected source optionssdk.swapWithExactOut(input, { onEvent })swapIntent.current from setOnSwapIntentHookswapIntent.current.allow() in continueSwap()NEXUS_EVENTS.SWAP_STEP_COMPLETEexactIn: requires source chain/token/amount and destination chain/token.exactOut: requires destination chain/token/amount; sources are auto-selected unless overridden.deny() and resets; re-enter or wait for re-simulation.development
Integrate the ViewHistory element for Nexus intent history in React/TypeScript apps. Use when installing or debugging intent-history retrieval, infinite-scroll pagination, modal/inline history UIs, and refresh events tied to completed bridge/transfer/deposit flows.
development
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.
development
Integrate the Transfer element (registry name `transfer`) for bridge-to-recipient flows in React/TypeScript apps. Use when installing or debugging cross-chain recipient transfers, allowance/intent approvals, source-selection constraints, and `sdk.bridgeAndTransfer` step execution.
development
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.