nym-validator-client 1.21.4

Client for interacting with Nyx Cosmos SDK blockchain
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
// Copyright 2021-2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0

pub use crate::nym_api::NymApiClientExt;
use crate::nyxd::{self, NyxdClient};
use crate::signing::direct_wallet::DirectSecp256k1HdWallet;
use crate::signing::signer::{NoSigner, OfflineSigner};
use crate::{
    DirectSigningReqwestRpcValidatorClient, QueryReqwestRpcValidatorClient, ValidatorClientError,
};
use nym_api_requests::ecash::models::{
    AggregatedCoinIndicesSignatureResponse, AggregatedExpirationDateSignatureResponse,
    BatchRedeemTicketsBody, EcashBatchTicketRedemptionResponse, EcashTicketVerificationResponse,
    IssuedTicketbooksChallengeCommitmentRequest, IssuedTicketbooksChallengeCommitmentResponse,
    IssuedTicketbooksDataRequest, IssuedTicketbooksDataResponse, IssuedTicketbooksForCountResponse,
    IssuedTicketbooksForResponse, VerifyEcashTicketBody,
};
use nym_api_requests::ecash::{
    BlindSignRequestBody, BlindedSignatureResponse, PartialCoinIndicesSignatureResponse,
    PartialExpirationDateSignatureResponse, VerificationKeyResponse,
};
use nym_api_requests::models::described::v1::NymNodeDescriptionV1;
use nym_api_requests::models::described::v2::NymNodeDescriptionV2;
use nym_api_requests::models::{
    ApiHealthResponse, GatewayCoreStatusResponse, HistoricalPerformanceResponse,
    MixnodeCoreStatusResponse,
};
use nym_api_requests::nym_nodes::{
    NodesByAddressesResponse, SemiSkimmedNodesWithMetadata, SkimmedNodeV1, SkimmedNodesWithMetadata,
};
use nym_coconut_dkg_common::types::EpochId;
use nym_http_api_client::UserAgent;
use nym_mixnet_contract_common::EpochRewardedSet;
pub use nym_mixnet_contract_common::{
    mixnode::MixNodeDetails, GatewayBond, IdentityKey, IdentityKeyRef, NodeId, NymNodeDetails,
};
use nym_network_defaults::NymNetworkDetails;
use std::net::IpAddr;
use time::Date;
use url::Url;
// re-export the type to not break existing imports
pub use crate::coconut::EcashApiClient;

#[cfg(feature = "http-client")]
use crate::rpc::http_client;
#[cfg(feature = "http-client")]
use crate::{DirectSigningHttpRpcValidatorClient, HttpRpcClient, QueryHttpRpcValidatorClient};

// a simple helper macro to define to repeatedly call a paged query until a full response is constructed
macro_rules! collect_paged_skimmed_v2 {
    ( $self:ident, $f: ident ) => {{
        // unroll first loop iteration in order to obtain the metadata
        let mut page = 0;
        let res = $self
            .nym_api
            .$f(false, Some(page), None, $self.use_bincode)
            .await?;
        let mut nodes = res.nodes.data;
        let metadata = res.metadata;

        if res.nodes.pagination.total == nodes.len() {
            return Ok(SkimmedNodesWithMetadata::new(nodes, metadata));
        }

        page += 1;

        loop {
            let mut res = $self
                .nym_api
                .$f(false, Some(page), None, $self.use_bincode)
                .await?;

            if !metadata.consistency_check(&res.metadata) {
                return Err(ValidatorClientError::InconsistentPagedMetadata);
            }

            nodes.append(&mut res.nodes.data);
            if nodes.len() < res.nodes.pagination.total {
                page += 1
            } else {
                break;
            }
        }

        Ok(SkimmedNodesWithMetadata::new(nodes, metadata))
    }};
}

#[must_use]
#[derive(Debug, Clone)]
pub struct Config {
    api_url: Url,
    nyxd_url: Url,

    // TODO: until refactored, this is a dead field under some features
    nyxd_config: nyxd::Config,
}

impl TryFrom<NymNetworkDetails> for Config {
    type Error = ValidatorClientError;

