skills/nexus-one-deposit/SKILL.md
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.
npx skillsauth add availproject/nexus-elements nexus-one-depositInstall 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 the Nexus One component with config.mode = "deposit" to allow users to pay for a smart contract execution/deposit on a destination chain with assets from any source chain. Nexus One resolves pay-with assets, handles the cross-chain swap, and executes your custom deposit payload in a single flow.
Install dependencies and the component via the shadcn CLI:
npx shadcn@latest add @nexus-elements/nexus-one
Make sure peer dependencies are installed:
npm install @avail-project/[email protected] decimal.js lucide-react viem wagmi class-variance-authority clsx tailwind-merge
Wrap the component with NexusProvider (usually in your root layout or app provider stack). In "deposit" mode, the deposit object is required inside the config.
import { NexusOne } from "@/components/nexus-one/nexus-one";
import { encodeFunctionData } from "viem";
export function DepositWidget({ address }: { address?: `0x${string}` }) {
// Define destination contract details and ABI
const APP_DEPOSIT_CONTRACT = "0xYourDepositContractAddress";
const DESTINATION_TOKEN = "0xUSDTBaseAddress";
const APP_DEPOSIT_ABI = [
{
inputs: [
{ name: "token", type: "address" },
{ name: "amount", type: "uint256" },
{ name: "user", type: "address" },
],
name: "deposit",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
// Transaction builder function executed post-swap settlement
function buildDepositExecuteConfig(
tokenAddress: `0x${string}`,
amount: bigint,
user: `0x${string}`
) {
return {
to: APP_DEPOSIT_CONTRACT,
data: encodeFunctionData({
abi: APP_DEPOSIT_ABI,
functionName: "deposit",
args: [tokenAddress, amount, user],
}),
tokenApproval: {
token: tokenAddress,
amount,
spender: APP_DEPOSIT_CONTRACT,
},
};
}
const depositConfig = {
mode: "deposit",
deposit: {
chainId: 8453, // Destination Chain ID (e.g. Base)
tokenSymbol: "USDT", // Destination Token Symbol
tokenDecimals: 6, // Destination Token Decimals
tokenAddress: DESTINATION_TOKEN,
title: "MyProtocol", // Name of your application/action
protocol: "MyProtocol",
executeDeposit: (_symbol, tokenAddress, amount, _chainId, user) =>
buildDepositExecuteConfig(tokenAddress, amount, user),
},
} as const;
return <NexusOne config={depositConfig} connectedAddress={address} />;
}
prefill.amount to prefill the exact output deposit amount.allowedSourcePairs to restrict which source assets are displayed as deposit payment options.const depositConfig = {
mode: "deposit",
prefill: {
amount: "150.0", // Pre-populate deposit field with 150 USDT
},
allowedSourcePairs: [
{ token: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", chain: 42161 }, // USDC on Arbitrum
{ token: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", chain: 8453 }, // USDC on Base
],
deposit: {
// ... mandatory deposit configuration
}
};
Leverage standard callbacks to manage your app's flow:
<NexusOne
config={depositConfig}
connectedAddress={address}
onStart={() => console.log("Deposit started")}
onComplete={(explorerUrl) => console.log("Deposit succeeded!", explorerUrl)}
onError={(err) => console.error("Deposit failed:", err)}
/>
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.
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.
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.