Registry / devops / sui-ts-transpiler

sui-ts-transpiler

JSON →
library1.0.0jsnpmunverified

A CLI tool and SDK that converts TypeScript smart contracts to Sui Move language with full logic preservation (not just structural mapping). v1.0.0 targets Node >=16 and ships TypeScript declarations. It provides a `sui-ts` CLI for project scaffolding (`init`), transpilation (`transpile`), building (`build`), and sample generation. Key differentiators: complete logic conversion vs. syntax-only mappers, automatic Sui-specific type mapping (e.g., `constructor()` → `create_*()`), and programmatic SDK support via `SuiMoveTranspiler` class. Active development under @gsui-team.

npm install sui-ts-transpiler
INSTALL
IMPORT
SIG · SUI-TS-TRANSPILER
S
sui-ts-transpiler
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SuiMoveTranspiler
import { SuiMoveTranspiler } from 'sui-ts-transpiler'
import SuiMoveTranspiler from 'sui-ts-transpiler'
Package uses named export for the transpiler class; default import is not supported.
sui-ts CLI
sui-ts init my-project
sui-ts-transpiler init my-project
CLI command is `sui-ts`, not the package name. Global install via npm -g sui-ts-transpiler provides the bin.
MoveTranspilerOptions
import { MoveTranspilerOptions } from 'sui-ts-transpiler'
This type is exported for configuring the transpiler programmatically. Not documented in the snippet but present in .d.ts files.

Installs the transpiler globally, creates a new project, writes a simple TypeScript contract, transpiles it, and lists the generated Move files.

npm install -g sui-ts-transpiler sui-ts init my-sui-project cd my-sui-project npm install cat > src/contract.ts << 'EOF' class Counter { private value: number; private owner: Address; constructor(owner: Address) { this.value = 0; this.owner = owner; } public increment(): void { this.value = this.value + 1; } public getValue(): number { return this.value; } } EOF sui-ts transpile ls out/
sui-ts --version
Debug
Known issues
gotchaCLI command is `sui-ts` not `sui-ts-transpiler`. Users often try `sui-ts-transpiler init` which fails.
fix
Use `sui-ts init <project>` or alias `npx sui-ts-transpiler` if needed.
affects: all
breakingGlobal install may conflict with other Sui tooling if `sui-ts` is already used by another package.
fix
Use npx: `npx sui-ts-transpiler init <project>` or install locally as devDependency.
affects: all
gotchaNumber → u64, but Move's u64 is unsigned and 64-bit. Large numbers (>2^53-1) lose precision in JS; the compiler may silently truncate.
fix
Use `bigint` for values exceeding 2^53-1. The transpiler maps `bigint` to `u256`.
affects: all
deprecatedPackage uses `-v` for verbose. Future versions may change to `--verbose` only.
fix
Prefer `--verbose` in scripts for forward compatibility.
affects: 1.0.0
gotchaConstructor transpiles to a create function named after the class (e.g., `create_counter`). If the class name is not a valid Move identifier (e.g., starts with underscore), the generated name may conflict.
fix
Use PascalCase class names that are also valid Move identifiers (no leading underscores).
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'sui-ts-transpiler'
Trying to require or import the package without installing it.
fix
Install globally: `npm install -g sui-ts-transpiler` or locally: `npm install --save-dev sui-ts-transpiler`.
sui-ts: command not found
Global installation missing or not on PATH.
fix
Install globally: `npm install -g sui-ts-transpiler`. If still not found, check npm global bin directory or use npx: `npx sui-ts-transpiler`.
Error: Type 'string' is not assignable to type 'vector<u8>'
Using TypeScript `string` type which maps to `vector<u8>` in Move, but the transpiler expects a specific format.
fix
Ensure string values are UTF-8 encoded. For complex strings, use `vector<u8>` directly in TS with `new Uint8Array([...])`.
Error: Module 'contract' not found in package 'sui_contract'
Output directory structure mismatch when publishing; Move expects specific package layout.
fix
Run `sui-ts build` which generates a proper Move.toml and directory structure, then publish from `out/`.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
noderequiredRequires Node.js >=16.0.0 (engines field). CLI or SDK will fail on older versions.
Agent activity
2 hits · last 30 days
node
2
Resources
sui-ts-transpiler — npm install sui-ts-transpiler · libregistry