mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
Convert all UK spelling to US (#2138)
* all the ise * forgot a misspelling * a few more replacements * bump impl * rollback and fixes * bump impl again * Add aliases for RPC * Update on_demand.rs
This commit is contained in:
@@ -57,9 +57,9 @@ pub trait ChainApi<Number, Hash, Header, SignedBlock> {
|
||||
#[rpc(name = "chain_getBlockHash", alias("chain_getHead"))]
|
||||
fn block_hash(&self, hash: Option<number::NumberOrHex<Number>>) -> Result<Option<Hash>>;
|
||||
|
||||
/// Get hash of the last finalised block in the canon chain.
|
||||
#[rpc(name = "chain_getFinalisedHead")]
|
||||
fn finalised_head(&self) -> Result<Hash>;
|
||||
/// Get hash of the last finalized block in the canon chain.
|
||||
#[rpc(name = "chain_getFinalizedHead", alias("chain_getFinalisedHead"))]
|
||||
fn finalized_head(&self) -> Result<Hash>;
|
||||
|
||||
/// New head subscription
|
||||
#[pubsub(
|
||||
@@ -81,19 +81,21 @@ pub trait ChainApi<Number, Hash, Header, SignedBlock> {
|
||||
|
||||
/// New head subscription
|
||||
#[pubsub(
|
||||
subscription = "chain_finalisedHead",
|
||||
subscription = "chain_finalizedHead",
|
||||
subscribe,
|
||||
name = "chain_subscribeFinalisedHeads"
|
||||
name = "chain_subscribeFinalizedHeads",
|
||||
alias("chain_subscribeFinalisedHeads")
|
||||
)]
|
||||
fn subscribe_finalised_heads(&self, metadata: Self::Metadata, subscriber: Subscriber<Header>);
|
||||
fn subscribe_finalized_heads(&self, metadata: Self::Metadata, subscriber: Subscriber<Header>);
|
||||
|
||||
/// Unsubscribe from new head subscription.
|
||||
#[pubsub(
|
||||
subscription = "chain_finalisedHead",
|
||||
subscription = "chain_finalizedHead",
|
||||
unsubscribe,
|
||||
name = "chain_unsubscribeFinalisedHeads"
|
||||
name = "chain_unsubscribeFinalizedHeads",
|
||||
alias("chain_unsubscribeFinalisedHeads")
|
||||
)]
|
||||
fn unsubscribe_finalised_heads(&self, metadata: Option<Self::Metadata>, id: SubscriptionId) -> RpcResult<bool>;
|
||||
fn unsubscribe_finalized_heads(&self, metadata: Option<Self::Metadata>, id: SubscriptionId) -> RpcResult<bool>;
|
||||
}
|
||||
|
||||
/// Chain API with subscriptions support.
|
||||
@@ -192,7 +194,7 @@ impl<B, E, Block, RA> ChainApi<NumberFor<Block>, Block::Hash, Block::Header, Sig
|
||||
})
|
||||
}
|
||||
|
||||
fn finalised_head(&self) -> Result<Block::Hash> {
|
||||
fn finalized_head(&self) -> Result<Block::Hash> {
|
||||
Ok(self.client.info()?.chain.finalized_hash)
|
||||
}
|
||||
|
||||
@@ -210,7 +212,7 @@ impl<B, E, Block, RA> ChainApi<NumberFor<Block>, Block::Hash, Block::Header, Sig
|
||||
Ok(self.subscriptions.cancel(id))
|
||||
}
|
||||
|
||||
fn subscribe_finalised_heads(&self, _meta: Self::Metadata, subscriber: Subscriber<Block::Header>) {
|
||||
fn subscribe_finalized_heads(&self, _meta: Self::Metadata, subscriber: Subscriber<Block::Header>) {
|
||||
self.subscribe_headers(
|
||||
subscriber,
|
||||
|| Ok(Some(self.client.info()?.chain.finalized_hash)),
|
||||
@@ -219,7 +221,7 @@ impl<B, E, Block, RA> ChainApi<NumberFor<Block>, Block::Hash, Block::Header, Sig
|
||||
)
|
||||
}
|
||||
|
||||
fn unsubscribe_finalised_heads(&self, _metadata: Option<Self::Metadata>, id: SubscriptionId) -> RpcResult<bool> {
|
||||
fn unsubscribe_finalized_heads(&self, _metadata: Option<Self::Metadata>, id: SubscriptionId) -> RpcResult<bool> {
|
||||
Ok(self.subscriptions.cancel(id))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ fn should_return_block_hash() {
|
||||
|
||||
|
||||
#[test]
|
||||
fn should_return_finalised_hash() {
|
||||
fn should_return_finalized_hash() {
|
||||
let core = ::tokio::runtime::Runtime::new().unwrap();
|
||||
let remote = core.executor();
|
||||
|
||||
@@ -167,23 +167,23 @@ fn should_return_finalised_hash() {
|
||||
};
|
||||
|
||||
assert_matches!(
|
||||
client.finalised_head(),
|
||||
client.finalized_head(),
|
||||
Ok(ref x) if x == &client.client.genesis_hash()
|
||||
);
|
||||
|
||||
// import new block
|
||||
let builder = client.client.new_block().unwrap();
|
||||
client.client.import(BlockOrigin::Own, builder.bake().unwrap()).unwrap();
|
||||
// no finalisation yet
|
||||
// no finalization yet
|
||||
assert_matches!(
|
||||
client.finalised_head(),
|
||||
client.finalized_head(),
|
||||
Ok(ref x) if x == &client.client.genesis_hash()
|
||||
);
|
||||
|
||||
// finalise
|
||||
// finalize
|
||||
client.client.finalize_block(BlockId::number(1), None, true).unwrap();
|
||||
assert_matches!(
|
||||
client.finalised_head(),
|
||||
client.finalized_head(),
|
||||
Ok(ref x) if x == &client.client.block_hash(1).unwrap().unwrap()
|
||||
);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ fn should_notify_about_latest_block() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_notify_about_finalised_block() {
|
||||
fn should_notify_about_finalized_block() {
|
||||
let mut core = ::tokio::runtime::Runtime::new().unwrap();
|
||||
let remote = core.executor();
|
||||
let (subscriber, id, transport) = Subscriber::new_test("test");
|
||||
@@ -231,7 +231,7 @@ fn should_notify_about_finalised_block() {
|
||||
subscriptions: Subscriptions::new(remote),
|
||||
};
|
||||
|
||||
api.subscribe_finalised_heads(Default::default(), subscriber);
|
||||
api.subscribe_finalized_heads(Default::default(), subscriber);
|
||||
|
||||
// assert id assigned
|
||||
assert_eq!(core.block_on(id), Ok(Ok(SubscriptionId::Number(1))));
|
||||
|
||||
Reference in New Issue
Block a user