types

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: Apache-2.0 Imports: 8 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

	// 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

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

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

	// GetMeta returns the meta information of the transaction
	GetMeta() map[string]interface{}

	// SetMeta set key and value
	SetMeta(key string, val interface{})

	// HasMetaKey checks if a key exists in the metadata map
	HasMetaKey(key string) bool

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

BaseTx describes a base transaction

type Conn

type Conn interface {
	network.Conn
}

type Host

type Host interface {
	host.Host
}

type Meta

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

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

func NewMeta

func NewMeta() *Meta

NewMeta creates an instance of Meta

func (*Meta) GetMeta

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

GetMeta returns the meta information of the transaction

func (*Meta) HasMetaKey

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

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

func (*Meta) SetMeta

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

SetMeta set key and value

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