@bsv/teranode-listener hands callbacks the raw GossipSub bytes (Uint8Array). Those bytes are a two-layer JSON structure: a message-bus envelope { name, data: base64 } (from go-p2p-message-bus) wrapping a topic-specific JSON payload (from services/p2p/message_types.go). Every consumer currently has to reimplement that decode, including the PascalCase vs snake_case difference between block/subtree/rejected-tx and node_status.
Proposal: an opt-in typed decoder in the package, decodeMessage() / tryDecodeMessage() plus typed payload interfaces, and a decodeMessages: true listener flag so callbacks receive a typed DecodedMessage instead of raw bytes. Fully backward compatible (defaults to off).
I have a working implementation verified field-for-field against the current message_types.go and will open a PR.
@bsv/teranode-listenerhands callbacks the raw GossipSub bytes (Uint8Array). Those bytes are a two-layer JSON structure: a message-bus envelope{ name, data: base64 }(from go-p2p-message-bus) wrapping a topic-specific JSON payload (fromservices/p2p/message_types.go). Every consumer currently has to reimplement that decode, including the PascalCase vs snake_case difference between block/subtree/rejected-tx and node_status.Proposal: an opt-in typed decoder in the package,
decodeMessage()/tryDecodeMessage()plus typed payload interfaces, and adecodeMessages: truelistener flag so callbacks receive a typedDecodedMessageinstead of raw bytes. Fully backward compatible (defaults to off).I have a working implementation verified field-for-field against the current
message_types.goand will open a PR.