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")]
#[async_trait]
pub trait CeloMiddleware: Middleware {
async fn get_validators_bls_public_keys(
async fn get_validators_bls_public_keys<T: Into<BlockId> + Send + Sync>(
&self,
block: Option<BlockId>,
) -> Result<Vec<Vec<u8>>, ProviderError> {
block_id: T,
) -> Result<Vec<String>, ProviderError> {
self.provider()
.get_validators_bls_public_keys(block)
.get_validators_bls_public_keys(block_id)
.await
.map_err(FromErr::from)
}

View File

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