protocol

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeOK            = 0
	CodeEncodingError = 1
	CodeBadNonce      = 2
	CodeDidPanic      = 3
	CodeUnknownError  = 4
	CodeNotFound      = 5
)
View Source
const (
	// ACME is the name of the ACME token.
	ACME = "ACME"

	// Directory is the subnet ID of the DN.
	Directory = "Directory"

	// ValidatorBook is the path to a node's validator key book.
	ValidatorBook = "validators"

	// Ledger is the path to a node's internal ledger.
	Ledger = "ledger"

	// AnchorPool is the path to a node's anchor chain account.
	AnchorPool = "anchors"

	// MainChain is the main transaction chain of a record.
	MainChain = "main"

	// PendingChain is the pending signature chain of a record.
	PendingChain = "pending"

	// DataChain is the data chain of a record.
	DataChain = "data"

	// MajorRootChain is the major root chain of a subnet.
	MajorRootChain = "major-root"

	// MinorRootChain is the minor root chain of a subnet.
	MinorRootChain = "minor-root"

	// SyntheticChain is the synthetic transaction chain of a subnet.
	SyntheticChain = "synthetic"
)

Well known strings

View Source
const AcmePrecision = 1e8

AcmePrecision is the precision of ACME token amounts.

View Source
const CreditPrecision = 1e2

CreditPrecision is the precision of credit balances.

View Source
const CreditsPerFiatUnit = 1e2 * CreditPrecision

CreditsPerFiatUnit is the conversion rate from credit balances to fiat currency. We expect to use USD indefinitely as the fiat currency.

100 credits converts to 1 dollar, but we charge down to 0.01 credits, so the actual conversion rate of the credit balance field to dollars is is 10,000 to 1.

View Source
const FiatUnitsPerAcmeToken = 1

FiatUnitsPerAcmeToken fixes the conversion between ACME tokens and fiat currency to 1:1, as in $1 per 1 ACME token.

As soon as we have an oracle, this must be removed.

View Source
const LiteEntryHeaderSize = 1 +
	32 +

	2 // total len

LiteEntryHeaderSize is the exact length of an Entry header.

View Source
const LiteEntryMaxTotalSize = WriteDataMax + LiteEntryHeaderSize

LiteEntryMaxTotalSize is the maximum encoded length of an Entry.

View Source
const WriteDataMax = 10240

Variables

View Source
var ErrNotEnoughData = encoding.ErrNotEnoughData
View Source
var ErrOverflow = encoding.ErrOverflow
View Source
var FaucetUrl *url.URL

Functions

func AcmeUrl

func AcmeUrl() *url.URL

AcmeUrl returns `acc://ACME`.

func BelongsToDn added in v0.4.0

func BelongsToDn(u *url.URL) bool

BelongsToDn checks if the give account belongs to the DN.

func BvnUrl

func BvnUrl(subnet string) *url.URL

BvnUrl returns `acc://bvn-${subnet}`.

func ComputeEntryHash

func ComputeEntryHash(data [][]byte) []byte

ComputeEntryHash returns the entry hash given external id's and data associated with an entry

func ComputeLiteDataAccountId added in v0.4.0

func ComputeLiteDataAccountId(firstEntry *DataEntry) []byte

ComputeLiteDataAccountId will compute the chain id from the first entry in the chain which defines the names as part of the external id's https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#chainid

func ComputeLiteEntryHash added in v0.4.0

func ComputeLiteEntryHash(data []byte) []byte

ComputeLiteEntryHash returns the Entry hash of data for a lite chain https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry-hash

func ComputeLiteEntryHashFromEntry added in v0.4.0

func ComputeLiteEntryHashFromEntry(accountId []byte, entry *DataEntry) ([]byte, error)

ComputeLiteEntryHashFromEntry will compute the entry hash from an entry. If accountId is nil, then entry will be used to construct an account id, and it assumes the entry will be the first entry in the chain

func DnUrl

func DnUrl() *url.URL

DnUrl returns `acc://dn`.

func IsDnUrl

func IsDnUrl(u *url.URL) bool

IsDnUrl checks if the URL is the DN ADI URL.

func IsReserved

func IsReserved(u *url.URL) bool

IsReserved checks if the given URL is reserved.

func IsValidAdiUrl

func IsValidAdiUrl(u *url.URL) error

IsValidAdiUrl returns an error if the URL is not valid for an ADI.

An ADI URL: 1) Must be valid UTF-8. 2) Authority must not include a port number. 3) Must have a (non-empty) hostname. 4) Hostname must not include dots (cannot be a domain). 5) Hostname must not be a number. 6) Hostname must not be 48 hexidecimal digits. 7) Must not have a path, query, or fragment. 8) Must not be a reserved URL, such as ACME, DN, or BVN-*

func LiteDataAddress added in v0.4.0

func LiteDataAddress(chainId []byte) (*url.URL, error)

LiteDataAddress returns a lite address for the given chain id as `acc://<chain-id-hash-and-checksum>`.

The rules for generating the authority of a lite data chain are the same as the address for a Lite Token Account

func LiteTokenAddress added in v0.4.0

func LiteTokenAddress(pubKey []byte, tokenUrlStr string) (*url.URL, error)

LiteTokenAddress returns an lite address for the given public key and token URL as `acc://<key-hash-and-checksum>/<token-url>`.

Only the first 20 bytes of the public key hash is used. The checksum is the last four bytes of the hexadecimal partial key hash. For an ACME lite token account URL for a key with a public key hash of

"aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f"

The checksum is calculated as

sha256("aec070645fe53ee3b3763059376134f058cc3372")[28:] == "26e2a324"

The resulting URL is

"acc://aec070645fe53ee3b3763059376134f058cc337226e2a324/ACME"

func NewChain

func NewChain(typ types.AccountType) (state.Chain, error)

func NewValidator

func NewValidator() (*validator.Validate, error)

func ParseBvnUrl

func ParseBvnUrl(u *url.URL) (string, bool)

ParseBvnUrl extracts the BVN subnet name from a BVN URL, if the URL is a valid BVN ADI URL.

func ParseLiteDataAddress added in v0.4.0

func ParseLiteDataAddress(u *url.URL) ([]byte, error)

ParseLiteDataAddress extracts the partial chain id from a lite chain URL. Returns `nil, err if the URL does not appear to be a lite token chain URL. Returns an error if the checksum is invalid.

func ParseLiteTokenAddress added in v0.4.0

func ParseLiteTokenAddress(u *url.URL) ([]byte, *url.URL, error)

ParseLiteTokenAddress extracts the key hash and token URL from an lite token account URL. Returns `nil, nil, nil` if the URL is not an lite token account URL. Returns an error if the checksum is invalid.

func UnmarshalChain

func UnmarshalChain(data []byte) (state.Chain, error)

Types

type ADI added in v0.4.0

type ADI struct {
	state.ChainHeader
}

func NewADI added in v0.4.0

func NewADI() *ADI

func (*ADI) BinarySize added in v0.4.0

func (v *ADI) BinarySize() int

func (*ADI) Equal added in v0.4.0

func (v *ADI) Equal(u *ADI) bool

func (*ADI) MarshalBinary added in v0.4.0

func (v *ADI) MarshalBinary() ([]byte, error)

func (*ADI) UnmarshalBinary added in v0.4.0

func (v *ADI) UnmarshalBinary(data []byte) error

type AcmeFaucet

type AcmeFaucet struct {
	Url string `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
}

func (*AcmeFaucet) BinarySize

func (v *AcmeFaucet) BinarySize() int

func (*AcmeFaucet) Equal

func (v *AcmeFaucet) Equal(u *AcmeFaucet) bool

func (*AcmeFaucet) GetType

func (*AcmeFaucet) GetType() types.TransactionType

func (*AcmeFaucet) MarshalBinary

func (v *AcmeFaucet) MarshalBinary() ([]byte, error)

func (*AcmeFaucet) UnmarshalBinary

func (v *AcmeFaucet) UnmarshalBinary(data []byte) error

type AddCredits

type AddCredits struct {
	Recipient string `json:"recipient,omitempty" form:"recipient" query:"recipient" validate:"required"`
	Amount    uint64 `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*AddCredits) BinarySize

func (v *AddCredits) BinarySize() int

func (*AddCredits) Equal

func (v *AddCredits) Equal(u *AddCredits) bool

func (*AddCredits) GetType

func (*AddCredits) GetType() types.TransactionType

func (*AddCredits) MarshalBinary

func (v *AddCredits) MarshalBinary() ([]byte, error)

func (*AddCredits) UnmarshalBinary

func (v *AddCredits) UnmarshalBinary(data []byte) error

type Anchor added in v0.4.0

type Anchor struct {
	state.ChainHeader
}

func NewAnchor added in v0.4.0

func NewAnchor() *Anchor

func (*Anchor) BinarySize added in v0.4.0

func (v *Anchor) BinarySize() int

func (*Anchor) Equal added in v0.4.0

func (v *Anchor) Equal(u *Anchor) bool

func (*Anchor) MarshalBinary added in v0.4.0

func (v *Anchor) MarshalBinary() ([]byte, error)

func (*Anchor) UnmarshalBinary added in v0.4.0

func (v *Anchor) UnmarshalBinary(data []byte) error

type AnchorMetadata added in v0.4.0

type AnchorMetadata struct {
	ChainMetadata
	Account     *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	Index       uint64   `json:"index,omitempty" form:"index" query:"index" validate:"required"`
	SourceIndex uint64   `json:"sourceIndex,omitempty" form:"sourceIndex" query:"sourceIndex" validate:"required"`
	SourceBlock uint64   `json:"sourceBlock,omitempty" form:"sourceBlock" query:"sourceBlock" validate:"required"`
	Entry       []byte   `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"`
}

func (*AnchorMetadata) BinarySize added in v0.4.0

func (v *AnchorMetadata) BinarySize() int

func (*AnchorMetadata) Equal added in v0.4.0

func (v *AnchorMetadata) Equal(u *AnchorMetadata) bool

func (*AnchorMetadata) MarshalBinary added in v0.4.0

func (v *AnchorMetadata) MarshalBinary() ([]byte, error)

func (*AnchorMetadata) MarshalJSON added in v0.4.0

func (v *AnchorMetadata) MarshalJSON() ([]byte, error)

func (*AnchorMetadata) UnmarshalBinary added in v0.4.0

func (v *AnchorMetadata) UnmarshalBinary(data []byte) error

func (*AnchorMetadata) UnmarshalJSON added in v0.4.0

func (v *AnchorMetadata) UnmarshalJSON(data []byte) error

type AnchoredRecord added in v0.4.0

