Struct Arweave

Source
pub struct Arweave {
    pub name: String,
    pub units: String,
    pub base_url: Url,
    pub crypto: Provider,
}
Expand description

Struct with methods for interacting with the Arweave network.

Fields§

§name: String§units: String§base_url: Url§crypto: Provider

Implementations§

Source§

impl Arweave

Source

pub async fn from_keypair_path( keypair_path: PathBuf, base_url: Url, ) -> Result<Arweave, Error>

Source

pub fn from_keypair_path_sync( keypair_path: PathBuf, base_url: Url, ) -> Result<Arweave, Error>

Source

pub async fn get_pending_count(&self) -> Result<usize, Error>

Get pending network transaction count.

Source

pub async fn get_price( &self, bytes: &u64, ) -> Result<(BigUint, BigUint, BigUint), Error>

Returns price of uploading data to the network in winstons and USD per AR and USD per SOL as a BigUint with two decimals.

Source

pub async fn get_price_terms( &self, reward_mult: f32, ) -> Result<(u64, u64), Error>

Gets base and incremental prices for a 256 KB block of data.

Source

pub async fn get_transaction(&self, id: &Base64) -> Result<Transaction, Error>

Gets transaction from the network.

Source

pub async fn get_wallet_balance( &self, wallet_address: Option<String>, ) -> Result<BigUint, Error>

Returns the balance of the wallet.

Source

pub fn chunk_file_paths<IP>( &self, paths_iter: IP, data_size: u64, ) -> Result<Vec<PathsChunk>, Error>
where IP: Iterator<Item = PathBuf> + Send,

Source

pub fn create_bundle_from_data_items( &self, data_items: Vec<(DataItem, Status)>, ) -> Result<(Vec<u8>, Value), Error>

Source

pub async fn create_bundle_transaction_from_file_paths( &self, paths_iter: Vec<PathBuf>, tags: Vec<Tag<String>>, price_terms: (u64, u64), ) -> Result<(Transaction, Value), Error>

Source

pub fn create_data_item( &self, data: Vec<u8>, tags: Vec<Tag<String>>, auto_content_tag: bool, ) -> Result<DataItem, Error>

Source

pub async fn create_data_item_from_file_path( &self, file_path: PathBuf, tags: Vec<Tag<String>>, ) -> Result<(DataItem, Status), Error>

Source

pub async fn create_data_items_from_file_paths( &self, paths: Vec<PathBuf>, tags: Vec<Tag<String>>, ) -> Result<Vec<(DataItem, Status)>, Error>

Source

pub fn deserialize_bundle( &self, bundle: Vec<u8>, ) -> Result<Vec<DataItem>, Error>

Source

pub async fn post_bundle_transaction_from_file_paths( &self, paths_chunk: PathsChunk, tags: Vec<Tag<String>>, price_terms: (u64, u64), buffer: usize, ) -> Result<BundleStatus, Error>

Source

pub async fn post_bundle_transaction_from_file_paths_with_sol( &self, paths_chunk: PathsChunk, tags: Vec<Tag<String>>, price_terms: (u64, u64), chunks_buffer: usize, solana_url: Url, sol_ar_url: Url, from_keypair: &Keypair, ) -> Result<BundleStatus, Error>

Source

pub fn sign_data_item(&self, data_item: DataItem) -> Result<DataItem, Error>

Source

pub async fn create_transaction( &self, data: Vec<u8>, other_tags: Option<Vec<Tag<Base64>>>, last_tx: Option<Base64>, price_terms: (u64, u64), auto_content_tag: bool, ) -> Result<Transaction, Error>

Source

pub async fn create_transaction_from_file_path( &self, file_path: PathBuf, other_tags: Option<Vec<Tag<Base64>>>, last_tx: Option<Base64>, price_terms: (u64, u64), auto_content_tag: bool, ) -> Result<Transaction, Error>

Source

pub fn merklize(&self, data: Vec<u8>) -> Result<Transaction, Error>

Source

pub async fn post_chunk( &self, chunk: &Chunk, client: &Client, ) -> Result<usize, Error>

Source

pub async fn post_chunk_with_retries( &self, chunk: Chunk, client: Client, ) -> Result<usize, Error>

Source

pub async fn post_transaction( &self, signed_transaction: &Transaction, ) -> Result<(Base64, u64), Error>

Source

pub async fn post_transaction_chunks( &self, signed_transaction: Transaction, chunks_buffer: usize, ) -> Result<(Base64, u64), Error>

Source

pub fn sign_transaction( &self, transaction: Transaction, ) -> Result<Transaction, Error>

Gets deep hash, signs and sets signature and id.

Source

pub async fn sign_transaction_with_sol( &self, transaction: Transaction, solana_url: Url, sol_ar_url: Url, from_keypair: &Keypair, ) -> Result<(Transaction, SigResponse), Error>

Signs transaction with sol_ar service.

Source

pub async fn upload_file_from_path( &self, file_path: PathBuf, log_dir: Option<PathBuf>, additional_tags: Option<Vec<Tag<Base64>>>, last_tx: Option<Base64>, price_terms: (u64, u64), ) -> Result<Status, Error>

Source

