app

package
v0.0.0-...-9870119 Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagByte      = 0x9F
	MinScriptSize = 1 + 1 + 2 + 1 + 32
	MaxScriptSize = 220
	HashSize      = 32
)

Variables

View Source
var (
	ErrInvalidLength   = errors.New("script does not meet the minimum or maximum length requirement")
	ErrInvalidScript   = errors.New("invalid script")
	ErrUnknownCommand  = errors.New("unknown command")
	ErrInvalidPushData = errors.New("invalid pushdata")
)

Functions

func GetRepoPath

func GetRepoPath() (string, error)

func MakeTransaction

func MakeTransaction(w *bitcoincash.SPVWallet, utxos []wallet.Utxo, ipfsScript Script) (*chainhash.Hash, error)

func MinimumInputSize

func MinimumInputSize(w *bitcoincash.SPVWallet) (uint64, error)

Set equal to one USD penny. Must use exchange rate provider for this.

func NewWallet

func NewWallet(params *chaincfg.Params, repoPath string, trustedPeer net.Addr) (*bitcoincash.SPVWallet, error)

Types

type AddFileScript

type AddFileScript struct {
	Cid         cid.Cid
	Description string
	Category    string
}

func (*AddFileScript) Command

func (as *AddFileScript) Command() Command

func (*AddFileScript) ID

func (as *AddFileScript) ID() []byte

func (*AddFileScript) Parsed

func (as *AddFileScript) Parsed() ParsedScript

func (*AddFileScript) Serialize

func (as *AddFileScript) Serialize() ([]byte, error)

type BitcoinCashPriceFetcher

type BitcoinCashPriceFetcher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewBitcoinCashPriceFetcher

func NewBitcoinCashPriceFetcher(dialer proxy.Dialer) *BitcoinCashPriceFetcher

func (*BitcoinCashPriceFetcher) GetAllRates

func (b *BitcoinCashPriceFetcher) GetAllRates(cacheOK bool) (map[string]float64, error)

func (*BitcoinCashPriceFetcher) GetExchangeRate

func (b *BitcoinCashPriceFetcher) GetExchangeRate(currencyCode string) (float64, error)

func (*BitcoinCashPriceFetcher) GetLatestRate

func (b *BitcoinCashPriceFetcher) GetLatestRate(currencyCode string) (float64, error)

func (*BitcoinCashPriceFetcher) UnitsPerCoin

func (b *BitcoinCashPriceFetcher) UnitsPerCoin() int

type BitfinexDecoder

type BitfinexDecoder struct{}

type BittrexDecoder

type BittrexDecoder struct{}

type Command

type Command byte
const (
	AddFileCommand Command = 0x01
	VoteCommand    Command = 0x02
)

func (*Command) String

func (c *Command) String() string

type DataType

type DataType byte
const (
	Cid         DataType = 0x00
	Description DataType = 0x01
	Txid        DataType = 0x02
	Vote        DataType = 0x03
	Comment     DataType = 0x04
	Category    DataType = 0x05
)

type ExchangeRateDecoder

type ExchangeRateDecoder interface {
	// contains filtered or unexported methods
}

type ExchangeRateProvider

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

type KrakenDecoder

type KrakenDecoder struct{}

type OpenBazaarDecoder

type OpenBazaarDecoder struct{}

type ParsedScript

type ParsedScript struct {
	Cid         cid.Cid
	Description string
	Txid        chainhash.Hash
	Upvote      bool
	Comment     string
	Category    string
}

type PoloniexDecoder

type PoloniexDecoder struct{}

type Script

type Script interface {
	Command() Command
	ID() []byte
	Parsed() ParsedScript
	Serialize() ([]byte, error)
}

func ParseScript

func ParseScript(script []byte) (Script, error)

type TransactionListener

type TransactionListener struct {
	UserEntries map[string]UserEntry
	// contains filtered or unexported fields
}

func NewTransactionListener

func NewTransactionListener(wallet *bitcoincash.SPVWallet, db *db.Database, addrChan chan [2]string) *TransactionListener

func (*TransactionListener) ListenBitcoinCash

func (l *TransactionListener) ListenBitcoinCash(tx wallet.TransactionCallback)

func (*TransactionListener) NewEntry

func (l *TransactionListener) NewEntry(addr btcutil.Address, entry UserEntry)

type UserEntry

type UserEntry struct {
	ID          string
	Script      Script
	Address     btcutil.Address
	Timestamp   time.Time
	AmountToPay uint64
	AmountPaid  uint64
}

type VoteScript

type VoteScript struct {
	Txid    chainhash.Hash
	Comment string
	Upvote  bool
}

func (*VoteScript) Command

func (vs *VoteScript) Command() Command

func (*VoteScript) ID

func (vs *VoteScript) ID() []byte

func (*VoteScript) Parsed

func (vs *VoteScript) Parsed() ParsedScript

func (*VoteScript) Serialize

func (vs *VoteScript) Serialize() ([]byte, error)

Jump to

Keyboard shortcuts

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