Skip to content

Commit 0ea9c7e

Browse files
Prep for v0.34.0 release (#1395)
* getting ready for a 0.34.0 release * minor change * fix typos * bump substrate deps as well
1 parent 388ebac commit 0ea9c7e

File tree

6 files changed

+857
-587
lines changed

6 files changed

+857
-587
lines changed

CHANGELOG.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,132 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.34.0] - 2024-01-23
8+
9+
This release introduces a bunch of features that make subxt easier to use. Let's look at a few of them.
10+
11+
### Codegen - Integrating [`scale-typegen`](https://github.com/paritytech/scale-typegen) and adding type aliases ([#1249](https://github.com/paritytech/subxt/pull/1249))
12+
13+
We rewrote the code generation functionality of subxt and outsourced it to the new [`scale-typegen`](https://github.com/paritytech/scale-typegen) crate, which serves a more general purpose.
14+
15+
Since a lot of types used in substrate are rich with generics, this release introduces type aliases into the generated code.
16+
A type alias is generated for the arguments/keys or each call, storage entry, and runtime API method ([#1249](https://github.com/paritytech/subxt/pull/1249)).
17+
18+
### Macro - Errors for misspecified type paths ([#1339](https://github.com/paritytech/subxt/pull/1339))
19+
20+
The subxt macro provides attributes to specify custom derives, attributes, and type substitutions on a per-type basis.
21+
Previously we did not verify that the provided type paths are part of the metadata. This is now fixed:
22+
If you provide an invalid type path, the macro will tell you so. It also suggests similar type paths, you might have meant instead.
23+
24+
```rust
25+
#[subxt::subxt(
26+
runtime_metadata_path = "metadata.scale",
27+
derive_for_type(path = "Junctions", derive = "Clone")
28+
)]
29+
pub mod polkadot {}
30+
```
31+
32+
This gives you a compile-time error like this:
33+
34+
```md
35+
Type `Junctions` does not exist at path `Junctions`
36+
37+
A type with the same name is present at:
38+
xcm::v3::junctions::Junctions
39+
xcm::v2::multilocation::Junctions
40+
```
41+
42+
### Macro - Recursive derives and attributes ([#1379](https://github.com/paritytech/subxt/pull/1379))
43+
44+
Previously adding derives on a type containing other types was also cumbersome, see this example:
45+
46+
```rust
47+
#[subxt::subxt(
48+
runtime_metadata_path = "metadata.scale",
49+
derive_for_type(path = "xcm::v2::multilocation::MultiLocation", derive = "Clone"),
50+
derive_for_type(path = "xcm::v2::multilocation::Junctions", derive = "Clone"),
51+
derive_for_type(path = "xcm::v2::junction::Junction", derive = "Clone"),
52+
derive_for_type(path = "xcm::v2::NetworkId", derive = "Clone"),
53+
derive_for_type(path = "xcm::v2::BodyId", derive = "Clone"),
54+
derive_for_type(path = "xcm::v2::BodyPart", derive = "Clone"),
55+
derive_for_type(
56+
path = "bounded_collections::weak_bounded_vec::WeakBoundedVec",
57+
derive = "Clone"
58+
)
59+
)]
60+
pub mod polkadot {}
61+
```
62+
63+
We introduced a `recursive` flag for custom derives and attributes that automatically inserts the specified derives on all child types:
64+
65+
```rust
66+
#[subxt::subxt(
67+
runtime_metadata_path = "metadata.scale",
68+
derive_for_type(path = "xcm::v2::multilocation::MultiLocation", derive = "Clone", recursive),
69+
)]
70+
pub mod polkadot {}
71+
```
72+
73+
### Subxt CLI - New features and usability improvements ([#1290](https://github.com/paritytech/subxt/pull/1290), [#1336](https://github.com/paritytech/subxt/pull/1336), and [#1379](https://github.com/paritytech/subxt/pull/1379))
74+
75+
Our CLI tool now allows you to explore runtime APIs and events ([#1290](https://github.com/paritytech/subxt/pull/1290)). We also fully integrated with [`scale-typegen-description`](https://github.com/paritytech/scale-typegen/tree/master/description), a crate that can describe types in a friendly way and provide type examples. The output is also color-coded to be easier on the eyes. Get started with these commands:
76+
77+
```sh
78+
# Show details about a runtime API call:
79+
subxt explore --url wss://westend-rpc.polkadot.io api StakingAPI nominations_quota
80+
# Execute a runtime API call from the CLI:
81+
subxt explore --url wss://westend-rpc.polkadot.io api core version -e
82+
# Discover what events a pallet can emit:
83+
subxt explore --url wss://westend-rpc.polkadot.io pallet Balances events
84+
```
85+
86+
All CLI commands that take some metadata via `--file` or `--url`, can now also read the metadata directly from `stdin` with `--file -` ([#1336](https://github.com/paritytech/subxt/pull/1336)).
87+
This allows you to pipe in metadata from other processes like in this command chain:
88+
```sh
89+
parachain-node export-metadata | subxt codegen --file - | rustfmt > main.rs
90+
```
91+
92+
Similar to the macro, the `subxt codegen` command can now also use `recursive` flags:
93+
```sh
94+
subxt codegen --derive-for-type xcm::v2::multilocation::MultiLocation=Clone,recursive
95+
subxt codegen --attributes-for-type "xcm::v2::multilocation::MultiLocation=#[myerror],recursive"
96+
```
97+
98+
### Minor changes and things to be aware of
99+
100+
- Using insecure connections is now an explicit opt-in in many places ([#1309](https://github.com/paritytech/subxt/pull/1309))
101+
- When decoding extrinsics from a block into a static type, we now return it's details (e.g. signature, signed extensions, raw bytes) alongside the statically decoded extrinsic itself ([#1376](https://github.com/paritytech/subxt/pull/1376))
102+
103+
We also made a few fixes and improvements around the unstable backend and the lightclient, preparing them for more stable usage in the future.
104+
105+
### Added
106+
107+
- Errors for misspecified type paths + suggestions ([#1339](https://github.com/paritytech/subxt/pull/1339))
108+
- CLI: Recursive derives and attributes ([#1379](https://github.com/paritytech/subxt/pull/1379))
109+
- CLI: Explore runtime APIs and events, colorized outputs, scale-typegen integration for examples ([#1290](https://github.com/paritytech/subxt/pull/1290))
110+
- Add chainflip to real world usage section of README ([#1351](https://github.com/paritytech/subxt/pull/1351))
111+
- CLI: Allow using `--file -` to read metadata from stdin ([#1336](https://github.com/paritytech/subxt/pull/1336))
112+
- Codegen: Generate type aliases for better API ergonomics ([#1249](https://github.com/paritytech/subxt/pull/1249))
113+
114+
### Changed
115+
116+
- Return Pending rather than loop around if no new finalized hash in submit_transaction ([#1378](https://github.com/paritytech/subxt/pull/1378))
117+
- Return `ExtrinsicDetails` alongside decoded static extrinsics ([#1376](https://github.com/paritytech/subxt/pull/1376))
118+
- Improve Signed Extension and Block Decoding Examples/Book ([#1357](https://github.com/paritytech/subxt/pull/1357))
119+
- Use `scale-typegen` as a backend for the codegen ([#1260](https://github.com/paritytech/subxt/pull/1260))
120+
- Using insecure connections is now opt-in ([#1309](https://github.com/paritytech/subxt/pull/1309))
121+
122+
### Fixed
123+
124+
- Ensure lightclient chainSpec is at least one block old ([#1372](https://github.com/paritytech/subxt/pull/1372))
125+
- Typo fix in docs ([#1370](https://github.com/paritytech/subxt/pull/1370))
126+
- Don't unpin blocks that may show up again ([#1368](https://github.com/paritytech/subxt/pull/1368))
127+
- Runtime upgrades in unstable backend ([#1348](https://github.com/paritytech/subxt/pull/1348))
128+
- Generate docs for feature gated items ([#1332](https://github.com/paritytech/subxt/pull/1332))
129+
- Backend: Remove only finalized blocks from the event window ([#1356](https://github.com/paritytech/subxt/pull/1356))
130+
- Runtime updates: wait until upgrade on chain ([#1321](https://github.com/paritytech/subxt/pull/1321))
131+
- Cache extrinsic events ([#1327](https://github.com/paritytech/subxt/pull/1327))
132+
7133
## [0.33.0] - 2023-12-06
8134

9135
This release makes a bunch of small QoL improvements and changes. Let's look at the main ones.

0 commit comments

Comments
 (0)