type AnchoredRecord struct {
	Record []byte   `json:"record,omitempty" form:"record" query:"record" validate:"required"`
	Anchor [32]byte `json:"anchor,omitempty" form:"anchor" query:"anchor" validate:"required"`
}

func (*AnchoredRecord) BinarySize added in v0.4.0

func (v *AnchoredRecord) BinarySize() int

func (*AnchoredRecord) Equal added in v0.4.0

func (v *AnchoredRecord) Equal(u *AnchoredRecord) bool

func (*AnchoredRecord) MarshalBinary added in v0.4.0

func (v *AnchoredRecord) MarshalBinary() ([]byte, error)

func (*AnchoredRecord) MarshalJSON added in v0.4.0

func (v *AnchoredRecord) MarshalJSON() ([]byte, error)

func (*AnchoredRecord) UnmarshalBinary added in v0.4.0

func (v *AnchoredRecord) UnmarshalBinary(data []byte) error

func (*AnchoredRecord) UnmarshalJSON added in v0.4.0

func (v *AnchoredRecord) UnmarshalJSON(data []byte) error

type BurnTokens

type BurnTokens struct {
	Amount big.Int `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*BurnTokens) BinarySize

func (v *BurnTokens) BinarySize() int

func (*BurnTokens) Equal

func (v *BurnTokens) Equal(u *BurnTokens) bool

func (*BurnTokens) GetType

func (*BurnTokens) GetType() types.TransactionType

func (*BurnTokens) MarshalBinary

func (v *BurnTokens) MarshalBinary() ([]byte, error)

func (*BurnTokens) MarshalJSON added in v0.4.0

func (v *BurnTokens) MarshalJSON() ([]byte, error)

func (*BurnTokens) UnmarshalBinary

func (v *BurnTokens) UnmarshalBinary(data []byte) error

func (*BurnTokens) UnmarshalJSON added in v0.4.0

func (v *BurnTokens) UnmarshalJSON(data []byte) error

type ChainMetadata added in v0.4.0

type ChainMetadata struct {
	Name string    `json:"name,omitempty" form:"name" query:"name" validate:"required"`
	Type ChainType `json:"type,omitempty" form:"type" query:"type" validate:"required"`
}

func (*ChainMetadata) BinarySize added in v0.4.0

func (v *ChainMetadata) BinarySize() int

func (*ChainMetadata) Equal added in v0.4.0

func (v *ChainMetadata) Equal(u *ChainMetadata) bool

func (*ChainMetadata) MarshalBinary added in v0.4.0

func (v *ChainMetadata) MarshalBinary() ([]byte, error)

func (*ChainMetadata) UnmarshalBinary added in v0.4.0

func (v *ChainMetadata) UnmarshalBinary(data []byte) error

type ChainParams

type ChainParams struct {
	Data     []byte `json:"data,omitempty" form:"data" query:"data" validate:"required"`
	IsUpdate bool   `json:"isUpdate,omitempty" form:"isUpdate" query:"isUpdate" validate:"required"`
}

func (*ChainParams) BinarySize

func (v *ChainParams) BinarySize() int

func (*ChainParams) Equal

func (v *ChainParams) Equal(u *ChainParams) bool

func (*ChainParams) MarshalBinary

func (v *ChainParams) MarshalBinary() ([]byte, error)

func (*ChainParams) MarshalJSON

func (v *ChainParams) MarshalJSON() ([]byte, error)

func (*ChainParams) UnmarshalBinary

func (v *ChainParams) UnmarshalBinary(data []byte) error

func (*ChainParams) UnmarshalJSON

func (v *ChainParams) UnmarshalJSON(data []byte) error

type ChainType added in v0.4.0

type ChainType uint64

ChainType is the type of a chain belonging to an account.

const ChainTypeAnchor ChainType = 2

ChainTypeAnchor holds chain anchors.

const ChainTypeData ChainType = 3

ChainTypeData holds data entry hashes.

const ChainTypeTransaction ChainType = 1

ChainTypeTransaction holds transaction hashes.

const ChainTypeUnknown ChainType = 0

ChainTypeUnknown is used when the chain type is not known.

func ChainTypeByName added in v0.4.0

func ChainTypeByName(name string) (ChainType, bool)

ChainTypeByName returns the named Chain Type.

func (ChainType) BinarySize added in v0.4.0

func (v ChainType) BinarySize() int

BinarySize returns the number of bytes required to binary marshal the Chain Type.

func (ChainType) ID added in v0.4.0

func (v ChainType) ID() uint64

ID returns the ID of the Chain Type

func (ChainType) MarshalBinary added in v0.4.0

func (v ChainType) MarshalBinary() ([]byte, error)

MarshalBinary marshals the Chain Type to bytes as a unsigned varint.

func (ChainType) MarshalJSON added in v0.4.0

func (v ChainType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Chain Type to JSON as a string.

func (ChainType) String added in v0.4.0

func (v ChainType) String() string

String returns the name of the Chain Type

func (*ChainType) UnmarshalBinary added in v0.4.0

func (v *ChainType) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshals the Chain Type from bytes as a unsigned varint.

func (*ChainType) UnmarshalJSON added in v0.4.0

func (v *ChainType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Chain Type from JSON as a string.

type CreateDataAccount

type CreateDataAccount struct {
	Url               string `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	KeyBookUrl        string `json:"keyBookUrl,omitempty" form:"keyBookUrl" query:"keyBookUrl" validate:"acc-url"`
	ManagerKeyBookUrl string `json:"managerKeyBookUrl,omitempty" form:"managerKeyBookUrl" query:"managerKeyBookUrl" validate:"acc-url"`
	Scratch           bool   `json:"scratch,omitempty" form:"scratch" query:"scratch"`
}

func (*CreateDataAccount) BinarySize

func (v *CreateDataAccount) BinarySize() int

func (*CreateDataAccount) Equal

func (*CreateDataAccount) GetType

func (*CreateDataAccount) MarshalBinary

func (v *CreateDataAccount) MarshalBinary() ([]byte, error)

func (*CreateDataAccount) UnmarshalBinary

func (v *CreateDataAccount) UnmarshalBinary(data []byte) error

type CreateIdentity added in v0.4.0

type CreateIdentity struct {
	Url         string `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	PublicKey   []byte `json:"publicKey,omitempty" form:"publicKey" query:"publicKey" validate:"required"`
	KeyBookName string `json:"keyBookName,omitempty" form:"keyBookName" query:"keyBookName"`
	KeyPageName string `json:"keyPageName,omitempty" form:"keyPageName" query:"keyPageName"`
}

func (*CreateIdentity) BinarySize added in v0.4.0

func (v *CreateIdentity) BinarySize() int

func (*CreateIdentity) Equal added in v0.4.0

func (v *CreateIdentity) Equal(u *CreateIdentity) bool

func (*CreateIdentity) GetType added in v0.4.0

func (*CreateIdentity) MarshalBinary added in v0.4.0

func (v *CreateIdentity) MarshalBinary() ([]byte, error)

func (*CreateIdentity) MarshalJSON added in v0.4.0

func (v *CreateIdentity) MarshalJSON() ([]byte, error)

func (*CreateIdentity) UnmarshalBinary added in v0.4.0

func (v *CreateIdentity) UnmarshalBinary(data []byte) error

func (*CreateIdentity) UnmarshalJSON added in v0.4.0

func (v *CreateIdentity) UnmarshalJSON(data []byte) error

type CreateKeyBook

type CreateKeyBook struct {
	Url   string   `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	Pages []string `json:"pages,omitempty" form:"pages" query:"pages" validate:"required"`
}

func (*CreateKeyBook) BinarySize

func (v *CreateKeyBook) BinarySize() int

func (*CreateKeyBook) Equal

func (v *CreateKeyBook) Equal(u *CreateKeyBook) bool

func (*CreateKeyBook) GetType

func (*CreateKeyBook) GetType() types.TransactionType

func (*CreateKeyBook) MarshalBinary

func (v *CreateKeyBook) MarshalBinary() ([]byte, error)

func (*CreateKeyBook) UnmarshalBinary

func (v *CreateKeyBook) UnmarshalBinary(data []byte) error

type CreateKeyPage

type CreateKeyPage struct {
	Url  string           `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	Keys []*KeySpecParams `json:"keys,omitempty" form:"keys" query:"keys" validate:"required"`
}

func (*CreateKeyPage) BinarySize

func (v *CreateKeyPage) BinarySize() int

func (*CreateKeyPage) Equal

func (v *CreateKeyPage) Equal(u *CreateKeyPage) bool

func (*CreateKeyPage) GetType

func (*CreateKeyPage) GetType() types.TransactionType

func (*CreateKeyPage) MarshalBinary

func (v *CreateKeyPage) MarshalBinary() ([]byte, error)

func (*CreateKeyPage) UnmarshalBinary

func (v *CreateKeyPage) UnmarshalBinary(data []byte) error

type CreateToken

type CreateToken struct {
	Url            string  `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	KeyBookUrl     string  `json:"keyBookUrl,omitempty" form:"keyBookUrl" query:"keyBookUrl" validate:"acc-url"`
	Symbol         string  `json:"symbol,omitempty" form:"symbol" query:"symbol" validate:"required"`
	Precision      uint64  `json:"precision,omitempty" form:"precision" query:"precision" validate:"required"`
	Properties     string  `json:"properties,omitempty" form:"properties" query:"properties" validate:"acc-url"`
	InitialSupply  big.Int `json:"initialSupply,omitempty" form:"initialSupply" query:"initialSupply"`
	HasSupplyLimit bool    `json:"hasSupplyLimit,omitempty" form:"hasSupplyLimit" query:"hasSupplyLimit"`
}

func (*CreateToken) BinarySize

func (v *CreateToken) BinarySize() int

func (*CreateToken) Equal

func (v *CreateToken) Equal(u *CreateToken) bool

func (*CreateToken) GetType

func (*CreateToken) GetType() types.TransactionType

func (*CreateToken) MarshalBinary

func (v *CreateToken) MarshalBinary() ([]byte, error)

func (*CreateToken) MarshalJSON added in v0.4.0

func (v *CreateToken) MarshalJSON() ([]byte, error)

func (*CreateToken) UnmarshalBinary

func (v *CreateToken) UnmarshalBinary(data []byte) error

func (*CreateToken) UnmarshalJSON added in v0.4.0

func (v *CreateToken) UnmarshalJSON(data []byte) error

type CreateTokenAccount added in v0.4.0

