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.
transpile
✓ import { transpile } from 'scrypt-ts-transpiler'
✗ const transpile = require('scrypt-ts-transpiler').transpile
Package is ESM-only; CommonJS require will fail.
CompileError
✓ import { CompileError } from 'scrypt-ts-transpiler'
Type included for handling compilation errors.
TranspileOptions
✓ import type { TranspileOptions } from 'scrypt-ts-transpiler'
✗ import { TranspileOptions } from 'scrypt-ts-transpiler'
Use type import for compile-time type safety, avoid runtime import.
Compile a simple sCrypt TypeScript smart contract into bytecode and save the artifact.
import { transpile } from 'scrypt-ts-transpiler';
import { writeFileSync } from 'fs';
const source = `
export class Counter extends SmartContract {
@prop()
readonly count: bigint;
constructor(count: bigint) {
super(...arguments);
this.count = count;
}
@method()
public increment() {
this.count++;
}
}`;
const result = transpile(source, {
artifactPath: './artifacts',
sourceMap: true
});
writeFileSync('artifacts/counter.scrypt', result.bytecode);
console.log('Bytecode compiled successfully');
scrypt-ts-transpiler --version
Errors
Common errors & fixes
Error: Cannot find module 'scrypt-ts-transpiler'
Package is not installed or not in node_modules.
fixRun: npm install scrypt-ts-transpiler
SyntaxError: The requested module 'scrypt-ts-transpiler' does not provide an export named 'transpile'
Using CommonJS require instead of ESM import.
fixUse import statement: import { transpile } from 'scrypt-ts-transpiler' error TS2688: Cannot find type definition file for 'scrypt-ts-transpiler'
TypeScript cannot resolve the package's types; likely missing or misconfigured.
fixEnsure TypeScript ~5.3.0 is installed and tsconfig.json includes 'moduleResolution': 'node' or 'node16'.
Audit
Dependencies
typescriptrequiredRequired as a peer dependency to transpile TypeScript source files