GraphQlClientExt

Trait GraphQlClientExt 

Source
pub trait GraphQlClientExt:
    GraphQlClient
    + Sized
    + Send {
Show 31 methods // Provided methods fn current_epoch_id( &self, ) -> impl Future<Output = Result<u64, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn epoch_final_checkpoint_num( &self, epoch_id: u64, ) -> impl Future<Output = Result<u64, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn events_backward( &self, filter: Option<EventFilter>, cursor: Option<String>, page_size: Option<u32>, ) -> impl Future<Output = Result<(Vec<EventEdge>, bool), Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn filtered_full_objects( &self, owner: Option<Address>, type_: Option<String>, page_size: Option<u32>, ) -> impl Stream<Item = Result<Object, Error<<Self as GraphQlClient>::Error>>> + '_ + Send { ... } fn full_object( &self, object_id: Address, version: Option<u64>, ) -> impl Future<Output = Result<Object, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn latest_full_objects( &self, objects: impl IntoIterator<Item = Address> + Send, page_size: Option<u32>, ) -> impl Future<Output = Result<HashMap<Address, Object>, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn multi_get_objects( &self, keys: impl IntoIterator<Item = (Address, Version)> + Send, ) -> impl Future<Output = Result<Vec<Object>, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn genesis_tx( &self, ) -> impl Future<Output = Result<Transaction, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn latest_checkpoint( &self, ) -> impl Future<Output = Result<u64, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn latest_object_version( &self, object_id: Address, ) -> impl Future<Output = Result<(u64, u64), Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn latest_objects_version( &self, object_ids: &[Address], ) -> impl Future<Output = Result<(u64, HashMap<Address, u64>), Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn latest_version_at_checkpoint( &self, id: Address, ckpt_num: u64, ) -> impl Future<Output = Result<u64, LatestVersionAtCheckpointError<Self::Error>>> + Send { ... } fn object_arg( &self, id: Address, ) -> impl Future<Output = Result<ObjectArg, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn object_args( &self, names: BiMap<String, Address>, page_size: Option<u32>, ) -> impl Future<Output = Result<BiMap<String, ObjectArg>, ObjectArgsError<Self::Error>>> + Send { ... } fn object_args_and_content( &self, object_ids: impl IntoIterator<Item = Address> + Send, mutable: bool, page_size: Option<u32>, ) -> impl Future<Output = Result<Vec<(ObjectArg, RawMoveStruct)>, ObjectArgsAndContentError<Self::Error>>> + Send { ... } fn object_content( &self, object_id: Address, version: Option<u64>, ) -> impl Future<Output = Result<RawMoveStruct, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn objects_content( &self, object_ids: Vec<Address>, ) -> impl Future<Output = Result<HashMap<Address, RawMoveStruct>, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn owner_df_content( &self, address: Address, raw_move_value: RawMoveValue, root_version: Option<u64>, ) -> impl Future<Output = Result<RawMoveValue, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn owner_df_contents( &self, address: Address, root_version: Option<u64>, first: Option<i32>, after: Option<String>, ) -> impl Future<Output = Result<(HashMap<RawMoveValue, DynamicField>, Option<String>), Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn owner_df_contents_stream( &self, address: Address, root_version: Option<u64>, page_size: Option<i32>, ) -> impl Future<Output = impl Stream<Item = Result<(RawMoveValue, DynamicField), Error<<Self as GraphQlClient>::Error>>> + '_> + Send { ... } fn owner_dof_content( &self, address: Address, raw_move_value: RawMoveValue, root_version: Option<u64>, ) -> impl Future<Output = Result<(ObjectKey, RawMoveStruct), Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn latest_package( &self, package_id: Address, ) -> impl Future<Output = Result<(Address, Version), Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn package_at_version( &self, package_id: Address, version: Version, ) -> impl Future<Output = Result<Address, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn packages_from_original( &self, package_id: Address, ) -> impl Future<Output = Result<impl Iterator<Item = (Address, u64)>, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn packages_published_epoch( &self, package_ids: Vec<Address>, ) -> impl Future<Output = Result<impl Iterator<Item = (Address, u64, u64)>, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn reference_gas_price( &self, ) -> impl Future<Output = Result<u64, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn transaction_blocks_status( &self, transaction_digests: Vec<String>, ) -> impl Future<Output = Result<impl Iterator<Item = Result<(String, bool), Error>>, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn gas_payment( &self, sponsor: Address, budget: u64, exclude: Vec<Address>, ) -> impl Future<Output = Result<Vec<ObjectRef>, GasPaymentError<Self::Error>>> + Send { ... } fn max_page_size( &self, ) -> impl Future<Output = Result<i32, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn object_type( &self, id: Address, ) -> impl Future<Output = Result<StructTag, Error<<Self as GraphQlClient>::Error>>> + Send { ... } fn coin_metadata( &self, type_: &str, ) -> impl Future<Output = Result<(Option<u8>, Option<String>, Option<String>), Error<<Self as GraphQlClient>::Error>>> + Send { ... }
}
Available on crate feature queries only.
Expand description