type CreateTokenAccount struct {
	Url        string `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	TokenUrl   string `json:"tokenUrl,omitempty" form:"tokenUrl" query:"tokenUrl" validate:"required,acc-url"`
	KeyBookUrl string `json:"keyBookUrl,omitempty" form:"keyBookUrl" query:"keyBookUrl" validate:"acc-url"`
	Scratch    bool   `json:"scratch,omitempty" form:"scratch" query:"scratch"`
}

func (*CreateTokenAccount) BinarySize added in v0.4.0

func (v *CreateTokenAccount) BinarySize() int

func (*CreateTokenAccount) Equal added in v0.4.0

func (*CreateTokenAccount) GetType added in v0.4.0

func (*CreateTokenAccount) MarshalBinary added in v0.4.0

func (v *CreateTokenAccount) MarshalBinary() ([]byte, error)

func (*CreateTokenAccount) UnmarshalBinary added in v0.4.0

func (v *CreateTokenAccount) UnmarshalBinary(data []byte) error

type CreditHolder added in v0.4.0

type CreditHolder interface {
	CreditCredits(amount uint64)
	DebitCredits(amount uint64) bool
}

type DataAccount

type DataAccount struct {
	state.ChainHeader
	Scratch bool `json:"scratch,omitempty" form:"scratch" query:"scratch"`
}

func NewDataAccount

func NewDataAccount() *DataAccount

func (*DataAccount) BinarySize

func (v *DataAccount) BinarySize() int

func (*DataAccount) Equal

func (v *DataAccount) Equal(u *DataAccount) bool

func (*DataAccount) MarshalBinary

func (v *DataAccount) MarshalBinary() ([]byte, error)

func (*DataAccount) UnmarshalBinary

func (v *DataAccount) UnmarshalBinary(data []byte) error

type DataEntry

type DataEntry struct {
	ExtIds [][]byte `json:"extIds,omitempty" form:"extIds" query:"extIds"`
	Data   []byte   `json:"data,omitempty" form:"data" query:"data"`
}

func (*DataEntry) BinarySize

func (v *DataEntry) BinarySize() int

func (*DataEntry) CheckSize

func (e *DataEntry) CheckSize() (int, error)

CheckSize is the marshaled size minus the implicit type header, returns error if there is too much or no data

func (*DataEntry) Cost

func (e *DataEntry) Cost() (int, error)

Cost will return the number of credits to be used for the data write

func (*DataEntry) Equal

func (v *DataEntry) Equal(u *DataEntry) bool

func (*DataEntry) Hash

func (e *DataEntry) Hash() []byte

func (*DataEntry) MarshalBinary

func (v *DataEntry) MarshalBinary() ([]byte, error)

func (*DataEntry) MarshalJSON

func (v *DataEntry) MarshalJSON() ([]byte, error)

func (*DataEntry) UnmarshalBinary

func (v *DataEntry) UnmarshalBinary(data []byte) error

func (*DataEntry) UnmarshalJSON

func (v *DataEntry) UnmarshalJSON(data []byte) error

type DirectoryIndexMetadata

type DirectoryIndexMetadata struct {
	Count uint64 `json:"count,omitempty" form:"count" query:"count" validate:"required"`
}

func (*DirectoryIndexMetadata) BinarySize

func (v *DirectoryIndexMetadata) BinarySize() int

func (*DirectoryIndexMetadata) Equal

func (*DirectoryIndexMetadata) MarshalBinary

func (v *DirectoryIndexMetadata) MarshalBinary() ([]byte, error)

func (*DirectoryIndexMetadata) UnmarshalBinary

func (v *DirectoryIndexMetadata) UnmarshalBinary(data []byte) error

type DirectoryQueryResult

type DirectoryQueryResult struct {
	Entries         []string        `json:"entries,omitempty" form:"entries" query:"entries"`
	ExpandedEntries []*state.Object `json:"expandedEntries,omitempty" form:"expandedEntries" query:"expandedEntries"`
	Total           uint64          `json:"total" form:"total" query:"total" validate:"required"`
}

func (*DirectoryQueryResult) BinarySize

func (v *DirectoryQueryResult) BinarySize() int

func (*DirectoryQueryResult) Equal

func (*DirectoryQueryResult) MarshalBinary

func (v *DirectoryQueryResult) MarshalBinary() ([]byte, error)

func (*DirectoryQueryResult) UnmarshalBinary

func (v *DirectoryQueryResult) UnmarshalBinary(data []byte) error

type EmptyResult added in v0.4.0

type EmptyResult struct{}

func (*EmptyResult) BinarySize added in v0.4.0

func (r *EmptyResult) BinarySize() int

func (*EmptyResult) GetType added in v0.4.0

func (r *EmptyResult) GetType() types.TxType

func (*EmptyResult) MarshalBinary added in v0.4.0

func (r *EmptyResult) MarshalBinary() (data []byte, err error)

func (*EmptyResult) UnmarshalBinary added in v0.4.0

func (r *EmptyResult) UnmarshalBinary(data []byte) error

type Error

type Error struct {
	Code    ErrorCode
	Message error
}

func (*Error) Error

func (err *Error) Error() string

func (*Error) Unwrap

func (err *Error) Unwrap() error

type ErrorCode

type ErrorCode int
const (
	//CodeTxnQueryError is returned when txn is not found
	CodeTxnQueryError ErrorCode = 5
	//CodeTxnRange is returned when txn range query fails
	CodeTxnRange ErrorCode = 6
	//CodeTxnHistory is returned when txn history query fails
	CodeTxnHistory ErrorCode = 7
	//CodeInvalidURL is returned when invalid URL is passed in query
	CodeInvalidURL ErrorCode = 8
	//CodeDirectoryURL is returned when invalid directory URL is passed in query
	CodeDirectoryURL ErrorCode = 9
	//CodeChainIdError is returned when query by in id fails
	CodeChainIdError ErrorCode = 10
	//CodeRoutingChainId is returned when setting routing chain id fails
	CodeRoutingChainId ErrorCode = 11
	//CodeCheckTxError is returned when txn validation check fails
	CodeCheckTxError ErrorCode = 12
	//CodeDeliverTxError is returned when txn deliver method fails
	CodeDeliverTxError ErrorCode = 13
	//CodeTxnStateError is returned when adding txn to state fails
	CodeTxnStateError ErrorCode = 14
	//CodeRecordTxnError is returned when storing pending state updates fail
	CodeRecordTxnError ErrorCode = 15
	//CodeSyntheticTxnError is returned when submit synthetic txn fails
	CodeSyntheticTxnError ErrorCode = 16
	//CodeMarshallingError is returned when marshaling  object or binary fails
	CodeMarshallingError ErrorCode = 17
	//CodeUnMarshallingError is returned when unmarshaling  object or binary fails
	CodeUnMarshallingError ErrorCode = 18
	//CodeInvalidQueryType is returned when query type in request is not matched with the available ones
	CodeInvalidQueryType ErrorCode = 19
	//CodeInvalidTxnType is returned when txn type passed is not available
	CodeInvalidTxnType ErrorCode = 20
	//CodeValidateTxnError is returned when execution validation of txn fails
	CodeValidateTxnError ErrorCode = 21
	//CodeInvalidTxnError is returned when txn doesn't contains proper data
	CodeInvalidTxnError ErrorCode = 22
	//CodeAddTxnError is returned when adding txn to state db fails
	CodeAddTxnError ErrorCode = 23
	//CodeDataUrlError is returned when a url passed to a data query fails
	CodeDataUrlError ErrorCode = 24
	//CodeDataEntryHashError is returned when an entry hash query fails on a data chain
	CodeDataEntryHashError ErrorCode = 24
)

type Fee

type Fee int

Fee is the unit cost of a transaction.

const (
	// FeeFailedMaximum $0.01
	FeeFailedMaximum Fee = 100

	// FeeCreateIdentity $5.00 = 50000 credits @ 0.0001 / credit.
	FeeCreateIdentity Fee = 50000

	// FeeCreateTokenAccount $0.25
	FeeCreateTokenAccount Fee = 2500

	// FeeSendTokens $0.03
	FeeSendTokens Fee = 300

	// FeeCreateDataAccount $.25
	FeeCreateDataAccount Fee = 2500

	// FeeWriteData $0.001 / 256 bytes
	FeeWriteData Fee = 10

	// FeeWriteDataTo $0.001 / 256 bytes
	FeeWriteDataTo Fee = 10

	// FeeCreateToken $50.00
	FeeCreateToken Fee = 500000

	// FeeIssueTokens equiv. to token send @ $0.03
	FeeIssueTokens Fee = 300

	// FeeAcmeFaucet free
	FeeAcmeFaucet Fee = 0

	// FeeBurnTokens equiv. to token send
	FeeBurnTokens Fee = 300

	// FeeCreateKeyPage $1.00
	FeeCreateKeyPage Fee = 10000

	// FeeCreateKeyBook $1.00
	FeeCreateKeyBook Fee = 10000

	// FeeAddCredits conversion of ACME tokens to credits a "free" transaction
	FeeAddCredits Fee = 0

	// FeeUpdateKeyPage $0.03
	FeeUpdateKeyPage Fee = 300

	// FeeCreateScratchChain $0.25
	FeeCreateScratchChain Fee = 2500

	//FeeWriteScratchData $0.0001 / 256 bytes
	FeeWriteScratchData Fee = 1

	// FeeSignPending $0.001
	FeeSignPending Fee = 10
)

Fee Schedule

func ComputeFee

func ComputeFee(tx *transactions.Envelope) (Fee, error)

func (Fee) AsInt

func (n Fee) AsInt() int

type HashAlgorithm

type HashAlgorithm uint8
const (
	Unhashed HashAlgorithm = iota
	UnknownHashAlgorithm
	SHA256
	SHA256D
)

func HashAlgorithmByName

func HashAlgorithmByName(s string) HashAlgorithm

func (HashAlgorithm) Apply

func (ha HashAlgorithm) Apply(b []byte) ([]byte, error)

func (HashAlgorithm) BinarySize

func (ha HashAlgorithm) BinarySize() int

func (HashAlgorithm) MarshalBinary

func (ha HashAlgorithm) MarshalBinary() ([]byte, error)

func (HashAlgorithm) MarshalJSON

func (ha HashAlgorithm) MarshalJSON() ([]byte, error)

func (HashAlgorithm) MustApply

func (ha HashAlgorithm) MustApply(b []byte) []byte

func (HashAlgorithm) String

func (ha HashAlgorithm) String() string

func (*HashAlgorithm) UnmarshalBinary

func (ha *HashAlgorithm) UnmarshalBinary(b []byte) error

func (*HashAlgorithm) UnmarshalJSON

func (ha *HashAlgorithm) UnmarshalJSON(b []byte) error

type InternalGenesis added in v0.4.0

type InternalGenesis struct {
}

func (*InternalGenesis) BinarySize added in v0.4.0

func (v *InternalGenesis) BinarySize() int

func (*InternalGenesis) Equal added in v0.4.0

func (v *InternalGenesis) Equal(u *InternalGenesis) bool

func (*InternalGenesis) GetType added in v0.4.0

func (*InternalGenesis) MarshalBinary added in v0.4.0

func (v *InternalGenesis) MarshalBinary() ([]byte, error)

func (*InternalGenesis) UnmarshalBinary added in v0.4.0

func (v *InternalGenesis) UnmarshalBinary(data []byte) error

type InternalLedger added in v0.4.0

type InternalLedger struct {
	state.ChainHeader
	Index     int64            `json:"index,omitempty" form:"index" query:"index" validate:"required"`
	Timestamp time.Time        `json:"timestamp,omitempty" form:"timestamp" query:"timestamp" validate:"required"`
	Synthetic SyntheticLedger  `json:"synthetic,omitempty" form:"synthetic" query:"synthetic" validate:"required"`
	Updates   []AnchorMetadata `json:"updates,omitempty" form:"updates" query:"updates" validate:"required"`
}

func NewInternalLedger added in v0.4.0

func NewInternalLedger() *InternalLedger

func (*InternalLedger) BinarySize added in v0.4.0

func (v *InternalLedger) BinarySize() int

func (*InternalLedger) Equal added in v0.4.0

func (v *InternalLedger) Equal(u *InternalLedger) bool

func (*InternalLedger) MarshalBinary added in v0.4.0

func (v *InternalLedger) MarshalBinary() ([]byte, error)

func (*InternalLedger) UnmarshalBinary added in v0.4.0

func (v *InternalLedger) UnmarshalBinary(data []byte) error

type InternalSendTransactions added in v0.4.0

type InternalSendTransactions struct {
	Transactions []SendTransaction `json:"transactions,omitempty" form:"transactions" query:"transactions" validate:"required"`
}

func (*InternalSendTransactions) BinarySize added in v0.4.0

func (v *InternalSendTransactions) BinarySize() int

func (*InternalSendTransactions) GetType added in v0.4.0

func (*InternalSendTransactions) MarshalBinary added in v0.4.0

func (v *InternalSendTransactions) MarshalBinary() ([]byte, error)

func (*InternalSendTransactions) UnmarshalBinary added in v0.4.0

func (v *InternalSendTransactions) UnmarshalBinary(data []byte) error

type InternalTransactionsSent added in v0.4.0

type InternalTransactionsSent struct {
	Transactions [][32]byte `json:"transactions,omitempty" form:"transactions" query:"transactions" validate:"required"`
}

func (*InternalTransactionsSent) BinarySize added in v0.4.0

func (v *InternalTransactionsSent) BinarySize() int

func (*InternalTransactionsSent) Equal added in v0.4.0

func (*InternalTransactionsSent) GetType added in v0.4.0

func (*InternalTransactionsSent) MarshalBinary added in v0.4.0

func (v *InternalTransactionsSent) MarshalBinary() ([]byte, error)

func (*InternalTransactionsSent) MarshalJSON added in v0.4.0

func (v *InternalTransactionsSent) MarshalJSON() ([]byte, error)

func (*InternalTransactionsSent) UnmarshalBinary added in v0.4.0

func (v *InternalTransactionsSent) UnmarshalBinary(data []byte) error

func (*InternalTransactionsSent) UnmarshalJSON added in v0.4.0

func (v *InternalTransactionsSent) UnmarshalJSON(data []byte) error

type InternalTransactionsSigned added in v0.4.0

type InternalTransactionsSigned struct {
	Transactions []TransactionSignature `json:"transactions,omitempty" form:"transactions" query:"transactions" validate:"required"`
}

func (*InternalTransactionsSigned) BinarySize added in v0.4.0

func (v *InternalTransactionsSigned) BinarySize() int

func (*InternalTransactionsSigned) Equal added in v0.4.0

func (*InternalTransactionsSigned) GetType added in v0.4.0

func (*InternalTransactionsSigned) MarshalBinary added in v0.4.0

func (v *InternalTransactionsSigned) MarshalBinary() ([]byte, error)

func (*InternalTransactionsSigned) UnmarshalBinary added in v0.4.0

func (v *InternalTransactionsSigned) UnmarshalBinary(data []byte) error

type IssueTokens

type IssueTokens struct {
	Recipient string  `json:"recipient,omitempty" form:"recipient" query:"recipient" validate:"required,acc-url"`
	Amount    big.Int `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*IssueTokens) BinarySize

