diff --git a/mithril-client-wasm/www/index.js b/mithril-client-wasm/www/index.js
index 22900c13ff1..f5921029af5 100644
--- a/mithril-client-wasm/www/index.js
+++ b/mithril-client-wasm/www/index.js
@@ -12,15 +12,15 @@ broadcast_channel.onmessage = (e) => {
displayMessageInDOM(
event.type,
"The certificate chain validation has started, event_id: " +
- event.payload.certificate_chain_validation_id,
+ event.payload.certificate_chain_validation_id,
);
} else if (event.type == "CertificateValidated") {
displayMessageInDOM(
event.type,
"A certificate has been validated, certificate_hash: " +
- event.payload.certificate_hash +
- ", event_id: " +
- event.payload.certificate_chain_validation_id,
+ event.payload.certificate_hash +
+ ", event_id: " +
+ event.payload.certificate_chain_validation_id,
);
} else if (event.type == "CertificateChainValidated") {
certificate_chain_validated_occurs = true;
@@ -64,21 +64,16 @@ function format_tx_list(transactions_hashes) {
return "
" + transactions_hashes.map((tx) => "- " + tx + "
").join("") + "
";
}
-function client_options_with_custom_headers() {
- // The following header is set as an example.
- // It's used to demonstrate how to add headers.
- let http_headers_map = new Map();
- http_headers_map.set("Content-Type", "application/json");
-
- return {
- http_headers: http_headers_map,
- };
-}
-
await initMithrilClient();
-let client_options = client_options_with_custom_headers();
-let client = new MithrilClient(aggregator_endpoint, genesis_verification_key, client_options);
+let client = new MithrilClient(aggregator_endpoint, genesis_verification_key, {
+ // The following header is set as an example.
+ // It's used to demonstrate how to add headers.
+ http_headers: new Map([["Content-Type", "application/json"]]),
+ // The following option activates the unstable features of the client.
+ // Unstable features will trigger an error if this option is not set.
+ unstable: true
+});
displayStepInDOM(1, "Getting stake distributions list...");
let mithril_stake_distributions_list = await client.list_mithril_stake_distributions();
@@ -104,8 +99,8 @@ console.log("last_stake_distribution:", last_stake_distribution);
displayStepInDOM(
3,
"Getting Mithril certificate from certificate hash: " +
- last_stake_distribution.certificate_hash +
- "...",
+ last_stake_distribution.certificate_hash +
+ "...",
);
let certificate = await client.get_mithril_certificate(last_stake_distribution.certificate_hash);
displayMessageInDOM("Result", "got Mithril certificate ✓");
@@ -135,7 +130,7 @@ displayMessageInDOM("Result", "Mithril stake distribution message validated
console.log("valid_stake_distribution_message:", valid_stake_distribution_message);
displayStepInDOM(7, "Getting transaction proof...");
-const proof = await client.unstable.get_cardano_transaction_proofs([
+const proof = await client.get_cardano_transaction_proofs([
"eac09f970f47ef3ab378db9232914e146773853397e79b904f1a45123a23c21f",
"81fe7a5dab42867ef309b6d7210158bf99331884ac3c3b6c7188a8c9c18d5974",
"320c13f4a3e51f6f4f66fcd9007e02bf658aa4ee9a88a509028d867d3b8a8e9a",
@@ -157,7 +152,7 @@ displayMessageInDOM("Result", "certificate chain verified ✓");
console.log("verify_certificate_chain OK, last_certificate_from_chain:", proof_certificate);
displayStepInDOM(10, "Validating Cardano transaction proof message...");
-let protocol_message = await client.unstable.verify_cardano_transaction_proof_then_compute_message(
+let protocol_message = await client.verify_cardano_transaction_proof_then_compute_message(
proof,
proof_certificate,
);