mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 10:21:05 +00:00
integration with jsonrpsee v2 (#214)
* hacky integration with jsonrpsee v2 * stray todos * fmt * add http support * make test build compile * Update src/rpc.rs * bring back set_client * use crates.io version jsonrpsee * WIP: workaround for embedded subxt client (#236) * workaround for embedded subxt client Signed-off-by: Gregory Hill <gregorydhill@outlook.com> * increase default channel size on subxt client Signed-off-by: Gregory Hill <gregorydhill@outlook.com> * remove client tests due to inference problem on From Signed-off-by: Gregory Hill <gregorydhill@outlook.com> * add comments for missing impls * more verbose errors * make subscription notifs buffer bigger * fmt Co-authored-by: Greg Hill <gregorydhill@outlook.com>
This commit is contained in:
+10
-2
@@ -14,7 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use jsonrpsee::client::Subscription;
|
||||
use jsonrpsee_types::error::Error as RpcError;
|
||||
use jsonrpsee_ws_client::WsSubscription as Subscription;
|
||||
use sp_core::storage::StorageChangeSet;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
@@ -86,7 +87,14 @@ impl<'a, T: Runtime> EventSubscription<'a, T> {
|
||||
if self.finished {
|
||||
return None
|
||||
}
|
||||
let change_set = self.subscription.next().await;
|
||||
let change_set = match self.subscription.next().await {
|
||||
Some(c) => c,
|
||||
None => {
|
||||
return Some(Err(
|
||||
RpcError::Custom("RPC subscription dropped".into()).into()
|
||||
))
|
||||
}
|
||||
};
|
||||
if let Some(hash) = self.block.as_ref() {
|
||||
if &change_set.block == hash {
|
||||
self.finished = true;
|
||||
|
||||
Reference in New Issue
Block a user