wallet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExplicitCoveredFields

func ExplicitCoveredFields(txn types.Transaction) (cf types.CoveredFields)

ExplicitCoveredFields returns a CoveredFields that covers all elements present in txn.

func KeyFromPhrase

func KeyFromPhrase(phrase string) (types.PrivateKey, error)

KeyFromPhrase returns the Ed25519 key derived from the supplied seed phrase.

func NewSeedPhrase

func NewSeedPhrase() string

NewSeedPhrase returns a random seed phrase.

func SignTransaction

func SignTransaction(cs consensus.State, txn *types.Transaction, sigIndex int, key types.PrivateKey)

SignTransaction signs txn with the given key. The TransactionSignature object must already be present in txn at the given index.

func StandardTransactionSignature

func StandardTransactionSignature(id types.Hash256) types.TransactionSignature

StandardTransactionSignature is the most common form of TransactionSignature. It covers the entire transaction, references a sole public key, and has no timelock.

Types

type ChainUpdate

type ChainUpdate interface {
	ForEachSiacoinElement(func(sce types.SiacoinElement, spent bool))
	ForEachSiafundElement(func(sfe types.SiafundElement, spent bool))
	ForEachFileContractElement(func(fce types.FileContractElement, rev *types.FileContractElement, resolved, valid bool))
	ForEachV2FileContractElement(func(fce types.V2FileContractElement, rev *types.V2FileContractElement, res types.V2FileContractResolutionType))
}

type Event

type Event struct {
	Index     types.ChainIndex
	Timestamp time.Time
	Val       interface {
		// contains filtered or unexported methods
	}
}

An Event is something interesting that happened on the Sia blockchain.

func AppliedEvents

func AppliedEvents(cs consensus.State, b types.Block, cu ChainUpdate, addr types.Address) []Event

AppliedEvents extracts a list of relevant events from a chain update.

func (Event) String

func (e Event) String() string

String implements fmt.Stringer.

type EventMinerPayout

type EventMinerPayout struct {
	SiacoinOutput types.SiacoinElement `json:"siacoinOutput"`
}

func (EventMinerPayout) String

func (emp EventMinerPayout) String() string

String implements fmt.Stringer.

type EventMissedFileContract

type EventMissedFileContract struct {
	FileContract  types.FileContractElement `json:"fileContract"`
	MissedOutputs []types.SiacoinElement    `json:"missedOutputs"`
}

func (EventMissedFileContract) String

func (emfc EventMissedFileContract) String() string

String implements fmt.Stringer.

type EventTransaction

type EventTransaction struct {
	ID                types.TransactionID    `json:"id"`
	SiacoinInputs     []types.SiacoinElement `json:"siacoinInputs"`
	SiacoinOutputs    []types.SiacoinElement `json:"siacoinOutputs"`
	SiafundInputs     []SiafundInput         `json:"siafundInputs"`
	SiafundOutputs    []types.SiafundElement `json:"siafundOutputs"`
	FileContracts     []FileContract         `json:"fileContracts"`
	V2FileContracts   []V2FileContract       `json:"v2FileContracts"`
	HostAnnouncements []HostAnnouncement     `json:"hostAnnouncements"`
	Fee               types.Currency         `json:"fee"`
}

func (EventTransaction) String

func (et EventTransaction) String() string

String implements fmt.Stringer.

type FileContract

type FileContract struct {
	FileContract types.FileContractElement `json:"fileContract"`
	// only non-nil if transaction revised contract
	Revision *types.FileContract `json:"revision,omitempty"`
	// only non-nil if transaction resolved contract
	ValidOutputs []types.SiacoinElement `json:"validOutputs,omitempty"`
}

A FileContract represents a file contract within an EventTransaction.

type HostAnnouncement

type HostAnnouncement struct {
	PublicKey  types.PublicKey `json:"publicKey"`
	NetAddress string          `json:"netAddress"`
}

A HostAnnouncement represents a host announcement within an EventTransaction.

type PoolTransaction

type PoolTransaction struct {
	ID       types.TransactionID `json:"id"`
	Raw      types.Transaction   `json:"raw"`
	Type     string              `json:"type"`
	Sent     types.Currency      `json:"sent"`
	Received types.Currency      `json:"received"`
	Locked   types.Currency      `json:"locked"`
}

A PoolTransaction summarizes the wallet-relevant data in a txpool transaction.

func Annotate

func Annotate(txn types.Transaction, addr types.Address) PoolTransaction

Annotate annotates a txpool transaction.

type SiafundInput

type SiafundInput struct {
	SiafundElement types.SiafundElement `json:"siafundElement"`
	ClaimElement   types.SiacoinElement `json:"claimElement"`
}

A SiafundInput represents a siafund input within an EventTransaction.

type V2FileContract

type V2FileContract struct {
	FileContract types.V2FileContractElement `json:"fileContract"`
	// only non-nil if transaction revised contract
	Revision *types.V2FileContract `json:"revision,omitempty"`
	// only non-nil if transaction resolved contract
	Resolution types.V2FileContractResolutionType `json:"resolution,omitempty"`
	Outputs    []types.SiacoinElement             `json:"outputs,omitempty"`
}

A V2FileContract represents a v2 file contract within an EventTransaction.

Jump to

Keyboard shortcuts

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