transaction

package
v0.0.0-...-788cfe2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEd25519Condition

func NewEd25519Condition(pubKey ed25519.PublicKey) *cryptoconditions.Condition

Types

type Asset

type Asset struct {
	Data map[string]interface{} `json:"data,omitempty"`
	ID   *string                `json:"id,omitempty"`
}

type AssetResponse

type AssetResponse struct {
	Data          map[string]interface{} `json:"data"`
	TransactionID string                 `json:"id"`
}

type Block

type Block struct {
	Height       int           `json:"height"`
	Transactions []Transaction `json:"transactions"`
}

type Condition

type Condition struct {
	Details ConditionDetail `json:"details"`
	Uri     string          `json:"uri"`
}

type ConditionDetail

type ConditionDetail struct {
	PublicKey string `json:"public_key"`
	Type      string `json:"type"`
}

type Input

type Input struct {
	// Fulfillment can have both uri string or object with pubKey and other info
	// ID has to convert to null value in JSON
	Fulfillment  *string         `json:"fulfillment"`
	Fulfills     *OutputLocation `json:"fulfills"`
	OwnersBefore []string        `json:"owners_before"`
}

type KeyPair

type KeyPair struct {
	PrivateKey ed25519.PrivateKey `json:"privateKey"`
	PublicKey  ed25519.PublicKey  `json:"publicKey"`
}

func NewKeyPair

func NewKeyPair() (*KeyPair, error)

TODO add configurable seed to GenerateKey

type Metadata

type Metadata map[string]interface{}

type MetadataResponse

type MetadataResponse struct {
	Metadata      map[string]interface{} `json:"metadata"`
	TransactionID string                 `json:"id"`
}

type Output

type Output struct {
	Amount     string    `json:"amount"`
	Condition  Condition `json:"condition"`
	PublicKeys []string  `json:"public_keys"`
}

func NewOutput

func NewOutput(condition cryptoconditions.Condition, amount string) (Output, error)

type OutputLocation

type OutputLocation struct {
	TransactionID string `json:"transaction_id,omitempty"`
	// Test if this should be json.Number
	OutputIndex int64 `json:"output_index,omitempty"`
}

type Transaction

type Transaction struct {
	Asset Asset `json:"asset"`
	// ID has to convert to null value in JSON
	ID        *string  `json:"id"`
	Inputs    []Input  `json:"inputs"`
	Metadata  Metadata `json:"metadata"`
	Operation string   `json:"operation"`
	Outputs   []Output `json:"outputs"`
	Version   string   `json:"version"`
}

func New

func New(
	operation string,
	asset Asset,
	metadata Metadata,
	inputs []Input,
	outputs []Output,
) (*Transaction, error)

func NewCreateTransaction

func NewCreateTransaction(
	asset Asset,
	metadata Metadata,
	outputs []Output,
	issuers []ed25519.PublicKey,
) (*Transaction, error)

func NewTransferTransaction

func NewTransferTransaction(
	unspentTransactions []Transaction,
	outputs []Output,
	metadata Metadata,
) (*Transaction, error)

TODO clarify starting point transfer txn: Outputlocations or unspent transactions?

func (*Transaction) JSON

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

func (*Transaction) Sign

func (t *Transaction) Sign(keyPairs []*KeyPair) error

The privateKeys slice expects keys in the same order as the accompanying public key in the transaction.Inputs

func (*Transaction) String

func (t *Transaction) String() (string, error)

Jump to

Keyboard shortcuts

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