1use cml_chain::{assets::PositiveCoin, Coin};
2use cml_chain_wasm::{
3 address::Address,
4 assets::{Mint, Value},
5 block::{OperationalCert, ProtocolVersion},
6 certs::{
7 AuthCommitteeHotCert, PoolRegistration, PoolRetirement, RegCert, RegDrepCert,
8 ResignCommitteeColdCert, StakeDelegation, StakeDeregistration, StakeRegDelegCert,
9 StakeRegistration, StakeVoteDelegCert, StakeVoteRegDelegCert, UnregCert, UnregDrepCert,
10 UpdateDrepCert, VoteDelegCert, VoteRegDelegCert,
11 },
12 crypto::{GenesisHash, Nonce, VRFCert, Vkey},
13 governance::VotingProcedures,
14 plutus::{CostModels, ExUnitPrices, ExUnits},
15 DRepVotingThresholds, MapTransactionIndexToAuxiliaryData, NetworkId, PoolVotingThresholds,
16 ProposalProcedureList, Rational, RequiredSigners, TransactionInputList,
17 TransactionWitnessSetList, UnitInterval, Withdrawals,
18};
19use cml_core::{Epoch, TransactionIndex};
20use cml_core_wasm::{impl_wasm_conversions, impl_wasm_json_api, impl_wasm_list, impl_wasm_map};
21use cml_crypto_wasm::{
22 AuxiliaryDataHash, BlockBodyHash, BlockHeaderHash, ScriptDataHash, TransactionHash, VRFVkey,
23};
24use wasm_bindgen::{prelude::wasm_bindgen, JsError};
25
26use crate::{
27 allegra::MoveInstantaneousRewardsCert, shelley::GenesisKeyDelegation,
28 shelley::ProtocolVersionStruct, GenesisHashList, MultiEraBlock, MultiEraTransactionBody,
29};
30
31#[wasm_bindgen]
32impl MultiEraBlock {
33 pub fn from_explicit_network_cbor_bytes(bytes: &[u8]) -> Result<MultiEraBlock, JsError> {
43 cml_multi_era::MultiEraBlock::from_explicit_network_cbor_bytes(bytes)
44 .map(Into::into)
45 .map_err(Into::into)
46 }
47
48 pub fn transaction_bodies(&self) -> MultiEraTransactionBodyList {
49 self.0.transaction_bodies().into()
50 }
51
52 pub fn transaction_witness_sets(&self) -> TransactionWitnessSetList {
53 self.0.transaction_witness_sets().into()
54 }
55
56 pub fn auxiliary_data_set(&self) -> MapTransactionIndexToAuxiliaryData {
57 self.0.auxiliary_data_set().into()
58 }
59
60 pub fn invalid_transactions(&self) -> Vec<TransactionIndex> {
61 self.0.invalid_transactions()
62 }
63}
64
65impl_wasm_list!(
66 cml_multi_era::utils::MultiEraCertificate,
67 MultiEraCertificate,
68 MultiEraCertificateList
69);
70
71impl_wasm_list!(
72 cml_multi_era::MultiEraTransactionBody,
73 MultiEraTransactionBody,
74 MultiEraTransactionBodyList
75);
76
77impl_wasm_list!(
78 cml_multi_era::utils::MultiEraTransactionInput,
79 MultiEraTransactionInput,
80 MultiEraTransactionInputList
81);
82
83impl_wasm_list!(
84 cml_multi_era::utils::MultiEraTransactionOutput,
85 MultiEraTransactionOutput,
86 MultiEraTransactionOutputList
87);
88
89#[derive(Clone, Debug)]
90#[wasm_bindgen]
91pub struct MultiEraBlockHeader(cml_multi_era::utils::MultiEraBlockHeader);
92
93impl_wasm_json_api!(MultiEraBlockHeader);
94
95impl_wasm_conversions!(
96 cml_multi_era::utils::MultiEraBlockHeader,
97 MultiEraBlockHeader
98);
99
100#[wasm_bindgen]
101impl MultiEraBlockHeader {
102 pub fn block_number(&self) -> u64 {
103 self.0.block_number()
104 }
105
106 pub fn slot(&self) -> u64 {
107 self.0.slot()
108 }
109
110 pub fn prev_hash(&self) -> Option<BlockHeaderHash> {
111 self.0.prev_hash().map(Into::into)
112 }
113
114 pub fn issuer_vkey(&self) -> Option<Vkey> {
115 self.0.issuer_vkey().map(|vkey| vkey.clone().into())
116 }
117
118 pub fn vrf_vkey(&self) -> Option<VRFVkey> {
119 self.0.vrf_vkey().map(|vkey| (*vkey).into())
120 }
121
122 pub fn nonce_vrf(&self) -> Option<VRFCert> {
123 self.0.nonce_vrf().map(|vrf| vrf.clone().into())
124 }
125
126 pub fn leader_vrf(&self) -> Option<VRFCert> {
127 self.0.leader_vrf().map(|vrf| vrf.clone().into())
128 }
129
130 pub fn vrf_result(&self) -> Option<VRFCert> {
131 self.0.vrf_result().map(|res| res.clone().into())
132 }
133
134 pub fn block_body_size(&self) -> Option<u64> {
135 self.0.block_body_size()
136 }
137
138 pub fn block_body_hash(&self) -> Option<BlockBodyHash> {
139 self.0.block_body_hash().map(Into::into)
140 }
141
142 pub fn operational_cert(&self) -> Option<OperationalCert> {
143 self.0.operational_cert().map(|cert| cert.clone().into())
144 }
145
146 pub fn protocol_version(&self) -> Option<ProtocolVersion> {
147 self.0.protocol_version().map(|ver| ver.clone().into())
148 }
149}
150
151#[derive(Clone, Debug)]
152#[wasm_bindgen]
153pub struct MultiEraCertificate(cml_multi_era::utils::MultiEraCertificate);
154
155impl_wasm_json_api!(MultiEraCertificate);
156
157impl_wasm_conversions!(
158 cml_multi_era::utils::MultiEraCertificate,
159 MultiEraCertificate
160);
161
162#[wasm_bindgen]
163impl MultiEraCertificate {
164 pub fn kind(&self) -> MultiEraCertificateKind {
165 match &self.0 {
166 cml_multi_era::utils::MultiEraCertificate::StakeRegistration(_) => {
167 MultiEraCertificateKind::StakeRegistration
168 }
169 cml_multi_era::utils::MultiEraCertificate::StakeDeregistration(_) => {
170 MultiEraCertificateKind::StakeDeregistration
171 }
172 cml_multi_era::utils::MultiEraCertificate::StakeDelegation(_) => {
173 MultiEraCertificateKind::StakeDelegation
174 }
175 cml_multi_era::utils::MultiEraCertificate::PoolRegistration(_) => {
176 MultiEraCertificateKind::PoolRegistration
177 }
178 cml_multi_era::utils::MultiEraCertificate::PoolRetirement(_) => {
179 MultiEraCertificateKind::PoolRetirement
180 }
181 cml_multi_era::utils::MultiEraCertificate::GenesisKeyDelegation(_) => {
182 MultiEraCertificateKind::GenesisKeyDelegation
183 }
184 cml_multi_era::utils::MultiEraCertificate::MoveInstantaneousRewardsCert(_) => {
185 MultiEraCertificateKind::MoveInstantaneousRewardsCert
186 }
187 cml_multi_era::utils::MultiEraCertificate::RegCert(_) => {
188 MultiEraCertificateKind::RegCert
189 }
190 cml_multi_era::utils::MultiEraCertificate::UnregCert(_) => {
191 MultiEraCertificateKind::UnregCert
192 }
193 cml_multi_era::utils::MultiEraCertificate::VoteDelegCert(_) => {
194 MultiEraCertificateKind::VoteDelegCert
195 }
196 cml_multi_era::utils::MultiEraCertificate::StakeVoteDelegCert(_) => {
197 MultiEraCertificateKind::StakeVoteDelegCert
198 }
199 cml_multi_era::utils::MultiEraCertificate::StakeRegDelegCert(_) => {
200 MultiEraCertificateKind::StakeRegDelegCert
201 }
202 cml_multi_era::utils::MultiEraCertificate::VoteRegDelegCert(_) => {
203 MultiEraCertificateKind::VoteRegDelegCert
204 }
205 cml_multi_era::utils::MultiEraCertificate::StakeVoteRegDelegCert(_) => {
206 MultiEraCertificateKind::StakeVoteRegDelegCert
207 }
208 cml_multi_era::utils::MultiEraCertificate::AuthCommitteeHotCert(_) => {
209 MultiEraCertificateKind::AuthCommitteeHotCert
210 }
211 cml_multi_era::utils::MultiEraCertificate::ResignCommitteeColdCert(_) => {
212 MultiEraCertificateKind::ResignCommitteeColdCert
213 }
214 cml_multi_era::utils::MultiEraCertificate::RegDrepCert(_) => {
215 MultiEraCertificateKind::RegDrepCert
216 }
217 cml_multi_era::utils::MultiEraCertificate::UnregDrepCert(_) => {
218 MultiEraCertificateKind::UnregDrepCert
219 }
220 cml_multi_era::utils::MultiEraCertificate::UpdateDrepCert(_) => {
221 MultiEraCertificateKind::UpdateDrepCert
222 }
223 }
224 }
225
226 pub fn as_stake_registration(&self) -> Option<StakeRegistration> {
227 match &self.0 {
228 cml_multi_era::utils::MultiEraCertificate::StakeRegistration(stake_registration) => {
229 Some(stake_registration.clone().into())
230 }
231 _ => None,
232 }
233 }
234
235 pub fn as_stake_deregistration(&self) -> Option<StakeDeregistration> {
236 match &self.0 {
237 cml_multi_era::utils::MultiEraCertificate::StakeDeregistration(
238 stake_deregistration,
239 ) => Some(stake_deregistration.clone().into()),
240 _ => None,
241 }
242 }
243
244 pub fn as_stake_delegation(&self) -> Option<StakeDelegation> {
245 match &self.0 {
246 cml_multi_era::utils::MultiEraCertificate::StakeDelegation(stake_delegation) => {
247 Some(stake_delegation.clone().into())
248 }
249 _ => None,
250 }
251 }
252
253 pub fn as_pool_registration(&self) -> Option<PoolRegistration> {
254 match &self.0 {
255 cml_multi_era::utils::MultiEraCertificate::PoolRegistration(pool_registration) => {
256 Some(pool_registration.clone().into())
257 }
258 _ => None,
259 }
260 }
261
262 pub fn as_pool_retirement(&self) -> Option<PoolRetirement> {
263 match &self.0 {
264 cml_multi_era::utils::MultiEraCertificate::PoolRetirement(pool_retirement) => {
265 Some(pool_retirement.clone().into())
266 }
267 _ => None,
268 }
269 }
270
271 pub fn as_genesis_key_delegation(&self) -> Option<GenesisKeyDelegation> {
272 match &self.0 {
273 cml_multi_era::utils::MultiEraCertificate::GenesisKeyDelegation(
274 genesis_key_delegation,
275 ) => Some(genesis_key_delegation.clone().into()),
276 _ => None,
277 }
278 }
279
280 pub fn as_move_instantaneous_rewards_cert(&self) -> Option<MoveInstantaneousRewardsCert> {
281 match &self.0 {
282 cml_multi_era::utils::MultiEraCertificate::MoveInstantaneousRewardsCert(
283 move_instantaneous_rewards_cert,
284 ) => Some(move_instantaneous_rewards_cert.clone().into()),
285 _ => None,
286 }
287 }
288
289 pub fn as_reg_cert(&self) -> Option<RegCert> {
290 match &self.0 {
291 cml_multi_era::utils::MultiEraCertificate::RegCert(reg_cert) => {
292 Some(reg_cert.clone().into())
293 }
294 _ => None,
295 }
296 }
297
298 pub fn as_unreg_cert(&self) -> Option<UnregCert> {
299 match &self.0 {
300 cml_multi_era::utils::MultiEraCertificate::UnregCert(unreg_cert) => {
301 Some(unreg_cert.clone().into())
302 }
303 _ => None,
304 }
305 }
306
307 pub fn as_vote_deleg_cert(&self) -> Option<VoteDelegCert> {
308 match &self.0 {
309 cml_multi_era::utils::MultiEraCertificate::VoteDelegCert(vote_deleg_cert) => {
310 Some(vote_deleg_cert.clone().into())
311 }
312 _ => None,
313 }
314 }
315
316 pub fn as_stake_vote_deleg_cert(&self) -> Option<StakeVoteDelegCert> {
317 match &self.0 {
318 cml_multi_era::utils::MultiEraCertificate::StakeVoteDelegCert(
319 stake_vote_deleg_cert,
320 ) => Some(stake_vote_deleg_cert.clone().into()),
321 _ => None,
322 }
323 }
324
325 pub fn as_stake_reg_deleg_cert(&self) -> Option<StakeRegDelegCert> {
326 match &self.0 {
327 cml_multi_era::utils::MultiEraCertificate::StakeRegDelegCert(stake_reg_deleg_cert) => {
328 Some(stake_reg_deleg_cert.clone().into())
329 }
330 _ => None,
331 }
332 }
333
334 pub fn as_vote_reg_deleg_cert(&self) -> Option<VoteRegDelegCert> {
335 match &self.0 {
336 cml_multi_era::utils::MultiEraCertificate::VoteRegDelegCert(vote_reg_deleg_cert) => {
337 Some(vote_reg_deleg_cert.clone().into())
338 }
339 _ => None,
340 }
341 }
342
343 pub fn as_stake_vote_reg_deleg_cert(&self) -> Option<StakeVoteRegDelegCert> {
344 match &self.0 {
345 cml_multi_era::utils::MultiEraCertificate::StakeVoteRegDelegCert(
346 stake_vote_reg_deleg_cert,
347 ) => Some(stake_vote_reg_deleg_cert.clone().into()),
348 _ => None,
349 }
350 }
351
352 pub fn as_auth_committee_hot_cert(&self) -> Option<AuthCommitteeHotCert> {
353 match &self.0 {
354 cml_multi_era::utils::MultiEraCertificate::AuthCommitteeHotCert(
355 auth_committee_hot_cert,
356 ) => Some(auth_committee_hot_cert.clone().into()),
357 _ => None,
358 }
359 }
360
361 pub fn as_resign_committee_cold_cert(&self) -> Option<ResignCommitteeColdCert> {
362 match &self.0 {
363 cml_multi_era::utils::MultiEraCertificate::ResignCommitteeColdCert(
364 resign_committee_cold_cert,
365 ) => Some(resign_committee_cold_cert.clone().into()),
366 _ => None,
367 }
368 }
369
370 pub fn as_reg_drep_cert(&self) -> Option<RegDrepCert> {
371 match &self.0 {
372 cml_multi_era::utils::MultiEraCertificate::RegDrepCert(reg_drep_cert) => {
373 Some(reg_drep_cert.clone().into())
374 }
375 _ => None,
376 }
377 }
378
379 pub fn as_unreg_drep_cert(&self) -> Option<UnregDrepCert> {
380 match &self.0 {
381 cml_multi_era::utils::MultiEraCertificate::UnregDrepCert(unreg_drep_cert) => {
382 Some(unreg_drep_cert.clone().into())
383 }
384 _ => None,
385 }
386 }
387
388 pub fn as_update_drep_cert(&self) -> Option<UpdateDrepCert> {
389 match &self.0 {
390 cml_multi_era::utils::MultiEraCertificate::UpdateDrepCert(update_drep_cert) => {
391 Some(update_drep_cert.clone().into())
392 }
393 _ => None,
394 }
395 }
396}
397
398#[wasm_bindgen]
399pub enum MultiEraCertificateKind {
400 StakeRegistration,
401 StakeDeregistration,
402 StakeDelegation,
403 PoolRegistration,
404 PoolRetirement,
405 GenesisKeyDelegation,
406 MoveInstantaneousRewardsCert,
407 RegCert,
408 UnregCert,
409 VoteDelegCert,
410 StakeVoteDelegCert,
411 StakeRegDelegCert,
412 VoteRegDelegCert,
413 StakeVoteRegDelegCert,
414 AuthCommitteeHotCert,
415 ResignCommitteeColdCert,
416 RegDrepCert,
417 UnregDrepCert,
418 UpdateDrepCert,
419}
420
421#[derive(Clone, Debug)]
422#[wasm_bindgen]
423pub struct MultiEraProtocolParamUpdate(cml_multi_era::utils::MultiEraProtocolParamUpdate);
424
425impl_wasm_json_api!(MultiEraProtocolParamUpdate);
426
427impl_wasm_conversions!(
428 cml_multi_era::utils::MultiEraProtocolParamUpdate,
429 MultiEraProtocolParamUpdate
430);
431
432#[wasm_bindgen]
433impl MultiEraProtocolParamUpdate {
434 pub fn minfee_a(&self) -> Option<u64> {
435 self.0.minfee_a()
436 }
437
438 pub fn minfee_b(&self) -> Option<u64> {
439 self.0.minfee_b()
440 }
441
442 pub fn max_block_body_size(&self) -> Option<u64> {
443 self.0.max_block_body_size()
444 }
445
446 pub fn max_transaction_size(&self) -> Option<u64> {
447 self.0.max_transaction_size()
448 }
449
450 pub fn max_block_header_size(&self) -> Option<u64> {
451 self.0.max_block_header_size()
452 }
453
454 pub fn key_deposit(&self) -> Option<Coin> {
455 self.0.key_deposit()
456 }
457
458 pub fn pool_deposit(&self) -> Option<Coin> {
459 self.0.pool_deposit()
460 }
461
462 pub fn maximum_epoch(&self) -> Option<Epoch> {
463 self.0.maximum_epoch()
464 }
465
466 pub fn n_opt(&self) -> Option<u64> {
467 self.0.n_opt()
468 }
469
470 pub fn pool_pledge_influence(&self) -> Option<Rational> {
471 self.0.pool_pledge_influence().map(|ppi| ppi.clone().into())
472 }
473
474 pub fn expansion_rate(&self) -> Option<UnitInterval> {
475 self.0.expansion_rate().map(|er| er.clone().into())
476 }
477
478 pub fn treasury_growth_rate(&self) -> Option<UnitInterval> {
479 self.0.treasury_growth_rate().map(|tgr| tgr.clone().into())
480 }
481
482 pub fn decentralization_constant(&self) -> Option<UnitInterval> {
483 self.0
484 .decentralization_constant()
485 .map(|dc| dc.clone().into())
486 }
487
488 pub fn extra_entropy(&self) -> Option<Nonce> {
489 self.0.extra_entropy().map(|ee| ee.clone().into())
490 }
491
492 pub fn protocol_version(&self) -> Option<ProtocolVersionStruct> {
493 self.0.protocol_version().map(|pv| pv.clone().into())
494 }
495
496 pub fn min_utxo_value(&self) -> Option<Coin> {
497 self.0.min_utxo_value()
498 }
499
500 pub fn min_pool_cost(&self) -> Option<Coin> {
501 self.0.min_pool_cost()
502 }
503
504 pub fn ada_per_utxo_byte(&self) -> Option<Coin> {
505 self.0.ada_per_utxo_byte()
506 }
507
508 pub fn cost_models_for_script_languages(&self) -> Option<CostModels> {
509 self.0.cost_models_for_script_languages().map(Into::into)
510 }
511
512 pub fn execution_costs(&self) -> Option<ExUnitPrices> {
513 self.0.execution_costs().map(|ec| ec.clone().into())
514 }
515
516 pub fn max_tx_ex_units(&self) -> Option<ExUnits> {
517 self.0.max_tx_ex_units().map(|mteu| mteu.clone().into())
518 }
519
520 pub fn max_block_ex_units(&self) -> Option<ExUnits> {
521 self.0.max_block_ex_units().map(|mbeu| mbeu.clone().into())
522 }
523
524 pub fn max_value_size(&self) -> Option<u64> {
525 self.0.max_value_size()
526 }
527
528 pub fn collateral_percentage(&self) -> Option<u64> {
529 self.0.collateral_percentage()
530 }
531
532 pub fn max_collateral_inputs(&self) -> Option<u64> {
533 self.0.max_collateral_inputs()
534 }
535
536 pub fn pool_voting_thresholds(&self) -> Option<PoolVotingThresholds> {
537 self.0
538 .pool_voting_thresholds()
539 .map(|pvt| pvt.clone().into())
540 }
541
542 pub fn d_rep_voting_thresholds(&self) -> Option<DRepVotingThresholds> {
543 self.0
544 .d_rep_voting_thresholds()
545 .map(|drvt| drvt.clone().into())
546 }
547
548 pub fn min_committee_size(&self) -> Option<u64> {
549 self.0.min_committee_size()
550 }
551
552 pub fn committee_term_limit(&self) -> Option<u64> {
553 self.0.committee_term_limit()
554 }
555
556 pub fn governance_action_validity_period(&self) -> Option<Epoch> {
557 self.0.governance_action_validity_period()
558 }
559
560 pub fn governance_action_deposit(&self) -> Option<Coin> {
561 self.0.governance_action_deposit()
562 }
563
564 pub fn d_rep_deposit(&self) -> Option<Coin> {
565 self.0.d_rep_deposit()
566 }
567
568 pub fn d_rep_inactivity_period(&self) -> Option<Epoch> {
569 self.0.d_rep_inactivity_period()
570 }
571}
572
573#[wasm_bindgen]
574impl MultiEraTransactionBody {
575 pub fn inputs(&self) -> MultiEraTransactionInputList {
576 self.0.inputs().into()
577 }
578
579 pub fn outputs(&self) -> MultiEraTransactionOutputList {
580 self.0.outputs().into()
581 }
582
583 pub fn fee(&self) -> Option<Coin> {
584 self.0.fee()
585 }
586
587 pub fn ttl(&self) -> Option<u64> {
588 self.0.ttl()
589 }
590
591 pub fn certs(&self) -> Option<MultiEraCertificateList> {
592 self.0.certs().map(Into::into)
593 }
594
595 pub fn withdrawals(&self) -> Option<Withdrawals> {
596 self.0.withdrawals().map(|wd| wd.clone().into())
597 }
598
599 pub fn update(&self) -> Option<MultiEraUpdate> {
600 self.0.update().map(Into::into)
601 }
602
603 pub fn auxiliary_data_hash(&self) -> Option<AuxiliaryDataHash> {
604 self.0.auxiliary_data_hash().map(|aux| (*aux).into())
605 }
606
607 pub fn validity_interval_start(&self) -> Option<u64> {
608 self.0.validity_interval_start()
609 }
610
611 pub fn mint(&self) -> Option<Mint> {
612 self.0.mint().map(|m| m.into_owned().into())
613 }
614
615 pub fn script_data_hash(&self) -> Option<ScriptDataHash> {
616 self.0.script_data_hash().map(Into::into)
617 }
618
619 pub fn collateral_inputs(&self) -> Option<TransactionInputList> {
620 self.0
621 .collateral_inputs()
622 .map(|inputs| inputs.to_vec().into())
623 }
624
625 pub fn required_signers(&self) -> Option<RequiredSigners> {
626 self.0
627 .required_signers()
628 .map(|signers| signers.to_vec().into())
629 }
630
631 pub fn network_id(&self) -> Option<NetworkId> {
632 self.0.network_id().map(Into::into)
633 }
634
635 pub fn collateral_return(&self) -> Option<MultiEraTransactionOutput> {
636 self.0.collateral_return().map(Into::into)
637 }
638
639 pub fn total_collateral(&self) -> Option<Coin> {
640 self.0.total_collateral()
641 }
642
643 pub fn reference_inputs(&self) -> Option<TransactionInputList> {
644 self.0
645 .reference_inputs()
646 .map(|inputs| inputs.to_vec().into())
647 }
648
649 pub fn voting_procedures(&self) -> Option<VotingProcedures> {
650 self.0.voting_procedures().map(|vps| vps.clone().into())
651 }
652
653 pub fn proposal_procedures(&self) -> Option<ProposalProcedureList> {
654 self.0.proposal_procedures().map(|pps| pps.to_vec().into())
655 }
656
657 pub fn current_treasury_value(&self) -> Option<Coin> {
658 self.0.current_treasury_value()
659 }
660
661 pub fn donation(&self) -> Option<PositiveCoin> {
662 self.0.donation()
663 }
664}
665
666#[wasm_bindgen]
667#[derive(Clone, Debug)]
668pub struct MultiEraTransactionInput(cml_multi_era::utils::MultiEraTransactionInput);
669
670impl_wasm_conversions!(
671 cml_multi_era::utils::MultiEraTransactionInput,
672 MultiEraTransactionInput
673);
674
675#[wasm_bindgen]
676impl MultiEraTransactionInput {
677 pub fn hash(&self) -> Option<TransactionHash> {
680 self.0.hash().map(|h| (*h).into())
681 }
682
683 pub fn index(&self) -> Option<u64> {
686 self.0.index()
687 }
688}
689
690#[wasm_bindgen]
691#[derive(Clone, Debug)]
692pub struct MultiEraTransactionOutput(cml_multi_era::utils::MultiEraTransactionOutput);
693
694impl_wasm_conversions!(
695 cml_multi_era::utils::MultiEraTransactionOutput,
696 MultiEraTransactionOutput
697);
698
699#[wasm_bindgen]
700impl MultiEraTransactionOutput {
701 pub fn address(&self) -> Address {
702 self.0.address().into()
703 }
704
705 pub fn amount(&self) -> Value {
706 self.0.amount().into()
707 }
708}
709
710#[wasm_bindgen]
711#[derive(Clone, Debug)]
712pub struct MultiEraUpdate(cml_multi_era::utils::MultiEraUpdate);
713
714impl_wasm_conversions!(cml_multi_era::utils::MultiEraUpdate, MultiEraUpdate);
715
716#[wasm_bindgen]
717impl MultiEraUpdate {
718 pub fn epoch(&self) -> u64 {
719 self.0.epoch
720 }
721
722 pub fn proposed_protocol_parameter_updates(
723 &self,
724 ) -> MapGenesisHashToMultiEraProtocolParamUpdate {
725 self.0.proposed_protocol_parameter_updates.clone().into()
726 }
727}
728
729impl_wasm_map!(
730 cml_crypto::GenesisHash,
731 cml_multi_era::utils::MultiEraProtocolParamUpdate,
732 GenesisHash,
733 MultiEraProtocolParamUpdate,
734 GenesisHashList,
735 MapGenesisHashToMultiEraProtocolParamUpdate
736);