ticket

package
v0.0.0-...-19a5819 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: ISC Imports: 8 Imported by: 0

Documentation

Overview

Package ticket provides test helpers for Ticket transaction testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTicketConsumeMeta

func CheckTicketConsumeMeta(
	t *testing.T,
	result jtx.TxResult,
	txn tx.Transaction,
)

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

func CheckTicketCreateMeta(
	t *testing.T,
	result jtx.TxResult,
	txn tx.Transaction,
)

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

Fee sets the transaction fee in drops.

func (*TicketCreateBuilder) Flags

Flags sets the transaction flags.

func (*TicketCreateBuilder) Sequence

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL