mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 22:07:58 +00:00
b069c4425a
* WIP second pass over light client code for simpler API * First pass new light client * pub(crate) LightClientRpc::new_raw(), and fmt * Update examples and add back a way to configure boot nodes and fetch chainspec from a URL * Fix light client examples * remove unused deps and tidy lightclient feature flags * fix wasm error * LightClientRpc can be cloned * update light client tests * Other small fixes * exclude mod unless jsonrpsee * Fix wasm-lightclient-tests * add back docsrs bit and web+native feature flag compile error * update book and light client example names * fix docs
41 lines
952 B
Rust
41 lines
952 B
Rust
// Copyright 2019-2023 Parity Technologies (UK) Ltd.
|
|
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
|
// see LICENSE for license details.
|
|
|
|
//! Default platform for WASM environments.
|
|
|
|
#[cfg(feature = "web")]
|
|
mod wasm_helpers;
|
|
#[cfg(feature = "web")]
|
|
mod wasm_platform;
|
|
#[cfg(feature = "web")]
|
|
mod wasm_socket;
|
|
|
|
pub use helpers::{build_platform, DefaultPlatform};
|
|
|
|
#[cfg(feature = "native")]
|
|
mod helpers {
|
|
use smoldot_light::platform::default::DefaultPlatform as Platform;
|
|
use std::sync::Arc;
|
|
|
|
pub type DefaultPlatform = Arc<Platform>;
|
|
|
|
pub fn build_platform() -> DefaultPlatform {
|
|
Platform::new(
|
|
"subxt-light-client".into(),
|
|
env!("CARGO_PKG_VERSION").into(),
|
|
)
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "web")]
|
|
mod helpers {
|
|
use super::wasm_platform::SubxtPlatform as Platform;
|
|
|
|
pub type DefaultPlatform = Platform;
|
|
|
|
pub fn build_platform() -> DefaultPlatform {
|
|
Platform::new()
|
|
}
|
|
}
|