mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
Rename traits to remove T suffix (#1535)
* Rename traits to renmove T suffix * Fix doc links * Fix straggler doc links
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::client::OfflineClientT;
|
||||
use crate::{Config, Error};
|
||||
use derive_where::derive_where;
|
||||
|
||||
use subxt_core::custom_values::address::{AddressT, Yes};
|
||||
use subxt_core::custom_values::address::{Address, Yes};
|
||||
|
||||
/// A client for accessing custom values stored in the metadata.
|
||||
#[derive_where(Clone; Client)]
|
||||
@@ -24,25 +24,22 @@ impl<T, Client> CustomValuesClient<T, Client> {
|
||||
impl<T: Config, Client: OfflineClientT<T>> CustomValuesClient<T, Client> {
|
||||
/// Access a custom value by the address it is registered under. This can be just a [str] to get back a dynamic value,
|
||||
/// or a static address from the generated static interface to get a value of a static type returned.
|
||||
pub fn at<Address: AddressT<IsDecodable = Yes> + ?Sized>(
|
||||
pub fn at<Addr: Address<IsDecodable = Yes> + ?Sized>(
|
||||
&self,
|
||||
address: &Address,
|
||||
) -> Result<Address::Target, Error> {
|
||||
address: &Addr,
|
||||
) -> Result<Addr::Target, Error> {
|
||||
subxt_core::custom_values::get(address, &self.client.metadata()).map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Access the bytes of a custom value by the address it is registered under.
|
||||
pub fn bytes_at<Address: AddressT + ?Sized>(
|
||||
&self,
|
||||
address: &Address,
|
||||
) -> Result<Vec<u8>, Error> {
|
||||
pub fn bytes_at<Addr: Address + ?Sized>(&self, address: &Addr) -> Result<Vec<u8>, Error> {
|
||||
subxt_core::custom_values::get_bytes(address, &self.client.metadata()).map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Run the validation logic against some custom value address you'd like to access. Returns `Ok(())`
|
||||
/// if the address is valid (or if it's not possible to check since the address has no validation hash).
|
||||
/// Returns an error if the address was not valid (wrong name, type or raw bytes)
|
||||
pub fn validate<Address: AddressT + ?Sized>(&self, address: &Address) -> Result<(), Error> {
|
||||
pub fn validate<Addr: Address + ?Sized>(&self, address: &Addr) -> Result<(), Error> {
|
||||
subxt_core::custom_values::validate(address, &self.client.metadata()).map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user