@@ -207,8 +207,210 @@ impl From<ObjectRef> for iota_graphql_client::query_types::ObjectRef {
207207 }
208208}
209209
210- #[ derive( derive_more:: From , uniffi:: Object ) ]
211- pub struct Epoch ( pub iota_graphql_client:: query_types:: Epoch ) ;
210+ #[ derive( uniffi:: Record ) ]
211+ pub struct Epoch {
212+ /// The epoch's id as a sequence number that starts at 0 and is incremented
213+ /// by one at every epoch change.
214+ pub epoch_id : u64 ,
215+ /// The storage fees paid for transactions executed during the epoch.
216+ #[ uniffi( default = None ) ]
217+ pub fund_inflow : Option < String > ,
218+ /// The storage fee rebates paid to users who deleted the data associated
219+ /// with past transactions.
220+ #[ uniffi( default = None ) ]
221+ pub fund_outflow : Option < String > ,
222+ /// The storage fund available in this epoch.
223+ /// This fund is used to redistribute storage fees from past transactions
224+ /// to future validators.
225+ #[ uniffi( default = None ) ]
226+ pub fund_size : Option < String > ,
227+ /// A commitment by the committee at the end of epoch on the contents of the
228+ /// live object set at that time. This can be used to verify state
229+ /// snapshots.
230+ #[ uniffi( default = None ) ]
231+ pub live_object_set_digest : Option < String > ,
232+ /// The difference between the fund inflow and outflow, representing
233+ /// the net amount of storage fees accumulated in this epoch.
234+ #[ uniffi( default = None ) ]
235+ pub net_inflow : Option < String > ,
236+ /// The epoch's corresponding protocol configuration, including the feature
237+ /// flags and the configuration options.
238+ #[ uniffi( default = None ) ]
239+ pub protocol_configs : Option < ProtocolConfigs > ,
240+ /// The minimum gas price that a quorum of validators are guaranteed to sign
241+ /// a transaction for.
242+ #[ uniffi( default = None ) ]
243+ pub reference_gas_price : Option < String > ,
244+ /// The epoch's starting timestamp.
245+ pub start_timestamp : u64 ,
246+ /// The epoch's ending timestamp. Note that this is available only on epochs
247+ /// that have ended.
248+ #[ uniffi( default = None ) ]
249+ pub end_timestamp : Option < u64 > ,
250+ /// The value of the `version` field of `0x5`, the
251+ /// `0x3::iota::IotaSystemState` object. This version changes whenever
252+ /// the fields contained in the system state object (held in a dynamic
253+ /// field attached to `0x5`) change.
254+ #[ uniffi( default = None ) ]
255+ pub system_state_version : Option < u64 > ,
256+ /// The total number of checkpoints in this epoch.
257+ #[ uniffi( default = None ) ]
258+ pub total_checkpoints : Option < u64 > ,
259+ /// The total amount of gas fees (in IOTA) that were paid in this epoch.
260+ #[ uniffi( default = None ) ]
261+ pub total_gas_fees : Option < String > ,
262+ /// The total IOTA rewarded as stake.
263+ #[ uniffi( default = None ) ]
264+ pub total_stake_rewards : Option < String > ,
265+ /// The total number of transaction in this epoch.
266+ #[ uniffi( default = None ) ]
267+ pub total_transactions : Option < u64 > ,
268+ /// Validator related properties. For active validators, see
269+ /// `active_validators` API.
270+ #[ uniffi( default = None ) ]
271+ pub validator_set : Option < ValidatorSet > ,
272+ }
273+
274+ impl From < iota_graphql_client:: query_types:: Epoch > for Epoch {
275+ fn from ( value : iota_graphql_client:: query_types:: Epoch ) -> Self {
276+ Self {
277+ epoch_id : value. epoch_id ,
278+ fund_inflow : value. fund_inflow . map ( |v| v. 0 ) ,
279+ fund_outflow : value. fund_outflow . map ( |v| v. 0 ) ,
280+ fund_size : value. fund_size . map ( |v| v. 0 ) ,
281+ live_object_set_digest : value. live_object_set_digest ,
282+ net_inflow : value. net_inflow . map ( |v| v. 0 ) ,
283+ protocol_configs : value. protocol_configs ,
284+ reference_gas_price : value. reference_gas_price . map ( |v| v. 0 ) ,
285+ start_timestamp : value. start_timestamp . 0 . parse ( ) . unwrap_or ( 0 ) ,
286+ end_timestamp : value. end_timestamp . map ( |dt| dt. 0 . parse ( ) . unwrap_or ( 0 ) ) ,
287+ system_state_version : value. system_state_version ,
288+ total_checkpoints : value. total_checkpoints ,
289+ total_gas_fees : value. total_gas_fees . map ( |v| v. 0 ) ,
290+ total_stake_rewards : value. total_stake_rewards . map ( |v| v. 0 ) ,
291+ total_transactions : value. total_transactions ,
292+ validator_set : value. validator_set . map ( |vs| ValidatorSet {
293+ inactive_pools_id : vs. inactive_pools_id . map ( Into :: into) . map ( Arc :: new) ,
294+ inactive_pools_size : vs. inactive_pools_size ,
295+ pending_active_validators_id : vs
296+ . pending_active_validators_id
297+ . map ( Into :: into)
298+ . map ( Arc :: new) ,
299+ pending_active_validators_size : vs. pending_active_validators_size ,
300+ pending_removals : vs. pending_removals ,
301+ staking_pool_mappings_id : vs. staking_pool_mappings_id . map ( Into :: into) . map ( Arc :: new) ,
302+ staking_pool_mappings_size : vs. staking_pool_mappings_size ,
303+ total_stake : vs. total_stake . map ( |v| v. 0 ) ,
304+ validator_candidates_size : vs. validator_candidates_size ,
305+ validator_candidates_id : vs. validator_candidates_id . map ( Into :: into) . map ( Arc :: new) ,
306+ } ) ,
307+ }
308+ }
309+ }
310+
311+ impl From < Epoch > for iota_graphql_client:: query_types:: Epoch {
312+ fn from ( value : Epoch ) -> Self {
313+ Self {
314+ epoch_id : value. epoch_id ,
315+ fund_inflow : value. fund_inflow . map ( |v| v. into ( ) ) ,
316+ fund_outflow : value. fund_outflow . map ( |v| v. into ( ) ) ,
317+ fund_size : value. fund_size . map ( |v| v. into ( ) ) ,
318+ live_object_set_digest : value. live_object_set_digest ,
319+ net_inflow : value. net_inflow . map ( |v| v. into ( ) ) ,
320+ protocol_configs : value. protocol_configs ,
321+ reference_gas_price : value. reference_gas_price . map ( |v| v. into ( ) ) ,
322+ start_timestamp : iota_graphql_client:: query_types:: DateTime (
323+ value. start_timestamp . to_string ( ) ,
324+ ) ,
325+ end_timestamp : value
326+ . end_timestamp
327+ . map ( |ts| iota_graphql_client:: query_types:: DateTime ( ts. to_string ( ) ) ) ,
328+ system_state_version : value. system_state_version ,
329+ total_checkpoints : value. total_checkpoints ,
330+ total_gas_fees : value. total_gas_fees . map ( |v| v. into ( ) ) ,
331+ total_stake_rewards : value. total_stake_rewards . map ( |v| v. into ( ) ) ,
332+ total_transactions : value. total_transactions ,
333+ validator_set : value. validator_set . map ( Into :: into) ,
334+ }
335+ }
336+ }
337+
338+ #[ derive( uniffi:: Record ) ]
339+ pub struct ValidatorSet {
340+ /// Object ID of the `Table` storing the inactive staking pools.
341+ #[ uniffi( default = None ) ]
342+ pub inactive_pools_id : Option < Arc < ObjectId > > ,
343+ /// Size of the inactive pools `Table`.
344+ #[ uniffi( default = None ) ]
345+ pub inactive_pools_size : Option < i32 > ,
346+ /// Object ID of the wrapped object `TableVec` storing the pending active
347+ /// validators.
348+ #[ uniffi( default = None ) ]
349+ pub pending_active_validators_id : Option < Arc < ObjectId > > ,
350+ /// Size of the pending active validators table.
351+ #[ uniffi( default = None ) ]
352+ pub pending_active_validators_size : Option < i32 > ,
353+ /// Validators that are pending removal from the active validator set,
354+ /// expressed as indices in to `activeValidators`.
355+ #[ uniffi( default = None ) ]
356+ pub pending_removals : Option < Vec < i32 > > ,
357+ /// Object ID of the `Table` storing the mapping from staking pool ids to
358+ /// the addresses of the corresponding validators. This is needed
359+ /// because a validator's address can potentially change but the object
360+ /// ID of its pool will not.
361+ #[ uniffi( default = None ) ]
362+ pub staking_pool_mappings_id : Option < Arc < ObjectId > > ,
363+ /// Size of the stake pool mappings `Table`.
364+ #[ uniffi( default = None ) ]
365+ pub staking_pool_mappings_size : Option < i32 > ,
366+ /// Total amount of stake for all active validators at the beginning of the
367+ /// epoch.
368+ #[ uniffi( default = None ) ]
369+ pub total_stake : Option < String > ,
370+ /// Size of the validator candidates `Table`.
371+ #[ uniffi( default = None ) ]
372+ pub validator_candidates_size : Option < i32 > ,
373+ /// Object ID of the `Table` storing the validator candidates.
374+ #[ uniffi( default = None ) ]
375+ pub validator_candidates_id : Option < Arc < ObjectId > > ,
376+ }
377+
378+ impl From < iota_graphql_client:: query_types:: ValidatorSet > for ValidatorSet {
379+ fn from ( value : iota_graphql_client:: query_types:: ValidatorSet ) -> Self {
380+ Self {
381+ inactive_pools_id : value. inactive_pools_id . map ( Into :: into) . map ( Arc :: new) ,
382+ inactive_pools_size : value. inactive_pools_size ,
383+ pending_active_validators_id : value
384+ . pending_active_validators_id
385+ . map ( Into :: into)
386+ . map ( Arc :: new) ,
387+ pending_active_validators_size : value. pending_active_validators_size ,
388+ pending_removals : value. pending_removals ,
389+ staking_pool_mappings_id : value. staking_pool_mappings_id . map ( Into :: into) . map ( Arc :: new) ,
390+ staking_pool_mappings_size : value. staking_pool_mappings_size ,
391+ total_stake : value. total_stake . map ( |v| v. 0 ) ,
392+ validator_candidates_size : value. validator_candidates_size ,
393+ validator_candidates_id : value. validator_candidates_id . map ( Into :: into) . map ( Arc :: new) ,
394+ }
395+ }
396+ }
397+
398+ impl From < ValidatorSet > for iota_graphql_client:: query_types:: ValidatorSet {
399+ fn from ( value : ValidatorSet ) -> Self {
400+ Self {
401+ inactive_pools_id : value. inactive_pools_id . map ( |v| * * v) ,
402+ inactive_pools_size : value. inactive_pools_size ,
403+ pending_active_validators_id : value. pending_active_validators_id . map ( |v| * * v) ,
404+ pending_active_validators_size : value. pending_active_validators_size ,
405+ pending_removals : value. pending_removals ,
406+ staking_pool_mappings_id : value. staking_pool_mappings_id . map ( |v| * * v) ,
407+ staking_pool_mappings_size : value. staking_pool_mappings_size ,
408+ total_stake : value. total_stake . map ( |v| v. into ( ) ) ,
409+ validator_candidates_size : value. validator_candidates_size ,
410+ validator_candidates_id : value. validator_candidates_id . map ( |v| * * v) ,
411+ }
412+ }
413+ }
212414
213415#[ derive( uniffi:: Record ) ]
214416pub struct EventFilter {
@@ -567,27 +769,6 @@ pub enum Direction {
567769 Backward ,
568770}
569771
570- #[ derive( uniffi:: Record ) ]
571- pub struct ValidatorSet {
572- pub active_validators : ValidatorConnection ,
573- }
574-
575- impl From < iota_graphql_client:: query_types:: ValidatorSet > for ValidatorSet {
576- fn from ( value : iota_graphql_client:: query_types:: ValidatorSet ) -> Self {
577- ValidatorSet {
578- active_validators : value. active_validators . into ( ) ,
579- }
580- }
581- }
582-
583- impl From < ValidatorSet > for iota_graphql_client:: query_types:: ValidatorSet {
584- fn from ( value : ValidatorSet ) -> Self {
585- iota_graphql_client:: query_types:: ValidatorSet {
586- active_validators : value. active_validators . into ( ) ,
587- }
588- }
589- }
590-
591772#[ derive( uniffi:: Record ) ]
592773pub struct ValidatorConnection {
593774 pub page_info : PageInfo ,
0 commit comments