Skip to content

Instantly share code, notes, and snippets.

from substrateinterface import SubstrateInterface
substrate = SubstrateInterface(
# url="wss://kusama-rpc.polkadot.io",
url="wss://kusama-rpc.dwellir.com",
)
block_number = 16799223
block_hash = substrate.get_block_hash(block_number)
# block_hash = substrate.get_block_header()['header']['number']
@muharem
muharem / gist:24376bcaa4ab19c3e7e0974cbc063648
Last active September 22, 2023 14:15
prefixed result / rust
/// Provides a way to prefix both `Ok` and `Err` variants of a `Result`.
///
/// This trait allows you to attach a prefix to both the `Ok` and `Err` variants
/// of a `Result`, making it easier to track additional contextual information
/// alongside the original result. It is especially handy when `P` does not implement
/// `Clone` and `Copy`.
pub trait PrefixedResult<T, E> {
/// Maps this `Result` to a new `Result` with a prefixed value.
///
/// Takes a value of any type `P` as a prefix and an `FnOnce` closure `O`