    fn try_from(value: NymNetworkDetails) -> Result<Self, Self::Error> {
        Config::try_from_nym_network_details(&value)
    }
}

impl Config {
    pub fn new(nyxd_url: Url, api_url: Url, nyxd_config: nyxd::Config) -> Self {
        Config {
            api_url,
            nyxd_url,
            nyxd_config,
        }
    }

    pub fn try_from_nym_network_details(
        details: &NymNetworkDetails,
    ) -> Result<Self, ValidatorClientError> {
        let mut api_url = details
            .endpoints
            .iter()
            .filter_map(|d| d.api_url.as_ref())
            .map(|url| Url::parse(url))
            .collect::<Result<Vec<_>, _>>()?;

        if let Some(nym_api_urls) = details.nym_api_urls.as_ref() {
            api_url.extend(
                nym_api_urls
                    .iter()
                    .map(|url| url.url.parse())
                    .collect::<Result<Vec<_>, _>>()?,
            );
        }

        if api_url.is_empty() {
            return Err(ValidatorClientError::NoAPIUrlAvailable);
        }

        Ok(Config {
            api_url: api_url.pop().unwrap(),
            nyxd_url: details.endpoints[0]
                .nyxd_url
                .parse()
                .map_err(ValidatorClientError::MalformedUrlProvided)?,
            nyxd_config: nyxd::Config::try_from_nym_network_details(details)?,
        })
    }

    // TODO: this method shouldn't really exist as all information should be included immediately
    // via `from_nym_network_details`, but it's here for, you guessed it, legacy compatibility
    pub fn with_urls(mut self, nyxd_url: Url, api_url: Url) -> Self {
        self.nyxd_url = nyxd_url;
        self.api_url = api_url;
        self
    }

    pub fn with_nyxd_url(mut self, nyxd_url: Url) -> Self {
        self.nyxd_url = nyxd_url;
        self
    }

    pub fn with_simulated_gas_multiplier(mut self, gas_multiplier: f32) -> Self {
        self.nyxd_config.simulated_gas_multiplier = gas_multiplier;
        self
    }
}

pub struct Client<C, S = NoSigner> {
    // ideally they would have been read-only, but unfortunately rust doesn't have such features
    // #[deprecated(note = "please use `nym_api_client` instead")]
    pub nym_api: nym_http_api_client::Client,
    // pub nym_api_client: NymApiClient,
    pub nyxd: NyxdClient<C, S>,
}

#[cfg(feature = "http-client")]
impl Client<HttpRpcClient, DirectSecp256k1HdWallet> {
    pub fn new_signing(
        config: Config,
        mnemonic: bip39::Mnemonic,
    ) -> Result<DirectSigningHttpRpcValidatorClient, ValidatorClientError> {
        let rpc_client = http_client(config.nyxd_url.as_str())?;
        let prefix = &config.nyxd_config.chain_details.bech32_account_prefix;
        let wallet = DirectSecp256k1HdWallet::checked_from_mnemonic(prefix, mnemonic)?;

        Ok(Self::new_signing_with_rpc_client(
            config, rpc_client, wallet,
        ))
    }

    pub fn change_nyxd(&mut self, new_endpoint: Url) -> Result<(), ValidatorClientError> {
        self.nyxd.change_endpoint(new_endpoint.as_ref())?;
        Ok(())
    }
}

#[allow(deprecated)]
impl Client<crate::ReqwestRpcClient, DirectSecp256k1HdWallet> {
    pub fn new_reqwest_signing(
        config: Config,
        mnemonic: bip39::Mnemonic,
    ) -> DirectSigningReqwestRpcValidatorClient {
        let rpc_client = crate::ReqwestRpcClient::new(config.nyxd_url.clone());
        let prefix = &config.nyxd_config.chain_details.bech32_account_prefix;
        let wallet = DirectSecp256k1HdWallet::from_mnemonic(prefix, mnemonic);

        Self::new_signing_with_rpc_client(config, rpc_client, wallet)
    }
}

