Introduces Consumers, which provide a standard layer on top of different RPC APIs (the current and the experimental). This will allow us to decouple the fluent API from RPC specifics (and therefore ease the transition to Smoldot). The end DX may look as follows.
import { ParachainRune } from "@capi/parachain"
import { ExperimentalRpc, SmoldotConnection } from "capi"
import { parachainSpec, relayChainSpec } from "./chain_specs.ts"
const api = ParachainRune.from(
new ExperimentalRpc(
SmoldotConnection.bind({ parachainSpec, relayChainSpec }),
signal,
),
)
The ExperimentalRpc (a Consumer) wraps the Connect itself. The consumer is then passed into the chain rune factory, so that the chain rune can operate with an RPC-unspecific API.
For now, the ExperimentalRpc API accepts an additional argument: a non-smoldot Connect. This is necessary for retrieving historical block info. It seems the archive-prefixed methods of the new JSON RPC spec are yet to be implemented for any chains (?). Seems a bit far-fetched... but a GitHub-wide search revealed no such clues.
Heavily WIP
Introduces
Consumer
s, which provide a standard layer on top of different RPC APIs (the current and the experimental). This will allow us to decouple the fluent API from RPC specifics (and therefore ease the transition to Smoldot). The end DX may look as follows.The
ExperimentalRpc
(aConsumer
) wraps theConnect
itself. The consumer is then passed into the chain rune factory, so that the chain rune can operate with an RPC-unspecific API.For now, the
ExperimentalRpc
API accepts an additional argument: a non-smoldotConnect
. This is necessary for retrieving historical block info. It seems thearchive
-prefixed methods of the new JSON RPC spec are yet to be implemented for any chains (?). Seems a bit far-fetched... but a GitHub-wide search revealed no such clues.