DataAnchorClient

Struct DataAnchorClient 

Source
pub struct DataAnchorClient<Encoding = Default, Compression = Default>
where Encoding: DataAnchorEncoding + Default, Compression: DataAnchorCompressionAsync,
{ /* private fields */ }

Implementations§

Source§

impl<Encoding, Compression> DataAnchorClient<Encoding, Compression>
where Encoding: DataAnchorEncoding + Default, Compression: DataAnchorCompressionAsync,

Source

pub async fn get_blobs<T>( &self, slot: u64, identifier: BloberIdentifier, ) -> DataAnchorClientResult<Option<Vec<T>>>
where T: Decodable,

Fetches all blobs for a given slot from the IndexerRpcClient.

Source

pub async fn get_blobs_by_blober<T>( &self, identifier: BloberIdentifier, time_range: Option<TimeRange>, ) -> DataAnchorClientResult<Vec<T>>
where T: Decodable,

Fetches blobs for a given blober and time range from the IndexerRpcClient.

Source

pub async fn get_blobs_by_payer<T>( &self, payer: Pubkey, network_name: String, time_range: Option<TimeRange>, ) -> DataAnchorClientResult<Vec<T>>
where T: Decodable,

Fetches blobs for a given payer, network name and time range from the IndexerRpcClient.

Source

pub async fn get_blobs_by_network<T>( &self, network_name: String, time_range: Option<TimeRange>, ) -> DataAnchorClientResult<Vec<T>>
where T: Decodable,

Fetches blobs for a given network and time range from the IndexerRpcClient.

Source

pub async fn get_blobs_by_namespace_for_payer<T>( &self, namespace: String, payer_pubkey: Option<Pubkey>, time_range: Option<TimeRange>, ) -> DataAnchorClientResult<Vec<T>>
where T: Decodable,

Fetches blobs for a given namespace and time range from the IndexerRpcClient.

Source

pub async fn get_payers_by_network( &self, network: String, ) -> DataAnchorClientResult<Vec<PubkeyFromStr>>

Fetches payers for a given network from the IndexerRpcClient.

Source

pub async fn get_proof( &self, slot: u64, identifier: BloberIdentifier, ) -> DataAnchorClientResult<Option<CompoundInclusionProof>>

Fetches compound proof for a given slot from the IndexerRpcClient.

Source

pub async fn get_proof_for_blob( &self, blob: Pubkey, ) -> DataAnchorClientResult<Option<CompoundInclusionProof>>

Fetches compound proof for a given blob PDA Pubkey from the IndexerRpcClient.

Source§

impl<Encoding, Compression> DataAnchorClient<Encoding, Compression>
where Encoding: DataAnchorEncoding + Default, Compression: DataAnchorCompressionAsync,

Source

pub async fn get_ledger_blobs_from_signatures<T>( &self, identifier: BloberIdentifier, signatures: Vec<Signature>, ) -> DataAnchorClientResult<T>
where T: Decodable,

Returns the raw blob data from the ledger for the given signatures.

Source

pub async fn get_ledger_blobs<T>( &self, slot: u64, identifier: BloberIdentifier, lookback_slots: Option<u64>, ) -> DataAnchorClientResult<Vec<T>>
where T: Decodable,

Fetches all blobs finalized in a given slot from the ledger.

Source

pub async fn get_blob_messages( &self, slot: u64, identifier: BloberIdentifier, ) -> DataAnchorClientResult<Vec<(Pubkey, VersionedMessage)>>

Fetches blob messages for a given slot Returns a tuple of (Pubkey, VersionedMessage) where the Pubkey is the address of the data_anchor_blober::state::blob::Blob account and the VersionedMessage is the message that included the data_anchor_blober::instruction::FinalizeBlob instruction.

Source

pub async fn list_blobers( &self, ) -> DataAnchorClientResult<Vec<BloberWithNamespace>>

Lists all blober accounts owned by the payer.

Source

pub async fn get_blober( &self, identifier: BloberIdentifier, ) -> DataAnchorClientResult<Option<Blober>>

Retrieves a blober account by its identifier.

Source

pub async fn get_checkpoint( &self, blober: BloberIdentifier, ) -> DataAnchorClientResult<Option<Checkpoint>>

Retrieves the checkpoint containing the Groth16 proof for a given blober account.

Source§

impl<Encoding, Compression> DataAnchorClient<Encoding, Compression>
where Encoding: DataAnchorEncoding + Default, Compression: DataAnchorCompressionAsync,

Source

pub async fn checkpoint_custom_proof( &self, slot: Slot, identifier: BloberIdentifier, customer_elf: CustomerElf, ) -> DataAnchorClientResult<String>

Requests ZK proof generation on the proof RPC for a given blober, slot and proof type.

Source

pub async fn get_proof_request_status( &self, request_id: String, ) -> DataAnchorClientResult<RequestStatus>

Returns the status of a proof request by its request ID.