#[cfg(feature = "http-client")]
impl Client<HttpRpcClient> {
    pub fn new_query(config: Config) -> Result<QueryHttpRpcValidatorClient, ValidatorClientError> {
        let rpc_client = http_client(config.nyxd_url.as_str())?;
        Ok(Self::new_with_rpc_client(config, rpc_client))
    }

    pub fn change_nyxd(&mut self, new_endpoint: Url) -> Result<(), ValidatorClientError> {
        self.nyxd = NyxdClient::connect(self.nyxd.current_config().clone(), new_endpoint.as_ref())?;
        Ok(())
    }
}

#[allow(deprecated)]
impl Client<crate::ReqwestRpcClient> {
    pub fn new_reqwest_query(config: Config) -> QueryReqwestRpcValidatorClient {
        let rpc_client = crate::ReqwestRpcClient::new(config.nyxd_url.clone());
        Self::new_with_rpc_client(config, rpc_client)
    }
}

impl<C> Client<C> {
    pub fn new_with_rpc_client(config: Config, rpc_client: C) -> Self {
        let nym_api_client = nym_http_api_client::Client::new(config.api_url.clone(), None);

        Client {
            nym_api: nym_api_client,
            nyxd: NyxdClient::new(config.nyxd_config, rpc_client),
        }
    }
}

impl<C, S> Client<C, S> {
    pub fn new_signing_with_rpc_client(config: Config, rpc_client: C, signer: S) -> Self
    where
        S: OfflineSigner,
    {
        let nym_api_client = nym_http_api_client::Client::new(config.api_url.clone(), None);

        Client {
            nym_api: nym_api_client,
            nyxd: NyxdClient::new_signing(config.nyxd_config, rpc_client, signer),
        }
    }
}

// validator-api wrappers
// we have to allow the use of deprecated method here as they're calling the deprecated trait methods
#[allow(deprecated)]
impl<C, S> Client<C, S> {
    pub fn api_url(&self) -> &Url {
        self.nym_api.current_url().as_ref()
    }

    pub fn change_nym_api(&mut self, new_endpoint: Url) {
        self.nym_api.change_base_urls(vec![new_endpoint.into()])
    }

    pub async fn get_full_node_performance_history(
        &self,
        node_id: NodeId,
    ) -> Result<Vec<HistoricalPerformanceResponse>, ValidatorClientError> {
        // TODO: deal with paging in macro or some helper function or something, because it's the same pattern everywhere
        let mut page = 0;
        let mut history = Vec::new();

        loop {
            let mut res = self
                .nym_api
                .get_node_performance_history(node_id, Some(page), None)
                .await?;

            history.append(&mut res.history.data);
            if history.len() < res.history.pagination.total {
                page += 1
            } else {
                break;
            }
        }

        Ok(history)
    }

    #[deprecated(note = "use get_all_cached_described_nodes_v2 instead")]
    pub async fn get_all_cached_described_nodes(
        &self,
    ) -> Result<Vec<NymNodeDescriptionV1>, ValidatorClientError> {
        Ok(self.nym_api.get_all_described_nodes().await?)
    }

    pub async fn get_all_cached_described_nodes_v2(
        &self,
    ) -> Result<Vec<NymNodeDescriptionV2>, ValidatorClientError> {
        Ok(self.nym_api.get_all_described_nodes_v2().await?)
    }

    pub async fn get_all_cached_bonded_nym_nodes(
        &self,
    ) -> Result<Vec<NymNodeDetails>, ValidatorClientError> {
        self.nym_api.get_all_bonded_nym_nodes().await
    }

    pub async fn blind_sign(
        &self,
        request_body: &BlindSignRequestBody,
    ) -> Result<BlindedSignatureResponse, ValidatorClientError> {
        Ok(self.nym_api.blind_sign(request_body).await?)
    }
}

/// DEPRECATED: Use nym_http_api_client::Client with from_network() or with_bincode() instead
#[deprecated(
    since = "1.2.0",
    note = "Use nym_http_api_client::Client::from_network() or ClientBuilder::with_bincode() instead"
)]
#[derive(Clone)]
pub struct NymApiClient {
    pub use_bincode: bool,
    pub nym_api: nym_http_api_client::Client,
    // TODO: perhaps if we really need it at some (currently I don't see any reasons for it)
    // we could re-implement the communication with the REST API on port 1317
}

