CLI

Dedot's Command line interface

Dedot comes by default with a cli when you install dedot package, you can access the cli typing dedot (or djs) in the terminal. dedot cli helps you generate Types & APIs to any Substrate-based chains or ink! smart contracts that you're working with. This enable Types & APIs suggetions/auto-completion via IntelliSense for any on-chain interactions.

dedot chaintypes

Generate Types & APIs for a Substrated-based blockchain given its metadata. The cli can fetch metadata from a WebSocket endpoint, a wasm runtime file or a raw metadata (.scale) file.

Usage:

npx dedot chaintypes -w wss://rpc.polkadot.io

Options:

  • -w, --wsUrl: Fetch metadata from a WebSocket endpoint

  • -r, --wasm: Fetch metadata from a runtime wasm file (.wasm)

  • -m, --metadata: Fetch metadata from a raw metadata file (.scale)

  • -o, --output: Folder to put generated files

  • -c, --chain: Customize the chain name to generate, default to runtimeVersion.specName

  • -d, --dts: Generate .d.ts files instead of .ts, default: true

  • -s, --subpath: Using subpath packages (e.g: dedot/types instead of @dedot/types), default: true

  • -a, --at: Block hash or block number to generate chaintypes at (requires --wsUrl)

  • -x, --specVersion: Spec version to generate chaintypes at (requires --wsUrl)

Generate chaintypes at a specific block

You can generate chain types at a specific point in the chain history using the --at or --specVersion options. This is useful when you need types for a specific runtime version.

The --at and --specVersion options can only be used with --wsUrl and cannot be used together.

dedot typink

Generate Types & APIs for an ink! or Solidity smart contract given its metadata/ABI.

Usage:

Options:

  • -m, --metadata: Path to contract metadata file (.json, .contract)

  • -o, --output: Folder to put generated files

  • -c, --contract: Custom contract name, default is contract name from metadata

  • -d, --dts: Generate .d.ts files instead of .ts, default: true

  • -s, --subpath: Using subpath packages (e.g: dedot/types instead of @dedot/types), default: true

Last updated

Was this helpful?