definitions

package
v0.0.0-...-2b6a5f4 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package definitions contains XRPL binary codec field and type definitions.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrUnableToCastFieldInfo is returned when the field info cannot be cast.
	ErrUnableToCastFieldInfo = errors.New("unable to cast to field info")
)

Functions

This section is empty.

Types

type Definitions

type Definitions struct {
	Types                  map[string]int32
	LedgerEntryTypes       map[string]int32
	Fields                 fieldInstanceMap
	TransactionResults     map[string]int32
	TransactionTypes       map[string]int32
	FieldIDNameMap         map[FieldHeader]string
	GranularPermissions    map[string]int32
	DelegatablePermissions map[string]int32
	// contains filtered or unexported fields
}

Definitions holds the binary serialization definitions for the XRP Ledger, loaded once at package init from the embedded RFC JSON document.

All forward maps (name -> code) and reverse maps (code -> name) are built eagerly so every lookup is O(1).

func Get

func Get() *Definitions

Get returns the singleton instance of Definitions.

func (*Definitions) CreateFieldHeader

func (d *Definitions) CreateFieldHeader(tc, fc int32) FieldHeader

CreateFieldHeader creates a new field header.

func (*Definitions) GetDelegatablePermissionNameByValue

func (d *Definitions) GetDelegatablePermissionNameByValue(v int32) (string, error)

GetDelegatablePermissionNameByValue returns the delegatable permission name associated with the permission value.

func (*Definitions) GetDelegatablePermissionValueByName

func (d *Definitions) GetDelegatablePermissionValueByName(n string) (int32, error)

GetDelegatablePermissionValueByName returns the delegatable permission value associated with the permission name.

func (*Definitions) GetFieldCodeByFieldName

func (d *Definitions) GetFieldCodeByFieldName(n string) (int32, error)

GetFieldCodeByFieldName returns the field code associated with the given field name.

func (*Definitions) GetFieldHeaderByFieldName

func (d *Definitions) GetFieldHeaderByFieldName(n string) (*FieldHeader, error)

GetFieldHeaderByFieldName returns the field header struct associated with the given field name.

func (*Definitions) GetFieldInfoByFieldName

func (d *Definitions) GetFieldInfoByFieldName(n string) (*FieldInfo, error)

GetFieldInfoByFieldName returns the field info struct associated with the given field name.

func (*Definitions) GetFieldInstanceByFieldName

func (d *Definitions) GetFieldInstanceByFieldName(n string) (*FieldInstance, error)

GetFieldInstanceByFieldName returns the field instance struct associated with the given field name.

func (*Definitions) GetFieldNameByFieldHeader

func (d *Definitions) GetFieldNameByFieldHeader(fh FieldHeader) (string, error)

GetFieldNameByFieldHeader returns the field name associated with the given field header struct.

func (*Definitions) GetLedgerEntryTypeCodeByLedgerEntryTypeName

func (d *Definitions) GetLedgerEntryTypeCodeByLedgerEntryTypeName(n string) (int32, error)

GetLedgerEntryTypeCodeByLedgerEntryTypeName returns the ledger entry type code associated with the ledger entry type name.

func (*Definitions) GetLedgerEntryTypeNameByLedgerEntryTypeCode

func (d *Definitions) GetLedgerEntryTypeNameByLedgerEntryTypeCode(c int32) (string, error)

GetLedgerEntryTypeNameByLedgerEntryTypeCode returns the ledger entry type name associated with the ledger entry type code.

func (*Definitions) GetTransactionResultNameByTransactionResultTypeCode

func (d *Definitions) GetTransactionResultNameByTransactionResultTypeCode(c int32) (string, error)

GetTransactionResultNameByTransactionResultTypeCode returns the transaction result name associated with the transaction result type code.

func (*Definitions) GetTransactionResultTypeCodeByTransactionResultName

func (d *Definitions) GetTransactionResultTypeCodeByTransactionResultName(n string) (int32, error)

GetTransactionResultTypeCodeByTransactionResultName returns the transaction result type code associated with the transaction result name.

func (*Definitions) GetTransactionTypeCodeByTransactionTypeName

func (d *Definitions) GetTransactionTypeCodeByTransactionTypeName(n string) (int32, error)

GetTransactionTypeCodeByTransactionTypeName returns the transaction type code associated with the transaction type name.

func (*Definitions) GetTransactionTypeNameByTransactionTypeCode

func (d *Definitions) GetTransactionTypeNameByTransactionTypeCode(c int32) (string, error)

GetTransactionTypeNameByTransactionTypeCode returns the transaction type name associated with the transaction type code.

func (*Definitions) GetTypeCodeByFieldName

func (d *Definitions) GetTypeCodeByFieldName(n string) (int32, error)

GetTypeCodeByFieldName returns the type code associated with the given field name.

func (*Definitions) GetTypeCodeByTypeName

func (d *Definitions) GetTypeCodeByTypeName(n string) (int32, error)

GetTypeCodeByTypeName returns the type code associated with the given type name.

func (*Definitions) GetTypeNameByFieldName

func (d *Definitions) GetTypeNameByFieldName(n string) (string, error)

GetTypeNameByFieldName returns the serialization data type for the given field name.

type FieldHeader

type FieldHeader struct {
	TypeCode  int32
	FieldCode int32
}

FieldHeader is a struct that represents the field header.

type FieldInfo

type FieldInfo struct {
	Nth            int32  `json:"nth"`
	IsVLEncoded    bool   `json:"isVLEncoded"`
	IsSerialized   bool   `json:"isSerialized"`
	IsSigningField bool   `json:"isSigningField"`
	Type           string `json:"type"`
}

FieldInfo is a struct that represents the field info.

type FieldInstance

type FieldInstance struct {
	FieldName string
	*FieldInfo
	FieldHeader *FieldHeader
	Ordinal     int32
}

FieldInstance is a struct that represents a field instance.

type NotFoundError

type NotFoundError struct {
	Instance string
	Input    string
}

NotFoundError is an error that occurs when a value is not found.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotFoundErrorFieldHeader

type NotFoundErrorFieldHeader struct {
	Instance string
	Input    FieldHeader
}

NotFoundErrorFieldHeader is an error that occurs when a value is not found.

func (*NotFoundErrorFieldHeader) Error

func (e *NotFoundErrorFieldHeader) Error() string

Error implements the error interface.

type NotFoundErrorInt

type NotFoundErrorInt struct {
	Instance string
	Input    int32
}

NotFoundErrorInt is an error that occurs when a value is not found.

func (*NotFoundErrorInt) Error

func (e *NotFoundErrorInt) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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