Registry / scrypt-ts-transpiler

scrypt-ts-transpiler

JSON →
library1.2.29jsnpmunverified

Transpiler that compiles TypeScript smart contracts for Bitcoin SV into sCrypt bytecode. Current stable version is 1.2.29, updated periodically. Key differentiator: enables writing Bitcoin smart contracts entirely in TypeScript, leveraging its tooling and type safety, while outputting efficient on-chain bytecode. Requires TypeScript ~5.3.0 as a peer dependency and Node.js >=16.

npm install scrypt-ts-transpiler
INSTALL
IMPORT
SIG · SCRYPT-TS-TRANSPIL
S
scrypt-ts-transpiler
javascriptv1.2.29
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.

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
Debug
Known issues
breakingVersion 1.0.0 changed the transpile function signature; options object is required.
fix
Pass an options object as the second argument to transpile().
affects: >=1.0.0
gotchaTypeScript peer dependency must be exactly ~5.3.x; other versions may cause compilation errors.
fix
Install TypeScript ~5.3.0: npm install typescript@~5.3.0
affects: >=1.0.0
gotchaNode.js <16 is not supported; transpile will fail on older runtimes.
fix
Upgrade Node.js to >=16.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'scrypt-ts-transpiler'
Package is not installed or not in node_modules.
fix
Run: 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.
fix
Use 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.
fix
Ensure TypeScript ~5.3.0 is installed and tsconfig.json includes 'moduleResolution': 'node' or 'node16'.
Upgrade
Version history
1.2.29latest on npm
Audit
Dependencies
typescriptrequiredRequired as a peer dependency to transpile TypeScript source files
Agent activity
5 hits · last 30 days
node
4
Resources
scrypt-ts-transpiler — npm install scrypt-ts-transpiler · libregistry