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:
Niklas Adolfsson
2021-03-08 11:52:23 +01:00
committed by GitHub
parent c4405c40ad
commit a920e34c20
8 changed files with 393 additions and 207 deletions
+10 -2
View File
@@ -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;