CCC Docs
    Preparing search index...

    Function buildTypeIdOperations

    • Build Type ID operations.

      Type Parameters

      • Encodable = BytesLike
      • Decoded = Bytes$1

      Parameters

      • props: {
            getScriptInfo: (client: Client) => Promise<ScriptInfoLike>;
            codec?: null | CodecLike<Encodable, Decoded>;
            calculateTypeId?:
                | null
                | ((client: Client, tx: Transaction) => Promise<BytesLike>);
            addCellDeps?:
                | null
                | (
                    (
                        client: Client,
                        tx: Transaction,
                        scriptInfo: ScriptInfo,
                    ) => Promise<TransactionLike>
                );
        }

        The properties to build the operations.

        • getScriptInfo: (client: Client) => Promise<ScriptInfoLike>

          Function to get the script info.

        • Optionalcodec?: null | CodecLike<Encodable, Decoded>
        • OptionalcalculateTypeId?: null | ((client: Client, tx: Transaction) => Promise<BytesLike>)

          Function to calculate the Type ID.

        • OptionaladdCellDeps?:
              | null
              | (
                  (
                      client: Client,
                      tx: Transaction,
                      scriptInfo: ScriptInfo,
                  ) => Promise<TransactionLike>
              )

          Function to add cell dependencies.

      Returns {
          create(
              this: void,
              props: {
                  signer: Signer;
                  data: Encodable;
                  receiver?: null | ScriptLike;
                  tx?: null | TransactionLike;
              },
          ): Promise<{ tx: Transaction; id: `0x${string}`; index: number }>;
          transfer(
              this: void,
              props: {
                  client: Client;
                  id: BytesLike;
                  receiver: ScriptLike;
                  tx?: null | TransactionLike;
                  data?:
                      | null
                      | Encodable
                      | ((cell: Cell, data?: Decoded) => Encodable | Promise<Encodable>);
              },
          ): Promise<{ tx: Transaction; inIndex: number; outIndex: number }>;
          destroy(
              this: void,
              props: { client: Client; id: BytesLike; tx?: null | TransactionLike },
          ): Promise<{ tx: Transaction; index: number }>;
      }

      • create: function
        • Create a Type ID cell.

          Parameters

          • this: void
          • props: {
                signer: Signer;
                data: Encodable;
                receiver?: null | ScriptLike;
                tx?: null | TransactionLike;
            }

            The arguments for creating the cell.

            • signer: Signer

              The signer to sign the transaction.

            • data: Encodable

              The output data.

            • Optionalreceiver?: null | ScriptLike

              The receiver script (optional).

            • Optionaltx?: null | TransactionLike

              The transaction skeleton (optional).

          Returns Promise<{ tx: Transaction; id: `0x${string}`; index: number }>

      • transfer: function
        • Transfer a Type ID cell.

          Parameters

          • this: void
          • props: {
                client: Client;
                id: BytesLike;
                receiver: ScriptLike;
                tx?: null | TransactionLike;
                data?:
                    | null
                    | Encodable
                    | ((cell: Cell, data?: Decoded) => Encodable | Promise<Encodable>);
            }

            The arguments for transferring the cell.

            • client: Client

              The client to communicate with CKB.

            • id: BytesLike

              The Type ID to transfer.

            • receiver: ScriptLike

              The new receiver script.

            • Optionaltx?: null | TransactionLike

              The transaction skeleton (optional).

            • Optionaldata?:
                  | null
                  | Encodable
                  | ((cell: Cell, data?: Decoded) => Encodable | Promise<Encodable>)

              The new output data or a transformer to update the data (optional).

          Returns Promise<{ tx: Transaction; inIndex: number; outIndex: number }>

      • destroy: function
        • Destroy a Type ID cell.

          Parameters

          • this: void
          • props: { client: Client; id: BytesLike; tx?: null | TransactionLike }

            The arguments for destroying the cell.

            • client: Client

              The client to communicate with CKB.

            • id: BytesLike

              The Type ID to destroy.

            • Optionaltx?: null | TransactionLike

              The transaction skeleton (optional).

          Returns Promise<{ tx: Transaction; index: number }>