walletimpl

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthWalletimpl = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWalletimpl   = fmt.Errorf("proto: integer overflow")
)

Functions

func ExistsInHistory

func ExistsInHistory(hists []*History, h *tx.InoutHash) bool

ExistsInHistory returns true if h is in hists.

func GetAllPrivateKeys

func GetAllPrivateKeys(s *aklib.DBConfig) ([]string, error)

GetAllPrivateKeys returns privatekeys stored in the wallet.

Types

type History

type History struct {
	No            uint64    `protobuf:"varint,1,opt,name=no,proto3" json:"no,omitempty"`
	OTAddress     string    `protobuf:"bytes,2,opt,name=otaddress,proto3" json:"otaddress,omitempty"`
	OTAReceived   bool      `protobuf:"varint,3,opt,name=otareceived,proto3" json:"otareceived,omitempty"`
	Received      time.Time `protobuf:"bytes,4,opt,name=received,proto3,stdtime" json:"received"`
	*tx.InoutHash `protobuf:"bytes,5,opt,name=inout_hash,json=inoutHash,proto3,embedded=inout_hash" json:"inout_hash,omitempty"`
	Address       string        `protobuf:"bytes,6,opt,name=address,proto3" json:"address,omitempty"`
	Value         uint64        `protobuf:"varint,7,opt,name=value,proto3" json:"value,omitempty"`
	IsUtxo        bool          `protobuf:"varint,8,opt,name=is_utxo,json=isUtxo,proto3" json:"is_utxo,omitempty"`
	Out           *tx.InoutHash `protobuf:"bytes,9,opt,name=out,proto3" json:"out,omitempty"`
	Confirmed     bool          `protobuf:"varint,10,opt,name=confirmed,proto3" json:"confirmed,omitempty"`
	Rejected      bool          `protobuf:"varint,11,opt,name=rejected,proto3" json:"rejected,omitempty"`
}

History is a tx history for an account.

func NewPopulatedHistory

func NewPopulatedHistory(r randyWalletimpl, easy bool) *History

func (*History) Descriptor

func (*History) Descriptor() ([]byte, []int)

func (*History) Equal

func (this *History) Equal(that interface{}) bool

func (*History) Marshal

func (m *History) Marshal() (dAtA []byte, err error)

func (*History) MarshalTo

func (m *History) MarshalTo(dAtA []byte) (int, error)

func (*History) ProtoMessage

func (*History) ProtoMessage()

func (*History) Reset

func (m *History) Reset()

func (*History) Size

func (m *History) Size() (n int)

func (*History) String

func (m *History) String() string

func (*History) Unmarshal

func (m *History) Unmarshal(dAtA []byte) error

func (*History) XXX_DiscardUnknown

func (m *History) XXX_DiscardUnknown()

func (*History) XXX_Marshal

func (m *History) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*History) XXX_Merge

func (dst *History) XXX_Merge(src proto.Message)

func (*History) XXX_Size

func (m *History) XXX_Size() int

func (*History) XXX_Unmarshal

func (m *History) XXX_Unmarshal(b []byte) error

type Pool

