skills/nexus-elements-nexus-provider/SKILL.md
Install and configure NexusProvider for Nexus Elements with full SDK lifecycle wiring. NexusProvider is required by Nexus One — the single unified element for all swap, send, and deposit flows. All other standalone widget skills are deprecated.
npx skillsauth add availproject/nexus-elements nexus-elements-nexus-providerInstall 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.
Note: NexusProvider is the foundation required by Nexus One — the single unified element for all flows. All legacy standalone widget skills (fast-bridge, transfer, swaps, deposit, bridge-deposit, unified-balance, view-history, common) are deprecated and removed. Use
npx shadcn@latest add @nexus-elements/nexus-oneto install the unified element. For detailed SDK integration, refer to the Nexus SDK agent skills (.agents/skills/nexus-sdk-*).
npx shadcn@latest add @nexus-elements/nexus-provider@avail-project/nexus-corewagmi"use client";
import NexusProvider from "@/components/nexus/NexusProvider";
export function AppNexusProvider({ children }: { children: React.ReactNode }) {
return (
<NexusProvider config={{ network: "mainnet", debug: false }}>
{children}
</NexusProvider>
);
}
handleInit(provider) after wallet status becomes connected.request()."use client";
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") return;
await handleInit(provider);
})();
}, [status, connector, walletClient, handleInit]);
return null;
}
handleInit(provider):
initializeNexus(provider).supported chains/tokens, bridge balances, Coinbase rates).intent, allowance, swapIntent).initializeNexus(provider):
sdk.initialize(provider) once.nexusSDK state.deinitializeNexus():
sdk.deinit().useAccountEffect from wagmi to deinit on disconnect.sdk.initialize(provider)sdk.deinit()sdk.isInitialized()sdk.utils.getSupportedChains(...)sdk.utils.getSwapSupportedChainsAndTokens()sdk.getBalancesForBridge()sdk.getBalancesForSwap()sdk.utils.getCoinbaseRates()sdk.setOnIntentHook(...)sdk.setOnAllowanceHook(...)sdk.setOnSwapIntentHook(...)allow() and deny().allow()/deny() leaves a flow pending.useNexus() API surfacenexusSDK, loading, networkhandleInit, initializeNexus, deinitializeNexus, attachEventHooksintent, allowance, swapIntentbridgableBalance, swapBalance, exchangeRatesupportedChainsAndTokens, swapSupportedChainsAndTokensfetchBridgableBalance, fetchSwapBalance, getFiatValue(amount, token)nexusSDK becomes non-null.Invalid EIP-1193 provider:
connector.getProvider() or a wallet client wrapper exposing request().handleInit runs before mounting interactive flows.exchangeRate; fallback is token amount * 1 if rate missing.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
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.