Releases: CashScript/cashscript
Releases · CashScript/cashscript
v0.13.0
This release contains several breaking changes, please refer to the migration notes for more information.
cashc compiler
- ✨ Add support for
for,whileanddo-whileloops. - ✨ Add support for compound assignment operators (
+=,-=) and increment/decrement operators (++,--). - ✨ Add support for bitwise and arithmetic shift operators (
<<,>>) and bitwise inversion (~). - ✨ Add
fingerprintfield to artifact to allow for fingerprinting of the contract bytecode. - ✨ Add
unsafe_bool()andunsafe_int()casting for semantic-only casts. - ✨ Add support for narrowing bytes types after
x.length == Nand checks in require or if statements. - 🛠️ BREAKING: Automatically inject
require(tx.time >= tx.locktime)when a function usestx.locktimewithout atx.timecheck in scope, ensuring the spending input is non-final sonLockTimeis enforced. This can be disabled with theenforceLocktimeGuard: falsecompiler option (CLI:--skip-enforce-locktime-guard). - 🛠️ BREAKING: Function parameter types are now strictly enforced (bounded bytes and boolean values). This can be disabled with the
enforceFunctionParameterTypes: falsecompiler option (CLI:--skip-enforce-function-parameter-types). - 🐛 Fix issue where casting bytes larger than
bytes8tointwas not allowed. - 🐛 Fix issue where empty bytecode contracts were not properly compiled.
- 🐛 BREAKING: Fix issue where
bool()casting did not change the value of the argument. - 💥 BREAKING: Rename
bytes4(int)andbytes(int, 4)totoPaddedBytes(int, 4). - 💥 BREAKING: Rename
bytes4(bytes)tounsafe_bytes4(bytes). - 🐎 Add optimisations for negated number comparisons and boolean comparisons.
CashScript SDK
- ✨ Add support for loops in debug tooling.
- ✨ Add support for
p2scontract type. - ✨ Add
addBchChangeOutputIfNeeded()method toTransactionBuilderclass. - ✨ Add
addTokenChangeOutputIfNeeded()method toTransactionBuilderclass for adding a fungible token change output for a specific category. - ✨ Add
getTransactionSizemethod toTransactionBuilderclass. - ✨ Add
lockingBytecodeproperty toContractclass. - ✨ Add
getUtxosForLockingBytecode()method toElectrumNetworkProviderclass andMockNetworkProviderinterface. - ✨ In the
MockNetworkProvider,addUtxo()now also allows UTXOs to be added by locking bytecode. - ✨ Add
gatherBchUtxos()andgatherFungibleTokenUtxos()functions to the SDK for gathering UTXOs. - ✨ Add specific network error classes to standardise error handling in network providers.
- ✨ Add TSDoc strings for all public classes and methods.
- 🐛 Fix issue where
FailedTransactionErrorwould not show underlying error if BitAuth URI generation failed. - 💥 BREAKING: Remove
BitcoinRpcNetworkProviderandFullStackNetworkProviderfrom the SDK. - 🛠️ BREAKING: Rename
addressTypeoption onContractconstructor tocontractType. - 🛠️ BREAKING: Remove undocumented
redeemScriptproperty fromContractclass. - 🛠️ BREAKING: Remove undocumented
buildLibauthTransaction()method fromTransactionBuilderclass. - 🛠️ Update default VM target to
BCH_2026_05. - 🛠️ Improve validation when adding outputs to a transaction.
- 🛠️ Improve package size by tidying up dependencies.
Testing Suite
- 🛠️ Add README.md to help guide users on how to use the testing suite.
- 🛠️ Compile all contracts in the
contracts/directory and save the artifacts in theartifacts/directory. - 🛠️ Compile TS artifacts as well as JSON artifacts.
- 🛠️ Add key management utilities for testing.
v0.12.1
v0.12.0
CashScript SDK
- ✨ Add
getVmResourceUsagemethod toTransactionBuilder. - ✨ Add
maximumFeeSatsPerByteandallowImplicitFungibleTokenBurnoptions toTransactionBuilderconstructor. - ✨ Add a configurable
vmTargetoption toMockNetworkProvider. - ✨ Add support for ECDSA signatures in contract unlockers for
siganddatasigparameters. - ✨ Add
signMessageHash()method toSignatureTemplateto allow for signing of non-transaction messages. - 💥 BREAKING: Remove deprecated "old" transaction builder (
contract.functions). - 💥 BREAKING: Make
providera required option inContractconstructor. - 💥 BREAKING: Set
updateUtxoSettotrueby default forMockNetworkProvider. - 💥 BREAKING: No longer seed the MockNetworkProvider with any test UTXOs.
- 💥 BREAKING: Replace
setMaxFee()method onTransactionBuilderwithmaximumFeeSatoshisoption. - 💥 BREAKING: Rename
bitauthUri()method onTransactionBuildertogetBitauthUri()for consistency. - 🛠️ Improve libauth template generation.
- 🐛 Fix bug where
SignatureTemplatewould not accept private key hex strings as a signer.
v0.11.5
CashScript SDK
- ✨ Include input index in console.log statements for debugging.
- ✨ Improve type inference for function and constructor arguments in the
Contractclass. - 🛠️ Replace redundant dependencies.
- 🐛 Remove accidental dependency inclusion of
@types/node.
v0.11.4
CashScript SDK
- ✨ Add
updateUtxoSetoption toMockNetworkProviderto allow for updating the UTXO set after a transaction is sent (PR by @mainnet-pat). - 🐛 Fix bug where sending P2PKH-only transactions would throw
No placeholder scenario ID or script ID found(PR by @mainnet-pat).
v0.11.3
cashc compiler
- ✨ Add
.slice(start, end)operator for bytes and strings. - ✨ Add bounded bytes typing and bounds checking for
.split()(includes checking for negative indices). - 🐎 Add optimisation for
.slice(0, x)and.slice(x, y.length)(also applies to.split(0)[1]). - 🐛 Disallow incorrect bounded bytes typing when using
.split().
CashScript SDK
- 🐛 Fix bug with where
ElectrumNetworkProviderwould disconnect in browser on visibility change of the page.
v0.11.2
v0.11.1
CashScript SDK
- ✨ Add generateWcTransactionObject() method to TransactionBuilder to generate a WcTransactionObject that can be used to sign a transaction with a WalletConnect client.
- ✨ Add placeholderSignature(), placeholderPublicKey() and placeholderP2PKHUnlocker() helper functions to the SDK for WalletConnect usage.
v0.11.0
In this version we added debugging capabilities to the new Transaction Builder
This release also contains several breaking changes, please refer to the migration notes for more information.
cashc compiler
- 🐛 Fix bug where source code in
--format tsartifacts used incorrect quotation marks. - 🛠️ Remove warning for opcount and update warning for byte size to match new limits.
- 💥 BREAKING:
tx.agewas renamed tothis.ageto better reflect that it enforces a UTXO-level locktime check (not transaction-level). - 💥 BREAKING: The entire
debugobject on the artifact is reworked to enable debugging the optimised contract bytecode.
CashScript SDK
- ✨ Add debugging capabilities to the
TransactionBuilder.transaction.debug()&transaction.bitauthUri()- Output BitAuth IDE URI for debugging when transaction is rejected.
- Libauth template generation and debugging for multi-contract transactions
- ✨ Debugging now supports using the optimised contract bytecode (when compiled with
cashc@0.11.0or later). - ✨ Add
setBlockHeight()method toMockNetworkProvider - ✨ Config-free usage of the CashScript SDK with Vite or Webpack
- 🛠️ Update debug tooling to use the new
BCH_2025_05instruction set. - 🛠️ Deprecate the simple transaction builder. You can still use the simple transaction builder with the current SDK, but this support will be removed in a future release
- 💥 BREAKING: the Jest utilities for automated testing are now synchronous and no longer work with the deprecated simple transaction builder
expect(transaction).toLog(message)expect(transaction).toFailRequire()expect(transaction).toFailRequireWith(message)
- 💥 BREAKING: Remove support for custom Clusters from
ElectrumNetworkProviderand added a configuration object to the constructor. - 💥 BREAKING: Remove support for old contracts compiled with CashScript v0.6.x or earlier.
- 🐛 Fix bug where
JestExtensionsexpect().toLog()would detect logs from different tests. - 🐛 Fix bug where certain edge cases in require statements caused the
FailedRequireErrormessage to be slightly different from the original error message.
@cashscript/utils
- 💥 BREAKING: Remove
importArtifactandexportArtifacthelper functions. If you want to import or export artifacts, use'fs'to read and write files directly.