helpers

package
v0.0.0-...-1c07160 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusNotEnoughFunds              = 600 + iota // NOT ENOUTH FUNDS
	StatusNotEnoughFundsForCommission              // 601 NOT ENOUGH FUNDS FOR COMMISSION
	StatusTranNotFound                             // 602 TRANSACTION NOT FOUND
	StatusInternalServerError                      // 603 SOMETHING BAD HAPPEND
	StatusUnknownTranType                          // 604 UNKNOWN TRANSACTION TYPE
	StatusAttrNotFound_TT                          // 605 CAN NOT FIND ATTRIBUTE - TT
	StatusAttrNotFound_VERSION                     // 606 CAN NOT FIND ATTRIBUT - VERSION
	StatusAttrNotFound_SENDER                      // 607 CAN NOT FIND ATTRIBUTE - SENDER
	StatusAttrNotFound_RECEIVER                    // 608 CAN NOT FIND ATTRIBUTE - RECEIVER
	StatusAttrNotFound_TTOKEN                      // 609 CAN NOT FIND ATTRIBUTE - TTOKEN
	StatusAttrNotFound_CTOKEN                      // 610 CAN NOT FIND ATTRIBUTE - CTOKEN
	StatusAttrNotFound_TST                         // 611 CAN NOT FIND ATTRIBUTE - TST
	StatusAttrNotFound_SIGNATURE                   // 612 CAN NOT FIND ATTRIBUTE - SIGNATURE
	StatusAttrNotFound_KEY                         // 613 CAN NOT FIND ATTRIBUTE - KEY
	StatusAttrNotFound_SOURCE                      // 614 CAN NOT FIND ATTRIBUTE - SOURCE
	StatusAttrNotFound_PAIR                        // 615 CAN NOT FIND ATTRIBUTE - PAIR
	StatusAttrNotFound_TICKER                      // 616 CAN NOT FIND ATTRIBUTE - TICKER
	StatusWrongAttr_KEY                            // 617 WRONG ATTRIBUTE - KEY
	StatusWrongAttr_TT                             // 618 WRONG ATTRIBUTE - TT
	StatusWrongAttr_VERSION                        // 619 WRONG ATTRIBUTE - VERSION
	StatusWrongAttr_SENDER                         // 620 WRONG ATTRIBUTE - SENDER
	StatusWrongAttr_RECEIVER                       // 621 WRONG ATTRIBUTE - RECEIVER
	StatusWrongAttr_TST                            // 622 WRONG ATTRIBUTE - TST
	StatusWrongAttr_CTOKEN                         // 623 WRONG ATTRIBUTE - CTOKEN
	StatusWrongAttr_Signature                      // 624 WRONG ATTRIBUTE - SIGNATURE
	StatusSignVerifyError                          // 625 CAN'T VERIFY SIGNATURE
	StatusDontSendYourself                         // 626 YOU CAN'T SEND YOURSELF
	StatusTranFailed                               // 627 TRANSACTION FAILED
	StatusDataNotFound                             // 628 DATA NOT FOUND
	StatusWrongDataFormat                          // 629 WRONG DATA FORMAT
	StatusWrongAttr_TTOKEN                         // 630 WRONG ATTRIBUTE - TTOKEN
	StatusWrongAttr_BHEIGHT                        // 631 WRONG ATTRIBUTE - BHEIGHT
	StatusWrongAttr_IPADDR                         // 632 WRONG ATTRIBUTE - IPADDR
	StatusWrongAttr_VOTES                          // 633 WRONG ATTRIBUTE - VOTES
	StatusAttrNotFound_BHEIGHT                     // 634 CAN NOT FIND ATTRIBUTE - BHEIGHT
	StatusAttrNotFound_IPADDR                      // 635 CAN NOT FIND ATTRIBUTE - IPADDR
	StatusAttrNotFound_ADDRESS                     // 636 CAN NOT FIND ATTRIBUTE - ADDRESS
	StatusWrongAttr_ADDRESS                        // 637 WRONG ATTRIBUTE - ADDRESS
)
View Source
const StatusOk = 200 // OK

Variables

View Source
var ApplicantStructureFields = map[int]string{StatusWrongAttr_TT: "TT",

	StatusAttrNotFound_SENDER:    "SENDER",
	StatusAttrNotFound_IPADDR:    "IPADDR",
	StatusAttrNotFound_TST:       "TST",
	StatusAttrNotFound_SIGNATURE: "SIGNATURE"}
View Source
var MandatoryTransactionFields = map[int]string{StatusWrongAttr_TT: "TT",

	StatusAttrNotFound_SENDER:    "SENDER",
	StatusAttrNotFound_TST:       "TST",
	StatusAttrNotFound_SIGNATURE: "SIGNATURE"}
View Source
var RequestBalanceFields = map[int]string{StatusAttrNotFound_TTOKEN: "TTOKEN",
	StatusAttrNotFound_SENDER: "SENDER"}
View Source
var RequestGetBlockFields = map[int]string{StatusAttrNotFound_BHEIGHT: "BHEIGHT"}
View Source
var RequestStakeFields = map[int]string{StatusAttrNotFound_SENDER: "SENDER"}
View Source
var RequestTranStatusFields = map[int]string{StatusAttrNotFound_KEY: "KEY"}
View Source
var RequestVSFields = map[int]string{StatusAttrNotFound_ADDRESS: "ADDRESS"}

Functions

func CreateHelloTransaction

func CreateHelloTransaction(publicKey string, privateKey []byte, ip string) (tran string, ok bool)

func GetRawTransactionType

func GetRawTransactionType(rawData string) string

func IsRedisError

func IsRedisError(err redisError) bool

func PubkeyFromSeckey

func PubkeyFromSeckey(privateKey []byte) []byte

func VerifyApplicantTransaction

func VerifyApplicantTransaction(tran ApplicantTransaction) (transactionTime int64, statusCode int, ok bool)

func VerifyHelloTransaction

func VerifyHelloTransaction(tran HelloTransaction) (ok bool)

func VerifySimpleTransaction

func VerifySimpleTransaction(tran SimpleTransaction) (transactionTime int64, statusCode int, ok bool)

func VerifyUATransaction

func VerifyUATransaction(tran UATransaction) (transactionTime int64, statusCode int, ok bool)

func VerifyUVTransaction

func VerifyUVTransaction(tran UVTransaction) (transactionTime int64, statusCode int, ok bool)

func VerifyVoteTransaction

func VerifyVoteTransaction(tran VoteTransaction) (transactionTime int64, statusCode int, ok bool)

Types

type ASResponse

type ASResponse struct {
	APPLICANTS []string
}

type AVSResponse

type AVSResponse struct {
	VOTES map[string]string
}

type ApplicantTransaction

type ApplicantTransaction struct {
	TT        string
	SENDER    string
	IPADDR    string
	TST       string
	SIGNATURE string
}

func ParseApplicantTransaction

func ParseApplicantTransaction(rawData string) (ApplicantTransaction, error)

type ApplicantTransactionForVerify

type ApplicantTransactionForVerify struct {
	TT     string
	SENDER string
	IPADDR string
	TST    string
}

type BHeightResponse

type BHeightResponse struct {
	BHEIGHT string
}

type BalanceResponse

type BalanceResponse struct {
	BALANCE map[string]string
	STAKE   map[string]string
}

type HelloTransaction

type HelloTransaction struct {
	TT        string
	SENDER    string
	ADDRESS   string
	TST       string
	SIGNATURE string
}

func ParseHelloTransaction

func ParseHelloTransaction(rawData string) (HelloTransaction, error)

type HelloTransactionForVerify

type HelloTransactionForVerify struct {
	TT      string
	SENDER  string
	ADDRESS string
	TST     string
}

type SimpleTransaction

type SimpleTransaction struct {
	TT        string
	SENDER    string
	RECEIVER  string
	TTOKEN    string
	CTOKEN    string
	TST       string
	SIGNATURE string
}

func ParseSimpleTransaction

func ParseSimpleTransaction(rawData string) (SimpleTransaction, error)

type SimpleTransactionForVerify

type SimpleTransactionForVerify struct {
	TT       string
	SENDER   string
	RECEIVER string
	TTOKEN   string
	CTOKEN   string
	TST      string
}

type StakeResponse

type StakeResponse struct {
	STAKE map[string]string
}

type StatisticsResponse

type StatisticsResponse struct {
	TCOUNT  string
	LTPS    string
	BHEIGHT string
	LTPB    string
	TPD     string
	VMAP    []string
	UPD     string
}

type TranType

type TranType struct {
	TT string
}

type UATransaction

type UATransaction struct {
	TT        string
	SENDER    string
	TST       string
	SIGNATURE string
}

func ParseUATransaction

func ParseUATransaction(rawData string) (UATransaction, error)

type UATransactionForVerify

type UATransactionForVerify struct {
	TT     string
	SENDER string
	TST    string
}

type UVTransaction

type UVTransaction struct {
	TT        string
	SENDER    string
	RECEIVER  string
	TST       string
	SIGNATURE string
}

func ParseUVTransaction

func ParseUVTransaction(rawData string) (UVTransaction, error)

type UVTransactionForVerify

type UVTransactionForVerify struct {
	TT       string
	SENDER   string
	RECEIVER string
	TST      string
}

type VSResponse

type VSResponse struct {
	VOTES string
}

type VersionResponse

type VersionResponse struct {
	VERSION string
}

type VoteTransaction

type VoteTransaction struct {
	TT        string
	SENDER    string
	RECEIVER  string
	VOTES     string
	TST       string
	SIGNATURE string
}

func ParseVoteTransaction

func ParseVoteTransaction(rawData string) (VoteTransaction, error)

type VoteTransactionForVerify

type VoteTransactionForVerify struct {
	TT       string
	SENDER   string
	RECEIVER string
	VOTES    string
	TST      string
}

Jump to

Keyboard shortcuts

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