ordinals

package
v0.3.0-brc20-1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TagBody    = Tag(0)
	TagPointer = Tag(2)
	// TagUnbound is unrecognized
	TagUnbound = Tag(66)

	TagContentType     = Tag(1)
	TagParent          = Tag(3)
	TagMetadata        = Tag(5)
	TagMetaprotocol    = Tag(7)
	TagContentEncoding = Tag(9)
	TagDelegate        = Tag(11)
	// TagNop is unrecognized
	TagNop = Tag(255)
)
View Source
var ErrInscriptionIdInvalidSeparator = fmt.Errorf("invalid inscription id: must contain exactly one separator")
View Source
var ErrSatPointInvalidSeparator = fmt.Errorf("invalid sat point: must contain exactly two separators")

Functions

func GetJubileeHeight

func GetJubileeHeight(network common.Network) uint64

Types

type Envelope

type Envelope struct {
	Inscription           Inscription
	InputIndex            uint32 // Index of input that contains the envelope
	Offset                int    // Number of envelope in the input
	PushNum               bool   // True if envelope contains pushnum opcodes
	Stutter               bool   // True if envelope matches stuttering curse structure
	IncompleteField       bool   // True if payload is incomplete
	DuplicateField        bool   // True if payload contains duplicated field
	UnrecognizedEvenField bool   // True if payload contains unrecognized even field
}

func ParseEnvelopesFromTx

func ParseEnvelopesFromTx(tx *types.Transaction) []*Envelope

type Fields

type Fields map[Tag][][]byte

func (Fields) Take

func (fields Fields) Take(tag Tag) []byte

type Inscription

type Inscription struct {
	Content         []byte
	ContentEncoding string
	ContentType     string
	Delegate        *InscriptionId
	Metadata        []byte
	Metaprotocol    string
	Parent          *InscriptionId // in 0.14, inscription has only one parent
	Pointer         *uint64
}

type InscriptionEntry

type InscriptionEntry struct {
	Id              InscriptionId
	Number          int64
	SequenceNumber  uint64
	Cursed          bool
	CursedForBRC20  bool
	CreatedAt       time.Time
	CreatedAtHeight uint64
	Inscription     Inscription
	TransferCount   uint32
}

TODO: refactor ordinals.InscriptionEntry to entity.InscriptionEntry

type InscriptionId

type InscriptionId struct {
	TxHash chainhash.Hash
	Index  uint32
}

func NewInscriptionId

func NewInscriptionId(txHash chainhash.Hash, index uint32) InscriptionId

func NewInscriptionIdFromString

func NewInscriptionIdFromString(s string) (InscriptionId, error)

func (InscriptionId) MarshalJSON

func (r InscriptionId) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (InscriptionId) String

func (i InscriptionId) String() string

func (*InscriptionId) UnmarshalJSON

func (r *InscriptionId) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type PushScriptBuilder

type PushScriptBuilder struct {
	// contains filtered or unexported fields
}

PushScriptBuilder is a helper to build scripts that requires data pushes to use OP_PUSHDATA* or OP_DATA_* opcodes only. Empty data pushes are still encoded as OP_0.

func NewPushScriptBuilder

func NewPushScriptBuilder() *PushScriptBuilder

func (*PushScriptBuilder) AddData

func (b *PushScriptBuilder) AddData(data []byte) *PushScriptBuilder

AddData pushes the passed data to the end of the script. It automatically chooses canonical opcodes depending on the length of the data. A zero length buffer will lead to a push of empty data onto the stack (OP_0) and any push of data greater than MaxScriptElementSize will not modify the script since that is not allowed by the script engine. Also, the script will not be modified if pushing the data would cause the script to exceed the maximum allowed script engine size.

func (*PushScriptBuilder) AddFullData

func (b *PushScriptBuilder) AddFullData(data []byte) *PushScriptBuilder

AddFullData should not typically be used by ordinary users as it does not include the checks which prevent data pushes larger than the maximum allowed sizes which leads to scripts that can't be executed. This is provided for testing purposes such as regression tests where sizes are intentionally made larger than allowed.

Use AddData instead.

func (*PushScriptBuilder) AddOp

func (b *PushScriptBuilder) AddOp(opcode byte) *PushScriptBuilder

AddOp pushes the passed opcode to the end of the script. The script will not be modified if pushing the opcode would cause the script to exceed the maximum allowed script engine size.

func (*PushScriptBuilder) AddOps

func (b *PushScriptBuilder) AddOps(opcodes []byte) *PushScriptBuilder

AddOps pushes the passed opcodes to the end of the script. The script will not be modified if pushing the opcodes would cause the script to exceed the maximum allowed script engine size.

func (*PushScriptBuilder) Script

func (b *PushScriptBuilder) Script() ([]byte, error)

Script returns the currently built script. When any errors occurred while building the script, the script will be returned up the point of the first error along with the error.

type SatPoint

type SatPoint struct {
	OutPoint wire.OutPoint
	Offset   uint64
}

func NewSatPointFromString

func NewSatPointFromString(s string) (SatPoint, error)

func (SatPoint) MarshalJSON

func (r SatPoint) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (SatPoint) String

func (s SatPoint) String() string

func (*SatPoint) UnmarshalJSON

func (r *SatPoint) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type Tag

type Tag uint8

Tags represent data fields in a runestone. Unrecognized odd tags are ignored. Unrecognized even tags produce a cenotaph.

func ParseTag

func ParseTag(input interface{}) (Tag, error)

func (Tag) Bytes

func (t Tag) Bytes() []byte

func (Tag) IsChunked

func (t Tag) IsChunked() bool

func (Tag) IsValid

func (t Tag) IsValid() bool

Jump to

Keyboard shortcuts

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