type Pool struct {
	Index   uint32   `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	Address []string `protobuf:"bytes,2,rep,name=address,proto3" json:"address,omitempty"`
}

Pool is a pool for addresses.

func NewPopulatedPool

func NewPopulatedPool(r randyWalletimpl, easy bool) *Pool

func (*Pool) Descriptor

func (*Pool) Descriptor() ([]byte, []int)

func (*Pool) Equal

func (this *Pool) Equal(that interface{}) bool

func (*Pool) Marshal

func (m *Pool) Marshal() (dAtA []byte, err error)

func (*Pool) MarshalTo

func (m *Pool) MarshalTo(dAtA []byte) (int, error)

func (*Pool) ProtoMessage

func (*Pool) ProtoMessage()

func (*Pool) Reset

func (m *Pool) Reset()

func (*Pool) Size

func (m *Pool) Size() (n int)

func (*Pool) String

func (m *Pool) String() string

func (*Pool) Unmarshal

func (m *Pool) Unmarshal(dAtA []byte) error

func (*Pool) XXX_DiscardUnknown

func (m *Pool) XXX_DiscardUnknown()

func (*Pool) XXX_Marshal

func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Pool) XXX_Merge

func (dst *Pool) XXX_Merge(src proto.Message)

func (*Pool) XXX_Size

func (m *Pool) XXX_Size() int

func (*Pool) XXX_Unmarshal

func (m *Pool) XXX_Unmarshal(b []byte) error

type TxType

type TxType byte

TxType defines types in wallet history db.

const (
	All TxType = iota
	Normal
	OTA
	Ticket
	Multisig
)

TxTypes

func GetTxType

func GetTxType(t tx.InOutHashType) TxType

GetTxType converts tx.InOutHashType to a type in wewallet db

type Wallet

type Wallet struct {
	AccountName   string            `protobuf:"bytes,1,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"`
	EncSeed       []byte            `protobuf:"bytes,2,opt,name=enc_seed,json=encSeed,proto3" json:"enc_seed,omitempty"`
	AddressChange map[string]uint32 `` /* 189-byte string literal not displayed */
	AddressPublic map[string]uint32 `` /* 189-byte string literal not displayed */
	AddressOT     map[string]uint32 `` /* 177-byte string literal not displayed */
	Pool          *Pool             `protobuf:"bytes,6,opt,name=pool,proto3" json:"pool,omitempty"`
}

Wallet represents a wallet in RPC..

func Load

func Load(s *aklib.DBConfig, pwd []byte, priv string) (*Wallet, error)

Load initialize wallet struct.

func NewFromPriv

func NewFromPriv(s *aklib.DBConfig, pwd []byte, priv string) (*Wallet, error)

NewFromPriv creates a new wallet from private key.

func NewPopulatedWallet

func NewPopulatedWallet(r randyWalletimpl, easy bool) *Wallet

func (*Wallet) AddHistory

func (w *Wallet) AddHistory(s *aklib.DBConfig, hist ...*History) error

AddHistory updates address, isUtxo and value fields in histories and adds to db .

func (*Wallet) AllAddress

func (w *Wallet) AllAddress() []string

AllAddress returns all addresses in the wallet.

func (*Wallet) DecryptSeed

func (w *Wallet) DecryptSeed(pwd []byte) ([]byte, error)

DecryptSeed decrypts the seed of wallet.

func (*Wallet) Descriptor

func (*Wallet) Descriptor() ([]byte, []int)

func (*Wallet) Equal

func (this *Wallet) Equal(that interface{}) bool

func (*Wallet) FillPool

func (w *Wallet) FillPool(s *aklib.DBConfig, pwdd []byte) error

FillPool fills the pool.

func (*Wallet) FindAddress

func (w *Wallet) FindAddress(adrstr ...string) bool

FindAddress returns true if wallet has adrstr.

func (*Wallet) FindAddressByte

func (w *Wallet) FindAddressByte(cfg *aklib.DBConfig, adrstr ...address.Bytes) (bool, error)

FindAddressByte returns true if wallet has adrstr.

func (*Wallet) GetAddress

func (w *Wallet) GetAddress(s *aklib.DBConfig, isPublic bool, idx uint32, pwd []byte) (*address.Address, error)

GetAddress returns an address struct.

func (*Wallet) GetAddressHistory

func (w *Wallet) GetAddressHistory(s *aklib.DBConfig, adr string) ([]*tx.InoutHash, error)

GetAddressHistory returns InoutHash of adr.

func (*Wallet) GetAddressHistory2

func (w *Wallet) GetAddressHistory2(s *aklib.DBConfig, adr string) ([]*History, error)

GetAddressHistory2 returns History of adr.

func (*Wallet) GetAllUTXO

func (w *Wallet) GetAllUTXO(s *aklib.DBConfig, pwd []byte) ([]*tx.UTXO, uint64, error)

GetAllUTXO returns all UTXOs with balance.

func (*Wallet) GetHistory

func (w *Wallet) GetHistory(s *aklib.DBConfig, t TxType) ([]*History, error)

GetHistory gets histories of addresses in wallet.

func (*Wallet) GetOTAddress

func (w *Wallet) GetOTAddress(s *aklib.DBConfig, idx uint32, pwd []byte) (*sidh.PrivateKey, error)

GetOTAddress returns an sike privatekey..

func (*Wallet) GetUTXO

func (w *Wallet) GetUTXO(s *aklib.DBConfig, pwd []byte, pendingUtxos map[[34]byte]tx.Hash, isPublic bool) ([]*tx.UTXO, uint64, error)

GetUTXO returns UTXOs with balance.

func (*Wallet) GetUTXOFromHistory

func (w *Wallet) GetUTXOFromHistory(s *aklib.DBConfig, pwd []byte, pendingUtxos map[[34]byte]tx.Hash, isPublic bool) ([]*tx.UTXO, uint64, error)

GetUTXOFromHistory returns UTXOs with balance.

func (*Wallet) HasAddress

func (w *Wallet) HasAddress(s *aklib.DBConfig, out *tx.MultiSigOut) (bool, error)

HasAddress returns true if wallet has an address in the multisg address.

func (*Wallet) InitSeed

func (w *Wallet) InitSeed(s *aklib.DBConfig, pwd []byte) error

InitSeed initialize the seed.

func (*Wallet) Marshal

func (m *Wallet) Marshal() (dAtA []byte, err error)

func (*Wallet) MarshalTo

func (m *Wallet) MarshalTo(dAtA []byte) (int, error)

func (*Wallet) NewAddress

func (w *Wallet) NewAddress(s *aklib.DBConfig, pwd []byte, isPublic bool) (*address.Address, error)

NewAddress creates an address in wallet.

func (*Wallet) NewOTAddress

func (w *Wallet) NewOTAddress(s *aklib.DBConfig, pwd []byte) (*sidh.PrivateKey, error)

NewOTAddress creates an one-time address in wallet.

func (*Wallet) NewPublicAddressFromPool

func (w *Wallet) NewPublicAddressFromPool(s *aklib.DBConfig) (string, error)

NewPublicAddressFromPool get a public address from pool.

func (*Wallet) ProtoMessage

func (*Wallet) ProtoMessage()

func (*Wallet) Reset

func (m *Wallet) Reset()

func (*Wallet) Size

func (m *Wallet) Size() (n int)

func (*Wallet) String

func (m *Wallet) String() string

func (*Wallet) Unmarshal

func (m *Wallet) Unmarshal(dAtA []byte) error

func (*Wallet) UpdateHistory

func (w *Wallet) UpdateHistory(s *aklib.DBConfig, hist ...*History) error

UpdateHistory updates histroies. hist must be gotten by GetHistory func. Don't newly add histories to hist.

func (*Wallet) UpdateHistoryTxn

func (w *Wallet) UpdateHistoryTxn(b *bolt.Bucket, hist ...*History) error

UpdateHistoryTxn updates histroies. hist must be gotten by GetHistory func. Don't newly add histories to hist.

func (*Wallet) XXX_DiscardUnknown

func (m *Wallet) XXX_DiscardUnknown()

func (*Wallet) XXX_Marshal

func (m *Wallet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Wallet) XXX_Merge

func (dst *Wallet) XXX_Merge(src proto.Message)

func (*Wallet) XXX_Size

func (m *Wallet) XXX_Size() int

func (*Wallet) XXX_Unmarshal

func (m *Wallet) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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