skills/nexus-migration-guide/SKILL.md
Detailed guidelines for LLMs and developer agents on migrating codebases from legacy standalone Nexus Elements widgets (swaps, fast-bridge, transfer, deposit) to the unified Nexus One component.
npx skillsauth add availproject/nexus-elements nexus-migration-guideInstall 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.
Use this skill when asked to migrate an existing React/Next/Vite codebase from legacy Nexus elements (SwapWidget, FastBridge, FastTransfer, NexusDeposit, BridgeDeposit, UnifiedBalance, ViewHistory) to the unified Nexus One component.
All legacy standalone widgets have been deprecated and removed from the registry. You must migrate all usages to NexusOne, configuring the workflow via config.mode.
SwapWidget, FastBridge):
<NexusOne config={{ mode: "swap" }} />.config.prefill.source and config.prefill.destination.FastTransfer):
<NexusOne config={{ mode: "send" }} />.config.prefill.recipient and config.prefill.amount.NexusDeposit, BridgeDeposit):
<NexusOne config={{ mode: "deposit", deposit: { ... } }} />.deposit object with executeDeposit callback.NexusOne. Use sdk.getMyIntents() for custom history.Instruct the developer or run the command:
npx shadcn@latest add @nexus-elements/nexus-one
Update imports:
-import { SwapWidget } from "@/components/nexus-elements/swaps";
-import { FastTransfer } from "@/components/nexus-elements/transfer";
+import { NexusOne } from "@/components/nexus-one/nexus-one";
+import NexusProvider from "@/components/nexus/NexusProvider";
Ensure that NexusProvider wraps the app layout.
Provide the EIP-1193 provider initialization flow on wallet connection:
import { useEffect } from "react";
import { useAccount, useConnectorClient } from "wagmi";
import type { EthereumProvider } from "@avail-project/nexus-core";
import { useNexus } from "@/components/nexus/NexusProvider";
export function InitNexusOnConnect() {
const { status, connector } = useAccount();
const { data: walletClient } = useConnectorClient();
const { handleInit } = useNexus();
useEffect(() => {
if (status !== "connected") return;
void (async () => {
const mobileProvider = walletClient
? ({ request: (args: unknown) => walletClient.request(args as never) } as EthereumProvider)
: undefined;
const desktopProvider = await connector?.getProvider();
const provider = mobileProvider ?? (desktopProvider as EthereumProvider | undefined);
if (provider && typeof provider.request === "function") {
await handleInit(provider);
}
})();
}, [status, connector, walletClient, handleInit]);
return null;
}
If the existing project has custom logic modifications inside the components/nexus-elements/common/ folder, warn the user and follow this workflow:
components/nexus-elements/ folder before continuing.NexusOne first before editing component internals:
onStart: Called when transaction starts.onComplete(explorerUrl): Called when execution succeeds.onError(message): Called when execution fails.onConnectWallet: Custom handler for connect wallet CTA clicks.components/nexus-one/ files manually. Do NOT copy the legacy files directly over.data-ai
Scaffolding, configuration, and integration of the Nexus One component in swap mode (config.mode = "swap"). Handles cross-chain swaps and bridges.
testing
Scaffolding, configuration, and integration of the Nexus One component in send mode (config.mode = "send"). Used to send tokens to an external recipient address cross-chain.
data-ai
Scaffolding, configuration, and integration of the Nexus One component in deposit mode (config.mode = "deposit"). Handles swapping assets and executing custom smart contract calls on the destination chain.
development
DEPRECATED — ViewHistory has been removed. Intent history is not included in Nexus One V1. Use sdk.getMyIntents() directly for programmatic history access. Refer to the nexus-sdk-* agent skills for guidance.