CCC Docs
    Preparing search index...

    Module @ckb-ccc udt

    Logo

    CCC's Support for User Defined Token (UDT)

    NPM Version GitHub commit activity GitHub last commit GitHub branch check runs Playground App Docs

    CCC - CKBers' Codebase is a one-stop solution for your CKB JS/TS ecosystem development.
    Empower yourself with CCC to discover the unlimited potential of CKB.
    Interoperate with wallets from different chain ecosystems.
    Fully enabling CKB's Turing completeness and cryptographic freedom power.

    • At the moment, UDT and UDTPausable from @ckb-ccc/udt are fully supported through SSRI. In the future, there will be built in TypeScript generation directly based on the Rust source code on compilation.
    • To instantiate a UDT script compliant with SSRI, you can provide the SSRI server url and also specify the OutPoint of the script code.
    • You can also instantiate a UDTPausable script or other scripts that extends from UDT.
    import { Server } from "@ckb-ccc/ssri";
    import { Udt, UdtPausable } from "@ckb-ccc/udt";

    const { signer } = useApp();
    const server = new Server("https://localhost:9090");

    const udt = new Udt(
    server,
    {
    txHash: "0x...",
    index: 0,
    },
    {
    codeHash: "0x...",
    hashType: "type",
    args: "0x...",
    },
    );

    const udtPausable = new UdtPausable(
    server,
    {
    txHash: "0x...",
    index: 0,
    },
    {
    codeHash: "0x...",
    hashType: "type",
    args: "0x...",
    },
    );

    You can directly call the methods in the script:

    const { res: udtSymbol } = await udt.symbol();
    const { res: pauseList } = await udtPausable.enumeratePaused();

    Some of the methods can return a ccc.Transaction. For example, you can call transfer with the following params:

    const { script: to } = await signer.getRecommendedAddressObj();

    const { res: transferTx } = await udt.transfer(signer, [{ to, amount: 100 }]);
    const completedTx = await udt.completeUdtBy(transferTx, signer);

    await completedTx.completeInputsByCapacity(signer);
    await completedTx.completeFeeBy(signer);
    const transferTxHash = await signer.sendTransaction(completedTx);

    Read more about CCC on our website or GitHub Repo.

    Blockchain

    Udt

    Other

    udt
    UdtPausable

    Token

    Udt