mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 16:37:57 +00:00
update jsonrpsee
This commit is contained in:
+2
-2
@@ -22,7 +22,7 @@ use crate::{
|
||||
},
|
||||
Metadata,
|
||||
};
|
||||
use jsonrpsee::types::Error as RequestError;
|
||||
use jsonrpsee::core::Error as RpcError;
|
||||
use sp_core::crypto::SecretStringError;
|
||||
use sp_runtime::{
|
||||
transaction_validity::TransactionValidityError,
|
||||
@@ -41,7 +41,7 @@ pub enum Error {
|
||||
Codec(#[from] codec::Error),
|
||||
/// Rpc error.
|
||||
#[error("Rpc error: {0}")]
|
||||
Rpc(#[from] RequestError),
|
||||
Rpc(#[from] RpcError),
|
||||
/// Serde serialization error
|
||||
#[error("Serde json error: {0}")]
|
||||
Serialization(#[from] serde_json::error::Error),
|
||||
|
||||
+11
-19
@@ -41,22 +41,20 @@ pub use jsonrpsee::{
|
||||
Uri,
|
||||
WsTransportClientBuilder,
|
||||
},
|
||||
core_client::{
|
||||
Client as RpcClient,
|
||||
ClientBuilder as RpcClientBuilder,
|
||||
},
|
||||
rpc_params,
|
||||
types::{
|
||||
to_json_value,
|
||||
traits::{
|
||||
Client,
|
||||
SubscriptionClient,
|
||||
core::{
|
||||
client::{
|
||||
Client as RpcClient,
|
||||
ClientBuilder as RpcClientBuilder,
|
||||
ClientT,
|
||||
Subscription,
|
||||
SubscriptionClientT,
|
||||
},
|
||||
to_json_value,
|
||||
DeserializeOwned,
|
||||
Error as RpcError,
|
||||
JsonValue,
|
||||
Subscription,
|
||||
},
|
||||
rpc_params,
|
||||
};
|
||||
use serde::{
|
||||
Deserialize,
|
||||
@@ -488,10 +486,10 @@ impl<T: Config> Rpc<T> {
|
||||
}?;
|
||||
let mut xt_sub = self.watch_extrinsic(extrinsic).await?;
|
||||
|
||||
while let Ok(Some(status)) = xt_sub.next().await {
|
||||
while let Some(status) = xt_sub.next().await {
|
||||
log::info!("Received status {:?}", status);
|
||||
let status = status?;
|
||||
match status {
|
||||
// ignore in progress extrinsic for now
|
||||
TransactionStatus::Future
|
||||
| TransactionStatus::Ready
|
||||
| TransactionStatus::Broadcast(_)
|
||||
@@ -640,12 +638,6 @@ impl<T: Config> ExtrinsicSuccess<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Example to check that `From<(Sender, Receiver) for RpcClient` works.
|
||||
pub async fn build_ws_client_default(url: &str) -> Result<RpcClient, RpcError> {
|
||||
let client = ws_transport(url).await?.into();
|
||||
Ok(client)
|
||||
}
|
||||
|
||||
/// Build WS RPC client from URL
|
||||
pub async fn build_ws_client(url: &str) -> Result<RpcClient, RpcError> {
|
||||
let (sender, receiver) = ws_transport(url).await?;
|
||||
|
||||
+4
-7
@@ -14,10 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use jsonrpsee::types::{
|
||||
DeserializeOwned,
|
||||
Subscription,
|
||||
};
|
||||
use jsonrpsee::core::{DeserializeOwned, client::Subscription};
|
||||
use sp_core::{
|
||||
storage::{
|
||||
StorageChangeSet,
|
||||
@@ -253,9 +250,9 @@ where
|
||||
T: DeserializeOwned,
|
||||
{
|
||||
match sub.next().await {
|
||||
Ok(Some(next)) => Some(next),
|
||||
Ok(None) => None,
|
||||
Err(e) => {
|
||||
None => None,
|
||||
Some(Ok(next)) => Some(next),
|
||||
Some(Err(e)) => {
|
||||
log::error!("Subscription {} failed: {:?} dropping", sub_name, e);
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user