// we have to allow the use of deprecated method here as they're calling the deprecated trait methods
#[allow(deprecated)]
impl NymApiClient {
    #[cfg(not(target_arch = "wasm32"))]
    pub fn new_with_timeout(api_url: Url, timeout: std::time::Duration) -> Self {
        let nym_api = nym_http_api_client::Client::new(api_url, Some(timeout));

        NymApiClient {
            use_bincode: true,
            nym_api,
        }
    }

    #[must_use]
    pub fn with_bincode(mut self, use_bincode: bool) -> Self {
        self.use_bincode = use_bincode;
        self
    }

    pub fn new_with_user_agent(api_url: Url, user_agent: impl Into<UserAgent>) -> Self {
        let nym_api = nym_http_api_client::Client::builder(api_url)
            .expect("invalid api url")
            .with_user_agent(user_agent.into())
            .build()
            .expect("failed to build nym api client");

        NymApiClient {
            use_bincode: false,
            nym_api,
        }
    }

    pub fn api_url(&self) -> &Url {
        self.nym_api.current_url().as_ref()
    }

    pub fn change_nym_api(&mut self, new_endpoint: Url) {
        self.nym_api.change_base_urls(vec![new_endpoint.into()]);
    }

    #[deprecated(note = "use get_all_basic_active_mixing_assigned_nodes instead")]
    pub async fn get_basic_mixnodes(&self) -> Result<Vec<SkimmedNodeV1>, ValidatorClientError> {
        Ok(self.nym_api.get_basic_mixnodes().await?.nodes)
    }

    #[deprecated(note = "use get_all_basic_entry_assigned_nodes instead")]
    pub async fn get_basic_gateways(&self) -> Result<Vec<SkimmedNodeV1>, ValidatorClientError> {
        Ok(self.nym_api.get_basic_gateways().await?.nodes)
    }

    pub async fn get_current_rewarded_set(&self) -> Result<EpochRewardedSet, ValidatorClientError> {
        Ok(self.nym_api.get_rewarded_set().await?.into())
    }

    /// retrieve basic information for nodes are capable of operating as an entry gateway
    /// this includes legacy gateways and nym-nodes
    #[deprecated(note = "use get_all_basic_entry_assigned_nodes_with_metadata instead")]
    pub async fn get_all_basic_entry_assigned_nodes(
        &self,
    ) -> Result<Vec<SkimmedNodeV1>, ValidatorClientError> {
        self.get_all_basic_entry_assigned_nodes_with_metadata()
            .await
            .map(|res| res.nodes)
    }

    pub async fn get_all_basic_entry_assigned_nodes_with_metadata(
        &self,
    ) -> Result<SkimmedNodesWithMetadata, ValidatorClientError> {
        collect_paged_skimmed_v2!(self, get_basic_entry_assigned_nodes_v2)
    }

    /// retrieve basic information for nodes that got assigned 'mixing' node in this epoch
    /// this includes legacy mixnodes and nym-nodes
    #[deprecated(note = "use get_all_basic_active_mixing_assigned_nodes_with_metadata instead")]
    pub async fn get_all_basic_active_mixing_assigned_nodes(
        &self,
    ) -> Result<Vec<SkimmedNodeV1>, ValidatorClientError> {
        self.get_all_basic_active_mixing_assigned_nodes_with_metadata()
            .await
            .map(|res| res.nodes)
    }

    pub async fn get_all_basic_active_mixing_assigned_nodes_with_metadata(
        &self,
    ) -> Result<SkimmedNodesWithMetadata, ValidatorClientError> {
        collect_paged_skimmed_v2!(self, get_basic_active_mixing_assigned_nodes_v2)
    }

    /// retrieve basic information for nodes are capable of operating as a mixnode
    /// this includes legacy mixnodes and nym-nodes
    #[deprecated(note = "use get_all_basic_mixing_capable_nodes_with_metadata instead")]
    pub async fn get_all_basic_mixing_capable_nodes(
        &self,
    ) -> Result<Vec<SkimmedNodeV1>, ValidatorClientError> {
        self.get_all_basic_mixing_capable_nodes_with_metadata()
            .await
            .map(|res| res.nodes)
    }

