v1parser

package
v0.0.0-...-3c2e5f2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: MIT Imports: 10 Imported by: 15

Documentation

Index

Constants

View Source
const (
	OP_0         = 0x00 // 0
	OP_PUSHDATA1 = 0x4c // 76
	OP_PUSHDATA2 = 0x4d // 77
	OP_PUSHDATA4 = 0x4e // 78
	OP_RETURN    = 0x6a // 106
)

Variables

View Source
var (
	// ErrUnsupportedSlpVersion is an error that indicates the parsed slp metadata is
	// an unsupported version
	ErrUnsupportedSlpVersion = errors.New("token_type not token-type1, nft1-group, or nft1-child")
)

Functions

func Fuzz

func Fuzz(data []byte) int

Fuzz implements interface for running github.com/dvyuko/go-fuzz For more information see ../fuzz/README.md

Types

type ParseResult

type ParseResult interface {
	TokenType() TokenType
	TokenID() []byte
	GetVoutValue(vout int) (*big.Int, bool)
	TotalSlpMsgOutputValue() (*big.Int, error)
}

ParseResult returns the parsed result.

func ParseSLP

func ParseSLP(scriptPubKey []byte) (ParseResult, error)

ParseSLP unmarshals an SLP message from a transaction scriptPubKey.

type SlpGenesis

type SlpGenesis struct {
	Ticker, Name, DocumentURI, DocumentHash []byte
	Decimals, MintBatonVout                 int
	Qty                                     uint64
	// contains filtered or unexported fields
}

SlpGenesis is an unmarshalled Genesis ParseResult

func (SlpGenesis) GetVoutValue

func (r SlpGenesis) GetVoutValue(vout int) (*big.Int, bool)

GetVoutValue returns the output amount or boolean flag indicating the index is a mint baton for a given transaction output index. Out of range vout returns nil.

func (SlpGenesis) TokenID

func (r SlpGenesis) TokenID() []byte

TokenID returns the TokenID per the ParserResult interface

func (SlpGenesis) TokenType

func (r SlpGenesis) TokenType() TokenType

TokenType returns the TokenType per the ParserResult interface

func (SlpGenesis) TotalSlpMsgOutputValue

func (r SlpGenesis) TotalSlpMsgOutputValue() (*big.Int, error)

TotalSlpMsgOutputValue computes the output amount transferred in a transaction

type SlpMint

type SlpMint struct {
	MintBatonVout int
	Qty           uint64
	// contains filtered or unexported fields
}

SlpMint is an unmarshalled Mint ParseResult

func (SlpMint) GetVoutValue

func (r SlpMint) GetVoutValue(vout int) (*big.Int, bool)

GetVoutValue returns the output amount or boolean flag indicating the index is a mint baton for a given transaction output index. Out of range vout returns nil.

func (SlpMint) TokenID

func (r SlpMint) TokenID() []byte

TokenID returns the TokenID per the ParserResult interface

func (SlpMint) TokenType

func (r SlpMint) TokenType() TokenType

TokenType returns the TokenType per the ParserResult interface

func (SlpMint) TotalSlpMsgOutputValue

func (r SlpMint) TotalSlpMsgOutputValue() (*big.Int, error)

TotalSlpMsgOutputValue computes the output amount transferred in a transaction

type SlpSend

type SlpSend struct {
	Amounts []uint64
	// contains filtered or unexported fields
}

SlpSend is an unmarshalled Send ParseResult

func (SlpSend) GetVoutValue

func (r SlpSend) GetVoutValue(vout int) (*big.Int, bool)

GetVoutValue returns the output amount or boolean flag indicating the index is a mint baton for a given transaction output index. Out of range vout returns nil.

func (SlpSend) TokenID

func (r SlpSend) TokenID() []byte

TokenID returns the TokenID per the ParserResult interface

func (SlpSend) TokenType

func (r SlpSend) TokenType() TokenType

TokenType returns the TokenType per the ParserResult interface

func (SlpSend) TotalSlpMsgOutputValue

func (r SlpSend) TotalSlpMsgOutputValue() (*big.Int, error)

TotalSlpMsgOutputValue computes the output amount transferred in a transaction

type TokenType

type TokenType uint16

TokenType is an uint16 representing the slp version type

const (
	// TokenTypeFungible01 version type used for ParseResult.TokenType
	TokenTypeFungible01 TokenType = 0x01
	// TokenTypeNft1Child41 version type used for ParseResult.TokenType
	TokenTypeNft1Child41 TokenType = 0x41
	// TokenTypeNft1Group81 version type used for ParseResult.TokenType
	TokenTypeNft1Group81 TokenType = 0x81
)

Jump to

Keyboard shortcuts

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