Skip to content

Commit

Permalink
Exposed all rust SDK primitives (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
markopoloparadox authored Aug 23, 2024
1 parent 316414b commit c69585e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
8 changes: 4 additions & 4 deletions avail-rust/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::primitives;
use crate::{DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder, AvailHeader};
use subxt::{
backend::legacy::rpc_methods::{Block as BlockRPC, BlockDetails as BlockDetailsRPC},
blocks::BlocksClient,
Expand Down Expand Up @@ -30,11 +30,11 @@ pub type AvailBlockRPC = BlockRPC<AvailConfig>;

/// A struct representing the signed extra and additional parameters required
/// to construct a transaction for a avail node.
pub type AvailExtrinsicParams<T> = primitives::DefaultExtrinsicParams<T>;
pub type AvailExtrinsicParams<T> = DefaultExtrinsicParams<T>;

/// A builder which leads to [`PolkadotExtrinsicParams`] being constructed.
/// This is what you provide to methods like `sign_and_submit()`.
pub type AvailExtrinsicParamsBuilder<T> = primitives::DefaultExtrinsicParamsBuilder<T>;
pub type AvailExtrinsicParamsBuilder<T> = DefaultExtrinsicParamsBuilder<T>;

#[derive(Clone, Copy, Default, Debug)]
pub struct AppId(pub avail_core::AppId);
Expand All @@ -54,7 +54,7 @@ impl Config for AvailConfig {
type ExtrinsicParams = AvailExtrinsicParams<Self>;
type Hash = BlockHash;
type Hasher = BlakeTwo256;
type Header = primitives::AvailHeader;
type Header = AvailHeader;
type Signature = Signature;
type AssetId = u32;
}
5 changes: 3 additions & 2 deletions avail-rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
mod api_dev;
mod config;
mod from_substrate;
mod primitives;
mod rpcs;
mod sdk;
mod transactions;
mod utils;

// Export types for internal and external consumption
pub mod transaction_data;
pub mod primitives;

pub type RewardDestination =
api_dev::api::runtime_types::pallet_staking::RewardDestination<AccountId>;
Expand All @@ -22,7 +22,6 @@ pub use subxt_signer::{sr25519::Keypair, SecretUri};

pub use api_dev::api as avail;
pub use config::*;
pub use primitives::*;
pub use sdk::{WaitFor, SDK};

pub use avail_core;
Expand All @@ -31,3 +30,5 @@ pub use subxt;
pub use subxt::config::polkadot::U256;
pub use utils::utils_raw;
pub use utils::FetchTransactionError;
pub use primitives::block::{AvailHeader, AppUncheckedExtrinsic, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder};
pub use primitives::kate::{Cell, GDataProof, GRow};
6 changes: 3 additions & 3 deletions avail-rust/src/primitives/block/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod extrinsics;
mod extrinsics_params;
mod header;
pub mod extrinsics;
pub mod extrinsics_params;
pub mod header;

pub use extrinsics::AppUncheckedExtrinsic;
pub use extrinsics_params::{DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder};
Expand Down
9 changes: 2 additions & 7 deletions avail-rust/src/primitives/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
mod block;
mod kate;

pub use block::{
AppUncheckedExtrinsic, AvailHeader, DefaultExtrinsicParams, DefaultExtrinsicParamsBuilder,
};
pub use kate::*;
pub mod block;
pub mod kate;

0 comments on commit c69585e

Please sign in to comment.