func (v *IssueTokens) BinarySize() int

func (*IssueTokens) Equal

func (v *IssueTokens) Equal(u *IssueTokens) bool

func (*IssueTokens) GetType

func (*IssueTokens) GetType() types.TransactionType

func (*IssueTokens) MarshalBinary

func (v *IssueTokens) MarshalBinary() ([]byte, error)

func (*IssueTokens) MarshalJSON added in v0.4.0

func (v *IssueTokens) MarshalJSON() ([]byte, error)

func (*IssueTokens) UnmarshalBinary

func (v *IssueTokens) UnmarshalBinary(data []byte) error

func (*IssueTokens) UnmarshalJSON added in v0.4.0

func (v *IssueTokens) UnmarshalJSON(data []byte) error

type KeyAlgorithm

type KeyAlgorithm uint8
const (
	UnknownKeyAlgorithm KeyAlgorithm = iota
	RSA
	ECDSA
	ED25519
)

func KeyAlgorithmByName

func KeyAlgorithmByName(s string) KeyAlgorithm

func (KeyAlgorithm) BinarySize

func (ka KeyAlgorithm) BinarySize() int

func (KeyAlgorithm) MarshalBinary

func (ka KeyAlgorithm) MarshalBinary() ([]byte, error)

func (KeyAlgorithm) MarshalJSON

func (ka KeyAlgorithm) MarshalJSON() ([]byte, error)

func (KeyAlgorithm) String

func (ka KeyAlgorithm) String() string

func (*KeyAlgorithm) UnmarshalBinary

func (ka *KeyAlgorithm) UnmarshalBinary(b []byte) error

func (*KeyAlgorithm) UnmarshalJSON

func (ka *KeyAlgorithm) UnmarshalJSON(b []byte) error

type KeyBook

type KeyBook struct {
	state.ChainHeader
	Pages []string `json:"pages,omitempty" form:"pages" query:"pages" validate:"required"`
}

func NewKeyBook

func NewKeyBook() *KeyBook

func (*KeyBook) BinarySize

func (v *KeyBook) BinarySize() int

func (*KeyBook) Equal

func (v *KeyBook) Equal(u *KeyBook) bool

func (*KeyBook) MarshalBinary

func (v *KeyBook) MarshalBinary() ([]byte, error)

func (*KeyBook) UnmarshalBinary

func (v *KeyBook) UnmarshalBinary(data []byte) error

type KeyPage

type KeyPage struct {
	state.ChainHeader
	CreditBalance big.Int    `json:"creditBalance,omitempty" form:"creditBalance" query:"creditBalance" validate:"required"`
	Threshold     uint64     `json:"threshold,omitempty" form:"threshold" query:"threshold" validate:"required"`
	Keys          []*KeySpec `json:"keys,omitempty" form:"keys" query:"keys" validate:"required"`
}

func NewKeyPage

func NewKeyPage() *KeyPage

func (*KeyPage) BinarySize

func (v *KeyPage) BinarySize() int

func (*KeyPage) CreditCredits

func (ms *KeyPage) CreditCredits(amount uint64)

func (*KeyPage) DebitCredits

func (ms *KeyPage) DebitCredits(amount uint64) bool

func (*KeyPage) Equal

func (v *KeyPage) Equal(u *KeyPage) bool

func (*KeyPage) FindKey

func (ms *KeyPage) FindKey(pubKey []byte) *KeySpec

func (*KeyPage) GetMofN added in v0.4.0

func (ms *KeyPage) GetMofN() (m, n uint64)

GetMofN return the signature requirements of the Key Page. Each Key Page requires m of n signatures, where m <= n, and n is the number of keys on the key page. m is the Threshold number of signatures required to validate a transaction

func (*KeyPage) MarshalBinary

func (v *KeyPage) MarshalBinary() ([]byte, error)

func (*KeyPage) MarshalJSON added in v0.4.0

func (v *KeyPage) MarshalJSON() ([]byte, error)

func (*KeyPage) SetNonce added in v0.4.0

func (page *KeyPage) SetNonce(key []byte, nonce uint64) error

func (*KeyPage) SetThreshold added in v0.4.0

func (ms *KeyPage) SetThreshold(m uint64) error

SetThreshold set the signature threshold to M. Returns an error if m > n

func (*KeyPage) UnmarshalBinary

func (v *KeyPage) UnmarshalBinary(data []byte) error

func (*KeyPage) UnmarshalJSON added in v0.4.0

func (v *KeyPage) UnmarshalJSON(data []byte) error

type KeyPageOperation

type KeyPageOperation uint8

KeyPageOperation is the operation type of an UpdateKeyPage transaction.

const KeyPageOperationAdd KeyPageOperation = 3

KeyPageOperationAdd adds a key to the page.

const KeyPageOperationRemove KeyPageOperation = 2

KeyPageOperationRemove removes a key from the page.

const KeyPageOperationSetThreshold KeyPageOperation = 4

KeyPageOperationSetThreshold sets the signing threshold (the M of "M of N" signatures required).

const KeyPageOperationUnknown KeyPageOperation = 0

KeyPageOperationUnknown is used when the key page operation is not known.

const KeyPageOperationUpdate KeyPageOperation = 1

KeyPageOperationUpdate replaces a key in the page with a new key.

func KeyPageOperationByName

func KeyPageOperationByName(name string) (KeyPageOperation, bool)

KeyPageOperationByName returns the named Key PageOpe ration.

func (KeyPageOperation) BinarySize

func (v KeyPageOperation) BinarySize() int

BinarySize returns the number of bytes required to binary marshal the Key PageOpe ration.

func (KeyPageOperation) ID added in v0.4.0

func (v KeyPageOperation) ID() uint64

ID returns the ID of the Key PageOpe ration

func (KeyPageOperation) MarshalBinary

func (v KeyPageOperation) MarshalBinary() ([]byte, error)

MarshalBinary marshals the Key PageOpe ration to bytes as a unsigned varint.

func (KeyPageOperation) MarshalJSON

func (v KeyPageOperation) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Key PageOpe ration to JSON as a string.

func (KeyPageOperation) String

func (v KeyPageOperation) String() string

String returns the name of the Key PageOpe ration

