Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.solidscipt.zoracle.xyz/llms.txt

Use this file to discover all available pages before exploring further.

SolidScript ships as a TypeScript package you can import directly in contract source files and in build tooling. When you author contracts, you pull in types, decorators, and runtime globals. When you drive the compiler programmatically — for example in a custom build script or a CI pipeline — you use the compiler pipeline exports to parse, validate, optimise, and emit Solidity without touching the CLI.

Compiler pipeline exports

Use these exports when you need to integrate SolidScript into an existing Node.js build process or call the compiler from application code.
import {
  parseContractFiles,
  emitProgram,
  validateProgram,
  optimizeProgram,
  compileSolidity,
} from "solidscript";

const { program } = parseContractFiles(["./contracts/MyToken.ts"]);
optimizeProgram(program);
const emitted = emitProgram(program);
console.log(emitted[0].solidity);
ExportDescription
parseContractFilesParse TypeScript contract files into the SolidScript intermediate representation (IR)
validateProgramRun the native static validation rules against the parsed program
optimizeProgramApply optimiser passes to the parsed program in place
emitProgramEmit Solidity source from the parsed program and return one result object per file
compileSolidityCompile the emitted Solidity to ABI and bytecode artifacts

Contract types

SolidScript exports branded primitive types that map directly to EVM value types. Use them in function signatures and storage fields to catch unit errors at compile time.
ExportMeaning
AddressBranded EVM address string
CheckedAddressAddress returned by validate(addr), guaranteed to be non-zero and checksum-valid
Bytes32Branded 32-byte value
BytesBranded arbitrary-length byte string

Runtime globals

msg and block expose the transaction and block context that Solidity contracts depend on. Import them and reference their properties inside any contract method.
import { msg, block } from "solidscript";

msg.sender;   // Address of the immediate caller
msg.value;    // Ether sent with the call (bigint)
msg.data;     // Raw calldata (Bytes)

block.timestamp;  // Current block timestamp (bigint)
block.number;     // Current block number (bigint)
block.coinbase;   // Address of the block producer
block.chainid;    // Chain ID (bigint)

Decorators and helpers

SolidScript decorators map one-to-one to Solidity modifiers, access patterns, and code generation targets. Apply them to class fields or methods inside a contract class.
ExportPurpose
storageMark class fields as contract state variables
viewMark methods as read-only (no state writes allowed)
pureMark methods as state-independent (no state reads or writes)
payableAllow an entrypoint to receive Ether
onlyOwnerAdd owner-gated access control to a method
nonReentrantAdd reentrancy protection to a method
whenNotPausedAdd a pause guard to a method
assemblyInline a Yul body inside a method
invariantGenerate invariant tests for the decorated condition
unsafeDocument and explicitly allow an unsafe pattern
allowTxOriginTargeted override permitting tx.origin use
allowSelfdestructTargeted override permitting selfdestruct
allowZeroAddressTargeted override permitting zero-address behaviour
allowLowLevelCallTargeted override permitting low-level calls
throwsDeclare custom errors on a method
requireAssert a precondition; reverts with the given message if it fails
revertRevert execution unconditionally
emitEmit a contract event
pullPaymentQueue a pull payment for later withdrawal

Crypto and ABI helpers

SolidScript re-exports the cryptographic primitives and ABI utilities you need for hashing, signature recovery, and calldata encoding.
import { keccak256, sha256, ecrecover, abi } from "solidscript";

const packed = abi.encodePacked("SOLID", 1n);
const hash = keccak256(packed);
ecrecover accepts a digest and a signature and returns the signer’s Address. sha256 follows the same call signature as keccak256.

Standards

SolidScript ships base implementations of the most common token standards. Import and extend them instead of writing the interface from scratch.
import { ERC20, ERC721 } from "solidscript/standards";
ERC20 provides totalSupply, balanceOf, transfer, allowance, approve, transferFrom, _mint, and _burn. ERC721 provides ownerOf and balanceOf.
Use the package’s generated dist/index.d.ts as the authoritative source for exact type signatures when integrating the compiler pipeline programmatically.