types

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Authentication error codes
	ErrCodeInvalidAuthHeader      = 40000
	ErrCodeInvalidAuthCredentials = 40001

	// Implementation error codes
	RPCErrCodeInvalidParamType  = 60000
	RPCErrCodeInvalidParamValue = 60001
)

RPC error codes

View Source
const (
	ErrCodeFailedDecode     = uint32(1)
	ErrCodeExecFailure      = uint32(2)
	ErrCodeMaxTxTypeReached = 3
)

Transaction processing errors

View Source
const TxMetaKeyAllowNonceGap = "allowNonceGap"

Variables

View Source
var (
	ErrKeyUnknown        = fmt.Errorf("key not found")
	ErrAccountUnknown    = fmt.Errorf("account not found")
	ErrPushKeyUnknown    = fmt.Errorf("push key not found")
	ErrInvalidPrivKey    = fmt.Errorf("private key is invalid")
	ErrRepoNotFound      = fmt.Errorf("repo not found")
	ErrTxNotFound        = fmt.Errorf("transaction not found")
	ErrInvalidPassphrase = fmt.Errorf("invalid passphrase")
)

General

View Source
var (
	ErrCodeTxBadEncode        uint32 = 20000
	ErrCodeTxFailedValidation uint32 = 20001
	ErrCodeTxPoolReject       uint32 = 20002
)

ABI App Error Codes

View Source
var ErrExit = fmt.Errorf("exit")
View Source
var (
	// ErrIntSliceArgDecode means an interface slice parameter could not be decoded
	ErrIntSliceArgDecode = func(castType string, index, sliceIndex int) error {
		sliceIndexStr := ""
		if sliceIndex > -1 {
			sliceIndexStr = fmt.Sprintf("[%d]", sliceIndex)
		}
		return fmt.Errorf("failed to decode argument.%d%s to %s", index, sliceIndexStr, castType)
	}
)

Decode/Cast Error

View Source
var ErrSkipped = fmt.Errorf("skipped")

Functions

This section is empty.

Types

type BaseTx

type BaseTx interface {
	msgpack.CustomEncoder
	msgpack.CustomDecoder
	Meta

	// GetType returns the type of the transaction
	GetType() TxCode

	// GetSignature returns the transaction signature
	GetSignature() []byte

	// SetSignature sets the transaction signature
	SetSignature(s []byte)

	// GetSenderPubKey returns the transaction sender public key
	GetSenderPubKey() ed25519.PublicKey

	// SetSenderPubKey sets the transaction sender public key
	SetSenderPubKey(pk []byte)

	// GetTimestamp return the transaction creation unix timestamp
	GetTimestamp() int64

	// SetTimestamp sets the transaction creation unix timestamp
	SetTimestamp(t int64)

	// GetNonce returns the transaction nonce
	GetNonce() uint64

	// SetNonce set the transaction nonce
	SetNonce(nonce uint64)

	// SetFee sets the transaction fee
	SetFee(fee util.String)

	// GetFee returns the transaction fee
	GetFee() util.String

	// GetFrom returns the address of the transaction sender
	GetFrom() identifier.Address

	// GetHash returns the hash of the transaction
	GetHash() util.HexBytes

	// GetBytesNoSig returns the serialized the tx excluding the signature
	GetBytesNoSig() []byte

	// Bytes Returns the serialized transaction
	Bytes() []byte

	// ComputeHash computes the hash of the transaction
	ComputeHash() util.Bytes32

	// GetID returns the id of the transaction (also the hash)
	GetID() string

	// Sign signs the transaction
	Sign(privKey string) ([]byte, error)

	// GetEcoSize returns the size of the tx for use in fee calculation.
	// Size returned here may not be the actual tx size.
	GetEcoSize() int64

	// GetSize returns the size of the tx object (excluding nothing)
	GetSize() int64

	// ToMap returns a map equivalent of the transaction
	ToMap() map[string]interface{}

	// FromMap populate the fields from a map
	FromMap(map[string]interface{}) error

	// Is Id checks if the tx is a given type
	Is(txType TxCode) bool
}

BaseTx describes a base transaction

type BasicMeta added in v0.0.29

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

BasicMeta stores arbitrary, self-contained state information for a transaction

func NewMeta

func NewMeta() *BasicMeta

NewMeta creates an instance of BasicMeta

func (*BasicMeta) GetMeta added in v0.0.29

func (m *BasicMeta) GetMeta() map[string]interface{}

GetMeta returns the cloned meta information

func (*BasicMeta) HasMetaKey added in v0.0.29

func (m *BasicMeta) HasMetaKey(key string) bool

HasMetaKey returns true if the given key exist in the meta map

func (*BasicMeta) Join added in v0.0.29

func (m *BasicMeta) Join(d map[string]interface{})

ConcatMeta will concatenate a map into m

func (*BasicMeta) LoadMeta added in v0.0.29

func (m *BasicMeta) LoadMeta(d map[string]interface{})

LoadMeta loads d as the m

func (*BasicMeta) SetMeta added in v0.0.29

func (m *BasicMeta) SetMeta(key string, val interface{})

SetMeta set key and value

type Conn

type Conn interface {
	network.Conn
}

type Host

type Host interface {
	host.Host
}

type Meta

type Meta interface {
	HasMetaKey(key string) bool
	GetMeta() map[string]interface{}
	Join(d map[string]interface{})
	LoadMeta(d map[string]interface{})
	SetMeta(key string, val interface{})
}

type Peerstore

type Peerstore interface {
	peerstore.Peerstore
}

type ProposalTx

type ProposalTx interface {
	GetProposalID() string
	GetProposalRepoName() string
	GetProposalValue() util.String
}

ProposalTx describes a proposal creating transaction

type Stream

type Stream interface {
	network.Stream
}

type TxCode

type TxCode int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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