Skip to content

Commit 899f86c

Browse files
authored
Merge pull request #1914 from input-output-hk/jpraynaud/1911-seamless-stable-unstable-features-client-wasm
Refactor: seamless `unstable` to `stable` transition in WASM client
2 parents 1beeae8 + b0eaa98 commit 899f86c

File tree

15 files changed

+162
-111
lines changed

15 files changed

+162
-111
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ As a minor extension, we have adopted a slightly different versioning convention
99

1010
## Mithril Distribution [XXXX] - UNRELEASED
1111

12+
- **BREAKING** changes in Mithril client WASM:
13+
14+
- Implementation of seamless transition from **unstable** to **stable** features.
15+
- A new `unstable` option in the client allows the usage of unstable features.
16+
- The previous `client.unstable` implementation is not supported anymore and must be replaced with `client`.
17+
1218
- Support for Mithril nodes footprint support in Prometheus monitoring in infrastructure.
1319

1420
- Add support for custom HTTP headers in Mithril client WASM library.
@@ -19,7 +25,7 @@ As a minor extension, we have adopted a slightly different versioning convention
1925

2026
- Add feature options `num-integer-backend` and `rug-backend` for `mithril-common` and `mithril-client` crates. Allows to disable `rug-backend` and avoid `LGPL` license usage.
2127

22-
- Post `Chang` hard fork cleanup of the CI and the devnet.
28+
- Post `Chang` hard fork cleanup of the CI, devnet and infrastructure.
2329

2430
- **UNSTABLE** Cardano stake distribution certification:
2531

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/website/root/manual/developer-docs/nodes/mithril-client-library-wasm.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ broadcast_channel.onmessage = (e) => {
9494

9595
await initMithrilClient();
9696

97-
let client = await new MithrilClient(
98-
aggregator_endpoint,
99-
genesis_verification_key,
100-
);
97+
let client = new MithrilClient(aggregator_endpoint, genesis_verification_key, {
98+
// The following option activates the unstable features of the client.
99+
// Unstable features will trigger an error if this option is not set.
100+
unstable: true,
101+
});
101102
let mithril_stake_distributions_list =
102103
await client.list_mithril_stake_distributions();
103104
console.log("stake distributions:", mithril_stake_distributions_list);
@@ -187,7 +188,7 @@ wget -q -O - https://aggregator.pre-release-preview.api.mithril.network/aggregat
187188
:::
188189

189190
```js
190-
const proof = await client.unstable.get_cardano_transaction_proofs([
191+
const proof = await client.get_cardano_transaction_proofs([
191192
"CARDANO_TRANSACTION_HASH_1",
192193
"CARDANO_TRANSACTION_HASH_2",
193194
]);
@@ -203,7 +204,7 @@ console.log(
203204
);
204205

205206
let valid_cardano_transaction_proof =
206-
await client.unstable.verify_cardano_transaction_proof_then_compute_message(
207+
await client.verify_cardano_transaction_proof_then_compute_message(
207208
proof,
208209
proof_certificate,
209210
);
@@ -233,11 +234,11 @@ wget -q -O - https://aggregator.testing-preview.api.mithril.network/aggregator |
233234

234235
```js
235236
let cardano_stake_distributions_list =
236-
await client.unstable.list_cardano_stake_distributions();
237+
await client.list_cardano_stake_distributions();
237238
console.log("cardano stake distributions:", cardano_stake_distributions_list);
238239

239240
let last_cardano_stake_distribution =
240-
await client.unstable.get_cardano_stake_distribution(
241+
await client.get_cardano_stake_distribution(
241242
cardano_stake_distributions_list[0].hash,
242243
);
243244
console.log(
@@ -259,7 +260,7 @@ console.log(
259260
);
260261

261262
let cardano_stake_distribution_message =
262-
await client.unstable.compute_cardano_stake_distribution_message(
263+
await client.compute_cardano_stake_distribution_message(
263264
certificate,
264265
last_cardano_stake_distribution,
265266
);

mithril-client-wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-client-wasm"
3-
version = "0.3.10"
3+
version = "0.4.0"
44
description = "Mithril client WASM"
55
authors = { workspace = true }
66
edition = { workspace = true }

0 commit comments

Comments
 (0)