sia

package
v0.0.0-...-04e8804 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWalletLocked      = errors.New("wallet is locked")
	ErrInsufficientFunds = errors.New("insufficient funds")
)

Functions

func AddSignature

func AddSignature(tx types.Transaction, signature []byte) types.Transaction

func ApplyRate

func ApplyRate(siacoin types.Currency, rate *big.Rat) *big.Rat

func BuildClaimTransaction

func BuildClaimTransaction(parentID types.SiacoinOutputID, parentUnlockConditions types.UnlockConditions,
	destinationUnlockHash types.UnlockHash, value types.Currency, minerFee types.Currency) types.Transaction

func BuildFundingTransaction

func BuildFundingTransaction(usableOutputs []UsableOutput, changeUnlockHash types.UnlockHash,
	destinationUnlockHash types.UnlockHash, value types.Currency, minerFee types.Currency) (*types.Transaction, error)

func BuildRefundTransaction

func BuildRefundTransaction(parentID types.SiacoinOutputID, parentUnlockConditions types.UnlockConditions,
	destinationUnlockHash types.UnlockHash, value types.Currency, minerFee types.Currency,
	timelock types.BlockHeight) types.Transaction

func EncodeTransaction

func EncodeTransaction(tx types.Transaction) string

func PubKeyUnlockConditions

func PubKeyUnlockConditions(pubKey ed25519.PublicKey) types.UnlockConditions

func WholeSigHash

func WholeSigHash(tx types.Transaction, blockHeight types.BlockHeight) []byte

Types

type Blockchain

type Blockchain interface {
	FetchUsableOutputs() ([]UsableOutput, error)
	NextWalletUnlockHash() (*types.UnlockHash, error)
	Height() (*types.BlockHeight, error)
	WalletSign(tx types.Transaction) (*types.Transaction, error)
	BroadcastTransaction(tx types.Transaction) error
	ConfsOfRecentUnlockHash(unlockHash types.UnlockHash, value types.Currency) (int64, error)
}

type DryRunBlockchain

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

func NewDryRunBlockchain

func NewDryRunBlockchain(chain *HTTPAPIBlockchain) *DryRunBlockchain

func (*DryRunBlockchain) BroadcastTransaction

func (c *DryRunBlockchain) BroadcastTransaction(tx types.Transaction) error

func (*DryRunBlockchain) ConfsOfRecentUnlockHash

func (c *DryRunBlockchain) ConfsOfRecentUnlockHash(unlockHash types.UnlockHash, value types.Currency) (int64, error)

func (*DryRunBlockchain) FetchUsableOutputs

func (c *DryRunBlockchain) FetchUsableOutputs() ([]UsableOutput, error)

func (*DryRunBlockchain) Height

func (c *DryRunBlockchain) Height() (*types.BlockHeight, error)

func (*DryRunBlockchain) NextWalletUnlockHash

func (c *DryRunBlockchain) NextWalletUnlockHash() (*types.UnlockHash, error)

func (*DryRunBlockchain) WalletSign

func (c *DryRunBlockchain) WalletSign(tx types.Transaction) (*types.Transaction, error)

type HTTPAPIBlockchain

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

func NewLocalNodeBlockchain

func NewLocalNodeBlockchain(address string, password string) (*HTTPAPIBlockchain, error)

func NewSimulatedBlockchain

func NewSimulatedBlockchain() (*HTTPAPIBlockchain, error)

func (*HTTPAPIBlockchain) BroadcastTransaction

func (c *HTTPAPIBlockchain) BroadcastTransaction(tx types.Transaction) error

func (*HTTPAPIBlockchain) ConfsOfRecentUnlockHash

func (c *HTTPAPIBlockchain) ConfsOfRecentUnlockHash(unlockHash types.UnlockHash, value types.Currency) (int64, error)

func (*HTTPAPIBlockchain) FetchUsableOutputs

func (c *HTTPAPIBlockchain) FetchUsableOutputs() ([]UsableOutput, error)

func (*HTTPAPIBlockchain) Height

func (c *HTTPAPIBlockchain) Height() (*types.BlockHeight, error)

func (*HTTPAPIBlockchain) NextWalletUnlockHash

func (c *HTTPAPIBlockchain) NextWalletUnlockHash() (*types.UnlockHash, error)

func (*HTTPAPIBlockchain) WalletSign

func (c *HTTPAPIBlockchain) WalletSign(tx types.Transaction) (*types.Transaction, error)

type UsableOutput

type UsableOutput struct {
	UnspentOutput    modules.UnspentOutput
	UnlockConditions types.UnlockConditions
}

Jump to

Keyboard shortcuts

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