0.22.2 • Published 3 days ago

@ckb-lumos/experiment-tx-assembler v0.22.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

@ckb-lumos/experiment-tx-assembler

This package provides functions to simplify the transaction assembling process.

Usage

createScriptRegistry is for creating and managing script more easier.

import { createScriptRegistry } from "@ckb-lumos/experiment";
import { predefined } from "@ckb-lumos/config-manager";
const { AGGRON4 } = predefined;
const registry = createScriptRegistry(AGGRON4.SCRIPTS);
const secp256k1Script = registry.newScript("SECP256K1_BLAKE160", "0x");
const newRegistry = registry.extend({
  OMNI_LOCK: {
    CODE_HASH:
      "0x79f90bb5e892d80dd213439eeab551120eb417678824f282b4ffb5f21bad2e1e",
    HASH_TYPE: "type",
    TX_HASH:
      "0x9154df4f7336402114d04495175b37390ce86a4906d2d4001cf02c3e6d97f39c",
    INDEX: "0x0",
    DEP_TYPE: "code",
  },
});
const omniCellDep = newRegistry.newCellDep("OMNI_LOCK");

To create input or output cells, you can use createCell or createCellWithMinimalCapacity, you can also indicate type, data, block_hash, block_number of the cell.

  • Create an input cell:

    const lock: Script = {
      code_hash:
        "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
      args: "0x159890a7cacb44a95bef0743064433d763de229c",
      hash_type: "type",
    };
    const outPoint = {
      tx_hash:
        "0x942c23f72f0a2558a0029522b1dea2a7c64ba5196aed829ab6bfe4b6c3270958",
      index: "0x0",
    };
    const cell = createCell({
      lock: lock,
      capacity: BI.from("10000000000"),
      out_point: outPoint,
    });
  • Create an output cell:

    const lock: Script = {
      code_hash:
        "0x79f90bb5e892d80dd213439eeab551120eb417678824f282b4ffb5f21bad2e1e",
      hash_type: "type",
      args: "0x01a08bcc398854db4eaffd9c28b881c65f91e3a28b00",
    };
    const cell = createCell({ lock: lock, capacity: BI.from("10000000000") });
  • Create cell with minimal capacity:

    const lock: Script = {
      code_hash:
        "0x79f90bb5e892d80dd213439eeab551120eb417678824f282b4ffb5f21bad2e1e",
      hash_type: "type",
      args: "0x01a08bcc398854db4eaffd9c28b881c65f91e3a28b00",
    };
    const cell = createCellWithMinimalCapacity({ lock: lock });
0.22.2

27 days ago

0.22.1

1 month ago

0.22.0

1 month ago

0.22.0-next.5

2 months ago

0.22.0-next.4

4 months ago

0.22.0-next.3

4 months ago

0.22.0-next.2

4 months ago

0.22.0-next.1

5 months ago

0.22.0-next.0

5 months ago

0.21.1

5 months ago

0.21.0

5 months ago

0.20.0

10 months ago

0.21.0-next.0

9 months ago

0.21.0-next.1

7 months ago

0.21.0-next.2

6 months ago

0.21.0-next.3

6 months ago

0.20.0-alpha.3

12 months ago

0.20.0-alpha.2

1 year ago

0.19.0

2 years ago

0.20.0-alpha.0

1 year ago

0.20.0-alpha.1

1 year ago

0.19.0-beta.0

2 years ago

0.19.0-alpha.3

2 years ago

0.19.0-alpha.2

2 years ago

0.19.0-alpha.1

2 years ago

0.19.0-alpha.0

2 years ago

0.17.0

2 years ago

0.18.0

2 years ago

0.18.0-rc7

2 years ago

0.17.0-rc10

2 years ago

0.17.0-rc9

2 years ago