change types of block number and returned keys (#320)

This commit is contained in:
Hanyun Xu 2021-06-22 04:56:10 -07:00 committed by GitHub
parent ce20e312e3
commit 2a513f88d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -565,12 +565,12 @@ pub trait Middleware: Sync + Send + Debug {
#[cfg(feature = "celo")] #[cfg(feature = "celo")]
#[async_trait] #[async_trait]
pub trait CeloMiddleware: Middleware { pub trait CeloMiddleware: Middleware {
async fn get_validators_bls_public_keys( async fn get_validators_bls_public_keys<T: Into<BlockId> + Send + Sync>(
&self, &self,
block: Option<BlockId>, block_id: T,
) -> Result<Vec<Vec<u8>>, ProviderError> { ) -> Result<Vec<String>, ProviderError> {
self.provider() self.provider()
.get_validators_bls_public_keys(block) .get_validators_bls_public_keys(block_id)
.await .await
.map_err(FromErr::from) .map_err(FromErr::from)
} }

View File

@ -155,12 +155,12 @@ impl<P: JsonRpcClient> Provider<P> {
#[cfg(feature = "celo")] #[cfg(feature = "celo")]
#[async_trait] #[async_trait]
impl<P: JsonRpcClient> CeloMiddleware for Provider<P> { impl<P: JsonRpcClient> CeloMiddleware for Provider<P> {
async fn get_validators_bls_public_keys( async fn get_validators_bls_public_keys<T: Into<BlockId> + Send + Sync>(
&self, &self,
block: Option<BlockId>, block_id: T,
) -> Result<Vec<Vec<u8>>, ProviderError> { ) -> Result<Vec<String>, ProviderError> {
let block = utils::serialize(&block.unwrap_or_else(|| BlockNumber::Latest.into())); let block_id = utils::serialize(&block_id.into());
self.request("istanbul_getValidatorsBLSPublicKeys", [block]) self.request("istanbul_getValidatorsBLSPublicKeys", [block_id])
.await .await
} }
} }