Skip to content

Commit 0f46ff1

Browse files
committed
docs: rotate current documentation
With release of distribution '2437' by running 'make update-current' command.
1 parent f083934 commit 0f46ff1

File tree

8 files changed

+176
-43
lines changed

8 files changed

+176
-43
lines changed

docs/website/versioned_docs/version-maintained/manual/developer-docs/nodes/mithril-client-library-wasm.md

Lines changed: 94 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ It is responsible for handling the different types of data certified by Mithril,
1515

1616
- [**Snapshot**](../../../glossary.md#snapshot): list and get.
1717
- [**Mithril stake distribution**](../../../glossary.md#stake-distribution): list and get.
18-
- [**Cardano transaction**](../../../glossary.md#cardano-transaction): list & get snapshots, get proofs
18+
- [**Cardano transaction**](../../../glossary.md#cardano-transaction): list & get snapshots, get proofs.
19+
- [**Cardano stake distribution**](../../../glossary.md#stake-distribution): list, get and get by epoch.
1920
- [**Certificate**](../../../glossary.md#certificate): list, get, and chain validation.
2021

2122
:::
@@ -93,10 +94,11 @@ broadcast_channel.onmessage = (e) => {
9394

9495
await initMithrilClient();
9596

96-
let client = await new MithrilClient(
97-
aggregator_endpoint,
98-
genesis_verification_key,
99-
);
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+
});
100102
let mithril_stake_distributions_list =
101103
await client.list_mithril_stake_distributions();
102104
console.log("stake distributions:", mithril_stake_distributions_list);
@@ -145,6 +147,28 @@ console.log(
145147
);
146148
```
147149

150+
:::tip Adding Custom HTTP Headers
151+
152+
You can customize the HTTP headers sent by the Mithril client. This is particularly useful in scenarios where the Mithril client is used with a proxy, as it allows you to include headers like **Authorization** or custom headers for specific use cases. Below is an example of how to set custom headers:
153+
154+
```js
155+
let http_headers_map = new Map();
156+
http_headers_map.set("Authorization", "Bearer YourBearerToken");
157+
http_headers_map.set("X-Custom-Header", "YourCustomHeaderValue");
158+
159+
let client_options = {
160+
http_headers: http_headers_map,
161+
};
162+
163+
let client = new MithrilClient(
164+
aggregator_endpoint,
165+
genesis_verification_key,
166+
client_options,
167+
);
168+
```
169+
170+
:::
171+
148172
If the aggregator signs **CardanoTransactions**, you can add the code below to the previous example:
149173

150174
:::tip
@@ -155,16 +179,16 @@ You can verify that the aggregator signs **CardanoTransactions** by running the
155179
wget -q -O - YOUR_AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])'
156180
```
157181

158-
For example with the aggregator on `testing-sanchonet` Mithril network:
182+
For example with the aggregator on `pre-release-preview` Mithril network:
159183

160184
```bash
161-
wget -q -O - https://aggregator.testing-sanchonet.api.mithril.network/aggregator | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])'
185+
wget -q -O - https://aggregator.pre-release-preview.api.mithril.network/aggregator | jq '.capabilities.signed_entity_types | contains(["CardanoTransactions"])'
162186
```
163187

164188
:::
165189

166190
```js
167-
const proof = await client.unstable.get_cardano_transaction_proofs([
191+
const proof = await client.get_cardano_transaction_proofs([
168192
"CARDANO_TRANSACTION_HASH_1",
169193
"CARDANO_TRANSACTION_HASH_2",
170194
]);
@@ -180,7 +204,7 @@ console.log(
180204
);
181205

182206
let valid_cardano_transaction_proof =
183-
await client.unstable.verify_cardano_transaction_proof_then_compute_message(
207+
await client.verify_cardano_transaction_proof_then_compute_message(
184208
proof,
185209
proof_certificate,
186210
);
@@ -190,8 +214,68 @@ console.log(
190214
);
191215
```
192216

217+
With the same logic as above, if the aggregator signs **CardanoStakeDistribution**, you can add the code below to the previous example:
218+
193219
:::tip
194220

195-
You can read the complete [Rust developer documentation](https://mithril.network/rust-doc/mithril_client_wasm/index.html).
221+
You can verify that the aggregator signs **CardanoStakeDistribution** by running the command below:
222+
223+
```bash
224+
wget -q -O - YOUR_AGGREGATOR_ENDPOINT | jq '.capabilities.signed_entity_types | contains(["CardanoStakeDistribution"])'
225+
```
226+
227+
For example with the aggregator on `testing-preview` Mithril network:
228+
229+
```bash
230+
wget -q -O - https://aggregator.testing-preview.api.mithril.network/aggregator | jq '.capabilities.signed_entity_types | contains(["CardanoStakeDistribution"])'
231+
```
196232

197233
:::
234+
235+
```js
236+
let cardano_stake_distributions_list =
237+
await client.list_cardano_stake_distributions();
238+
console.log("cardano stake distributions:", cardano_stake_distributions_list);
239+
240+
let last_cardano_stake_distribution =
241+
await client.get_cardano_stake_distribution(
242+
cardano_stake_distributions_list[0].hash,
243+
);
244+
console.log(
245+
"last_cardano_stake_distribution:",
246+
last_cardano_stake_distribution,
247+
);
248+
249+
let certificate = await client.get_mithril_certificate(
250+
last_cardano_stake_distribution.certificate_hash,
251+
);
252+
console.log("certificate:", certificate);
253+
254+
let last_certificate_from_chain = await client.verify_certificate_chain(
255+
certificate.hash,
256+
);
257+
console.log(
258+
"verify certificate chain OK, last_certificate_from_chain:",
259+
last_certificate_from_chain,
260+
);
261+
262+
let cardano_stake_distribution_message =
263+
await client.compute_cardano_stake_distribution_message(
264+
certificate,
265+
last_cardano_stake_distribution,
266+
);
267+
console.log(
268+
"cardano_stake_distribution_message:",
269+
cardano_stake_distribution_message,
270+
);
271+
272+
let valid_cardano_stake_distribution_message =
273+
await client.verify_message_match_certificate(
274+
cardano_stake_distribution_message,
275+
last_certificate_from_chain,
276+
);
277+
console.log(
278+
"valid_cardano_stake_distribution_message:",
279+
valid_cardano_stake_distribution_message,
280+
);
281+
```

docs/website/versioned_docs/version-maintained/manual/developer-docs/nodes/mithril-client-library.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ It is responsible for handling the different types of data certified by Mithril,
1515

1616
- [**Snapshot**](../../../glossary.md#snapshot): list, get, download tarball and record statistics.
1717
- [**Mithril stake distribution**](../../../glossary.md#stake-distribution): list and get.
18+
- [**Cardano transaction**](../../../glossary.md#cardano-transaction): list & get snapshots, get proofs.
19+
- [**Cardano stake distribution**](../../../glossary.md#stake-distribution): list, get and get by epoch.
1820
- [**Certificate**](../../../glossary.md#certificate): list, get, and chain validation.
1921

2022
:::

docs/website/versioned_docs/version-maintained/manual/developer-docs/nodes/mithril-client.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ Commands:
131131
cardano-db Cardano db management (alias: cdb)
132132
mithril-stake-distribution Mithril Stake Distribution management (alias: msd)
133133
cardano-transaction [unstable] Cardano transactions management (alias: ctx)
134+
cardano-stake-distribution [unstable] Cardano stake distribution management (alias: csd)
134135
help Print this message or the help of the given subcommand(s)
135136

136137
Options:
@@ -259,6 +260,12 @@ mithril_client --unstable cardano-transaction snapshot show $CARDANO_TRANSACTION
259260

260261
# 9- Certify that given list of transactions hashes are included in the Cardano transactions set
261262
mithril_client --unstable cardano-transaction certify $TRANSACTION_HASH_1,$TRANSACTION_HASH_2
263+
264+
# 10- List Cardano stake distributions
265+
mithril_client --unstable cardano-stake-distribution list
266+
267+
# 11 - Download and verify the given Cardano stake distribution from its hash or epoch
268+
mithril_client --unstable cardano-stake-distribution download $UNIQUE_IDENTIFIER
262269
```
263270

264271
### Local image
@@ -305,6 +312,14 @@ Here are the subcommands available:
305312
| **snapshot show** | Shows information about a Cardano transactions snapshot |
306313
| **help** | Prints this message or the help for the given subcommand(s) |
307314

315+
### Cardano stake distribution
316+
317+
| Subcommand | Performed action |
318+
| ------------ | ----------------------------------------------------------- |
319+
| **download** | Downloads and verifies Cardano stake distribution |
320+
| **help** | Prints this message or the help for the given subcommand(s) |
321+
| **list** | Lists available Cardano stake distributions |
322+
308323
## Configuration parameters
309324

310325
The configuration parameters can be set in either of the following ways:
@@ -379,3 +394,16 @@ Here is a list of the available parameters:
379394
| --------------------- | ----------------------- | :------------------: | --------------------- | ----------------------------------------------- | ------------- | ------- | :----------------: |
380395
| `transactions_hashes` | `--transactions_hashes` | - | `TRANSACTIONS_HASHES` | Cardano transactions hashes separated by commas | - | - | :heavy_check_mark: |
381396
| `json` | `--json` | - | - | Enable JSON output for progress logs | - | - | - |
397+
398+
`cardano-stake-distribution list` command:
399+
400+
| Parameter | Command line (long) | Command line (short) | Environment variable | Description | Default value | Example | Mandatory |
401+
| --------- | ------------------- | :------------------: | -------------------- | -------------------------------------- | ------------- | ------- | :-------: |
402+
| `json` | `--json` | - | - | Enable JSON output for command results | - | - | - |
403+
404+
`cardano-stake-distribution download` command:
405+
406+
| Parameter | Command line (long) | Command line (short) | Environment variable | Description | Default value | Example | Mandatory |
407+
| ------------------- | --------------------- | :------------------: | -------------------- | -------------------------------------------------------------------------------------------- | ------------- | ------- | :----------------: |
408+
| `unique_identifier` | `--unique-identifier` | - | - | Epoch or hash of the Cardano stake distribution artifact or `latest` for the latest artifact | - | - | :heavy_check_mark: |
409+
| `download_dir` | `--download-dir` | - | - | Directory where the Cardano stake distribution will be downloaded | . | - | - |

0 commit comments

Comments
 (0)