Skip to content

Commit

Permalink
chore(gsdk): rename module types to subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop committed Jul 25, 2023
1 parent 625b786 commit eb39763
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions gsdk/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use crate::{client::RpcClient, config::GearConfig, signer::Signer, types, Result};
use crate::{client::RpcClient, config::GearConfig, signer::Signer, Blocks, Events, Result};
use core::ops::{Deref, DerefMut};
use std::sync::Arc;
use subxt::OnlineClient;
Expand Down Expand Up @@ -52,22 +52,22 @@ impl Api {
}

/// Subscribe all blocks
pub async fn blocks(&self) -> Result<types::Blocks> {
pub async fn blocks(&self) -> Result<Blocks> {
Ok(self.client.blocks().subscribe_all().await?.into())
}

/// Subscribe finalized blocks
pub async fn finalized_blocks(&self) -> Result<types::Blocks> {
pub async fn finalized_blocks(&self) -> Result<Blocks> {
Ok(self.client.blocks().subscribe_finalized().await?.into())
}

/// Subscribe all events
pub async fn events(&self) -> Result<types::Events> {
pub async fn events(&self) -> Result<Events> {
Ok(self.client.blocks().subscribe_all().await?.into())
}

/// Subscribe finalized events
pub async fn finalized_events(&self) -> Result<types::Events> {
pub async fn finalized_events(&self) -> Result<Events> {
Ok(self.client.blocks().subscribe_finalized().await?.into())
}

Expand Down
4 changes: 3 additions & 1 deletion gsdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
//! Gear api
pub use crate::{
api::Api,
metadata::Event,
result::{Error, Result},
signer::PairSigner,
subscription::{Blocks, Events},
};
use crate::{
config::GearConfig,
Expand Down Expand Up @@ -50,8 +52,8 @@ pub mod result;
mod rpc;
pub mod signer;
mod storage;
pub mod subscription;
pub mod testing;
pub mod types;
mod utils;

pub mod ext {
Expand Down
File renamed without changes.

0 comments on commit eb39763

Please sign in to comment.