tx

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tag added in v0.0.2

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 added in v0.0.2

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) FormatMsgBytes added in v0.0.3

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

FormatMsgBytes formats the message that needs to be signed. All fields need to be an array of bytes originating from the necessary data (not base64url encoded). The signing message is the SHA256 of the concatenation of the byte arrays of the owner public key, target address, data, quantity, reward and last 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 added in v0.0.2

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 added in v0.0.2

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

func (*Transaction) SetSignature added in v0.0.3

func (t *Transaction) SetSignature(signature []byte)

func (*Transaction) Sign

func (t *Transaction) Sign(w arweave.WalletSigner) (*Transaction, error)

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

Jump to

Keyboard shortcuts

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