    pub async fn get_all_basic_mixing_capable_nodes_with_metadata(
        &self,
    ) -> Result<SkimmedNodesWithMetadata, ValidatorClientError> {
        collect_paged_skimmed_v2!(self, get_basic_mixing_capable_nodes_v2)
    }

    /// retrieve basic information for all bonded nodes on the network
    #[deprecated(note = "use get_all_basic_nodes_with_metadata instead")]
    pub async fn get_all_basic_nodes(&self) -> Result<Vec<SkimmedNodeV1>, ValidatorClientError> {
        self.get_all_basic_nodes_with_metadata()
            .await
            .map(|res| res.nodes)
    }

    pub async fn get_all_basic_nodes_with_metadata(
        &self,
    ) -> Result<SkimmedNodesWithMetadata, ValidatorClientError> {
        collect_paged_skimmed_v2!(self, get_basic_nodes_v2)
    }

    /// retrieve expanded information for all bonded nodes on the network
    pub async fn get_all_expanded_nodes(
        &self,
    ) -> Result<SemiSkimmedNodesWithMetadata, ValidatorClientError> {
        // Unroll the first iteration to get the metadata
        let mut page = 0;

        let res = self
            .nym_api
            .get_expanded_nodes(false, Some(page), None)
            .await?;
        let mut nodes = res.nodes.data;
        let metadata = res.metadata;

        if res.nodes.pagination.total == nodes.len() {
            return Ok(SemiSkimmedNodesWithMetadata::new(nodes, metadata));
        }

        page += 1;

        loop {
            let mut res = self
                .nym_api
                .get_expanded_nodes(false, Some(page), None)
                .await?;

            nodes.append(&mut res.nodes.data);
            if nodes.len() < res.nodes.pagination.total {
                page += 1
            } else {
                break;
            }
        }

        Ok(SemiSkimmedNodesWithMetadata::new(nodes, metadata))
    }

    pub async fn health(&self) -> Result<ApiHealthResponse, ValidatorClientError> {
        Ok(self.nym_api.health().await?)
    }

    #[deprecated(note = "use .get_all_described_nodes_v2 instead")]
    pub async fn get_all_described_nodes(
        &self,
    ) -> Result<Vec<NymNodeDescriptionV1>, ValidatorClientError> {
        // TODO: deal with paging in macro or some helper function or something, because it's the same pattern everywhere
        let mut page = 0;
        let mut descriptions = Vec::new();

        loop {
            let mut res = self.nym_api.get_nodes_described(Some(page), None).await?;

            descriptions.append(&mut res.data);
            if descriptions.len() < res.pagination.total {
                page += 1
            } else {
                break;
            }
        }

        Ok(descriptions)
    }

    pub async fn get_all_described_nodes_v2(
        &self,
    ) -> Result<Vec<NymNodeDescriptionV2>, ValidatorClientError> {
        // TODO: deal with paging in macro or some helper function or something, because it's the same pattern everywhere
        let mut page = 0;
        let mut descriptions = Vec::new();

        loop {
            let mut res = self
                .nym_api
                .get_nodes_described_v2(Some(page), None)
                .await?;

            descriptions.append(&mut res.data);
            if descriptions.len() < res.pagination.total {
                page += 1
            } else {
                break;
            }
        }

        Ok(descriptions)
    }

    pub async fn get_all_bonded_nym_nodes(
        &self,
    ) -> Result<Vec<NymNodeDetails>, ValidatorClientError> {
        // TODO: deal with paging in macro or some helper function or something, because it's the same pattern everywhere
        let mut page = 0;
        let mut bonds = Vec::new();

        loop {
            let mut res = self.nym_api.get_nym_nodes(Some(page), None).await?;

            bonds.append(&mut res.data);
            if bonds.len() < res.pagination.total {
                page += 1
            } else {
                break;
            }
        }

        Ok(bonds)
    }

