Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ckb-devrel/ccc/llms.txt

Use this file to discover all available pages before exploring further.

CCC ships as several packages. Choose the one that matches your environment:
PackageUse case
@ckb-ccc/connector-reactReact applications
@ckb-ccc/shellNode.js scripts and backends
@ckb-ccc/connectorWeb Component (framework-agnostic)
@ckb-ccc/cccCustom UI, manual signer management
Install the React connector package:
npm install @ckb-ccc/connector-react
Then wrap your app with ccc.Provider:
If you’re using React Server Components (Next.js App Router, etc.), add "use client" at the top of any file that uses ccc.Provider or ccc.useCcc.
app.tsx
"use client";

import { ccc } from "@ckb-ccc/connector-react";

export default function App({ children }: { children: React.ReactNode }) {
  return (
    <ccc.Provider
      name="My CKB App"
      icon="/icon.png"
    >
      {children}
    </ccc.Provider>
  );
}
Access the signer and connector controls from any child component using ccc.useCcc():
component.tsx
"use client";

import { ccc } from "@ckb-ccc/connector-react";

export function ConnectButton() {
  const { open, wallet, signerInfo } = ccc.useCcc();

  return signerInfo ? (
    <p>Connected: {wallet?.name}</p>
  ) : (
    <button onClick={open}>Connect wallet</button>
  );
}

Import patterns

All CCC exports are available on the ccc object, which makes IDE autocompletion predictable regardless of which package you use:
import { ccc } from "@ckb-ccc/<package-name>";

const tx = ccc.Transaction.from({ ... });
const amount = ccc.fixedPointFrom("100");
For advanced customization, the /advanced entry point exports cccA, which contains lower-level internals:
import { cccA } from "@ckb-ccc/<package-name>/advanced";
APIs exported via cccA (the /advanced entry point) are not stable and may change between versions without notice. Use them only when you need capabilities not available through the ccc object.

TypeScript configuration

CCC uses the Node.js Package Entry Points feature for tree-shaking. Your tsconfig.json must set moduleResolution to node16, nodenext, or bundler, and must not disable resolvePackageJsonExports:
tsconfig.json
{
  "compilerOptions": {
    "moduleResolution": "bundler"
  }
}
If you see an error like Property '*' does not exist on type 'typeof import(".../@ckb-ccc/...")', check that your moduleResolution is set correctly. See the TypeScript module resolution guide for details.

Build docs developers (and LLMs) love