Extension trait to GraphQlClient collecting all defined queries in one place.

Provided Methods§

Source

fn current_epoch_id( &self, ) -> impl Future<Output = Result<u64, Error<<Self as GraphQlClient>::Error>>> + Send

The latest epoch id.

Source

fn epoch_final_checkpoint_num( &self, epoch_id: u64, ) -> impl Future<Output = Result<u64, Error<<Self as GraphQlClient>::Error>>> + Send

The last checkpoint number of an epoch.

Source

fn events_backward( &self, filter: Option<EventFilter>, cursor: Option<String>, page_size: Option<u32>, ) -> impl Future<Output = Result<(Vec<EventEdge>, bool), Error<<Self as GraphQlClient>::Error>>> + Send

Return a single page of events + cursors and a flag indicating if there’s a previous page.

If page_size is left None, the server decides the size of the page.

The edges are returned in reverse order of which they where returned by the server

Source

fn filtered_full_objects( &self, owner: Option<Address>, type_: Option<String>, page_size: Option<u32>, ) -> impl Stream<Item = Result<Object, Error<<Self as GraphQlClient>::Error>>> + '_ + Send

The latest full Object contents with the possibility to filter by owner or object type.

Source

fn full_object( &self, object_id: Address, version: Option<u64>, ) -> impl Future<Output = Result<Object, Error<<Self as GraphQlClient>::Error>>> + Send

The full Object contents at a certain version or the latest if not specified.

Source

fn latest_full_objects( &self, objects: impl IntoIterator<Item = Address> + Send, page_size: Option<u32>, ) -> impl Future<Output = Result<HashMap<Address, Object>, Error<<Self as GraphQlClient>::Error>>> + Send

The full Object contents at their latest versions.

Fails if any requested object id is not in the final map.

§Note

The check for returned object ids is just so that the caller can safely do map[object_id] on the returned map. Keep in mind that the result if an object id is repeated in objects is undefined. Avoid doing so.

Source

fn multi_get_objects( &self, keys: impl IntoIterator<Item = (Address, Version)> + Send, ) -> impl Future<Output = Result<Vec<Object>, Error<<Self as GraphQlClient>::Error>>> + Send

The full Object contents at specific versions.

Duplicate object keys are automatically discarded.

Source

fn genesis_tx( &self, ) -> impl Future<Output = Result<Transaction, Error<<Self as GraphQlClient>::Error>>> + Send

Genesis transaction of the Sui network instance.

Source

fn latest_checkpoint( &self, ) -> impl Future<Output = Result<u64, Error<<Self as GraphQlClient>::Error>>> + Send

Latest checkpoint number.

Source

fn latest_object_version( &self, object_id: Address, ) -> impl Future<Output = Result<(u64, u64), Error<<Self as GraphQlClient>::Error>>> + Send

The latest checkpoint number and object version of an object.

Source

fn latest_objects_version( &self, object_ids: &[Address], ) -> impl Future<Output = Result<(u64, HashMap<Address, u64>), Error<<Self as GraphQlClient>::Error>>> + Send

The latest checkpoint number and the map of object ids to the their version at that checkpoint.

Fails if the server doesn’t return the version for any of the requested objects.

Source

fn latest_version_at_checkpoint( &self, id: Address, ckpt_num: u64, ) -> impl Future<Output = Result<u64, LatestVersionAtCheckpointError<Self::Error>>> + Send

Version of the object at this checkpoint.

Source

fn object_arg( &self, id: Address, ) -> impl Future<Output = Result<ObjectArg, Error<<Self as GraphQlClient>::Error>>> + Send

Get the object argument for a programmable transaction.

Source

fn object_args( &self, names: BiMap<String, Address>, page_size: Option<u32>, ) -> impl Future<Output = Result<BiMap<String, ObjectArg>, ObjectArgsError<Self::Error>>> + Send

Turn a bijective map of names and object ids into one of names and object args.

Fails if the query response does not have the necessary data for the input map.

Source

fn object_args_and_content( &self, object_ids: impl IntoIterator<Item = Address> + Send, mutable: bool, page_size: Option<u32>, ) -> impl Future<Output = Result<Vec<(ObjectArg, RawMoveStruct)>, ObjectArgsAndContentError<Self::Error>>> + Send

