Skip to content

Commit d1c96f4

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat/migrate-jest-to-vitest
2 parents fd7d501 + 7aeea22 commit d1c96f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3405
-3827
lines changed

.cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
"incl",
230230
"infima",
231231
"jedex",
232+
"kiok",
232233
"lichos",
233234
"mainnetjs",
234235
"maxdepth",

examples/PriceOracle.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { padMinimallyEncodedVmNumber, flattenBinArray, secp256k1 } from '@bitauth/libauth';
1+
import { padMinimallyEncodedVmNumber, flattenBinArray } from '@bitauth/libauth';
22
import { encodeInt, sha256 } from '@cashscript/utils';
3+
import { SignatureAlgorithm, SignatureTemplate } from 'cashscript';
34

45
export class PriceOracle {
5-
constructor(public privateKey: Uint8Array) {}
6+
constructor(public privateKey: Uint8Array) { }
67

78
// Encode a blockHeight and bchUsdPrice into a byte sequence of 8 bytes (4 bytes per value)
89
createMessage(blockHeight: bigint, bchUsdPrice: bigint): Uint8Array {
@@ -12,9 +13,8 @@ export class PriceOracle {
1213
return flattenBinArray([encodedBlockHeight, encodedBchUsdPrice]);
1314
}
1415

15-
signMessage(message: Uint8Array): Uint8Array {
16-
const signature = secp256k1.signMessageHashSchnorr(this.privateKey, sha256(message));
17-
if (typeof signature === 'string') throw new Error();
18-
return signature;
16+
signMessage(message: Uint8Array, signatureAlgorithm: SignatureAlgorithm = SignatureAlgorithm.SCHNORR): Uint8Array {
17+
const signatureTemplate = new SignatureTemplate(this.privateKey, undefined, signatureAlgorithm);
18+
return signatureTemplate.signMessageHash(sha256(message));
1919
}
2020
}

examples/announcement.cash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma cashscript ^0.11.0;
1+
pragma cashscript ^0.12.0;
22

33
/* This is a contract showcasing covenants outside of regular transactional use.
44
* It enforces the contract to make an "announcement" on Memo.cash, and send the

examples/hodl_vault.cash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma cashscript ^0.11.0;
1+
pragma cashscript ^0.12.0;
22

33
// This contract forces HODLing until a certain price target has been reached
44
// A minimum block is provided to ensure that oracle price entries from before this block are disregarded

examples/mecenas.cash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma cashscript ^0.11.0;
1+
pragma cashscript ^0.12.0;
22

33
/* This is an unofficial CashScript port of Licho's Mecenas contract. It is
44
* not compatible with Licho's EC plugin, but rather meant as a demonstration

examples/mecenas_locktime.cash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma cashscript ^0.11.0;
1+
pragma cashscript ^0.12.0;
22

33
// This is an experimental contract for a more "streaming" Mecenas experience
44
// Completely untested, just a concept

examples/p2pkh.cash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma cashscript ^0.11.0;
1+
pragma cashscript ^0.12.0;
22

33
contract P2PKH(bytes20 pkh) {
44
// Require pk to match stored pkh and signature to match

examples/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cashscript-examples",
33
"private": true,
4-
"version": "0.11.5",
4+
"version": "0.12.0",
55
"description": "Usage examples of the CashScript SDK",
66
"main": "p2pkh.js",
77
"type": "module",
@@ -11,10 +11,10 @@
1111
"lint": "eslint . --ext .ts --ignore-path ../.eslintignore"
1212
},
1313
"dependencies": {
14-
"@bitauth/libauth": "^3.1.0-next.2",
14+
"@bitauth/libauth": "^3.1.0-next.8",
1515
"@types/node": "^22.17.0",
16-
"cashc": "^0.11.5",
17-
"cashscript": "^0.11.5",
16+
"cashc": "^0.12.0",
17+
"cashscript": "^0.12.0",
1818
"eslint": "^8.56.0",
1919
"typescript": "^5.9.2"
2020
}

examples/testing-suite/artifacts/example.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
"compiler": {
4343
"name": "cashc",
44-
"version": "0.11.3"
44+
"version": "0.12.0"
4545
},
46-
"updatedAt": "2025-08-05T08:32:16.100Z"
46+
"updatedAt": "2025-10-02T09:56:11.510Z"
4747
}

examples/testing-suite/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "testing-suite",
3-
"version": "0.11.5",
3+
"version": "0.12.0",
44
"description": "Example project to develop and test CashScript contracts",
55
"main": "index.js",
66
"type": "module",
@@ -23,9 +23,9 @@
2323
"test": "vitest run"
2424
},
2525
"dependencies": {
26-
"@bitauth/libauth": "^3.1.0-next.2",
27-
"cashc": "^0.11.5",
28-
"cashscript": "^0.11.5",
26+
"@bitauth/libauth": "^3.1.0-next.8",
27+
"cashc": "^0.12.0",
28+
"cashscript": "^0.12.0",
2929
"url-join": "^5.0.0"
3030
},
3131
"devDependencies": {

0 commit comments

Comments
 (0)