Documentation
¶
Overview ¶
Package ticket provides test helpers for Ticket transaction testing.
Index ¶
- func CheckTicketConsumeMeta(t *testing.T, result jtx.TxResult, txn tx.Transaction)
- func CheckTicketCreateMeta(t *testing.T, result jtx.TxResult, txn tx.Transaction)
- type TicketCreateBuilder
- func (b *TicketCreateBuilder) Build() tx.Transaction
- func (b *TicketCreateBuilder) Fee(f int64) *TicketCreateBuilder
- func (b *TicketCreateBuilder) Flags(flags uint32) *TicketCreateBuilder
- func (b *TicketCreateBuilder) Sequence(seq uint32) *TicketCreateBuilder
- func (b *TicketCreateBuilder) TicketSeq(ticketSeq uint32) *TicketCreateBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTicketConsumeMeta ¶
CheckTicketConsumeMeta validates metadata for a transaction that consumes a ticket. The transaction may have succeeded (tesSUCCESS) or failed with a tec code. Ported from rippled's Ticket_test.cpp checkTicketConsumeMeta() (lines 256-380).
It verifies:
- Transaction Sequence == 0 and TicketSequence is set
- Result is tesSUCCESS or tec*
- AccountRoot TicketCount decremented by 1 (removed if was 1)
- Exactly one Ticket node was deleted with matching Account and TicketSequence
- Consumed ticket sequence < final account sequence
func CheckTicketCreateMeta ¶
CheckTicketCreateMeta validates metadata for a successful TicketCreate transaction. Ported from rippled's Ticket_test.cpp checkTicketCreateMeta() (lines 35-248).
It verifies:
- AccountRoot sequence advanced correctly (by count+1 for seq, by count for ticket)
- OwnerCount incremented by (count - consumedTickets)
- TicketCount updated correctly
- Exactly `count` Ticket nodes were created with sequential TicketSequence values
- If a ticket was consumed (txSeq==0), exactly one Ticket node was deleted
- At least one DirectoryNode was modified or created
Types ¶
type TicketCreateBuilder ¶
type TicketCreateBuilder struct {
// contains filtered or unexported fields
}
TicketCreateBuilder provides a fluent interface for building TicketCreate transactions. Reference: rippled's ticket::create() in test/jtx/ticket.h
func TicketCreate ¶
func TicketCreate(account *testing.Account, count uint32) *TicketCreateBuilder
TicketCreate creates a new TicketCreateBuilder. count is the number of tickets to create (1-250).
func (*TicketCreateBuilder) Build ¶
func (b *TicketCreateBuilder) Build() tx.Transaction
Build constructs the TicketCreate transaction.
func (*TicketCreateBuilder) Fee ¶
func (b *TicketCreateBuilder) Fee(f int64) *TicketCreateBuilder
Fee sets the transaction fee in drops.
func (*TicketCreateBuilder) Flags ¶
func (b *TicketCreateBuilder) Flags(flags uint32) *TicketCreateBuilder
Flags sets the transaction flags.
func (*TicketCreateBuilder) Sequence ¶
func (b *TicketCreateBuilder) Sequence(seq uint32) *TicketCreateBuilder
Sequence sets the sequence number explicitly.
func (*TicketCreateBuilder) TicketSeq ¶
func (b *TicketCreateBuilder) TicketSeq(ticketSeq uint32) *TicketCreateBuilder
TicketSeq sets the TicketSequence (consumes a ticket to create new tickets). Reference: rippled's ticket::use() in test/jtx/ticket.h