Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cashscript-examples",
"private": true,
"version": "0.11.3",
"version": "0.11.4",
"description": "Usage examples of the CashScript SDK",
"main": "p2pkh.js",
"type": "module",
Expand All @@ -13,8 +13,8 @@
"dependencies": {
"@bitauth/libauth": "^3.1.0-next.2",
"@types/node": "^22.17.0",
"cashc": "^0.11.3",
"cashscript": "^0.11.3",
"cashc": "^0.11.4",
"cashscript": "^0.11.4",
"eslint": "^8.56.0",
"typescript": "^5.9.2"
}
Expand Down
6 changes: 3 additions & 3 deletions examples/testing-suite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "testing-suite",
"version": "0.11.3",
"version": "0.11.4",
"description": "Example project to develop and test CashScript contracts",
"main": "index.js",
"type": "module",
Expand All @@ -26,8 +26,8 @@
},
"dependencies": {
"@bitauth/libauth": "^3.1.0-next.2",
"cashc": "^0.11.3",
"cashscript": "^0.11.3",
"cashc": "^0.11.4",
"cashscript": "^0.11.4",
"url-join": "^5.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/cashc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cashc",
"version": "0.11.3",
"version": "0.11.4",
"description": "Compile Bitcoin Cash contracts to Bitcoin Cash Script or artifacts",
"keywords": [
"bitcoin",
Expand Down Expand Up @@ -52,7 +52,7 @@
},
"dependencies": {
"@bitauth/libauth": "^3.1.0-next.2",
"@cashscript/utils": "^0.11.3",
"@cashscript/utils": "^0.11.4",
"antlr4": "^4.13.2",
"commander": "^14.0.0",
"semver": "^7.7.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/cashc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export * from './Errors.js';
export * as utils from '@cashscript/utils';
export { compileFile, compileString } from './compiler.js';

export const version = '0.11.3';
export const version = '0.11.4';
4 changes: 2 additions & 2 deletions packages/cashscript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cashscript",
"version": "0.11.3",
"version": "0.11.4",
"description": "Easily write and interact with Bitcoin Cash contracts",
"keywords": [
"bitcoin cash",
Expand Down Expand Up @@ -46,7 +46,7 @@
},
"dependencies": {
"@bitauth/libauth": "^3.1.0-next.2",
"@cashscript/utils": "^0.11.3",
"@cashscript/utils": "^0.11.4",
"@electrum-cash/network": "^4.1.3",
"@mr-zwets/bchn-api-wrapper": "^1.0.1",
"@types/node": "^22.17.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cashscript/src/advanced/LibauthTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ export const getLibauthTemplates = (
export const debugLibauthTemplate = (template: WalletTemplate, transaction: TransactionBuilder): DebugResults => {
const allArtifacts = transaction.inputs
.map(input => 'contract' in input.unlocker ? input.unlocker.contract : undefined)
.filter((contract): contract is Contract => !!contract)
.filter((contract): contract is Contract => Boolean(contract))
.map(contract => contract.artifact);

return debugTemplate(template, allArtifacts);
Expand Down
2 changes: 1 addition & 1 deletion packages/cashscript/test/e2e/P2PKH.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('P2PKH-no-tokens', () => {

// TODO: this fails on mocknet, because mocknet doesn't check inputs vs outputs,
// we should add a sanity check in our own code
itOrSkip(!!process.env.TESTS_USE_CHIPNET, 'should fail when not enough satoshis are provided in utxos', async () => {
itOrSkip(Boolean(process.env.TESTS_USE_CHIPNET), 'should fail when not enough satoshis are provided in utxos', async () => {
// given
const to = p2pkhContract.address;
const amount = 1000n;
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cashscript/utils",
"version": "0.11.3",
"version": "0.11.4",
"description": "CashScript utilities and types",
"keywords": [
"bitcoin cash",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export function parseType(str: string): Type {
}

export function isPrimitive(type: Type): type is PrimitiveType {
return !!PrimitiveType[type.toString().toUpperCase() as keyof typeof PrimitiveType];
return Boolean(PrimitiveType[type.toString().toUpperCase() as keyof typeof PrimitiveType]);
}

export interface LocationI {
Expand Down
6 changes: 6 additions & 0 deletions website/docs/releases/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
title: Release Notes
---

## v0.11.4

### CashScript SDK
- :sparkles: Add `updateUtxoSet` option to `MockNetworkProvider` to allow for updating the UTXO set after a transaction is sent.
- :bug: Fix bug where sending P2PKH-only transactions would throw `No placeholder scenario ID or script ID found`.

## v0.11.3

#### cashc compiler
Expand Down
6 changes: 4 additions & 2 deletions website/docs/sdk/other-network-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ The CashScript SDK needs to connect to the BCH network to perform certain operat

## MockNetworkProvider
```ts
new MockNetworkProvider()
new MockNetworkProvider(options?: { updateUtxoSet: boolean })
```

The `MockNetworkProvider` is a special network provider that allows you to evaluate transactions locally without interacting with the Bitcoin Cash network. This is useful when writing automated tests for your contracts, or when debugging your contract locally.
The `MockNetworkProvider` is a special network provider that allows you to evaluate transactions locally without interacting with the Bitcoin Cash network. This is useful when writing automated tests for your contracts, or when debugging your contract locally.

The `MockNetworkProvider` has extra methods to enable this local emulation such as `.addUtxo()` and `.setBlockHeight()`.
You can read more about the `MockNetworkProvider` and automated tests on the [testing setup](/docs/sdk/testing-setup) page.

The `updateUtxoSet` option is used to determine whether the UTXO set should be updated after a transaction is sent. If `updateUtxoSet` is `true`, the UTXO set will be updated to reflect the new state of the mock network. If `updateUtxoSet` is `false` (default), the UTXO set will not be updated.

#### Example
```ts
const provider = new MockNetworkProvider();
Expand Down
2 changes: 1 addition & 1 deletion website/docs/sdk/testing-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const aliceUtxo = provider.addUtxo(aliceAddress, randomUtxo({
```

:::note
The `MockNetworkProvider` evaluates transactions locally but does not process the transaction updates. This means no UTXOs are consumed and no new UTXOs are created when mocking a transaction `send` using the provider.
By default, the `MockNetworkProvider` evaluates transactions locally but does not process the transaction updates. This means no UTXOs are consumed and no new UTXOs are created when mocking a transaction `send` using the provider. This can be configured by setting the `updateUtxoSet` option to `true`.
:::

## Automated testing
Expand Down