func (*KeyPageOperation) UnmarshalBinary

func (v *KeyPageOperation) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshals the Key PageOpe ration from bytes as a unsigned varint.

func (*KeyPageOperation) UnmarshalJSON

func (v *KeyPageOperation) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Key PageOpe ration from JSON as a string.

type KeySpec

type KeySpec struct {
	PublicKey []byte `json:"publicKey,omitempty" form:"publicKey" query:"publicKey" validate:"required"`
	Nonce     uint64 `json:"nonce,omitempty" form:"nonce" query:"nonce" validate:"required"`
	Owner     string `json:"owner,omitempty" form:"owner" query:"owner" validate:"required"`
}

func (*KeySpec) BinarySize

func (v *KeySpec) BinarySize() int

func (*KeySpec) Equal

func (v *KeySpec) Equal(u *KeySpec) bool

func (*KeySpec) MarshalBinary

func (v *KeySpec) MarshalBinary() ([]byte, error)

func (*KeySpec) MarshalJSON

func (v *KeySpec) MarshalJSON() ([]byte, error)

func (*KeySpec) UnmarshalBinary

func (v *KeySpec) UnmarshalBinary(data []byte) error

func (*KeySpec) UnmarshalJSON

func (v *KeySpec) UnmarshalJSON(data []byte) error

type KeySpecParams

type KeySpecParams struct {
	PublicKey []byte `json:"publicKey,omitempty" form:"publicKey" query:"publicKey" validate:"required"`
}

func (*KeySpecParams) BinarySize

func (v *KeySpecParams) BinarySize() int

func (*KeySpecParams) Equal

func (v *KeySpecParams) Equal(u *KeySpecParams) bool

func (*KeySpecParams) MarshalBinary

func (v *KeySpecParams) MarshalBinary() ([]byte, error)

func (*KeySpecParams) MarshalJSON

func (v *KeySpecParams) MarshalJSON() ([]byte, error)

func (*KeySpecParams) UnmarshalBinary

func (v *KeySpecParams) UnmarshalBinary(data []byte) error

func (*KeySpecParams) UnmarshalJSON

func (v *KeySpecParams) UnmarshalJSON(data []byte) error

type LiteDataAccount

type LiteDataAccount struct {
	state.ChainHeader
	Tail []byte `json:"tail,omitempty" form:"tail" query:"tail" validate:"required"`
}

func NewLiteDataAccount

func NewLiteDataAccount() *LiteDataAccount

func (*LiteDataAccount) AccountId added in v0.4.0

func (c *LiteDataAccount) AccountId() ([]byte, error)

func (*LiteDataAccount) BinarySize

func (v *LiteDataAccount) BinarySize() int

func (*LiteDataAccount) Equal

func (v *LiteDataAccount) Equal(u *LiteDataAccount) bool

func (*LiteDataAccount) MarshalBinary

func (v *LiteDataAccount) MarshalBinary() ([]byte, error)

func (*LiteDataAccount) MarshalJSON

func (v *LiteDataAccount) MarshalJSON() ([]byte, error)

func (*LiteDataAccount) UnmarshalBinary

func (v *LiteDataAccount) UnmarshalBinary(data []byte) error

func (*LiteDataAccount) UnmarshalJSON

func (v *LiteDataAccount) UnmarshalJSON(data []byte) error

type LiteDataEntry added in v0.4.0

type LiteDataEntry struct {
	AccountId [32]byte
	*DataEntry
}

func NewLiteDataEntry added in v0.4.0

func NewLiteDataEntry() *LiteDataEntry

func (*LiteDataEntry) Hash added in v0.4.0

func (e *LiteDataEntry) Hash() ([]byte, error)

func (*LiteDataEntry) MarshalBinary added in v0.4.0

func (e *LiteDataEntry) MarshalBinary() ([]byte, error)

MarshalBinary marshal the LiteDataEntry in accordance to https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry

func (*LiteDataEntry) UnmarshalBinary added in v0.4.0

func (e *LiteDataEntry) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshal the LiteDataEntry in accordance to https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry

type LiteTokenAccount

type LiteTokenAccount struct {
	state.ChainHeader
	TokenUrl      string  `json:"tokenUrl,omitempty" form:"tokenUrl" query:"tokenUrl" validate:"required,acc-url"`
	Balance       big.Int `json:"balance,omitempty" form:"balance" query:"balance" validate:"required"`
	Nonce         uint64  `json:"nonce,omitempty" form:"nonce" query:"nonce" validate:"required"`
	CreditBalance big.Int `json:"creditBalance,omitempty" form:"creditBalance" query:"creditBalance" validate:"required"`
}

func NewLiteTokenAccount

func NewLiteTokenAccount() *LiteTokenAccount

func (*LiteTokenAccount) BinarySize

func (v *LiteTokenAccount) BinarySize() int

func (*LiteTokenAccount) CanDebitTokens

func (acct *LiteTokenAccount) CanDebitTokens(amount *big.Int) bool

func (*LiteTokenAccount) CreditCredits

func (acct *LiteTokenAccount) CreditCredits(amount uint64)

func (*LiteTokenAccount) CreditTokens

func (acct *LiteTokenAccount) CreditTokens(amount *big.Int) bool

func (*LiteTokenAccount) DebitCredits

func (acct *LiteTokenAccount) DebitCredits(amount uint64) bool

func (*LiteTokenAccount) DebitTokens

func (acct *LiteTokenAccount) DebitTokens(amount *big.Int) bool

func (*LiteTokenAccount) Equal

func (v *LiteTokenAccount) Equal(u *LiteTokenAccount) bool

func (*LiteTokenAccount) MarshalBinary

func (v *LiteTokenAccount) MarshalBinary() ([]byte, error)

func (*LiteTokenAccount) MarshalJSON added in v0.4.0

func (v *LiteTokenAccount) MarshalJSON() ([]byte, error)

func (*LiteTokenAccount) ParseTokenUrl

func (acct *LiteTokenAccount) ParseTokenUrl() (*url.URL, error)

func (*LiteTokenAccount) SetNonce added in v0.4.0

func (acct *LiteTokenAccount) SetNonce(key []byte, nonce uint64) error

func (*LiteTokenAccount) TokenBalance added in v0.4.0

func (acct *LiteTokenAccount) TokenBalance() *big.Int

func (*LiteTokenAccount) UnmarshalBinary

func (v *LiteTokenAccount) UnmarshalBinary(data []byte) error

func (*LiteTokenAccount) UnmarshalJSON added in v0.4.0

func (v *LiteTokenAccount) UnmarshalJSON(data []byte) error

type MetricsRequest

type MetricsRequest struct {
	Metric   string        `json:"metric,omitempty" form:"metric" query:"metric" validate:"required"`
	Duration time.Duration `json:"duration,omitempty" form:"duration" query:"duration" validate:"required"`
}

func (*MetricsRequest) BinarySize

func (v *MetricsRequest) BinarySize() int

func (*MetricsRequest) Equal

func (v *MetricsRequest) Equal(u *MetricsRequest) bool

func (*MetricsRequest) MarshalBinary

func (v *MetricsRequest) MarshalBinary() ([]byte, error)

func (*MetricsRequest) MarshalJSON

func (v *MetricsRequest) MarshalJSON() ([]byte, error)

func (*MetricsRequest) UnmarshalBinary

func (v *MetricsRequest) UnmarshalBinary(data []byte) error

func (*MetricsRequest) UnmarshalJSON

func (v *MetricsRequest) UnmarshalJSON(data []byte) error

type MetricsResponse

type MetricsResponse struct {
	Value interface{} `json:"value,omitempty" form:"value" query:"value" validate:"required"`
}

func (*MetricsResponse) MarshalJSON added in v0.4.0

func (v *MetricsResponse) MarshalJSON() ([]byte, error)

func (*MetricsResponse) UnmarshalJSON added in v0.4.0

func (v *MetricsResponse) UnmarshalJSON(data []byte) error

type ObjectMetadata added in v0.4.0

type ObjectMetadata struct {
	Type   ObjectType      `json:"type,omitempty" form:"type" query:"type" validate:"required"`
	Chains []ChainMetadata `json:"chains,omitempty" form:"chains" query:"chains" validate:"required"`
}

func (*ObjectMetadata) BinarySize added in v0.4.0

func (v *ObjectMetadata) BinarySize() int

func (*ObjectMetadata) Equal added in v0.4.0

func (v *ObjectMetadata) Equal(u *ObjectMetadata) bool

func (*ObjectMetadata) MarshalBinary added in v0.4.0

func (v *ObjectMetadata) MarshalBinary() ([]byte, error)

func (*ObjectMetadata) UnmarshalBinary added in v0.4.0

func (v *ObjectMetadata) UnmarshalBinary(data []byte) error

type ObjectType added in v0.4.0

type ObjectType uint64

ObjectType is the type of an object in the database.

const ObjectTypeAccount ObjectType = 1

ObjectTypeAccount represents an account object.

const ObjectTypeTransaction ObjectType = 2

ObjectTypeTransaction represents a transaction object.

const ObjectTypeUnknown ObjectType = 0

ObjectTypeUnknown is used when the object type is not known.

func ObjectTypeByName added in v0.4.0

func ObjectTypeByName(name string) (ObjectType, bool)

ObjectTypeByName returns the named Object Type.

func (ObjectType) BinarySize added in v0.4.0

func (v ObjectType) BinarySize() int

BinarySize returns the number of bytes required to binary marshal the Object Type.

func (ObjectType) ID added in v0.4.0

func (v ObjectType) ID() uint64

ID returns the ID of the Object Type

func (ObjectType) MarshalBinary added in v0.4.0

func (v ObjectType) MarshalBinary() ([]byte, error)

MarshalBinary marshals the Object Type to bytes as a unsigned varint.

func (ObjectType) MarshalJSON added in v0.4.0

