Class: BSV::Transaction::Beef::BeefTx
- Inherits:
-
Object
- Object
- BSV::Transaction::Beef::BeefTx
- Defined in:
- lib/bsv/transaction/beef.rb
Overview
A single entry in a BEEF bundle, wrapping a transaction with its format metadata.
Instance Attribute Summary collapse
-
#bump_index ⇒ Integer?
readonly
Index into the BEEF bumps array.
-
#format ⇒ Integer
readonly
Format flag (FORMAT_RAW_TX, FORMAT_RAW_TX_AND_BUMP, or FORMAT_TXID_ONLY).
-
#known_txid ⇒ String?
readonly
32-byte txid for TXID-only entries.
-
#transaction ⇒ Transaction?
readonly
The transaction (nil for TXID-only entries).
Instance Method Summary collapse
-
#initialize(format:, transaction: nil, known_txid: nil, bump_index: nil) ⇒ BeefTx
constructor
A new instance of BeefTx.
-
#txid ⇒ String?
The transaction ID for this entry.
Constructor Details
#initialize(format:, transaction: nil, known_txid: nil, bump_index: nil) ⇒ BeefTx
Returns a new instance of BeefTx.
58 59 60 61 62 63 64 65 |
# File 'lib/bsv/transaction/beef.rb', line 58 def initialize(format:, transaction: nil, known_txid: nil, bump_index: nil) raise ArgumentError, 'FORMAT_RAW_TX_AND_BUMP requires a bump_index' if format == FORMAT_RAW_TX_AND_BUMP && bump_index.nil? @format = format @transaction = transaction @known_txid = known_txid @bump_index = bump_index end |
Instance Attribute Details
#bump_index ⇒ Integer? (readonly)
Returns index into the BEEF bumps array.
51 52 53 |
# File 'lib/bsv/transaction/beef.rb', line 51 def bump_index @bump_index end |
#format ⇒ Integer (readonly)
Returns format flag (FORMAT_RAW_TX, FORMAT_RAW_TX_AND_BUMP, or FORMAT_TXID_ONLY).
42 43 44 |
# File 'lib/bsv/transaction/beef.rb', line 42 def format @format end |
#known_txid ⇒ String? (readonly)
Returns 32-byte txid for TXID-only entries.
48 49 50 |
# File 'lib/bsv/transaction/beef.rb', line 48 def known_txid @known_txid end |
#transaction ⇒ Transaction? (readonly)
Returns the transaction (nil for TXID-only entries).
45 46 47 |
# File 'lib/bsv/transaction/beef.rb', line 45 def transaction @transaction end |
Instance Method Details
#txid ⇒ String?
The transaction ID for this entry.
70 71 72 73 74 75 76 77 |
# File 'lib/bsv/transaction/beef.rb', line 70 def txid case @format when FORMAT_TXID_ONLY @known_txid else @transaction&.txid end end |