transaction

package
v1.17.12 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

DEPRECATED: This package is deprecated and will be removed in a future release.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transaction

type Transaction struct {
	Hash              string          `json:"hash,omitempty"`
	Version           string          `json:"version,omitempty"`
	ClientID          string          `json:"client_id,omitempty"`
	PublicKey         string          `json:"public_key,omitempty"`
	ToClientID        string          `json:"to_client_id,omitempty"`
	ChainID           string          `json:"chain_id,omitempty"`
	TransactionData   string          `json:"transaction_data,omitempty"`
	Value             int64           `json:"transaction_value,omitempty"`
	Signature         string          `json:"signature,omitempty"`
	CreationDate      ctime.Timestamp `json:"creation_date,omitempty"`
	TransactionType   int             `json:"transaction_type,omitempty"`
	TransactionOutput string          `json:"transaction_output,omitempty"`
	OutputHash        string          `json:"txn_output_hash"`
	// contains filtered or unexported fields
}

Transaction entity that encapsulates the transaction related data and metadata.

func NewTransactionEntity

func NewTransactionEntity() (*Transaction, error)

NewTransactionEntity creates Transaction with initialized fields. Sets version, client ID, creation date, public key and creates internal zcncore.TransactionScheme.

func VerifyTransaction

func VerifyTransaction(ctx context.Context, txnHash string) (*Transaction, error)

VerifyTransaction verifies including in blockchain transaction with provided hash.

If execution completed with no error, returns Transaction with provided hash.

func (*Transaction) ExecuteSmartContract

func (t *Transaction) ExecuteSmartContract(ctx context.Context, address, funcName, input string,
	val uint64) (string, error)

ExecuteSmartContract executes function of smart contract with provided address.

Returns hash of executed transaction.

func (*Transaction) Verify

func (t *Transaction) Verify(ctx context.Context) error

Verify checks including of transaction in the blockchain.

type TxnStatus

type TxnStatus int

TxnStatus represented zcncore.TransactionCallback operations statuses.

const (
	// StatusSuccess represent zcncore.StatusSuccess.
	StatusSuccess TxnStatus = iota
	// StatusNetworkError represent zcncore.StatusNetworkError.
	StatusNetworkError
	// StatusError represent zcncore.StatusError.
	StatusError
	// StatusRejectedByUser represent zcncore.StatusRejectedByUser.
	StatusRejectedByUser
	// StatusInvalidSignature represent zcncore.StatusInvalidSignature.
	StatusInvalidSignature
	// StatusAuthError represent zcncore.StatusAuthError.
	StatusAuthError
	// StatusAuthVerifyFailed represent zcncore.StatusAuthVerifyFailed.
	StatusAuthVerifyFailed
	// StatusAuthTimeout represent zcncore.StatusAuthTimeout.
	StatusAuthTimeout
	// StatusUnknown represent zcncore.StatusUnknown.
	StatusUnknown = -1
)

func (TxnStatus) String

func (ts TxnStatus) String() string

String returns represented in string format TxnStatus.

Jump to

Keyboard shortcuts

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