Releases: CashScript/cashscript
Releases · CashScript/cashscript
v0.5.0
cashc compiler
- 🛠️ Replace BITBOX with Libauth.
CashScript SDK
CashScript used to be very tightly coupled with BITBOX. This proved to be problematic after maintenance for BITBOX was stopped. The main objective of this update is to allow CashScript to be used with many different BCH libraries.
- ✨ Add
withoutChange()function to disable change outputs for a transaction. - ✨
SignatureTemplatecan now be used with BITBOX keypairs,bitcore-lib-cashprivate keys, WIF strings, and raw private key buffers, rather than only BITBOX. - 💥 Remove
Sigalias forSignatureTemplatethat was deprecated in v0.4.1. - 💥 BREAKING: Refactor contract instantiation flow
- A contract is now instantiated by providing a compiled artifact, constructor arguments and an optional network provider.
- Anyone can implement the NetworkProvider interface to create a custom provider. The CashScript SDK offers three providers out of the box: one based on electrum-cash (default), one based on FullStack.cash' infrastructure, and one based on BITBOX. See the NetworkProvider docs for details.
- See the migration notes for details on migrating from the old contract instantiation flow.
- 💥 BREAKING: Remove the artifacts
'networks'field and.deployed()functionality, This proved to be confusing and is better suited to be handled outside of the CashScript SDK. - 💥 BREAKING:
.send()now returns a libauth Transaction instead of a BITBOX Transaction object. Alternatively arawflag can be passed into the function to return a raw hex string. - 🛠️ Removed BITBOX as a dependency in favour of libauth for utility functions.
v0.4.4
v0.4.3
v0.4.2
v0.4.1
cashc compiler
- 🐎 Add optimisations to bitwise operators.
- 🐚 New CLI arguments.
- Add
--opcount|-cflag that displays the number of opcodes in the compiled bytecode. - Add
--size|-sflag that displays the size in bytes of the compiled bytecode.
- Add
- 🔣 Add trailing comma support.
CashScript SDK
- 📛 Rename
SigtoSignatureTemplateto better convey its meaning.Sigstill exists for backward compatibility, but is deprecated and will be removed in a later release.
v0.4.0
cashc compiler
- ✨ - Add
.reverse()member function tobytesandstringtypes. - ✨ - Add bitwise operators
&,^,|. - ✨ - Allow casting
intto variable sizebytesbased onsizeparameter. - 💥 BREAKING: Casting from
intto unboundedbytestype now does not performOP_NUM2BIN. Instead it is a purely semantic cast to signal that an integer value should be treated as a bytes value. - 🏇 Compiler optimisations.
- Use
NUMEQUALVERIFYfor the final function in a contract. - Only drop the final
VERIFYif the remaining stack size is less than 5. - Precalculate
OutputNullDataargument size.
- Use
- 🐛 Fix a bug where return type of
sha1was incorrectly marked asbytes32. - 🐛
Data.decodeBoolonly treated numerical zero as false, now any zero-representation is considered false (e.g. 0x0000, -0, ...).
CashScript SDK
- ✨ Add ability to provide hardcoded inputs to the transaction rather than use CashScript's coin selection (authored by @maikelmclauflin through #61).
- 💥 BREAKING: Refactor the transaction flow to a fluent API
- Remove the
TxOptionsargument and other arguments to the Transactionsend()function. - Instead these parameters are passed in through fluent functions
from(),to(),withOpReturn(),withAge(),withTime(),withHardcodedFee(),withFeePerByte()andwithMinChange(). - After specifying at least one output with either
to()orwithOpReturn()the transaction is ready. From here the transaction can be sent to the network with thesend()function, the transaction hex can be returned with thebuild()function, or the meep debugging command can be returned with themeep()function.
- Remove the
- 💥 Remove
Contract.fromCashFile()andContract.fromArtifact()which were deprecated in favour orContract.compile()andContract.import()in v0.2.2.
Migration
This update contains several breaking changes. See the migration notes for a full migration guide.
v0.3.3
cashc compiler
- 🐛 Fix bug where variables could not reliably be used inside
OutputNullDatainstantiation.
v0.3.2
cashc compiler
- ✨ Add
OutputNullData(bytes[] chunks), an output type to enforceOP_RETURNoutputs. - 🐚 CLI improvements
- The
--output|-oflag is now optional, if it is omitted or manually set to-, the artifact will be written to stdout rather than a file. - Add
--asm|-Aflag that outputs only Script in ASM format instead of a full JSON artifact. - Add
--hex|-hflag that outputs only Script in hex format instead of a full JSON artifact. - Add
--args|-aflag that allows you to specify constructor arguments that are added to the generated bytecode.⚠️ The CLI does not perform type checking on these arguments, so it is recommended to use the CashScript SDK for type safety.
- The
- 🐛 Fix a compilation bug that allowed compilation of "unverified covenants" (#56).
- 🐛 Fix a compilation bug that allowed compilation of
OutputP2PKH(...)withoutnewkeyword (#57).
CashScript SDK
- 🌐 Browser support! You can now use CashScript inside web projects. Filesystem-based functionality such as compilation from file are not supported due to the nature of web, so CashScript files have to be read in a different way (e.g. Fetch API) and then passed into the CashScript SDK.
- 👛 Add
minChangeto transaction options. If thisminChangeis not reached, the change will be added to the transaction fee instead.
v0.3.1
cashc compiler
⚠️ Add warnings when a contract exceeds 201 opcodes or 520 bytes.- 🐛 Fix a bug where an incorrect number of items were dropped from the stack after execution of a branch.
CashScript SDK
- ✨ Improve error handling.
- Further specified
FailedTransactionErrorintoFailedRequireError,FailedSigCheckError,FailedTimeCheckErrorand a general fallbackFailedTransactionError. - Add
Reasonenum with all possible reasons for a Script failure - can be used to catch specific errors.
- Further specified
- 🔍 Add
instance.opcountandinstance.bytesizefields to all contract instances. - 🐛 Fix a bug where the size of a preimage was not accounted for in fee calculation for covenants.
v0.3.0
cashc compiler
- ✨ Covenants abstraction! All individual preimage fields can be accessed without manual decoding, passing, and verification.
- Available fields:
tx.version,tx.hashPrevouts,tx.hashSequence,tx.outpoint,tx.bytecode,tx.value,tx.sequence,tx.hashOutputs,tx.locktime,tx.hashtype. - When any of these fields is used inside a function, this function is marked
covenant: true, and requires a preimage as parameter (automatically passed by CashScript SDK). - The correct fields are efficiently cut out of the preimage and made available.
- The first occurrance of
require(checkSig(sig, pubkey));is identified, and preimage verification is inserted using the same sig/pubkey. Important: if you have multiplecheckSigstatements, keep in mind that the first will be used for verification. - Automatically cuts off VarInt from
scriptCode, sotx.bytecodecontains the actual contract bytecode.
- Available fields:
- ✨ Output instantiation! Automatically construct output formats for covenant transactions.
new OutputP2PKH(bytes8 amount, bytes20 pkh)new OutputP2SH(bytes8 amount, bytes20 scriptHash)
- 🐛 Fix bug with invalid output when the final statement in a contract is an if-statement.
CashScript SDK
- ✨ Add
feeoption to TransactionOptions. This allows you to specify a hardcoded fee for your transaction. - ✨ Automatically pass in sighash preimage into covenant functions. Important: uses the hashtype of the first signature in the parameters for generation of this preimage.
- 💫 Better fee estimation for transactions with many inputs.