func (v ObjectType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Object Type to JSON as a string.

func (ObjectType) String added in v0.4.0

func (v ObjectType) String() string

String returns the name of the Object Type

func (*ObjectType) UnmarshalBinary added in v0.4.0

func (v *ObjectType) UnmarshalBinary(data []byte) error

UnmarshalBinary unmarshals the Object Type from bytes as a unsigned varint.

func (*ObjectType) UnmarshalJSON added in v0.4.0

func (v *ObjectType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Object Type from JSON as a string.

type Receipt added in v0.4.0

type Receipt struct {
	Start   []byte         `json:"start,omitempty" form:"start" query:"start" validate:"required"`
	Entries []ReceiptEntry `json:"entries,omitempty" form:"entries" query:"entries" validate:"required"`
}

func (*Receipt) BinarySize added in v0.4.0

func (v *Receipt) BinarySize() int

func (*Receipt) Convert added in v0.4.0

func (r *Receipt) Convert() *managed.Receipt

func (*Receipt) Equal added in v0.4.0

func (v *Receipt) Equal(u *Receipt) bool

func (*Receipt) MarshalBinary added in v0.4.0

func (v *Receipt) MarshalBinary() ([]byte, error)

func (*Receipt) MarshalJSON added in v0.4.0

func (v *Receipt) MarshalJSON() ([]byte, error)

func (*Receipt) UnmarshalBinary added in v0.4.0

func (v *Receipt) UnmarshalBinary(data []byte) error

func (*Receipt) UnmarshalJSON added in v0.4.0

func (v *Receipt) UnmarshalJSON(data []byte) error

type ReceiptEntry added in v0.4.0

type ReceiptEntry struct {
	Right bool   `json:"right,omitempty" form:"right" query:"right" validate:"required"`
	Hash  []byte `json:"hash,omitempty" form:"hash" query:"hash" validate:"required"`
}

func (*ReceiptEntry) BinarySize added in v0.4.0

func (v *ReceiptEntry) BinarySize() int

func (*ReceiptEntry) Equal added in v0.4.0

func (v *ReceiptEntry) Equal(u *ReceiptEntry) bool

func (*ReceiptEntry) MarshalBinary added in v0.4.0

func (v *ReceiptEntry) MarshalBinary() ([]byte, error)

func (*ReceiptEntry) MarshalJSON added in v0.4.0

func (v *ReceiptEntry) MarshalJSON() ([]byte, error)

func (*ReceiptEntry) UnmarshalBinary added in v0.4.0

func (v *ReceiptEntry) UnmarshalBinary(data []byte) error

func (*ReceiptEntry) UnmarshalJSON added in v0.4.0

func (v *ReceiptEntry) UnmarshalJSON(data []byte) error

type RequestDataEntry

type RequestDataEntry struct {
	Url       string   `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	EntryHash [32]byte `json:"entryHash,omitempty" form:"entryHash" query:"entryHash"`
}

func (*RequestDataEntry) BinarySize

func (v *RequestDataEntry) BinarySize() int

func (*RequestDataEntry) Equal

func (v *RequestDataEntry) Equal(u *RequestDataEntry) bool

func (*RequestDataEntry) MarshalBinary

func (v *RequestDataEntry) MarshalBinary() ([]byte, error)

func (*RequestDataEntry) MarshalJSON

func (v *RequestDataEntry) MarshalJSON() ([]byte, error)

func (*RequestDataEntry) UnmarshalBinary

func (v *RequestDataEntry) UnmarshalBinary(data []byte) error

func (*RequestDataEntry) UnmarshalJSON

func (v *RequestDataEntry) UnmarshalJSON(data []byte) error

type RequestDataEntrySet

type RequestDataEntrySet struct {
	Url          string `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	Start        uint64 `json:"start,omitempty" form:"start" query:"start" validate:"required"`
	Count        uint64 `json:"count,omitempty" form:"count" query:"count" validate:"required"`
	ExpandChains bool   `json:"expandChains,omitempty" form:"expandChains" query:"expandChains"`
}

func (*RequestDataEntrySet) BinarySize

func (v *RequestDataEntrySet) BinarySize() int

func (*RequestDataEntrySet) Equal

func (*RequestDataEntrySet) MarshalBinary

func (v *RequestDataEntrySet) MarshalBinary() ([]byte, error)

func (*RequestDataEntrySet) UnmarshalBinary

func (v *RequestDataEntrySet) UnmarshalBinary(data []byte) error

type ResponseDataEntry

type ResponseDataEntry struct {
	EntryHash [32]byte  `json:"entryHash,omitempty" form:"entryHash" query:"entryHash" validate:"required"`
	Entry     DataEntry `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"`
}

func (*ResponseDataEntry) BinarySize

func (v *ResponseDataEntry) BinarySize() int

func (*ResponseDataEntry) Equal

func (*ResponseDataEntry) MarshalBinary

func (v *ResponseDataEntry) MarshalBinary() ([]byte, error)

func (*ResponseDataEntry) MarshalJSON

func (v *ResponseDataEntry) MarshalJSON() ([]byte, error)

func (*ResponseDataEntry) UnmarshalBinary

func (v *ResponseDataEntry) UnmarshalBinary(data []byte) error

func (*ResponseDataEntry) UnmarshalJSON

func (v *ResponseDataEntry) UnmarshalJSON(data []byte) error

type ResponseDataEntrySet

type ResponseDataEntrySet struct {
	DataEntries []ResponseDataEntry `json:"dataEntries,omitempty" form:"dataEntries" query:"dataEntries" validate:"required"`
	Total       uint64              `json:"total,omitempty" form:"total" query:"total" validate:"required"`
}

func (*ResponseDataEntrySet) BinarySize

func (v *ResponseDataEntrySet) BinarySize() int

func (*ResponseDataEntrySet) Equal

func (*ResponseDataEntrySet) MarshalBinary

func (v *ResponseDataEntrySet) MarshalBinary() ([]byte, error)

func (*ResponseDataEntrySet) UnmarshalBinary

func (v *ResponseDataEntrySet) UnmarshalBinary(data []byte) error

type SegWitDataEntry

type SegWitDataEntry struct {
	Cause     [32]byte `json:"cause,omitempty" form:"cause" query:"cause" validate:"required"`
	EntryUrl  string   `json:"entryUrl,omitempty" form:"entryUrl" query:"entryUrl" validate:"required,acc-url"`
	EntryHash [32]byte `json:"entryHash,omitempty" form:"entryHash" query:"entryHash" validate:"required"`
}

func (*SegWitDataEntry) BinarySize

func (v *SegWitDataEntry) BinarySize() int

func (*SegWitDataEntry) Equal

func (v *SegWitDataEntry) Equal(u *SegWitDataEntry) bool

func (*SegWitDataEntry) GetCause added in v0.4.0

func (tx *SegWitDataEntry) GetCause() [32]byte

func (*SegWitDataEntry) GetType

func (*SegWitDataEntry) MarshalBinary

func (v *SegWitDataEntry) MarshalBinary() ([]byte, error)

func (*SegWitDataEntry) MarshalJSON

func (v *SegWitDataEntry) MarshalJSON() ([]byte, error)

func (*SegWitDataEntry) UnmarshalBinary

func (v *SegWitDataEntry) UnmarshalBinary(data []byte) error

func (*SegWitDataEntry) UnmarshalJSON

func (v *SegWitDataEntry) UnmarshalJSON(data []byte) error

type SendTokens added in v0.4.0

type SendTokens struct {
	Hash [32]byte          `json:"hash,omitempty" form:"hash" query:"hash"`
	Meta json.RawMessage   `json:"meta,omitempty" form:"meta" query:"meta"`
	To   []*TokenRecipient `json:"to,omitempty" form:"to" query:"to" validate:"required"`
}

func (*SendTokens) AddRecipient added in v0.4.0

func (tx *SendTokens) AddRecipient(to *url.URL, amount *big.Int)

func (*SendTokens) BinarySize added in v0.4.0

func (v *SendTokens) BinarySize() int

func (*SendTokens) Equal added in v0.4.0

func (v *SendTokens) Equal(u *SendTokens) bool

func (*SendTokens) GetType added in v0.4.0

func (*SendTokens) GetType() types.TransactionType

func (*SendTokens) MarshalBinary added in v0.4.0

func (v *SendTokens) MarshalBinary() ([]byte, error)

func (*SendTokens) MarshalJSON added in v0.4.0

func (v *SendTokens) MarshalJSON() ([]byte, error)

func (*SendTokens) UnmarshalBinary added in v0.4.0

func (v *SendTokens) UnmarshalBinary(data []byte) error

func (*SendTokens) UnmarshalJSON added in v0.4.0

func (v *SendTokens) UnmarshalJSON(data []byte) error

type SendTransaction added in v0.4.0

type SendTransaction struct {
	Payload   TransactionPayload `json:"payload,omitempty" form:"payload" query:"payload" validate:"required"`
	Recipient *url.URL           `json:"recipient,omitempty" form:"recipient" query:"recipient" validate:"required"`
}

func (*SendTransaction) BinarySize added in v0.4.0

func (v *SendTransaction) BinarySize() int

func (*SendTransaction) MarshalBinary added in v0.4.0

func (v *SendTransaction) MarshalBinary() ([]byte, error)

func (*SendTransaction) MarshalJSON added in v0.4.0

func (v *SendTransaction) MarshalJSON() ([]byte, error)

func (*SendTransaction) UnmarshalBinary added in v0.4.0

func (v *SendTransaction) UnmarshalBinary(data []byte) error

func (*SendTransaction) UnmarshalJSON added in v0.4.0

func (v *SendTransaction) UnmarshalJSON(data []byte) error

type SignPending added in v0.4.0

type SignPending struct {
}

func (*SignPending) BinarySize added in v0.4.0

func (v *SignPending) BinarySize() int

func (*SignPending) Equal added in v0.4.0

func (v *SignPending) Equal(u *SignPending) bool

func (*SignPending) GetType added in v0.4.0

func (*SignPending) GetType() types.TransactionType

func (*SignPending) MarshalBinary added in v0.4.0

func (v *SignPending) MarshalBinary() ([]byte, error)

func (*SignPending) UnmarshalBinary added in v0.4.0

func (v *SignPending) UnmarshalBinary(data []byte) error

type SyntheticAnchor

type SyntheticAnchor struct {
	Source      string   `json:"source,omitempty" form:"source" query:"source" validate:"required,acc-url"`
	Major       bool     `json:"major,omitempty" form:"major" query:"major" validate:"required"`
	RootAnchor  [32]byte `json:"rootAnchor,omitempty" form:"rootAnchor" query:"rootAnchor" validate:"required"`
	RootIndex   uint64   `json:"rootIndex,omitempty" form:"rootIndex" query:"rootIndex" validate:"required"`
	Block       uint64   `json:"block,omitempty" form:"block" query:"block" validate:"required"`
	SourceIndex uint64   `json:"sourceIndex,omitempty" form:"sourceIndex" query:"sourceIndex" validate:"required"`
	SourceBlock uint64   `json:"sourceBlock,omitempty" form:"sourceBlock" query:"sourceBlock" validate:"required"`
	Receipt     Receipt  `json:"receipt,omitempty" form:"receipt" query:"receipt" validate:"required"`
}

func (*SyntheticAnchor) BinarySize

func (v *SyntheticAnchor) BinarySize() int

func (*SyntheticAnchor) Equal

func (v *SyntheticAnchor) Equal(u *SyntheticAnchor) bool

func (*SyntheticAnchor) GetType

func (*SyntheticAnchor) MarshalBinary

func (v *SyntheticAnchor) MarshalBinary() ([]byte, error)

func (*SyntheticAnchor) MarshalJSON

func (v *SyntheticAnchor) MarshalJSON() ([]byte, error)

func (*SyntheticAnchor) UnmarshalBinary

func (v *SyntheticAnchor) UnmarshalBinary(data []byte) error

func (*SyntheticAnchor) UnmarshalJSON

func (v *SyntheticAnchor) UnmarshalJSON(data []byte) error

type SyntheticBurnTokens

type SyntheticBurnTokens struct {
	Cause  [32]byte `json:"cause,omitempty" form:"cause" query:"cause" validate:"required"`
	Amount big.Int  `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*SyntheticBurnTokens) BinarySize

func (v *SyntheticBurnTokens) BinarySize() int

func (*SyntheticBurnTokens) Equal

func (*SyntheticBurnTokens) GetCause added in v0.4.0

func (tx *SyntheticBurnTokens) GetCause() [32]byte

func (*SyntheticBurnTokens) GetType

func (*SyntheticBurnTokens) MarshalBinary

func (v *SyntheticBurnTokens) MarshalBinary() ([]byte, error)

func (*SyntheticBurnTokens) MarshalJSON added in v0.4.0

func (v *SyntheticBurnTokens) MarshalJSON() ([]byte, error)

func (*SyntheticBurnTokens) UnmarshalBinary

func (v *SyntheticBurnTokens) UnmarshalBinary(data []byte) error

func (*SyntheticBurnTokens) UnmarshalJSON added in v0.4.0

func (v *SyntheticBurnTokens) UnmarshalJSON(data []byte) error

type SyntheticCreateChain

type SyntheticCreateChain struct {
	Cause  [32]byte      `json:"cause,omitempty" form:"cause" query:"cause" validate:"required"`
	Chains []ChainParams `json:"chains,omitempty" form:"chains" query:"chains" validate:"required"`
}

func (*SyntheticCreateChain) BinarySize

func (v *SyntheticCreateChain) BinarySize() int

func (*SyntheticCreateChain) Create

func (tx *SyntheticCreateChain) Create(chains ...state.Chain) error

func (*SyntheticCreateChain) Equal

func (*SyntheticCreateChain) GetCause

func (tx *SyntheticCreateChain) GetCause() [32]byte

func (*SyntheticCreateChain) GetType

func (*SyntheticCreateChain) MarshalBinary

func (v *SyntheticCreateChain) MarshalBinary() ([]byte, error)

func (*SyntheticCreateChain) MarshalJSON

func (v *SyntheticCreateChain) MarshalJSON() ([]byte, error)

func (*SyntheticCreateChain) UnmarshalBinary

func (v *SyntheticCreateChain) UnmarshalBinary(data []byte) error

func (*SyntheticCreateChain) UnmarshalJSON

func (v *SyntheticCreateChain) UnmarshalJSON(data []byte) error

func (*SyntheticCreateChain) Update

func (tx *SyntheticCreateChain) Update(chains ...state.Chain) error

type SyntheticDepositCredits

type SyntheticDepositCredits struct {
	Cause  [32]byte `json:"cause,omitempty" form:"cause" query:"cause" validate:"required"`
	Amount uint64   `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*SyntheticDepositCredits) BinarySize

func (v *SyntheticDepositCredits) BinarySize() int

func (*SyntheticDepositCredits) Equal

func (*SyntheticDepositCredits) GetCause added in v0.4.0

func (tx *SyntheticDepositCredits) GetCause() [32]byte

func (*SyntheticDepositCredits) GetType

func (*SyntheticDepositCredits) MarshalBinary

func (v *SyntheticDepositCredits) MarshalBinary() ([]byte, error)

func (*SyntheticDepositCredits) MarshalJSON

func (v *SyntheticDepositCredits) MarshalJSON() ([]byte, error)

func (*SyntheticDepositCredits) UnmarshalBinary

func (v *SyntheticDepositCredits) UnmarshalBinary(data []byte) error

func (*SyntheticDepositCredits) UnmarshalJSON

func (v *SyntheticDepositCredits) UnmarshalJSON(data []byte) error

type SyntheticDepositTokens added in v0.4.0

type SyntheticDepositTokens struct {
	Cause  [32]byte `json:"cause,omitempty" form:"cause" query:"cause" validate:"required"`
	Token  string   `json:"token,omitempty" form:"token" query:"token" validate:"required,acc-url"`
	Amount big.Int  `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*SyntheticDepositTokens) BinarySize added in v0.4.0

func (v *SyntheticDepositTokens) BinarySize() int

func (*SyntheticDepositTokens) Equal added in v0.4.0

func (*SyntheticDepositTokens) GetCause added in v0.4.0

func (tx *SyntheticDepositTokens) GetCause() [32]byte

func (*SyntheticDepositTokens) GetType added in v0.4.0

func (*SyntheticDepositTokens) MarshalBinary added in v0.4.0

func (v *SyntheticDepositTokens) MarshalBinary() ([]byte, error)

func (*SyntheticDepositTokens) MarshalJSON added in v0.4.0

func (v *SyntheticDepositTokens) MarshalJSON() ([]byte, error)

func (*SyntheticDepositTokens) UnmarshalBinary added in v0.4.0

func (v *SyntheticDepositTokens) UnmarshalBinary(data []byte) error

func (*SyntheticDepositTokens) UnmarshalJSON added in v0.4.0

func (v *SyntheticDepositTokens) UnmarshalJSON(data []byte) error

type SyntheticLedger added in v0.4.0

type SyntheticLedger struct {
	Nonce    uint64     `json:"nonce,omitempty" form:"nonce" query:"nonce" validate:"required"`
	Produced [][32]byte `json:"produced,omitempty" form:"produced" query:"produced" validate:"required"`
	Unsigned [][32]byte `json:"unsigned,omitempty" form:"unsigned" query:"unsigned" validate:"required"`
	Unsent   [][32]byte `json:"unsent,omitempty" form:"unsent" query:"unsent" validate:"required"`
}

func (*SyntheticLedger) BinarySize added in v0.4.0

func (v *SyntheticLedger) BinarySize() int

func (*SyntheticLedger) Equal added in v0.4.0

func (v *SyntheticLedger) Equal(u *SyntheticLedger) bool

func (*SyntheticLedger) MarshalBinary added in v0.4.0

func (v *SyntheticLedger) MarshalBinary() ([]byte, error)

func (*SyntheticLedger) MarshalJSON added in v0.4.0

func (v *SyntheticLedger) MarshalJSON() ([]byte, error)

func (*SyntheticLedger) UnmarshalBinary added in v0.4.0

func (v *SyntheticLedger) UnmarshalBinary(data []byte) error

func (*SyntheticLedger) UnmarshalJSON added in v0.4.0

func (v *SyntheticLedger) UnmarshalJSON(data []byte) error

type SyntheticMirror

type SyntheticMirror struct {
	Objects []AnchoredRecord `json:"objects,omitempty" form:"objects" query:"objects" validate:"required"`
}

func (*SyntheticMirror) BinarySize

func (v *SyntheticMirror) BinarySize() int

func (*SyntheticMirror) Equal

func (v *SyntheticMirror) Equal(u *SyntheticMirror) bool

func (*SyntheticMirror) GetType

func (*SyntheticMirror) MarshalBinary

func (v *SyntheticMirror) MarshalBinary() ([]byte, error)

func (*SyntheticMirror) UnmarshalBinary

func (v *SyntheticMirror) UnmarshalBinary(data []byte) error

type SyntheticTransaction

type SyntheticTransaction interface {
	TransactionPayload
	GetCause() [32]byte
}

type SyntheticWriteData

type SyntheticWriteData struct {
	Cause [32]byte  `json:"cause,omitempty" form:"cause" query:"cause" validate:"required"`
	Entry DataEntry `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"`
}

func (*SyntheticWriteData) BinarySize

func (v *SyntheticWriteData) BinarySize() int

func (*SyntheticWriteData) Equal

func (*SyntheticWriteData) GetCause added in v0.4.0

func (tx *SyntheticWriteData) GetCause() [32]byte

func (*SyntheticWriteData) GetType

func (*SyntheticWriteData) MarshalBinary

func (v *SyntheticWriteData) MarshalBinary() ([]byte, error)

func (*SyntheticWriteData) MarshalJSON

func (v *SyntheticWriteData) MarshalJSON() ([]byte, error)

func (*SyntheticWriteData) UnmarshalBinary

func (v *SyntheticWriteData) UnmarshalBinary(data []byte) error

func (*SyntheticWriteData) UnmarshalJSON

func (v *SyntheticWriteData) UnmarshalJSON(data []byte) error

type TokenAccount added in v0.4.0

type TokenAccount struct {
	state.ChainHeader
	TokenUrl string  `json:"tokenUrl,omitempty" form:"tokenUrl" query:"tokenUrl" validate:"required,acc-url"`
	Balance  big.Int `json:"balance,omitempty" form:"balance" query:"balance" validate:"required"`
	Scratch  bool    `json:"scratch,omitempty" form:"scratch" query:"scratch"`
}

func NewTokenAccount added in v0.4.0

func NewTokenAccount() *TokenAccount

func (*TokenAccount) BinarySize added in v0.4.0

func (v *TokenAccount) BinarySize() int

func (*TokenAccount) CanDebitTokens added in v0.4.0

func (acct *TokenAccount) CanDebitTokens(amount *big.Int) bool

func (*TokenAccount) CreditTokens added in v0.4.0

func (acct *TokenAccount) CreditTokens(amount *big.Int) bool

func (*TokenAccount) DebitTokens added in v0.4.0

func (acct *TokenAccount) DebitTokens(amount *big.Int) bool

func (*TokenAccount) Equal added in v0.4.0

func (v *TokenAccount) Equal(u *TokenAccount) bool

func (*TokenAccount) MarshalBinary added in v0.4.0

func (v *TokenAccount) MarshalBinary() ([]byte, error)

func (*TokenAccount) MarshalJSON added in v0.4.0

func (v *TokenAccount) MarshalJSON() ([]byte, error)

func (*TokenAccount) ParseTokenUrl added in v0.4.0

func (acct *TokenAccount) ParseTokenUrl() (*url.URL, error)

func (*TokenAccount) TokenBalance added in v0.4.0

func (acct *TokenAccount) TokenBalance() *big.Int

func (*TokenAccount) UnmarshalBinary added in v0.4.0

func (v *TokenAccount) UnmarshalBinary(data []byte) error

func (*TokenAccount) UnmarshalJSON added in v0.4.0

func (v *TokenAccount) UnmarshalJSON(data []byte) error

type TokenHolder added in v0.4.0

type TokenHolder interface {
	TokenBalance() *big.Int
	CreditTokens(amount *big.Int) bool
	CanDebitTokens(amount *big.Int) bool
	DebitTokens(amount *big.Int) bool
	ParseTokenUrl() (*url.URL, error)
}

type TokenIssuer

type TokenIssuer struct {
	state.ChainHeader
	Symbol         string  `json:"symbol,omitempty" form:"symbol" query:"symbol" validate:"required"`
	Precision      uint64  `json:"precision,omitempty" form:"precision" query:"precision" validate:"required"`
	Properties     string  `json:"properties,omitempty" form:"properties" query:"properties" validate:"required,acc-url"`
	Supply         big.Int `json:"supply,omitempty" form:"supply" query:"supply"`
	HasSupplyLimit bool    `json:"hasSupplyLimit,omitempty" form:"hasSupplyLimit" query:"hasSupplyLimit"`
}

func NewTokenIssuer

func NewTokenIssuer() *TokenIssuer

func (*TokenIssuer) BinarySize

func (v *TokenIssuer) BinarySize() int

func (*TokenIssuer) Equal

func (v *TokenIssuer) Equal(u *TokenIssuer) bool

func (*TokenIssuer) MarshalBinary

func (v *TokenIssuer) MarshalBinary() ([]byte, error)

func (*TokenIssuer) MarshalJSON added in v0.4.0

func (v *TokenIssuer) MarshalJSON() ([]byte, error)

func (*TokenIssuer) UnmarshalBinary

func (v *TokenIssuer) UnmarshalBinary(data []byte) error

func (*TokenIssuer) UnmarshalJSON added in v0.4.0

func (v *TokenIssuer) UnmarshalJSON(data []byte) error

type TokenRecipient added in v0.4.0

type TokenRecipient struct {
	Url    string  `json:"url,omitempty" form:"url" query:"url" validate:"required,acc-url"`
	Amount big.Int `json:"amount,omitempty" form:"amount" query:"amount" validate:"required"`
}

func (*TokenRecipient) BinarySize added in v0.4.0

func (v *TokenRecipient) BinarySize() int

func (*TokenRecipient) Equal added in v0.4.0

func (v *TokenRecipient) Equal(u *TokenRecipient) bool

func (*TokenRecipient) MarshalBinary added in v0.4.0

func (v *TokenRecipient) MarshalBinary() ([]byte, error)

func (*TokenRecipient) MarshalJSON added in v0.4.0

func (v *TokenRecipient) MarshalJSON() ([]byte, error)

func (*TokenRecipient) UnmarshalBinary added in v0.4.0

func (v *TokenRecipient) UnmarshalBinary(data []byte) error

func (*TokenRecipient) UnmarshalJSON added in v0.4.0

func (v *TokenRecipient) UnmarshalJSON(data []byte) error

type TransactionPayload

type TransactionPayload interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
	GetType() types.TxType
	BinarySize() int
}

func NewTransaction added in v0.4.0

func NewTransaction(typ types.TransactionType) (TransactionPayload, error)

func UnmarshalTransaction added in v0.4.0

func UnmarshalTransaction(data []byte) (TransactionPayload, error)

func UnmarshalTransactionJSON added in v0.4.0

func UnmarshalTransactionJSON(data []byte) (TransactionPayload, error)

type TransactionResult added in v0.4.0

type TransactionResult interface {
	GetType() types.TxType
	BinarySize() int
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

func NewTransactionResult added in v0.4.0

func NewTransactionResult(typ types.TransactionType) (TransactionResult, error)

func UnmarshalTransactionResult added in v0.4.0

func UnmarshalTransactionResult(data []byte) (TransactionResult, error)

func UnmarshalTransactionResultJSON added in v0.4.0

func UnmarshalTransactionResultJSON(data []byte) (TransactionResult, error)

type TransactionSignature added in v0.4.0

type TransactionSignature struct {
	Transaction [32]byte                 `json:"transaction,omitempty" form:"transaction" query:"transaction" validate:"required"`
	Signature   *transactions.ED25519Sig `json:"signature,omitempty" form:"signature" query:"signature" validate:"required"`
}

func (*TransactionSignature) BinarySize added in v0.4.0

func (v *TransactionSignature) BinarySize() int

func (*TransactionSignature) Equal added in v0.4.0

func (*TransactionSignature) MarshalBinary added in v0.4.0

func (v *TransactionSignature) MarshalBinary() ([]byte, error)

func (*TransactionSignature) MarshalJSON added in v0.4.0

func (v *TransactionSignature) MarshalJSON() ([]byte, error)

func (*TransactionSignature) UnmarshalBinary added in v0.4.0

func (v *TransactionSignature) UnmarshalBinary(data []byte) error

func (*TransactionSignature) UnmarshalJSON added in v0.4.0

func (v *TransactionSignature) UnmarshalJSON(data []byte) error

type TransactionStatus added in v0.4.0

type TransactionStatus struct {
	Remote    bool              `json:"remote,omitempty" form:"remote" query:"remote" validate:"required"`
	Delivered bool              `json:"delivered,omitempty" form:"delivered" query:"delivered" validate:"required"`
	Pending   bool              `json:"pending,omitempty" form:"pending" query:"pending" validate:"required"`
	Code      uint64            `json:"code,omitempty" form:"code" query:"code" validate:"required"`
	Message   string            `json:"message,omitempty" form:"message" query:"message" validate:"required"`
	Result    TransactionResult `json:"result,omitempty" form:"result" query:"result"`
}

func (*TransactionStatus) BinarySize added in v0.4.0

func (v *TransactionStatus) BinarySize() int

func (*TransactionStatus) Equal added in v0.4.0

func (*TransactionStatus) MarshalBinary added in v0.4.0

func (v *TransactionStatus) MarshalBinary() ([]byte, error)

func (*TransactionStatus) MarshalJSON added in v0.4.0

func (v *TransactionStatus) MarshalJSON() ([]byte, error)

func (*TransactionStatus) UnmarshalBinary added in v0.4.0

func (v *TransactionStatus) UnmarshalBinary(data []byte) error

func (*TransactionStatus) UnmarshalJSON added in v0.4.0

func (v *TransactionStatus) UnmarshalJSON(data []byte) error

type UpdateKeyPage

type UpdateKeyPage struct {
	Operation KeyPageOperation `json:"operation,omitempty" form:"operation" query:"operation" validate:"required"`
	Key       []byte           `json:"key,omitempty" form:"key" query:"key"`
	NewKey    []byte           `json:"newKey,omitempty" form:"newKey" query:"newKey"`
	Owner     string           `json:"owner,omitempty" form:"owner" query:"owner"`
	Threshold uint64           `json:"threshold,omitempty" form:"threshold" query:"threshold"`
}

func (*UpdateKeyPage) BinarySize

func (v *UpdateKeyPage) BinarySize() int

func (*UpdateKeyPage) Equal

func (v *UpdateKeyPage) Equal(u *UpdateKeyPage) bool

func (*UpdateKeyPage) GetType

func (*UpdateKeyPage) GetType() types.TransactionType

func (*UpdateKeyPage) MarshalBinary

func (v *UpdateKeyPage) MarshalBinary() ([]byte, error)

func (*UpdateKeyPage) MarshalJSON

func (v *UpdateKeyPage) MarshalJSON() ([]byte, error)

func (*UpdateKeyPage) UnmarshalBinary

func (v *UpdateKeyPage) UnmarshalBinary(data []byte) error

func (*UpdateKeyPage) UnmarshalJSON

func (v *UpdateKeyPage) UnmarshalJSON(data []byte) error

type WrappedTxPayload added in v0.4.0

type WrappedTxPayload struct {
	TransactionPayload
}

func (*WrappedTxPayload) UnmarshalBinary added in v0.4.0

func (w *WrappedTxPayload) UnmarshalBinary(data []byte) error

type WriteData

type WriteData struct {
	Entry DataEntry `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"`
}

func (*WriteData) BinarySize

func (v *WriteData) BinarySize() int

func (*WriteData) Equal

func (v *WriteData) Equal(u *WriteData) bool

func (*WriteData) GetType

func (*WriteData) GetType() types.TransactionType

func (*WriteData) MarshalBinary

func (v *WriteData) MarshalBinary() ([]byte, error)

func (*WriteData) UnmarshalBinary

func (v *WriteData) UnmarshalBinary(data []byte) error

type WriteDataResult added in v0.4.0

type WriteDataResult struct {
	EntryHash  [32]byte `json:"entryHash,omitempty" form:"entryHash" query:"entryHash" validate:"required"`
	AccountUrl *url.URL `json:"accountUrl,omitempty" form:"accountUrl" query:"accountUrl" validate:"required"`
	AccountID  []byte   `json:"accountID,omitempty" form:"accountID" query:"accountID" validate:"required"`
}

func (*WriteDataResult) BinarySize added in v0.4.0

func (v *WriteDataResult) BinarySize() int

func (*WriteDataResult) Equal added in v0.4.0

func (v *WriteDataResult) Equal(u *WriteDataResult) bool

func (*WriteDataResult) GetType added in v0.4.0

func (*WriteDataResult) MarshalBinary added in v0.4.0

func (v *WriteDataResult) MarshalBinary() ([]byte, error)

func (*WriteDataResult) MarshalJSON added in v0.4.0

func (v *WriteDataResult) MarshalJSON() ([]byte, error)

func (*WriteDataResult) UnmarshalBinary added in v0.4.0

func (v *WriteDataResult) UnmarshalBinary(data []byte) error

func (*WriteDataResult) UnmarshalJSON added in v0.4.0

func (v *WriteDataResult) UnmarshalJSON(data []byte) error

type WriteDataTo

type WriteDataTo struct {
	Recipient string    `json:"recipient,omitempty" form:"recipient" query:"recipient" validate:"required,acc-url"`
	Entry     DataEntry `json:"entry,omitempty" form:"entry" query:"entry" validate:"required"`
}

func (*WriteDataTo) BinarySize

func (v *WriteDataTo) BinarySize() int

func (*WriteDataTo) Equal

func (v *WriteDataTo) Equal(u *WriteDataTo) bool

func (*WriteDataTo) GetType

func (*WriteDataTo) GetType() types.TransactionType

func (*WriteDataTo) MarshalBinary

func (v *WriteDataTo) MarshalBinary() ([]byte, error)

func (*WriteDataTo) UnmarshalBinary

func (v *WriteDataTo) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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