@@ -6,6 +6,48 @@ and this project adheres to
66
77## [ Unreleased]
88
9+ ### Added
10+
11+ - @cosmjs/encoding : Add ` fixUint8Array ` which takes an
12+ ` Uint8Array<ArrayBufferLike> ` and returns ` Uint8Array<ArrayBuffer> ` . This can
13+ be used in cases where a data source returns an ` Uint8Array ` without
14+ specifying the buffer type but you need an ` ArrayBuffer ` . Internally it might
15+ perform a copy but in the vast majority of cases it will just change the type
16+ after ensuring ` ArrayBuffer ` is used. ([ #1883 ] )
17+
18+ [ #1883 ] : https://github.com/cosmos/cosmjs/issues/1883
19+
20+ ### Changed
21+
22+ - all: return ` Uint8Array<ArrayBuffer> ` instead of
23+ ` Uint8Array = Uint8Array<ArrayBufferLike> ` whenever CosmJS creates binary data
24+ for users. This allows users to stick it into APIs that require ` ArrayBuffer `
25+ such as many APIs from Subtle crypto. You can still assign
26+ ` Uint8Array<ArrayBuffer> ` to any ` Uint8Array ` in an existing codebase like
27+ this:
28+
29+ ``` ts
30+ const myVar: Uint8Array = fromHex (" aabb" );
31+ ```
32+
33+ That's the easy way and probably good for many use cases. However, this way
34+ you lose information which buffer type is in use and you cannot trivially pass
35+ it to an API requiring ` Uint8Array<ArrayBuffer> ` later on.
36+
37+ The other option is to preserve the information you are getting from CosmJS by
38+ using ` Uint8Array<ArrayBuffer> ` too:
39+
40+ ``` ts
41+ const myVar: Uint8Array <ArrayBuffer > = fromHex (" aabb" );
42+
43+ // or inferred
44+ const myVar = fromHex (" aabb" ); // Uint8Array<ArrayBuffer>
45+ ```
46+
47+ This change requires users to use TypeScript 5.7 or newer. ([ #1883 ] )
48+
49+ [ #1883 ] : https://github.com/cosmos/cosmjs/issues/1883
50+
951## [ 0.37.0] - 2025-10-29
1052
1153### Added
0 commit comments