Source§

impl<Encoding, Compression> DataAnchorClient<Encoding, Compression>
where Encoding: DataAnchorEncoding + Default, Compression: DataAnchorCompressionAsync,

Source

pub fn builder() -> DataAnchorClientBuilder<Encoding, Compression>

Create an instance of DataAnchorClient using the builder syntax

Source§

impl<Encoding, Compression> DataAnchorClient<Encoding, Compression>
where Encoding: DataAnchorEncoding + Default, Compression: DataAnchorCompressionAsync,

Source

pub fn rpc_client(&self) -> Arc<RpcClient>

Returns the underlaying RpcClient.

Source

pub fn payer(&self) -> Arc<Keypair>

Returns the transaction payer Keypair.

Source

pub async fn encode_and_compress<T>( &self, data: &T, ) -> DataAnchorClientResult<Vec<u8>>
where T: Encodable,

Source

pub async fn decompress_and_decode<T>( &self, bytes: &[u8], ) -> DataAnchorClientResult<T>
where T: Decodable,

Source

pub async fn decompress_and_decode_vec<T>( &self, slice_of_bytes: impl Iterator<Item = &[u8]>, ) -> DataAnchorClientResult<Vec<T>>
where T: Decodable,

Source

pub async fn initialize_blober( &self, fee_strategy: FeeStrategy, identifier: BloberIdentifier, timeout: Option<Duration>, ) -> DataAnchorClientResult<Vec<SuccessfulTransaction<TransactionType>>>

Initializes a new Blober PDA account.

Source

pub async fn close_blober( &self, fee_strategy: FeeStrategy, identifier: BloberIdentifier, timeout: Option<Duration>, ) -> DataAnchorClientResult<Vec<SuccessfulTransaction<TransactionType>>>

Closes a Blober PDA account.

Source

pub async fn upload_blob<T>( &self, blob_data: &T, fee_strategy: FeeStrategy, namespace: &str, timeout: Option<Duration>, ) -> DataAnchorClientResult<(Vec<SuccessfulTransaction<TransactionType>>, Pubkey)>
where T: Encodable,

Uploads a blob of data with the given Blober PDA account. Under the hood it creates a new data_anchor_blober::state::blob::Blob PDA which stores a incremental hash of the chunks from the blob data. On completion of the blob upload, the blob PDA gets closed sending it’s funds back to the DataAnchorClient::payer. If the blob upload fails, the blob PDA gets discarded and the funds also get sent to the DataAnchorClient::payer.

Source

pub async fn discard_blob( &self, fee_strategy: FeeStrategy, blob: Pubkey, namespace: &str, timeout: Option<Duration>, ) -> DataAnchorClientResult<(Vec<SuccessfulTransaction<TransactionType>>, Pubkey)>

Discards a data_anchor_blober::state::blob::Blob PDA account registered with the provided Blober PDA account.

Source

pub async fn configure_checkpoint( &self, fee_strategy: FeeStrategy, identifier: BloberIdentifier, authority: Pubkey, timeout: Option<Duration>, ) -> DataAnchorClientResult<(Vec<SuccessfulTransaction<TransactionType>>, Pubkey)>

Configures a checkpoint for a given blober with the given authority. This allows the authority to create checkpoints for the blober.

Source

pub async fn estimate_fees( &self, blob_size: usize, blober: Pubkey, fee_strategy: FeeStrategy, ) -> DataAnchorClientResult<Fee>

Estimates fees for uploading a blob of the size blob_size with the given priority. This whole functions is basically a simulation that doesn’t run anything. Instead of executing transactions, it just sums the expected fees and number of signatures.

The data_anchor_blober::state::blob::Blob PDA account is always newly created, so for estimating compute fees we don’t even need the real keypair, any unused pubkey will do.

Trait Implementations§

Source§

impl<Encoding, Compression> Clone for DataAnchorClient<Encoding, Compression>
where Encoding: DataAnchorEncoding + Default + Clone, Compression: DataAnchorCompressionAsync + Clone,

Source§

fn clone(&self) -> DataAnchorClient<Encoding, Compression>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<Encoding, Compression> Freeze for DataAnchorClient<Encoding, Compression>
where Encoding: Freeze, Compression: Freeze,

§

impl<Encoding = Postcard, Compression = Lz4Compression> !RefUnwindSafe for DataAnchorClient<Encoding, Compression>

§

impl<Encoding, Compression> Send for DataAnchorClient<Encoding, Compression>
where Encoding: Send,

§

impl<Encoding, Compression> Sync for DataAnchorClient<Encoding, Compression>
where Encoding: Sync,

§

impl<Encoding, Compression> Unpin for DataAnchorClient<Encoding, Compression>
where Encoding: Unpin, Compression: Unpin,

§

impl<Encoding = Postcard, Compression = Lz4Compression> !UnwindSafe for DataAnchorClient<Encoding, Compression>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSend for T
where T: Send,