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
Tuples are the type that is returned when calling the `split` member function on a `string` or `bytes` type. Their first or second element can be accessed through an indexing syntax similar to other languages:
142
144
143
145
```solidity
144
-
string question = "What is Bitcoin Cash?";
145
-
string answer = question.split(15)[0].split(8)[1]; // Answer is "Cash"
146
+
string bitcoinCash = "Bitcoin Cash";
147
+
string cash = bitcoinCash.split(8)[1];
146
148
```
147
149
148
150
:::note
@@ -152,8 +154,8 @@ It is not supported to use a variable for the tupleIndex. Instead you can assign
152
154
It is also possible to assign both sides of the tuple at once with a destructuring syntax:
153
155
154
156
```solidity
155
-
string hello, string world = "Hello World".split(5);
156
-
require(hello + "world" == "Hello " + world);
157
+
string hello, string world = "Hello World".split(6);
Copy file name to clipboardExpand all lines: website/docs/releases/release-notes.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,24 +6,28 @@ title: Release Notes
6
6
7
7
#### cashc compiler
8
8
-:sparkles: Add `.slice(start, end)` operator for bytes and strings.
9
-
-:sparkles: Add bounded bytes typing and bounds checking for `.split()` (includes checking for negative indices)
10
-
-:racehorse: Add optimisation for `.slice(0, x)` and `.slice(x, y.length)` (also applies to `.split(0)[1]`)
11
-
-:bug: Disallow incorrect bounded bytes typing when using `.split()`
9
+
-:sparkles: Add bounded bytes typing and bounds checking for `.split()` (includes checking for negative indices).
10
+
-:racehorse: Add optimisation for `.slice(0, x)` and `.slice(x, y.length)` (also applies to `.split(0)[1]`).
11
+
-:bug: Disallow incorrect bounded bytes typing when using `.split()`.
12
12
13
13
#### CashScript SDK
14
-
-:bug: Fix bug with where `ElectrumNetworkProvider` would disconnect in browser on visibility change of the page
14
+
-:bug: Fix bug with where `ElectrumNetworkProvider` would disconnect in browser on visibility change of the page.
15
15
16
16
## v0.11.2
17
17
18
18
#### CashScript SDK
19
-
-:bug: Fix bug with new `generateWcTransactionObject()` throwing when using `placeholderP2PKHUnlocker()`
19
+
-:bug: Fix bug with new `generateWcTransactionObject()` throwing when using `placeholderP2PKHUnlocker()`.
20
20
21
21
## v0.11.1
22
22
23
23
#### CashScript SDK
24
24
-:sparkles: Add `generateWcTransactionObject()` method to `TransactionBuilder` to generate a `WcTransactionObject` that can be used to sign a transaction with a WalletConnect client.
25
25
-:sparkles: Add `placeholderSignature()`, `placeholderPublicKey()` and `placeholderP2PKHUnlocker()` helper functions to the SDK for WalletConnect usage.
This update adds CashScript support for the new BCH 2025 network upgrade. To read more about the upgrade, see [this blog post](https://blog.bitjson.com/2025-chips/).
@@ -55,6 +59,10 @@ This release also contains several breaking changes, please refer to the [migrat
55
59
-:bug: Fix bug where `JestExtensions``expect().toLog()` would detect logs from different tests.
56
60
-:bug: Fix bug where certain edge cases in require statements caused the `FailedRequireError` message to be slightly different from the original error message.
-:boom:**BREAKING**: Remove `importArtifact` and `exportArtifact` helper functions. If you want to import or export artifacts, use `'fs'` to read and write files directly.
0 commit comments