@@ -365,6 +365,191 @@ impl From<ObjectRef> for iota_sdk::graphql_client::query_types::ObjectRef {
365365 }
366366}
367367
368+ /// Breakdown of gas costs in effects.
369+ #[ derive( uniffi:: Record ) ]
370+ pub struct GraphQLGasCostSummary {
371+ /// Gas paid for executing this transaction (in NANOS).
372+ #[ uniffi( default = None ) ]
373+ pub computation_cost : Option < String > ,
374+ /// Gas burned for executing this transaction (in NANOS).
375+ #[ uniffi( default = None ) ]
376+ pub computation_cost_burned : Option < String > ,
377+ /// Gas paid for the data stored on-chain by this transaction (in NANOS).
378+ #[ uniffi( default = None ) ]
379+ pub storage_cost : Option < String > ,
380+ /// Part of storage cost that can be reclaimed by cleaning up data created
381+ /// by this transaction (when objects are deleted or an object is
382+ /// modified, which is treated as a deletion followed by a creation) (in
383+ /// NANOS).
384+ #[ uniffi( default = None ) ]
385+ pub storage_rebate : Option < String > ,
386+ /// Part of storage cost that is not reclaimed when data created by this
387+ /// transaction is cleaned up (in NANOS).
388+ #[ uniffi( default = None ) ]
389+ pub non_refundable_storage_fee : Option < String > ,
390+ }
391+
392+ impl From < iota_sdk:: graphql_client:: query_types:: GasCostSummary > for GraphQLGasCostSummary {
393+ fn from ( value : iota_sdk:: graphql_client:: query_types:: GasCostSummary ) -> Self {
394+ Self {
395+ computation_cost : value. computation_cost . map ( |v| v. 0 ) ,
396+ computation_cost_burned : value. computation_cost_burned . map ( |v| v. 0 ) ,
397+ storage_cost : value. storage_cost . map ( |v| v. 0 ) ,
398+ storage_rebate : value. storage_rebate . map ( |v| v. 0 ) ,
399+ non_refundable_storage_fee : value. non_refundable_storage_fee . map ( |v| v. 0 ) ,
400+ }
401+ }
402+ }
403+
404+ impl From < GraphQLGasCostSummary > for iota_sdk:: graphql_client:: query_types:: GasCostSummary {
405+ fn from ( value : GraphQLGasCostSummary ) -> Self {
406+ Self {
407+ computation_cost : value. computation_cost . map ( |v| v. into ( ) ) ,
408+ computation_cost_burned : value. computation_cost_burned . map ( |v| v. into ( ) ) ,
409+ storage_cost : value. storage_cost . map ( |v| v. into ( ) ) ,
410+ storage_rebate : value. storage_rebate . map ( |v| v. into ( ) ) ,
411+ non_refundable_storage_fee : value. non_refundable_storage_fee . map ( |v| v. into ( ) ) ,
412+ }
413+ }
414+ }
415+
416+ /// Information about whether epoch changes are using safe mode.
417+ #[ derive( uniffi:: Record ) ]
418+ pub struct SafeMode {
419+ /// Whether safe mode was used for the last epoch change. The system will
420+ /// retry a full epoch change on every epoch boundary and automatically
421+ /// reset this flag if so.
422+ #[ uniffi( default = None ) ]
423+ pub enabled : Option < bool > ,
424+ /// Accumulated fees for computation and cost that have not been added to
425+ /// the various reward pools, because the full epoch change did not happen.
426+ #[ uniffi( default = None ) ]
427+ pub gas_summary : Option < GraphQLGasCostSummary > ,
428+ }
429+
430+ impl From < iota_sdk:: graphql_client:: query_types:: SafeMode > for SafeMode {
431+ fn from ( value : iota_sdk:: graphql_client:: query_types:: SafeMode ) -> Self {
432+ Self {
433+ enabled : value. enabled ,
434+ gas_summary : value. gas_summary . map ( Into :: into) ,
435+ }
436+ }
437+ }
438+
439+ impl From < SafeMode > for iota_sdk:: graphql_client:: query_types:: SafeMode {
440+ fn from ( value : SafeMode ) -> Self {
441+ Self {
442+ enabled : value. enabled ,
443+ gas_summary : value. gas_summary . map ( Into :: into) ,
444+ }
445+ }
446+ }
447+
448+ /// IOTA set aside to account for objects stored on-chain.
449+ #[ derive( uniffi:: Record ) ]
450+ pub struct StorageFund {
451+ /// Sum of storage rebates of live objects on chain.
452+ #[ uniffi( default = None ) ]
453+ pub total_object_storage_rebates : Option < String > ,
454+ /// The portion of the storage fund that will never be refunded through
455+ /// storage rebates.
456+ /// The system maintains an invariant that the sum of
457+ /// all storage fees into the storage fund is equal to the sum of of all
458+ /// storage rebates out, the total storage rebates remaining, and the
459+ /// non-refundable balance.
460+ #[ uniffi( default = None ) ]
461+ pub non_refundable_balance : Option < String > ,
462+ }
463+
464+ impl From < iota_sdk:: graphql_client:: query_types:: StorageFund > for StorageFund {
465+ fn from ( value : iota_sdk:: graphql_client:: query_types:: StorageFund ) -> Self {
466+ Self {
467+ total_object_storage_rebates : value. total_object_storage_rebates . map ( |v| v. 0 ) ,
468+ non_refundable_balance : value. non_refundable_balance . map ( |v| v. 0 ) ,
469+ }
470+ }
471+ }
472+
473+ impl From < StorageFund > for iota_sdk:: graphql_client:: query_types:: StorageFund {
474+ fn from ( value : StorageFund ) -> Self {
475+ Self {
476+ total_object_storage_rebates : value. total_object_storage_rebates . map ( |v| v. into ( ) ) ,
477+ non_refundable_balance : value. non_refundable_balance . map ( |v| v. into ( ) ) ,
478+ }
479+ }
480+ }
481+
482+ /// Details of the system that are decided during genesis.
483+ #[ derive( uniffi:: Record ) ]
484+ pub struct SystemParameters {
485+ /// Target duration of an epoch, in milliseconds.
486+ #[ uniffi( default = None ) ]
487+ pub duration_ms : Option < String > ,
488+ /// The minimum number of active validators that the system supports.
489+ #[ uniffi( default = None ) ]
490+ pub min_validator_count : Option < i32 > ,
491+ /// The maximum number of active validators that the system supports.
492+ #[ uniffi( default = None ) ]
493+ pub max_validator_count : Option < i32 > ,
494+ /// Minimum stake needed to become a new validator.
495+ #[ uniffi( default = None ) ]
496+ pub min_validator_joining_stake : Option < String > ,
497+ /// Validators with stake below this threshold will enter the grace period
498+ /// (see `validator_low_stake_grace_period`), after which they are removed
499+ /// from the active validator set.
500+ #[ uniffi( default = None ) ]
501+ pub validator_low_stake_threshold : Option < String > ,
502+ /// Validators with stake below this threshold will be removed from the
503+ /// active validator set at the next epoch boundary, without a grace period.
504+ #[ uniffi( default = None ) ]
505+ pub validator_very_low_stake_threshold : Option < String > ,
506+ /// The number of epochs that a validator has to recover from having less
507+ /// than `validator_low_stake_threshold` stake.
508+ #[ uniffi( default = None ) ]
509+ pub validator_low_stake_grace_period : Option < String > ,
510+ }
511+
512+ impl From < iota_sdk:: graphql_client:: query_types:: SystemParameters > for SystemParameters {
513+ fn from ( value : iota_sdk:: graphql_client:: query_types:: SystemParameters ) -> Self {
514+ Self {
515+ duration_ms : value. duration_ms . map ( |v| v. 0 ) ,
516+ min_validator_count : value. min_validator_count ,
517+ max_validator_count : value. max_validator_count ,
518+ min_validator_joining_stake : value. min_validator_joining_stake . map ( |v| v. 0 ) ,
519+ validator_low_stake_threshold : value. validator_low_stake_threshold . map ( |v| v. 0 ) ,
520+ validator_very_low_stake_threshold : value
521+ . validator_very_low_stake_threshold
522+ . map ( |v| v. 0 ) ,
523+ validator_low_stake_grace_period : value. validator_low_stake_grace_period . map ( |v| v. 0 ) ,
524+ }
525+ }
526+ }
527+
528+ impl From < SystemParameters > for iota_sdk:: graphql_client:: query_types:: SystemParameters {
529+ fn from ( value : SystemParameters ) -> Self {
530+ Self {
531+ duration_ms : value. duration_ms . map ( |v| v. into ( ) ) ,
532+ min_validator_count : value. min_validator_count ,
533+ max_validator_count : value. max_validator_count ,
534+ min_validator_joining_stake : value. min_validator_joining_stake . map ( |v| v. into ( ) ) ,
535+ validator_low_stake_threshold : value. validator_low_stake_threshold . map ( |v| v. into ( ) ) ,
536+ validator_very_low_stake_threshold : value
537+ . validator_very_low_stake_threshold
538+ . map ( |v| v. into ( ) ) ,
539+ validator_low_stake_grace_period : value
540+ . validator_low_stake_grace_period
541+ . map ( |v| v. into ( ) ) ,
542+ }
543+ }
544+ }
545+
546+ /// Operation of the IOTA network is temporally partitioned into non-overlapping
547+ /// epochs, and the network aims to keep epochs roughly the same duration as
548+ /// each other. During a particular epoch the following data is fixed:
549+ ///
550+ /// - the protocol version
551+ /// - the reference gas price
552+ /// - the set of participating validators
368553#[ derive( uniffi:: Record ) ]
369554pub struct Epoch {
370555 /// The epoch's id as a sequence number that starts at 0 and is incremented
@@ -429,6 +614,23 @@ pub struct Epoch {
429614 /// of the epoch.
430615 #[ uniffi( default = None ) ]
431616 pub validator_set : Option < ValidatorSet > ,
617+ /// IOTA set aside to account for objects stored on-chain, at the start of
618+ /// the epoch. This is also used for storage rebates.
619+ #[ uniffi( default = None ) ]
620+ pub storage_fund : Option < StorageFund > ,
621+ /// Information about whether this epoch was started in safe mode, which
622+ /// happens if the full epoch change logic fails for some reason.
623+ #[ uniffi( default = None ) ]
624+ pub safe_mode : Option < SafeMode > ,
625+ /// The total IOTA supply.
626+ #[ uniffi( default = None ) ]
627+ pub iota_total_supply : Option < u64 > ,
628+ /// The treasury-cap id.
629+ #[ uniffi( default = None ) ]
630+ pub iota_treasury_cap_id : Option < Arc < Address > > ,
631+ /// Details of the system that are decided during genesis.
632+ #[ uniffi( default = None ) ]
633+ pub system_parameters : Option < SystemParameters > ,
432634}
433635
434636impl From < iota_sdk:: graphql_client:: query_types:: Epoch > for Epoch {
@@ -449,21 +651,12 @@ impl From<iota_sdk::graphql_client::query_types::Epoch> for Epoch {
449651 total_gas_fees : value. total_gas_fees . map ( |v| v. 0 ) ,
450652 total_stake_rewards : value. total_stake_rewards . map ( |v| v. 0 ) ,
451653 total_transactions : value. total_transactions ,
452- validator_set : value. validator_set . map ( |vs| ValidatorSet {
453- inactive_pools_id : vs. inactive_pools_id . map ( Into :: into) . map ( Arc :: new) ,
454- inactive_pools_size : vs. inactive_pools_size ,
455- pending_active_validators_id : vs
456- . pending_active_validators_id
457- . map ( Into :: into)
458- . map ( Arc :: new) ,
459- pending_active_validators_size : vs. pending_active_validators_size ,
460- pending_removals : vs. pending_removals ,
461- staking_pool_mappings_id : vs. staking_pool_mappings_id . map ( Into :: into) . map ( Arc :: new) ,
462- staking_pool_mappings_size : vs. staking_pool_mappings_size ,
463- total_stake : vs. total_stake . map ( |v| v. 0 ) ,
464- validator_candidates_size : vs. validator_candidates_size ,
465- validator_candidates_id : vs. validator_candidates_id . map ( Into :: into) . map ( Arc :: new) ,
466- } ) ,
654+ validator_set : value. validator_set . map ( Into :: into) ,
655+ storage_fund : value. storage_fund . map ( Into :: into) ,
656+ safe_mode : value. safe_mode . map ( Into :: into) ,
657+ iota_total_supply : value. iota_total_supply ,
658+ iota_treasury_cap_id : value. iota_treasury_cap_id . map ( Into :: into) . map ( Arc :: new) ,
659+ system_parameters : value. system_parameters . map ( Into :: into) ,
467660 }
468661 }
469662}
@@ -491,12 +684,21 @@ impl From<Epoch> for iota_sdk::graphql_client::query_types::Epoch {
491684 total_stake_rewards : value. total_stake_rewards . map ( |v| v. into ( ) ) ,
492685 total_transactions : value. total_transactions ,
493686 validator_set : value. validator_set . map ( Into :: into) ,
687+ storage_fund : value. storage_fund . map ( Into :: into) ,
688+ safe_mode : value. safe_mode . map ( Into :: into) ,
689+ iota_total_supply : value. iota_total_supply ,
690+ iota_treasury_cap_id : value. iota_treasury_cap_id . map ( |a| * * a) ,
691+ system_parameters : value. system_parameters . map ( Into :: into) ,
494692 }
495693 }
496694}
497695
498696#[ derive( uniffi:: Record ) ]
499697pub struct ValidatorSet {
698+ /// The current set of active validators.
699+ pub active_validators : ValidatorConnection ,
700+ /// The current set of committee members.
701+ pub committee_members : ValidatorConnection ,
500702 /// Object ID of the `Table` storing the inactive staking pools.
501703 #[ uniffi( default = None ) ]
502704 pub inactive_pools_id : Option < Arc < ObjectId > > ,
@@ -538,6 +740,8 @@ pub struct ValidatorSet {
538740impl From < iota_sdk:: graphql_client:: query_types:: ValidatorSet > for ValidatorSet {
539741 fn from ( value : iota_sdk:: graphql_client:: query_types:: ValidatorSet ) -> Self {
540742 Self {
743+ active_validators : value. active_validators . into ( ) ,
744+ committee_members : value. committee_members . into ( ) ,
541745 inactive_pools_id : value. inactive_pools_id . map ( Into :: into) . map ( Arc :: new) ,
542746 inactive_pools_size : value. inactive_pools_size ,
543747 pending_active_validators_id : value
@@ -558,6 +762,8 @@ impl From<iota_sdk::graphql_client::query_types::ValidatorSet> for ValidatorSet
558762impl From < ValidatorSet > for iota_sdk:: graphql_client:: query_types:: ValidatorSet {
559763 fn from ( value : ValidatorSet ) -> Self {
560764 Self {
765+ active_validators : value. active_validators . into ( ) ,
766+ committee_members : value. committee_members . into ( ) ,
561767 inactive_pools_id : value. inactive_pools_id . map ( |v| * * v) ,
562768 inactive_pools_size : value. inactive_pools_size ,
563769 pending_active_validators_id : value. pending_active_validators_id . map ( |v| * * v) ,
0 commit comments