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.
More flexible block identification was added in utxorpc/spec#154, allowing
BlockRefto use any combination ofslot,hash,height, andtimestamp. This isn't made accessible to end users though, since the SDK helper methods (followTip,fetchBlock,fetchHistory, etc.) still only acceptChainPoint.I would propose having these methods accept some union type of
sync.BlockRef(orwatch.BlockRef, I think they're the same) andChainPoint, something like:This change would maintain backwards compatibility, if that's important here.