You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/releases/migration-notes.md
+29-23
Original file line number
Diff line number
Diff line change
@@ -5,32 +5,38 @@ title: Migration Notes
5
5
## v0.7 to v0.8
6
6
7
7
### 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.
10
11
11
12
### 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.
- 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.
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 =newSignatureTemplate(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`.
28
39
-`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 =newSignatureTemplate(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.
Copy file name to clipboardExpand all lines: website/docs/releases/release-notes.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ This release also contains several breaking changes, please refer to the [migrat
13
13
-:sparkles: Add `LockingBytecodeP2SH32` to generate the new P2SH32 standard locking script.
14
14
-:bug: Fix optimisation bug that caused `OP_0NOTEQUAL` to be applied to non-integer values.
15
15
-: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.
17
17
18
18
#### CashScript SDK
19
19
-:sparkles: Add support for CashTokens.
@@ -22,13 +22,14 @@ This release also contains several breaking changes, please refer to the [migrat
22
22
- UTXOs that are passed into `.from()` can also include this `token` field to send tokens.
23
23
- Add `.withoutTokenChange()` to disable automatic token change outputs.
24
24
- Note that only the `ElectrumNetworkProvider` supports CashTokens at this time.
25
+
- Note that NFTs do not support automatic UTXO selection
25
26
-:sparkles: Add `contract.tokenAddress` to get the token-enabled address of a contract.
26
27
-:sparkles: Add `fromP2PKH()` to add P2PKH inputs to a smart contract transaction.
27
28
- Note: this was in the SDK before as `experimentalFromP2PKH()`. It has now been released as an official feature.
0 commit comments