pub async fn upload_file_from_path_with_sol( &self, file_path: PathBuf, log_dir: Option<PathBuf>, additional_tags: Option<Vec<Tag<Base64>>>, last_tx: Option<Base64>, price_terms: (u64, u64), solana_url: Url, sol_ar_url: Url, from_keypair: &Keypair, ) -> Result<Status, Error>

Source

pub async fn upload_files_from_paths<IP, IT>( &self, paths_iter: IP, log_dir: Option<PathBuf>, tags_iter: Option<IT>, last_tx: Option<Base64>, price_terms: (u64, u64), ) -> Result<Vec<Status>, Error>
where IP: Iterator<Item = PathBuf> + Send, IT: Iterator<Item = Option<Vec<Tag<Base64>>>> + Send,

Uploads files from an iterator of paths.

Optionally logs Status objects to log_dir, if provided and optionally adds tags to each transaction from an iterator of tags that must be the same size as the paths iterator.

Source

pub async fn create_log_dir(&self, parent_dir: &Path) -> Result<PathBuf, Error>

Source

pub fn filter_statuses<S>( &self, all_statuses: Vec<S>, statuses: Option<Vec<StatusCode>>, max_confirms: Option<u64>, ) -> Result<Vec<S>, Error>
where S: Filterable,

Filters saved Status objects by status and/or number of confirmations. Return all statuses if no status codes or maximum confirmations are provided.

If there is no raw status object and max_confirms is passed, it assumes there are zero confirms. This is designed to be used to determine whether all files have a confirmed status and to collect the paths of the files that need to be re-uploaded.

Source

pub async fn get_status(&self, id: &Base64) -> Result<Status, Error>

Gets status from network.

Source

pub async fn read_bundle_status( &self, file_path: PathBuf, ) -> Result<BundleStatus, Error>

Source

pub async fn read_bundle_statuses( &self, log_dir: &str, ) -> Result<Vec<BundleStatus>, Error>

Source

pub async fn status_summary<IP>( &self, paths_iter: IP, log_dir: PathBuf, ) -> Result<String, Error>
where IP: Iterator<Item = PathBuf> + Send,

Source

pub async fn read_status( &self, file_path: PathBuf, log_dir: PathBuf, ) -> Result<Status, Error>

Source

pub async fn read_statuses<IP>( &self, paths_iter: IP, log_dir: PathBuf, ) -> Result<Vec<Status>, Error>
where IP: Iterator<Item = PathBuf> + Send,

Source

pub async fn update_bundle_status( &self, file_path: PathBuf, ) -> Result<BundleStatus, Error>

Source

pub async fn update_status( &self, file_path: PathBuf, log_dir: PathBuf, ) -> Result<Status, Error>

Source

pub async fn update_statuses<IP>( &self, paths_iter: IP, log_dir: PathBuf, ) -> Result<Vec<Status>, Error>
where IP: Iterator<Item = PathBuf> + Send,

Source

pub async fn write_status( &self, status: Status, log_dir: PathBuf, file_stem: Option<String>, ) -> Result<(), Error>

Writes Status Json to log_dir with file name based on BLAKE3 hash of status.file_path.

This is done to facilitate checking the status of uploaded file and also means that only one status object can exist for a given file_path. If for some reason you wanted to record statuses for multiple uploads of the same file you can provide a different log_dir (or copy the file to a different directory and upload from there).

Source

pub fn create_data_item_from_manifest( &self, manifest: Value, ) -> Result<DataItem, Error>

Source

pub fn create_manifest(&self, statuses: Vec<Status>) -> Result<Value, Error>

Source

pub fn create_manifest_from_bundle_statuses( &self, statuses: Vec<BundleStatus>, ) -> Result<Value, Error>

Source

pub async fn create_transaction_from_manifest( &self, manifest: Value, price_terms: (u64, u64), ) -> Result<Transaction, Error>

Source

pub async fn upload_manifest_from_bundle_log_dir( &self, log_dir: &str, price_terms: (u64, u64), solana_url: Url, sol_ar_url: Url, from_keypair: Option<Keypair>, ) -> Result<String, Error>

Source

pub async fn write_manifest( &self, manifest: Value, transaction_id: String, log_dir: PathBuf, ) -> Result<(), Error>

Source

pub async fn read_metadata_file( &self, file_path: PathBuf, ) -> Result<Value, Error>

Source

pub async fn update_metadata_file( &self, file_path: PathBuf, files_array: Vec<Value>, image_link: Option<String>, animation_url_link: Option<String>, ) -> Result<(), Error>

Source

pub async fn update_metadata<IP>( &self, paths_iter: IP, manifest_path: PathBuf, image_link_file: bool, update_image_link: bool, update_animation_url_link: bool, ) -> Result<(), Error>
where IP: Iterator<Item = PathBuf> + Send,

Source

pub async fn write_metaplex_items<IP>( &self, paths_iter: IP, manifest_path: PathBuf, link_file: bool, ) -> Result<PathBuf, Error>
where IP: Iterator<Item = PathBuf> + Send,

Trait Implementations§

Source§

impl Default for Arweave

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AbiExample for T

Source§

default fn example() -> T

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<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> 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, 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,