Skip to content

Commit db0665f

Browse files
committed
Website updates
1 parent d340ea6 commit db0665f

File tree

7 files changed

+5206
-6641
lines changed

7 files changed

+5206
-6641
lines changed

website/docs/releases/migration-notes.md

+29-23
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,38 @@ title: Migration Notes
55
## v0.7 to v0.8
66

77
### cashc compiler
8-
- `cashc` is now a [Pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). This means that you can no longer use `require` to import `cashscript`. For more information, see the [ESM documentation](https://nodejs.org/api/esm.html).
9-
- `LockingBytecodeP2SH` has been renamed to `LockingBytecodeP2SH20` but it is recommended to use the newly introduced `LockingBytecodeP2SH32` instead.
8+
`cashc` is now a [Pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). This means that you can no longer use `require` to import `cashscript`. For more information, see the [ESM documentation](https://nodejs.org/api/esm.html).
9+
10+
`LockingBytecodeP2SH` should be replaced with `LockingBytecodeP2SH20` to keep the same behaviour, or updated to `LockingBytecodeP2SH32` to use the recommended new `P2SH32` Address type.
1011

1112
### CashScript SDK
12-
- `cashscript` is now a [Pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). This means that you can no longer use `require` to import `cashscript`. For more information, see the [ESM documentation](https://nodejs.org/api/esm.html).
13-
- The SDK now returns `p2sh32` addresses by default. The address type can be changed to the old `p2sh20` in the options object when initializing a contract.
14-
- The configuration of the network provider is also part of this options object.
15-
```ts
16-
// old
17-
const contract = new Contract(artifact, constructorArgs, provider);
18-
19-
// new
20-
const options = { provider, addressType: 'p2sh20' };
21-
const contract = new Contract(artifact, constructorArgs, options);
22-
```
23-
24-
- Network options `"testnet"` & `"staging"` have been renamed to `"testnet3"` and `"testnet4"` respectively in version 0.7.3. The old option names are removed with this major release.
25-
- You can no longer use `number` inputs for constructor arguments, function arguments, or input/output amounts. Use `bigint` instead.
26-
- `contract.getBalance()` and `contract.getUtxos()` now return `bigint` for satoshi amounts instead of `number`.
27-
- `contract.getRedeemScriptHex()` has been replaced with `contract.bytecode`.
13+
`cashscript` is now a [Pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). This means that you can no longer use `require` to import `cashscript`. For more information, see the [ESM documentation](https://nodejs.org/api/esm.html).
14+
15+
#### Contract instantiation
16+
When instantiating a `Contract` object, you now have to pass an options object as a third parameter instead of a network provider. This options object contains the network provider, as well as the address type. The address type defaults to `p2sh32` but can be changed to `p2sh20` if you want to keep the same address type as in earlier versions of the SDK.
17+
```ts
18+
// old
19+
const contract = new Contract(artifact, constructorArgs, provider);
20+
21+
// new
22+
const options = { provider, addressType: 'p2sh20' };
23+
const contract = new Contract(artifact, constructorArgs, options);
24+
```
25+
26+
#### SIGHASH_UTXO
27+
All signature templates use `SIGHASH_ALL | SIGHASH_UTXOS` now, to keep using the only the previous `SIGHASH_ALL` overwrite it in the following way:
28+
```ts
29+
const sig = new SignatureTemplate(wif, HashType.SIGHASH_ALL);
30+
```
31+
Note that you *need* to use only `SIGHASH_ALL` if you're still using "old-style" covenants (from CashScript v0.6.0 and lower). It is recommended to upgrade to the new "native" covenants (from CashScript v0.7.0 and higher) instead.
32+
33+
#### bigint
34+
You can no longer use `number` inputs for constructor arguments, function arguments, or input/output amounts. Use `bigint` instead. `contract.getBalance()` and `contract.getUtxos()` now also return `bigint` for satoshi amounts instead of `number`.
35+
36+
#### Name changes & removal of deprecated features
37+
- Network options `"testnet"` and `"staging"` should be replaced with `"testnet3"` and `"testnet4"` respectively.
38+
- `contract.getRedeemScriptHex()` should be replaced with `contract.bytecode`.
2839
- `BitboxNetworkProvider` has been removed since Bitbox is long deprecated. Switch to modern solutions like `ElectrumNetworkProvider` instead.
29-
- :boom: **BREAKING**: All signature templates use `SIGHASH_ALL | SIGHASH_UTXOS` now, to keep using the only the previous `SIGHASH_ALL` overwrite it in the following way:
30-
```ts
31-
const sig = new SignatureTemplate(wif, HashType.SIGHASH_ALL);
32-
```
33-
Note that you *need* to use only `SIGHASH_ALL` if you're still using "old-style" covenants (from CashScript v0.6.0 and lower). It is recommended to upgrade to the new "native" covenants (from CashScript v0.7.0 and higher) instead.
3440

3541
## v0.6 to v0.7
3642
### cashc compiler

website/docs/releases/release-notes.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This release also contains several breaking changes, please refer to the [migrat
1313
- :sparkles: Add `LockingBytecodeP2SH32` to generate the new P2SH32 standard locking script.
1414
- :bug: Fix optimisation bug that caused `OP_0NOTEQUAL` to be applied to non-integer values.
1515
- :boom: **BREAKING**: Move to Pure ESM.
16-
- :boom: **BREAKING**: renamed `LockingBytecodeP2SH` to `LockingBytecodeP2SH20` but it is recommended to change over to the new P2SH32 for security reasons.
16+
- :boom: **BREAKING**: Rename `LockingBytecodeP2SH` to `LockingBytecodeP2SH20` - but it is recommended to change over to the new P2SH32 for security reasons.
1717

1818
#### CashScript SDK
1919
- :sparkles: Add support for CashTokens.
@@ -22,13 +22,14 @@ This release also contains several breaking changes, please refer to the [migrat
2222
- UTXOs that are passed into `.from()` can also include this `token` field to send tokens.
2323
- Add `.withoutTokenChange()` to disable automatic token change outputs.
2424
- Note that only the `ElectrumNetworkProvider` supports CashTokens at this time.
25+
- Note that NFTs do not support automatic UTXO selection
2526
- :sparkles: Add `contract.tokenAddress` to get the token-enabled address of a contract.
2627
- :sparkles: Add `fromP2PKH()` to add P2PKH inputs to a smart contract transaction.
2728
- Note: this was in the SDK before as `experimentalFromP2PKH()`. It has now been released as an official feature.
2829
- :boom: **BREAKING**: Move to Pure ESM.
2930
- :boom: **BREAKING**: Remove `"testnet"` & `"staging"` network options.
3031
- :boom: **BREAKING**: `contract.address` returns `p2sh32` address by default, this can be configured to be `p2sh20` on contract initialization.
31-
- :boom: **BREAKING**: Moved the configuration of the network provider to an options object on contract initialization.
32+
- :boom: **BREAKING**: Move the configuration of the network provider to an options object on contract initialization.
3233
- :boom: **BREAKING**: Use `bigint` rather than `number` for all instances of "script numbers" (e.g. function arguments) and satoshi amounts.
3334
- :boom: **BREAKING**: Replace `contract.getRedeemScriptHex()` with `contract.bytecode`.
3435
- :boom: **BREAKING**: Remove `BitboxNetworkProvider`.

website/docusaurus.config.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module.exports = {
88
projectName: 'cashscript',
99
themeConfig: {
1010
prism: {
11-
theme: require('prism-react-renderer/themes/nightOwlLight'),
12-
darkTheme: require('prism-react-renderer/themes/nightOwl'),
11+
theme: require('prism-react-renderer').themes.nightOwlLight,
12+
darkTheme: require('prism-react-renderer').themes.nightOwl,
1313
additionalLanguages: ['solidity', 'antlr4'],
1414
},
1515
image: 'img/logo.svg',
@@ -18,7 +18,7 @@ module.exports = {
1818
alt: 'CashScript',
1919
src: 'img/logo.svg',
2020
},
21-
links: [
21+
items: [
2222
{to: '/docs/basics/about', label: 'Docs', position: 'right'},
2323
{
2424
href: 'https://playground.cashscript.org',
@@ -31,6 +31,7 @@ module.exports = {
3131
position: 'right',
3232
},
3333
],
34+
style: 'dark',
3435
},
3536
footer: {
3637
style: 'light',
@@ -90,12 +91,10 @@ module.exports = {
9091
],
9192
copyright: `<b>Donations:</b> bitcoincash:qz6uftqp7dyc4ca9e94d7wsle06u0z2ccc223dkpl8`,
9293
},
93-
googleAnalytics: {
94-
trackingID: 'UA-26805430-6',
95-
},
9694
algolia: {
97-
apiKey: 'b0b29787f1ed36aa2c1057bf4f6e6dde',
98-
indexName: 'cashscript',
95+
apiKey: 'd1e059f9bd6bf56667612a41a5115c6b',
96+
appId: 'XBVJRKV38F',
97+
indexName: 'cashscript'
9998
},
10099
},
101100
presets: [
@@ -128,5 +127,6 @@ module.exports = {
128127
],
129128
},
130129
],
130+
['@branchup/docusaurus-plugin-simple-analytics', {}],
131131
],
132132
};

website/package.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
"deploy": "docusaurus deploy"
1010
},
1111
"dependencies": {
12-
"@docusaurus/core": "^2.0.0-alpha.58",
13-
"@docusaurus/plugin-client-redirects": "^2.0.0-alpha.58",
14-
"@docusaurus/preset-classic": "^2.0.0-alpha.58",
15-
"classnames": "^2.2.6",
16-
"prism-react-renderer": "^1.1.1",
17-
"react": "^16.8.4",
18-
"react-dom": "^16.8.4"
12+
"@branchup/docusaurus-plugin-simple-analytics": "^1.1.0",
13+
"@docusaurus/core": "^2.4.1",
14+
"@docusaurus/plugin-client-redirects": "^2.4.1",
15+
"@docusaurus/preset-classic": "^2.4.1",
16+
"classnames": "^2.3.2",
17+
"prism-react-renderer": "^2.0.4",
18+
"react": "^18.2.0",
19+
"react-dom": "^18.2.0"
1920
},
2021
"browserslist": {
2122
"production": [

website/src/css/custom.css

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
--ifm-code-font-size: 95%;
4646
}
4747

48+
.navbar--dark {
49+
--ifm-navbar-background-color: var(--ifm-color-dark);
50+
--ifm-navbar-link-hover-color: var(--ifm-color-secondary);
51+
}
52+
4853
html[data-theme="dark"] {
4954
/* Theme colours inverted in dark mode */
5055
--ifm-color-primary: #04FF84;

website/src/pages/index.js

+16-24
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,43 @@ const features = [
1111
title: 'Efficient and Reliable Verification',
1212
description: (
1313
<>
14-
<p>
15-
Smart contracts on Bitcoin Cash are stateless and UTXO-based. This
16-
model allows transactions to be verified independently and efficiently.
17-
Because there is no state that can impact the execution of these smart
18-
contracts, the results are deterministic and predictable.
19-
</p>
14+
Smart contracts on Bitcoin Cash are stateless and UTXO-based. This
15+
model allows transactions to be verified independently and efficiently.
16+
Because there is no state that can impact the execution of these smart
17+
contracts, the results are deterministic and predictable.
2018
</>
2119
),
2220
},
2321
{
2422
title: 'Private and Isolated Contracts',
2523
description: (
2624
<>
27-
<p>
28-
Because of Bitcoin Cash' UTXO-based model, each contract is fully
29-
independent and isolated from each other. This limits systemic risk
30-
and makes contract upgrades much simpler. Furthermore, Bitcoin Cash
31-
contracts use P2SH, preserving the privacy of participants.
32-
</p>
25+
Because of Bitcoin Cash' UTXO-based model, each contract is fully
26+
independent and isolated from each other. This limits systemic risk
27+
and makes contract upgrades much simpler. Furthermore, Bitcoin Cash
28+
contracts use P2SH, preserving the privacy of participants.
3329
</>
3430
),
3531
},
3632
{
3733
title: 'Strong Abstraction',
3834
description: (
3935
<>
40-
<p>
41-
Bitcoin Cash transactions run on a virtual machine called Bitcoin Script.
42-
Writing bytecode for this virtual machine is difficult and error-prone.
43-
CashScript offers a strong abstraction for writing Bitcoin Cash smart
44-
contracts, improving developer experience and reliability of contracts.
45-
</p>
36+
Bitcoin Cash transactions run on a virtual machine called Bitcoin Script.
37+
Writing bytecode for this virtual machine is difficult and error-prone.
38+
CashScript offers a strong abstraction for writing Bitcoin Cash smart
39+
contracts, improving developer experience and reliability of contracts.
4640
</>
4741
),
4842
},
4943
{
5044
title: 'DeFi on Bitcoin Cash',
5145
description: (
5246
<>
53-
<p>
54-
Most DeFi applications are currently running on top of Ethereum. Bitcoin
55-
Cash contracts use a different and functionally more limited paradigm.
56-
But with techniques such as covenants, local state and trust-minimised
57-
price oracles, DeFi is very much possible on Bitcoin Cash.
58-
</p>
47+
Most DeFi applications are currently running on top of Ethereum. Bitcoin
48+
Cash contracts use a different and functionally more limited paradigm.
49+
But with techniques such as covenants, local state and trust-minimised
50+
price oracles, DeFi is very much possible on Bitcoin Cash.
5951
</>
6052
),
6153
},

0 commit comments

Comments
 (0)