Nexus Widget - Send / Transfers
Use NexusWidget with config.mode = "send" for recipient transfers. The recipient can be user-entered or locked by passing recipientAddress.
Installation
npm (recommended):
npm install @avail-project/widgets viem wagmi @tanstack/react-queryshadcn (source files):
npx shadcn@latest add availproject/widgets/nexusConfig Shape
destination.chainis optional. If omitted, users can change chains.destination.tokensis optional. If supplied withdestination.chain, the token selector is limited to those tokens.recipientAddressis optional and locked when supplied.prefill.amount,prefill.token,validation.minAmount,validation.maxAmount, andappearanceare optional.prefill.tokensets the initial destination token but keeps the full token selector available. Ifdestination.tokensis supplied, the first destination token wins andprefill.tokenis ignored.
npm:
import { NexusWidget } from "@avail-project/widgets";
const USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" as const;
const RECIPIENT = "0xRecipientWalletAddressHere" as const;
export function SendWidget({ address }: { address?: `0x${string}` }) {
return (
<NexusWidget
connectedAddress={address}
config={{
mode: "send",
destination: {
chain: 8453,
tokens: [
{
address: USDC_BASE,
symbol: "USDC",
decimals: 6,
},
],
},
recipientAddress: RECIPIENT,
prefill: { amount: "25.5" },
validation: { minAmount: "1", maxAmount: "500" },
appearance: {
heading: "Send",
mode: "system",
primaryColor: "hsl(216 100% 50%)",
},
}}
/>
);
}shadcn: Same config, change import to import { NexusWidget } from "@/components/nexus/nexus".
Notes
- Do not use the old
prefill.chain,prefill.recipient,allowedDestinationPairs, orallowedSourcePairsfields. prefill.amountmust be greater than0.prefill.tokenmust be shaped as{ chain, address, symbol, decimals, logo? }.- Use the component prop
onConnectClickto open the host app wallet modal.