|
2 | 2 | title: Migration Notes |
3 | 3 | --- |
4 | 4 |
|
| 5 | +## v0.11 to v0.12 |
| 6 | + |
| 7 | +There are several breaking changes to the SDK in this release. |
| 8 | + |
| 9 | +### CashScript SDK |
| 10 | + |
| 11 | +#### Old Transaction Builder Removal |
| 12 | + |
| 13 | +The most impactful breaking change is the removal of the deprecated 'Simple Transaction Builder'. See [below for steps to migrate to the new transaction builder](/docs/releases/migration-notes#sdk-transaction-builder). |
| 14 | + |
| 15 | +#### Contract constructor |
| 16 | +Before, the `provider` option was optional in the `Contract` constructor. This is no longer the case. |
| 17 | + |
| 18 | +```ts |
| 19 | +// Before: defaults to mainnet ElectrumNetworkProvider |
| 20 | +const contract = new Contract(artifact, constructorArgs); |
| 21 | + |
| 22 | +// After: explicitly specify the provider |
| 23 | +const provider = new ElectrumNetworkProvider('mainnet'); |
| 24 | +const contract = new Contract(artifact, constructorArgs, { provider }); |
| 25 | +``` |
| 26 | + |
| 27 | +#### Transaction Builder Max Fee |
| 28 | +Before, the `setMaxFee()` method was used to set the maximum fee for the transaction. This was replaced with the `maximumFeeSatoshis` option in the constructor. Additionally, the `maximumFeeSatsPerByte` option was added. |
| 29 | + |
| 30 | +```ts |
| 31 | +// Before: setMaxFee() was used to set the maximum fee |
| 32 | +const builder = new TransactionBuilder({ provider }).setMaxFee(1000n); |
| 33 | + |
| 34 | +// After: maximumFeeSatoshis option was added to the constructor |
| 35 | +const builder = new TransactionBuilder({ provider, maximumFeeSatoshis: 1000n }); |
| 36 | +``` |
| 37 | + |
| 38 | +#### MockNetworkProvider |
| 39 | + |
| 40 | +Before, the `updateUtxoSet` option was `false` by default for the `MockNetworkProvider`. This is now `true` by default to better match real-world network behaviour. |
| 41 | + |
| 42 | +```ts |
| 43 | +// Before: updateUtxoSet is false by default |
| 44 | +const provider = new MockNetworkProvider(); |
| 45 | + |
| 46 | +// After: updateUtxoSet is true by default, if you want to keep the old behaviour, set it to false |
| 47 | +const provider = new MockNetworkProvider({ updateUtxoSet: false }); |
| 48 | +``` |
| 49 | + |
| 50 | +Earlier, the `MockNetworkProvider` also automatically added some test UTXOs to the provider, which is no longer the case. Make sure to add any UTXOs you need manually. |
| 51 | + |
5 | 52 | ## v0.10 to v0.11 |
6 | 53 |
|
7 | 54 | There are several breaking changes to the compiler and SDK in this release. They are listed below in their own sections. |
|
0 commit comments