Index of every page on this site: llms.txt
All skills
availproject avatar

/avail-widgets-overview

@8f83d92
Run it yourself

End-to-end integration guide for Avail Widgets. Use Nexus Widget as the single unified component for all swap, send, and deposit flows. Legacy standalone widgets (FastBridge, FastTransfer, SwapWidget, Deposit, BridgeDeposit, UnifiedBalance, ViewHistory) have been deprecated and removed.

  • 1 file
  • 5.9 KB
  • Updated 4 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/availproject/widgets/avail-widgets-overview

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈78 tokens for metadata: the name and description. ≈1.4k when used: this file.

Description uses 3.9% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈312 characters, or 3.9%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Avail Widgets Overview

Nexus Widget is the only element you need

All legacy standalone widgets have been deprecated and removed. Nexus Widget is the single unified component that handles swap, send (transfer), and deposit flows.

Legacy element Status Nexus Widget replacement
FastBridge ❌ Removed NexusWidget with config.mode = "swap"
FastTransfer ❌ Removed NexusWidget with config.mode = "send"
SwapWidget ❌ Removed NexusWidget with config.mode = "swap"
Deposit ❌ Removed NexusWidget with config.mode = "deposit" + config.deposit
BridgeDeposit ❌ Removed NexusWidget with config.mode = "deposit" + config.deposit
UnifiedBalance ❌ Removed Inline balance view in Nexus Widget
ViewHistory ❌ Removed Use sdk.getMyIntents() directly

Install Nexus Widget

Default (npm — recommended):

npm install @avail-project/widgets viem wagmi @tanstack/react-query

Power users (shadcn — full source access):

npx shadcn@latest add availproject/widgets/nexus

Ask the user which install method they prefer if not specified. Default to npm.

Import paths

npm:

import { NexusWidget, NexusProvider, useNexus } from "@avail-project/widgets";

shadcn (local files):

import { NexusWidget } from "@/components/nexus/nexus";
import NexusProvider, { useNexus } from "@/components/nexus/NexusProvider";

Integrate end-to-end in any TS/React app

1. Install project deps (npm path)

npm install @avail-project/widgets viem wagmi @tanstack/react-query

2. Set up NexusProvider

npm:

"use client";
import { NexusProvider } from "@avail-project/widgets";

export function AppNexusProvider({ children }: { children: React.ReactNode }) {
  return <NexusProvider config={{ network: "mainnet" }}>{children}</NexusProvider>;
}

shadcn:

"use client";
import NexusProvider from "@/components/nexus/NexusProvider";

export function AppNexusProvider({ children }: { children: React.ReactNode }) {
  return <NexusProvider config={{ network: "mainnet" }}>{children}</NexusProvider>;
}

3. Initialize SDK on wallet connect

"use client";

import { useEffect } from "react";
import { useAccount, useConnectorClient } from "wagmi";
import type { EthereumProvider } from "@avail-project/nexus-core";
// npm path:
import { useNexus } from "@avail-project/widgets";
// shadcn path: 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;
}

4. Render Nexus Widget

npm:

import { NexusWidget } from "@avail-project/widgets";

// Swap mode (also handles bridges)
<NexusWidget config={{ mode: "swap" }} connectedAddress={address} />

// Send mode
<NexusWidget config={{ mode: "send" }} connectedAddress={address} />

// Deposit mode
<NexusWidget
  config={{
    mode: "deposit",
    destination: {
      chain: 8453,
      tokens: [{ address: "0xToken...", symbol: "USDC", decimals: 6 }],
    },
    depositAddress: "0xContract...",
    executeDeposit: (_symbol, tokenAddress, amount, _chainId, user) => ({
      to: "0xContract...",
      data: "0xCalldata...",
      tokenApproval: { toTokenAddress: tokenAddress, amount, spender: "0xContract..." },
    }),
  }}
  connectedAddress={address}
/>

shadcn:

import { NexusWidget } from "@/components/nexus/nexus";
// Same config props, only import path changes

Deposit/bridge config generation

For deposit and bridge mode, use the Avail Configurator to generate the exact depositConfig object based on your contract and token setup.

Nexus SDK agent skills

For detailed SDK integration guidance, use the Nexus SDK agent skills (.agents/skills/):

  • nexus-sdk-setup — SDK initialization and wallet wiring
  • nexus-sdk-bridge-flows — bridge, bridgeAndTransfer, bridgeAndExecute
  • nexus-sdk-swap-flows — swapWithExactIn, swapWithExactOut, swapAndExecute
  • nexus-sdk-hooks-events — intent hooks and event streaming
  • nexus-sdk-balances-metadata-utils — balances, supported chains/tokens, formatters
  • nexus-sdk-integration — end-to-end integration guide

E2E readiness checklist

  • Confirm wallet connects and handleInit runs once per session.
  • Confirm useNexus().nexusSDK is non-null after connect.
  • Confirm Nexus Widget renders and responds to mode, destination, prefill amount, and validation config.
  • Confirm every flow (swap, send, deposit) can reach success.
  • Confirm disconnect clears SDK state (deinitializeNexus).

Common integration failures

  • Invalid provider object:
    • Ensure provider has request().
  • Nexus Widget not rendering:
    • Ensure NexusProvider wraps your app and SDK is initialized.
  • Empty balance/sources:
    • Ensure SDK init finished and wallet is connected on a supported network.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 8f83d92. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 4 months ago

README badge

README badge for availproject/widgets/avail-widgets-overview