import "../_dnt.polyfills.js"; import { hex } from "../crypto/mod.js" import { known } from "../rpc/mod.js" import { ArrayRune, is, Rune } from "../rune/mod.js" import { ValueRune } from "../rune/ValueRune.js" import { BlockHashRune } from "./BlockHashRune.js" import { Chain } from "./ChainRune.js" import { EventsRune } from "./EventsRune.js" import { PatternRune } from "./PatternRune.js" export class BlockRune extends PatternRune> { hash = this.parent header() { return this.into(ValueRune).access("block", "header") } extrinsicsRaw() { return this.into(ValueRune).access("block", "extrinsics") } extrinsics() { return this .extrinsicsRaw() .into(ArrayRune) .mapArray((h) => this.chain.$extrinsic.decoded(h.map(hex.decode))) } events() { return this.chain .pallet("System") .storage("Events") .value(undefined!, this.parent) .handle( is(undefined), () => Rune.constant([]).unsafeAs>(), ) .into(EventsRune, this.chain) } }