Module: BSV::Wallet::Postgres::DisplayTxid

Included in:
Action, TxProof
Defined in:
lib/bsv/wallet/postgres/display_txid.rb

Overview

Convenience method for models with a wtxid column. Converts wire-order binary wtxid to display-order hex — the human-readable format used by block explorers and external APIs.

Include on any Sequel::Model whose table has a wtxid bytea column.

Instance Method Summary collapse

Instance Method Details

#dtxidString? Also known as: dtxid_hex

Display-order hex transaction ID (reversed from wire-order wtxid).

Returns:

  • (String, nil)

    64-character hex string, or nil if wtxid is nil



15
16
17
18
19
20
# File 'lib/bsv/wallet/postgres/display_txid.rb', line 15

def dtxid
  return unless wtxid

  BSV::Primitives::Hex.validate_wtxid!(wtxid, name: "#{self.class.name}#dtxid")
  wtxid.reverse.unpack1('H*')
end