bank

package
v0.0.0-...-a8cc34e Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExistKeyName           = errors.New("exist key name")
	ErrInvalidTag             = errors.New("invalid key tag")
	ErrInvalidNameAddress     = errors.New("invalid name address")
	ErrInvalidTransactionHash = errors.New("invalid transaction hash")
	ErrInvalidTXID            = errors.New("invalid txid")
	ErrTransactionTimeout     = errors.New("transaction timeout")
	ErrTransactionFailed      = errors.New("transaction failed")
)

errors

Functions

func Cipher

func Cipher(src []byte, Password string) ([]byte, error)

Cipher cipher data

func Decipher

func Decipher(cipherText []byte, Password string) ([]byte, error)

Decipher decrypting data

Types

type Bank

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

func NewBank

func NewBank(keyStore backend.StoreBackend, dbpath string) *Bank

NewBank returns a Bank

func (*Bank) Accounts

func (s *Bank) Accounts(name string) ([]common.Address, error)

Accounts returns accounts of the name from the wallet

func (*Bank) ChangePassword

func (s *Bank) ChangePassword(name string, oldPassword string, Password string) error

ChangePassword changes the password of the key

func (*Bank) CheckPassword

func (s *Bank) CheckPassword(name string, Password string) error

CheckPassword checks the password of the key

func (*Bank) CreateKey

func (s *Bank) CreateKey(name string, Password string) error

CreateKey creates the private key with password to the wallet

func (*Bank) DeleteKey

func (s *Bank) DeleteKey(name string, Password string) error

DeleteKey removes the private key from the wallet

func (*Bank) ImportKey

func (s *Bank) ImportKey(name string, bs []byte, Password string) error

ImportKey adds the private key with password to the wallet

func (*Bank) Init

func (s *Bank) Init(pm types.ProcessManager, cn types.Provider) error

Init called when initialize service

func (*Bank) InitFromStore

func (s *Bank) InitFromStore(st *chain.Store) error

InitFromStore initializes account datas from the store

func (*Bank) KeyNames

func (s *Bank) KeyNames() ([]string, error)

KeyNames returns names of keys from the wallet

func (*Bank) Name

func (s *Bank) Name() string

Name returns the name of the service

func (*Bank) NameByAddress

func (s *Bank) NameByAddress(addr common.Address) (string, error)

NameByAddress returns the name of the address from the wallet

func (*Bank) OnBlockConnected

func (s *Bank) OnBlockConnected(b *types.Block, events []types.Event, loader types.Loader)

OnBlockConnected called when a block is connected to the chain

func (*Bank) OnLoadChain

func (s *Bank) OnLoadChain(loader types.Loader) error

OnLoadChain called when the chain loaded

func (*Bank) SendTx

func (s *Bank) SendTx(tx types.Transaction, sigs []common.Signature) (hash.Hash256, error)

func (*Bank) SetNode

func (s *Bank) SetNode(nd *p2p.Node)

func (*Bank) Sign

func (s *Bank) Sign(name string, Password string, MessageHash hash.Hash256) (common.Signature, error)

Sign makes a signature of the message using the private key of the name

func (*Bank) Unstaking

func (s *Bank) Unstaking(HyperAddr common.Address, addr common.Address, UnstakedHeight uint32) *amount.Amount

func (*Bank) WaitTx

func (s *Bank) WaitTx(TxHash hash.Hash256, wait time.Duration) (string, error)

type Transaction

type Transaction struct {
	Type   uint16
	Data   []byte
	Result uint8
}

Jump to

Keyboard shortcuts

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