wallet

package
v0.0.0-...-e95e75c Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputUnconfirmed = iota
	OutputConfirmed
	OutputLocked
	OutputSpent
	OutputCanceled
)
View Source
const (
	TransactionUnconfirmed = iota
	TransactionConfirmed
	TransactionCanceled
)

Variables

This section is empty.

Functions

func ParseIDFromSlate

func ParseIDFromSlate(slateBytes []byte) (ID []byte, err error)

Types

type Database

type Database interface {
	PutSenderSlate(slate *SavedSlate) error
	PutReceiverSlate(slate *SavedSlate) error
	PutTransaction(tx Transaction) error
	PutOutput(output Output) error
	GetSenderSlate(id []byte) (slate *SavedSlate, err error)
	GetTransaction(id []byte) (transaction Transaction, err error)
	GetOutput(commit string) (output Output, err error)
	ListSlates() (slates []SavedSlate, err error)
	ListTransactions() (transactions []Transaction, err error)
	ListOutputs() (outputs []Output, err error)
	GetInputs(amount uint64, asset string) (inputs []Output, change uint64, err error)
	Confirm(transactionID []byte) error
	Cancel(transactionID []byte) error
	NextIndex() (uint32, error)
	Close()
}

func NewLeveldbDatabase

func NewLeveldbDatabase(dbDir string) (d Database, err error)

type Output

type Output struct {
	core.Output
	Index  uint32       `json:"index"`
	Value  uint64       `json:"value"`
	Status OutputStatus `json:"status,omitempty"`
	Asset  string       `json:"asset,omitempty"`
}

type OutputStatus

type OutputStatus int

func (OutputStatus) String

func (t OutputStatus) String() string

type SavedSlate

type SavedSlate struct {
	Slate
	Blind [32]byte `json:"blind,omitempty"`
	Nonce [32]byte `json:"nonce,omitempty"`
}

type Slate

type Slate struct {
	libwallet.Slate
	Asset         string      `json:"asset,omitempty"`
	ReceiveAmount core.Uint64 `json:"receive_amount,omitempty"`
	ReceiveAsset  string      `json:"receive_asset,omitempty"`
}

type Transaction

type Transaction struct {
	ledger.Transaction
	Status TransactionStatus `json:"status,omitempty"`
}

type TransactionStatus

type TransactionStatus int

func (TransactionStatus) String

func (t TransactionStatus) String() string

type Wallet

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

func NewWallet

func NewWallet(persistDir string) (w *Wallet, err error)

func NewWalletWithoutMasterKey

func NewWalletWithoutMasterKey(persistDir string) (w *Wallet, err error)

func (*Wallet) Cancel

func (t *Wallet) Cancel(transactionID []byte) error

func (*Wallet) Close

func (t *Wallet) Close()

func (*Wallet) Confirm

func (t *Wallet) Confirm(transactionID []byte) error

func (*Wallet) Finalize

func (t *Wallet) Finalize(responseSlateBytes []byte) (txBytes []byte, err error)

func (*Wallet) Info

func (t *Wallet) Info() (string, error)

func (*Wallet) InitMasterKey

func (t *Wallet) InitMasterKey(mnemonic string) (createdMnemonic string, err error)

func (*Wallet) Issue

func (t *Wallet) Issue(value uint64, asset string) (issueBytes []byte, err error)

func (*Wallet) NewResponse

func (t *Wallet) NewResponse(
	amount uint64,
	fee uint64,
	asset string,
	change uint64,
	walletInputs []Output,
	receiveAmount uint64,
	receiveAsset string,
	inSlate *Slate,
) (
	outSlateBytes []byte,
	outputs []Output,
	savedSlate *SavedSlate,
	err error,
)

func (*Wallet) NewSlate

func (t *Wallet) NewSlate(
	amount uint64,
	fee uint64,
	asset string,
	change uint64,
	walletInputs []Output,
	receiveAmount uint64,
	receiveAsset string,
) (
	slateBytes []byte,
	outputs []Output,
	savedSlate *SavedSlate,
	err error,
)

func (*Wallet) NewTransaction

func (t *Wallet) NewTransaction(responseSlate *Slate, senderSlate *SavedSlate) (ledgerTxBytes []byte, walletTx Transaction, err error)

func (*Wallet) Print

func (t *Wallet) Print() error

func (*Wallet) Respond

func (t *Wallet) Respond(inSlateBytes []byte) (outSlateBytes []byte, err error)

func (*Wallet) Send

func (t *Wallet) Send(amount uint64, asset string, receiveAmount uint64, receiveAsset string) (slateBytes []byte, err error)

Jump to

Keyboard shortcuts

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