    #[deprecated]
    pub async fn get_gateway_core_status_count(
        &self,
        identity: IdentityKeyRef<'_>,
        since: Option<i64>,
    ) -> Result<GatewayCoreStatusResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .get_gateway_core_status_count(identity, since)
            .await?)
    }

    #[deprecated]
    pub async fn get_mixnode_core_status_count(
        &self,
        mix_id: NodeId,
        since: Option<i64>,
    ) -> Result<MixnodeCoreStatusResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .get_mixnode_core_status_count(mix_id, since)
            .await?)
    }

    pub async fn blind_sign(
        &self,
        request_body: &BlindSignRequestBody,
    ) -> Result<BlindedSignatureResponse, ValidatorClientError> {
        Ok(self.nym_api.blind_sign(request_body).await?)
    }

    pub async fn verify_ecash_ticket(
        &self,
        request_body: &VerifyEcashTicketBody,
    ) -> Result<EcashTicketVerificationResponse, ValidatorClientError> {
        Ok(self.nym_api.verify_ecash_ticket(request_body).await?)
    }

    pub async fn batch_redeem_ecash_tickets(
        &self,
        request_body: &BatchRedeemTicketsBody,
    ) -> Result<EcashBatchTicketRedemptionResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .batch_redeem_ecash_tickets(request_body)
            .await?)
    }

    pub async fn partial_expiration_date_signatures(
        &self,
        expiration_date: Option<Date>,
        epoch_id: Option<EpochId>,
    ) -> Result<PartialExpirationDateSignatureResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .partial_expiration_date_signatures(expiration_date, epoch_id)
            .await?)
    }

    pub async fn partial_coin_indices_signatures(
        &self,
        epoch_id: Option<EpochId>,
    ) -> Result<PartialCoinIndicesSignatureResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .partial_coin_indices_signatures(epoch_id)
            .await?)
    }

    pub async fn global_expiration_date_signatures(
        &self,
        expiration_date: Option<Date>,
        epoch_id: Option<EpochId>,
    ) -> Result<AggregatedExpirationDateSignatureResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .global_expiration_date_signatures(expiration_date, epoch_id)
            .await?)
    }

    pub async fn global_coin_indices_signatures(
        &self,
        epoch_id: Option<EpochId>,
    ) -> Result<AggregatedCoinIndicesSignatureResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .global_coin_indices_signatures(epoch_id)
            .await?)
    }

    pub async fn master_verification_key(
        &self,
        epoch_id: Option<EpochId>,
    ) -> Result<VerificationKeyResponse, ValidatorClientError> {
        Ok(self.nym_api.master_verification_key(epoch_id).await?)
    }

    pub async fn issued_ticketbooks_for(
        &self,
        expiration_date: Date,
    ) -> Result<IssuedTicketbooksForResponse, ValidatorClientError> {
        Ok(self.nym_api.issued_ticketbooks_for(expiration_date).await?)
    }

    pub async fn issued_ticketbooks_for_count(
        &self,
        expiration_date: Date,
    ) -> Result<IssuedTicketbooksForCountResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .issued_ticketbooks_for_count(expiration_date)
            .await?)
    }

    pub async fn issued_ticketbooks_challenge_commitment(
        &self,
        request: &IssuedTicketbooksChallengeCommitmentRequest,
    ) -> Result<IssuedTicketbooksChallengeCommitmentResponse, ValidatorClientError> {
        Ok(self
            .nym_api
            .issued_ticketbooks_challenge_commitment(request)
            .await?)
    }

    pub async fn issued_ticketbooks_data(
        &self,
        request: &IssuedTicketbooksDataRequest,
    ) -> Result<IssuedTicketbooksDataResponse, ValidatorClientError> {
        Ok(self.nym_api.issued_ticketbooks_data(request).await?)
    }

    pub async fn nodes_by_addresses(
        &self,
        addresses: Vec<IpAddr>,
    ) -> Result<NodesByAddressesResponse, ValidatorClientError> {
        Ok(self.nym_api.nodes_by_addresses(addresses).await?)
    }
}