-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
More flexible block identification was added in utxorpc/spec#154, allowing BlockRef to use any combination of slot, hash, height, and timestamp. This isn't made accessible to end users though, since the SDK helper methods (followTip, fetchBlock, fetchHistory, etc.) still only accept ChainPoint.
I would propose having these methods accept some union type of sync.BlockRef (or watch.BlockRef, I think they're the same) and ChainPoint, something like:
type BlockRefLike = ChainPoint | sync.BlockRef;
function blockRefLikeToBlockRef(p: BlockRefLike) {
if (p instanceof sync.BlockRef) return p;
return new sync.BlockRef({
slot: BigInt(p.slot),
hash: new Uint8Array(Buffer.from(p.hash, "hex")),
});
}
async *followTip(intersect?: BlockRefLike[]): AsyncIterable<TipEvent> { ... }This change would maintain backwards compatibility, if that's important here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels