tx

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SHA256 = iota
	Sha384
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Tag

type Tag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Tag contains any tags the user wants to add to the transaction

type Transaction

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

Transaction struct

func NewTransaction

func NewTransaction(lastTx string, owner *big.Int, quantity string, target string, data []byte, reward string) *Transaction

NewTransaction creates a brand new transaction struct

func (*Transaction) AddTag

func (t *Transaction) AddTag(name string, value string) error

AddTag adds a new tag to the transaction

func (*Transaction) Data

func (t *Transaction) Data() string

Data returns the data of the transaction

func (*Transaction) Hash

func (t *Transaction) Hash() string

Hash returns the base64 RawURLEncoding of the transaction hash

func (*Transaction) ID

func (t *Transaction) ID() []byte

ID returns the id of the transaction which is the SHA256 of the signature

func (*Transaction) LastTx

func (t *Transaction) LastTx() string

LastTx returns the last transaction of the account

func (*Transaction) MarshalJSON

func (t *Transaction) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON

func (*Transaction) Owner

func (t *Transaction) Owner() string

Owner returns the Owner of the transaction

func (*Transaction) Quantity

func (t *Transaction) Quantity() string

Quantity returns the quantity of the transaction

func (*Transaction) RawData

func (t *Transaction) RawData() []byte

RawData returns the unencoded data

func (*Transaction) RawTags

func (t *Transaction) RawTags() []Tag

RawTags returns the unencoded tags of the transaction

func (*Transaction) Reward

func (t *Transaction) Reward() string

Reward returns the reward of the transaction

func (*Transaction) SetID

func (t *Transaction) SetID(id []byte)

func (*Transaction) Sign

Sign creates the signing message, and signs it using the private key, It takes the SHA256 of the resulting signature to calculate the id of the signature

func (*Transaction) Signature

func (t *Transaction) Signature() string

Signature returns the signature of the transaction

func (*Transaction) Tags

func (t *Transaction) Tags() ([]Tag, error)

Tags returns the tags of the transaction in plain text

func (*Transaction) Target

func (t *Transaction) Target() string

Target returns the target of the transaction

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals as JSON

type TransactionNew

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

Transaction struct

type TransactionV2

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

Transaction struct

func NewTransactionV2

func NewTransactionV2(lastTx string, owner *big.Int, quantity string, target string, data []byte, reward string) *TransactionV2

NewTransactionV2 creates a brand new TransactionV2 struct

func (*TransactionV2) AddTag

func (t *TransactionV2) AddTag(name string, value string) error

AddTag adds a new tag to the TransactionV2

func (*TransactionV2) Data

func (t *TransactionV2) Data() string

Data returns the data of the TransactionV2

func (*TransactionV2) Format

func (t *TransactionV2) Format() int

Data returns the data of the TransactionV2

func (*TransactionV2) Hash

func (t *TransactionV2) Hash() string

Hash returns the base64 RawURLEncoding of the TransactionV2 hash

func (*TransactionV2) ID

func (t *TransactionV2) ID() []byte

ID returns the id of the TransactionV2 which is the SHA256 of the signature

func (*TransactionV2) LastTx

func (t *TransactionV2) LastTx() string

LastTx returns the last TransactionV2 of the account

func (*TransactionV2) MarshalJSON

func (t *TransactionV2) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON

func (*TransactionV2) Owner

func (t *TransactionV2) Owner() string

Owner returns the Owner of the TransactionV2

func (*TransactionV2) Quantity

func (t *TransactionV2) Quantity() string

Quantity returns the quantity of the TransactionV2

func (*TransactionV2) RawData

func (t *TransactionV2) RawData() []byte

RawData returns the unencoded data

func (*TransactionV2) RawTags

func (t *TransactionV2) RawTags() []Tag

RawTags returns the unencoded tags of the TransactionV2

func (*TransactionV2) Reward

func (t *TransactionV2) Reward() string

Reward returns the reward of the TransactionV2

func (*TransactionV2) SetID

func (t *TransactionV2) SetID(id []byte)

func (*TransactionV2) Sign

Sign creates the signing message, and signs it using the private key, It takes the SHA256 of the resulting signature to calculate the id of the signature

func (*TransactionV2) Signature

func (t *TransactionV2) Signature() string

Signature returns the signature of the TransactionV2

func (*TransactionV2) Tags

func (t *TransactionV2) Tags() ([]Tag, error)

Tags returns the tags of the TransactionV2 in plain text

func (*TransactionV2) Target

func (t *TransactionV2) Target() string

Target returns the target of the TransactionV2

func (*TransactionV2) Txid

func (t *TransactionV2) Txid() string

write by jun

func (*TransactionV2) UnmarshalJSON

func (t *TransactionV2) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals as JSON

Jump to

Keyboard shortcuts

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