helpers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetTxPath              = "/transactions/info"
	GetUnconfirmedTxByPath = "/transactions/unconfirmed/info"
	GetStateByAddressPath  = "/addresses/data"

	WaitCount = 10
)

Variables

This section is empty.

Functions

func GroupByHeightAndFunc

func GroupByHeightAndFunc(txs []Transaction) map[int]map[ContractFunc][]Transaction

Types

type ContractFunc

type ContractFunc string

type FuncArg

type FuncArg struct {
	Type  string      `structs:"type"`
	Value interface{} `structs:"value"`
}

type FuncCall

type FuncCall struct {
	Function ContractFunc `structs:"function"`
	Args     []FuncArg    `structs:"args"`
}

type InvokeScriptBody

type InvokeScriptBody struct {
	Call    FuncCall  `structs:"call"`
	DApp    string    `structs:"dApp"`
	Payment []Payment `structs:"payment"`
}

type Node

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

func New

func New(nodeUrl string, apiKey string) Node

func (*Node) GetStateByAddressAndKey

func (node *Node) GetStateByAddressAndKey(address string, key string) (*state.State, error)

func (*Node) GetTxById

func (node *Node) GetTxById(id string) (Transaction, error)

func (*Node) IsUnconfirmedTx

func (node *Node) IsUnconfirmedTx(id string) (bool, error)

func (*Node) WaitTx

func (node *Node) WaitTx(id string) <-chan error

type Payment

type Payment struct {
	Amount  int64   `structs:"amount"`
	AssetId *string `structs:"assetId"`
}

type Transaction

type Transaction struct {
	Sender          string   `structs:"sender"`
	SenderPublicKey string   `structs:"senderPublicKey"`
	Fee             int      `structs:"fee"`
	Type            TxType   `structs:"type"`
	Version         int      `structs:"version"`
	Proofs          []string `structs:"proofs"`
	ID              string   `structs:"id"`
	Timestamp       int64    `structs:"timestamp"`
	Height          int      `structs:"height"`
	Attachment      string   `structs:"attachment"`

	InvokeScriptBody *InvokeScriptBody `structs:"-"`
}

func NewTransaction

func NewTransaction(txType TxType, sender string) Transaction

func Parse

func Parse(json map[string]interface{}) (Transaction, error)

func Unmarshal

func Unmarshal(data []byte) (Transaction, error)

func (Transaction) JsonMap

func (tx Transaction) JsonMap() (map[string]interface{}, error)

func (Transaction) Marshal

func (tx Transaction) Marshal() ([]byte, error)

func (*Transaction) NewInvokeScript

func (tx *Transaction) NewInvokeScript(dapp string, funcCall FuncCall, payments []Payment, fee int)

type TxType

type TxType int
const (
	MassTransfer TxType = 11
	InvokeScript TxType = 16

	MassTransferReferralAttachment = "sp"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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