Get a sequence of object args and contents corresponding to object_ids, but not necessarily in the same order.

NOTE: prefer GraphQlClientExt::latest_full_objects instead and call Object::object_arg on each returned object.

The mutable argument controls whether we want to create mutable ObjectArgs, if they are of the ObjectArg::SharedObject variant.

Fails if any object in the response is missing data.

Source

fn object_content( &self, object_id: Address, version: Option<u64>, ) -> impl Future<Output = Result<RawMoveStruct, Error<<Self as GraphQlClient>::Error>>> + Send

Get the raw Move struct of an object’s content.

Source

fn objects_content( &self, object_ids: Vec<Address>, ) -> impl Future<Output = Result<HashMap<Address, RawMoveStruct>, Error<<Self as GraphQlClient>::Error>>> + Send

Source

fn owner_df_content( &self, address: Address, raw_move_value: RawMoveValue, root_version: Option<u64>, ) -> impl Future<Output = Result<RawMoveValue, Error<<Self as GraphQlClient>::Error>>> + Send

Get the raw Move value of a dynamic field’s value.

Source

fn owner_df_contents( &self, address: Address, root_version: Option<u64>, first: Option<i32>, after: Option<String>, ) -> impl Future<Output = Result<(HashMap<RawMoveValue, DynamicField>, Option<String>), Error<<Self as GraphQlClient>::Error>>> + Send

Map of all keys to dynamic field values: RawMoveValue -> DynamicField.

Source

fn owner_df_contents_stream( &self, address: Address, root_version: Option<u64>, page_size: Option<i32>, ) -> impl Future<Output = impl Stream<Item = Result<(RawMoveValue, DynamicField), Error<<Self as GraphQlClient>::Error>>> + '_> + Send

Streamed map of all keys to dynamic field values: RawMoveValue -> DynamicField.

Source

fn owner_dof_content( &self, address: Address, raw_move_value: RawMoveValue, root_version: Option<u64>, ) -> impl Future<Output = Result<(ObjectKey, RawMoveStruct), Error<<Self as GraphQlClient>::Error>>> + Send

Get the raw Move struct of a dynamic object field’s value.

Source

fn latest_package( &self, package_id: Address, ) -> impl Future<Output = Result<(Address, Version), Error<<Self as GraphQlClient>::Error>>> + Send

Get the latest version of a package.

Returns both its ID and version number.

Source

fn package_at_version( &self, package_id: Address, version: Version, ) -> impl Future<Output = Result<Address, Error<<Self as GraphQlClient>::Error>>> + Send

Get the address of a package at a specific version.

Source

fn packages_from_original( &self, package_id: Address, ) -> impl Future<Output = Result<impl Iterator<Item = (Address, u64)>, Error<<Self as GraphQlClient>::Error>>> + Send

Get all the package ids and versions given the original package id.

Source

fn packages_published_epoch( &self, package_ids: Vec<Address>, ) -> impl Future<Output = Result<impl Iterator<Item = (Address, u64, u64)>, Error<<Self as GraphQlClient>::Error>>> + Send

The epoch and checkpoint number (in this order) for each package id.

Source

fn reference_gas_price( &self, ) -> impl Future<Output = Result<u64, Error<<Self as GraphQlClient>::Error>>> + Send

The reference gas price for the latest epoch.

Source

fn transaction_blocks_status( &self, transaction_digests: Vec<String>, ) -> impl Future<Output = Result<impl Iterator<Item = Result<(String, bool), Error>>, Error<<Self as GraphQlClient>::Error>>> + Send

Get execution status for the input transaction digests

Source

fn gas_payment( &self, sponsor: Address, budget: u64, exclude: Vec<Address>, ) -> impl Future<Output = Result<Vec<ObjectRef>, GasPaymentError<Self::Error>>> + Send

Gas coins to satisfy the budget, excluding some object ids.

The exclude is here because it can be useful if a SUI coin is already being used in the PTB itself. However in such a scenario one can use Argument::Gas instead.

Source

fn max_page_size( &self, ) -> impl Future<Output = Result<i32, Error<<Self as GraphQlClient>::Error>>> + Send

The maximum size for pagination allowed by the server.

Source

fn object_type( &self, id: Address, ) -> impl Future<Output = Result<StructTag, Error<<Self as GraphQlClient>::Error>>> + Send

Struct type of an object given its ID.

Source

fn coin_metadata( &self, type_: &str, ) -> impl Future<Output = Result<(Option<u8>, Option<String>, Option<String>), Error<<Self as GraphQlClient>::Error>>> + Send

Fetches metadata for the given coin type

Returns a tuple containing (decimals, name, symbol)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§