pub struct TangleClient {
pub config: BlueprintEnvironment,
/* private fields */
}
Fields§
§config: BlueprintEnvironment
Implementations§
Source§impl TangleClient
impl TangleClient
Sourcepub async fn new(config: BlueprintEnvironment) -> Result<Self, Error>
pub async fn new(config: BlueprintEnvironment) -> Result<Self, Error>
Create a new Tangle runtime client from an existing BlueprintEnvironment
.
§Errors
See Keystore::new()
See Self::with_keystore()
Sourcepub async fn with_keystore(
config: BlueprintEnvironment,
keystore: Keystore,
) -> Result<Self, Error>
pub async fn with_keystore( config: BlueprintEnvironment, keystore: Keystore, ) -> Result<Self, Error>
Create a new Tangle runtime client from an existing BlueprintEnvironment
and a Keystore
.
§Errors
Sourcepub fn services_client(&self) -> &TangleServicesClient<PolkadotConfig>
pub fn services_client(&self) -> &TangleServicesClient<PolkadotConfig>
Get the associated TangleServicesClient
pub fn subxt_client(&self) -> &OnlineClient
pub fn runtime_api( &self, at: [u8; 32], ) -> RuntimeApi<TangleConfig, OnlineClient>
pub fn account_id(&self) -> &AccountId32
Sourcepub async fn operator_metadata(
&self,
operator: AccountId32,
) -> Result<Option<OperatorMetadata<AccountId32, Balance, AssetId, MaxDelegations, MaxOperatorBlueprints>>, Error>
pub async fn operator_metadata( &self, operator: AccountId32, ) -> Result<Option<OperatorMetadata<AccountId32, Balance, AssetId, MaxDelegations, MaxOperatorBlueprints>>, Error>
Get metadata
for an operator by Account ID
Sourcepub async fn get_party_index_and_operators(
&self,
) -> Result<(usize, BTreeMap<AccountId32, Public>), Error>
pub async fn get_party_index_and_operators( &self, ) -> Result<(usize, BTreeMap<AccountId32, Public>), Error>
Retrieves the current party index and operator mapping
§Errors
Returns an error if:
- Failed to retrieve operator keys
- Current party is not found in the operator list
pub async fn now(&self) -> Option<[u8; 32]>
Methods from Deref<Target = TangleServicesClient<TangleConfig>>§
Sourcepub async fn get_blueprint_by_id(
&self,
at: [u8; 32],
blueprint_id: u64,
) -> Result<Option<ServiceBlueprint>>
pub async fn get_blueprint_by_id( &self, at: [u8; 32], blueprint_id: u64, ) -> Result<Option<ServiceBlueprint>>
Get the Blueprint with the given ID at the given block
§Errors
Returns an error if the Blueprint could not be fetched
Sourcepub async fn query_operator_blueprints(
&self,
at_block: [u8; 32],
address: AccountId32,
) -> Result<Vec<RpcServicesWithBlueprint>>
pub async fn query_operator_blueprints( &self, at_block: [u8; 32], address: AccountId32, ) -> Result<Vec<RpcServicesWithBlueprint>>
Get the Blueprints provided by the operator at address
§Errors
Returns an error if the Blueprints could not be fetched
Sourcepub async fn current_blueprint_owner(
&self,
at: [u8; 32],
blueprint_id: u64,
) -> Result<AccountId32>
pub async fn current_blueprint_owner( &self, at: [u8; 32], blueprint_id: u64, ) -> Result<AccountId32>
Query the current Blueprint owner
Sourcepub async fn current_service_operators(
&self,
at: [u8; 32],
service_id: u64,
) -> Result<Vec<(AccountId32, Vec<AssetSecurityCommitment<u128>>)>>
pub async fn current_service_operators( &self, at: [u8; 32], service_id: u64, ) -> Result<Vec<(AccountId32, Vec<AssetSecurityCommitment<u128>>)>>
Get the current service operators with their restake exposure
Sourcepub async fn current_service_request_arguments(
&self,
service_id: u64,
) -> Result<RequestArgs>
pub async fn current_service_request_arguments( &self, service_id: u64, ) -> Result<RequestArgs>
Get the current service operators with their restake exposure
Methods from Deref<Target = OnlineClient<C>>§
Sourcepub fn updater(&self) -> ClientRuntimeUpdater<T>
pub fn updater(&self) -> ClientRuntimeUpdater<T>
Create an object which can be used to keep the runtime up to date in a separate thread.
§Example
use subxt::{ OnlineClient, PolkadotConfig };
let client = OnlineClient::<PolkadotConfig>::new().await.unwrap();
// high level API.
let update_task = client.updater();
tokio::spawn(async move {
update_task.perform_runtime_updates().await;
});
// low level API.
let updater = client.updater();
tokio::spawn(async move {
let mut update_stream = updater.runtime_updates().await.unwrap();
while let Some(Ok(update)) = update_stream.next().await {
let version = update.runtime_version().spec_version;
match updater.apply_update(update) {
Ok(()) => {
println!("Upgrade to version: {} successful", version)
}
Err(e) => {
println!("Upgrade to version {} failed {:?}", version, e);
}
};
}
});
Sourcepub fn set_metadata(&self, metadata: impl Into<Metadata>)
pub fn set_metadata(&self, metadata: impl Into<Metadata>)
Sourcepub fn genesis_hash(&self) -> <T as Config>::Hash
pub fn genesis_hash(&self) -> <T as Config>::Hash
Return the genesis hash.
Sourcepub fn set_genesis_hash(&self, genesis_hash: <T as Config>::Hash)
pub fn set_genesis_hash(&self, genesis_hash: <T as Config>::Hash)
Change the genesis hash used in this client.
§Warning
Setting a custom genesis hash may leave Subxt unable to submit valid transactions.
Sourcepub fn runtime_version(&self) -> RuntimeVersion
pub fn runtime_version(&self) -> RuntimeVersion
Return the runtime version.
Sourcepub fn set_runtime_version(&self, runtime_version: RuntimeVersion)
pub fn set_runtime_version(&self, runtime_version: RuntimeVersion)
Change the RuntimeVersion
used in this client.
§Warning
Setting a custom runtime version may leave Subxt unable to submit valid transactions.
Sourcepub fn backend(&self) -> &(dyn Backend<T> + 'static)
pub fn backend(&self) -> &(dyn Backend<T> + 'static)
Return an RPC client to make raw requests with.
Sourcepub fn offline(&self) -> OfflineClient<T>
pub fn offline(&self) -> OfflineClient<T>
Return an offline client with the same configuration as this.
Sourcepub fn tx(&self) -> TxClient<T, OnlineClient<T>>
pub fn tx(&self) -> TxClient<T, OnlineClient<T>>
Work with transactions.
Sourcepub fn events(&self) -> EventsClient<T, OnlineClient<T>>
pub fn events(&self) -> EventsClient<T, OnlineClient<T>>
Work with events.
Sourcepub fn storage(&self) -> StorageClient<T, OnlineClient<T>>
pub fn storage(&self) -> StorageClient<T, OnlineClient<T>>
Work with storage.
Sourcepub fn constants(&self) -> ConstantsClient<T, OnlineClient<T>>
pub fn constants(&self) -> ConstantsClient<T, OnlineClient<T>>
Access constants.
Sourcepub fn custom_values(&self) -> CustomValuesClient<T, OnlineClient<T>>
pub fn custom_values(&self) -> CustomValuesClient<T, OnlineClient<T>>
Access custom types.
Sourcepub fn blocks(&self) -> BlocksClient<T, OnlineClient<T>>
pub fn blocks(&self) -> BlocksClient<T, OnlineClient<T>>
Work with blocks.
Sourcepub fn runtime_api(&self) -> RuntimeApiClient<T, OnlineClient<T>>
pub fn runtime_api(&self) -> RuntimeApiClient<T, OnlineClient<T>>
Work with runtime API.
Trait Implementations§
Source§impl BlueprintServicesClient for TangleClient
impl BlueprintServicesClient for TangleClient
Source§async fn get_operators(
&self,
) -> Result<OperatorSet<Self::PublicAccountIdentity, Self::PublicApplicationIdentity>, Self::Error>
async fn get_operators( &self, ) -> Result<OperatorSet<Self::PublicAccountIdentity, Self::PublicApplicationIdentity>, Self::Error>
Retrieves the ECDSA keys for all current service operators
§Errors
Returns an error if:
- Failed to connect to the Tangle client
- Failed to retrieve operator information
- Missing ECDSA key for any operator
Source§async fn blueprint_id(&self) -> Result<Self::Id, Self::Error>
async fn blueprint_id(&self) -> Result<Self::Id, Self::Error>
Retrieves the current blueprint ID from the configuration
§Errors
Returns an error if the blueprint ID is not found in the configuration
Source§type PublicApplicationIdentity = CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>
type PublicApplicationIdentity = CryptoBytes<sp_core::::ecdsa::Public::{constant#0}, (PublicTag, EcdsaTag)>
Source§type PublicAccountIdentity = AccountId32
type PublicAccountIdentity = AccountId32
PublicApplicationIdentity
,
but may be cryptographically related thereto. E.g., AccountId32type Error = Error
Source§async fn operator_id(
&self,
) -> Result<Self::PublicApplicationIdentity, Self::Error>
async fn operator_id( &self, ) -> Result<Self::PublicApplicationIdentity, Self::Error>
Source§async fn get_operators_and_operator_id(
&self,
) -> Result<(BTreeMap<usize, Self::PublicApplicationIdentity>, usize), Self::Error>
async fn get_operators_and_operator_id( &self, ) -> Result<(BTreeMap<usize, Self::PublicApplicationIdentity>, usize), Self::Error>
Source§impl Clone for TangleClient
impl Clone for TangleClient
Source§fn clone(&self) -> TangleClient
fn clone(&self) -> TangleClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Deref for TangleClient
impl Deref for TangleClient
Source§type Target = TangleServicesClient<PolkadotConfig>
type Target = TangleServicesClient<PolkadotConfig>
Source§impl EventsClient<TangleEvent> for TangleClient
impl EventsClient<TangleEvent> for TangleClient
Source§async fn next_event(&self) -> Option<TangleEvent>
async fn next_event(&self) -> Option<TangleEvent>
Source§async fn latest_event(&self) -> Option<TangleEvent>
async fn latest_event(&self) -> Option<TangleEvent>
Auto Trait Implementations§
impl Freeze for TangleClient
impl !RefUnwindSafe for TangleClient
impl Send for TangleClient
impl Sync for TangleClient
impl Unpin for TangleClient
impl !UnwindSafe for TangleClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoJobMetadata for T
impl<T> IntoJobMetadata for T
Source§fn into_job_metadata(self) -> JobMetadata
fn into_job_metadata(self) -> JobMetadata
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
Source§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.