wallet

package
v0.1.1-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 Event

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

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

func DiffEvents

func DiffEvents(b types.Block, diff consensus.BlockDiff, index types.ChainIndex, relevant func(types.Address) bool) []Event

DiffEvents extracts a list of events from a block diff.

func (Event) MarshalJSON

func (e Event) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unarshaler.

type EventBlockReward

type EventBlockReward struct {
	OutputID       types.SiacoinOutputID
	Output         types.SiacoinOutput
	MaturityHeight uint64
}

EventBlockReward represents a block reward.

type EventFileContractFormation

type EventFileContractFormation struct {
	TransactionID types.TransactionID
	ContractID    types.FileContractID
	Contract      types.FileContract
}

EventFileContractFormation represents the formation of a file contract within a transaction.

type EventFileContractResolutionMissed

type EventFileContractResolutionMissed struct {
	Contract       types.FileContract
	OutputID       types.SiacoinOutputID
	Output         types.SiacoinOutput
	MaturityHeight uint64
}

EventFileContractResolutionMissed represents the expiration of a file contract.

type EventFileContractResolutionValid

type EventFileContractResolutionValid struct {
	TransactionID  types.TransactionID
	ContractID     types.FileContractID
	Contract       types.FileContract
	OutputID       types.SiacoinOutputID
	Output         types.SiacoinOutput
	MaturityHeight uint64
}

EventFileContractResolutionValid represents the valid resolution of a file contract within a transaction.

type EventFileContractRevision

type EventFileContractRevision struct {
	TransactionID types.TransactionID
	ContractID    types.FileContractID
	OldContract   types.FileContract
	NewContract   types.FileContract
}

EventFileContractRevision represents the revision of a file contract within a transaction.

type EventFoundationSubsidy

type EventFoundationSubsidy struct {
	OutputID       types.SiacoinOutputID
	Output         types.SiacoinOutput
	MaturityHeight uint64
}

EventFoundationSubsidy represents a Foundation subsidy.

type EventHostAnnouncement

type EventHostAnnouncement struct {
	TransactionID types.TransactionID
	PublicKey     types.PublicKey
	NetAddress    string
	Inputs        []SiacoinElement
}

EventHostAnnouncement represents a host announcement within a transaction.

type EventSiacoinMaturation

type EventSiacoinMaturation struct {
	OutputID types.SiacoinOutputID
	Output   types.SiacoinOutput
	Source   consensus.DelayedOutputSource
}

EventSiacoinMaturation represents the maturation of a siacoin output.

type EventSiacoinTransfer

type EventSiacoinTransfer struct {
	TransactionID types.TransactionID
	Inputs        []SiacoinElement
	Outputs       []SiacoinElement
	Fee           types.Currency
}

EventSiacoinTransfer represents the transfer of siacoins within a transaction.

type EventSiafundTransfer

type EventSiafundTransfer struct {
	TransactionID types.TransactionID
	Inputs        []SiafundElement
	Outputs       []SiafundElement
	ClaimOutputID types.SiacoinOutputID
	ClaimOutput   types.SiacoinOutput
}

EventSiafundTransfer represents the transfer of siafunds within a transaction.

type EventTransaction

type EventTransaction struct {
	TransactionID types.TransactionID
	Transaction   types.Transaction
}

EventTransaction represents a generic transaction.

type PoolTransaction

type PoolTransaction struct {
	ID       types.TransactionID
	Raw      types.Transaction
	Type     string
	Sent     types.Currency
	Received types.Currency
	Locked   types.Currency
}

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

func Annotate

func Annotate(txn types.Transaction, ownsAddress func(types.Address) bool) PoolTransaction

Annotate annotates a txpool transaction.

type Seed

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

A Seed is securely-generated entropy, used to derive an arbitrary number of keypairs.

func NewSeed

func NewSeed() Seed

NewSeed returns a random Seed.

func NewSeedFromEntropy

func NewSeedFromEntropy(entropy *[32]byte) Seed

NewSeedFromEntropy returns a the specified seed.

func (Seed) PrivateKey

func (s Seed) PrivateKey(index uint64) types.PrivateKey

PrivateKey derives the private key for the specified index.

func (Seed) PublicKey

func (s Seed) PublicKey(index uint64) (pk types.PublicKey)

PublicKey derives the public key for the specified index.

type SeedAddressVault

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

A SeedAddressVault generates and stores addresses from a seed.

func NewSeedAddressVault

func NewSeedAddressVault(seed Seed, initialAddrs, lookahead uint64) *SeedAddressVault

NewSeedAddressVault initializes a SeedAddressVault.

func (*SeedAddressVault) NewAddress

func (sav *SeedAddressVault) NewAddress(desc string) (types.Address, json.RawMessage)

NewAddress returns a new address derived from the seed, along with descriptive metadata.

func (*SeedAddressVault) OwnsAddress

func (sav *SeedAddressVault) OwnsAddress(addr types.Address) bool

OwnsAddress returns true if addr was derived from the seed.

func (*SeedAddressVault) SignTransaction

func (sav *SeedAddressVault) SignTransaction(cs consensus.State, txn *types.Transaction, toSign []types.Hash256) error

SignTransaction signs the specified transaction using keys derived from the wallet seed. If toSign is nil, SignTransaction will automatically add Signatures for each input owned by the seed. If toSign is not nil, it a list of IDs of Signatures already present in txn; SignTransaction will fill in the Signature field of each.

type SiacoinElement

type SiacoinElement struct {
	ID types.SiacoinOutputID
	types.SiacoinOutput
}

A SiacoinElement is a siacoin output paired with its ID.

type SiafundElement

type SiafundElement struct {
	ID types.SiafundOutputID
	types.SiafundOutput
}

A SiafundElement is a siafund output paired with its ID.

Jump to

Keyboard shortcuts

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