datastore

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToKey

func ToKey(k interface{}) datastore.Key

Types

type HdWallet

type HdWallet struct {
	Mnemonic     []byte `json:"mnemonic"`
	MnemonicHash []byte `json:"mnemonic_hash"`
}

type History

type History struct {
	Version    uint64   `json:"version"`
	To         string   `json:"to"`
	From       string   `json:"from"`
	Nonce      uint64   `json:"nonce"`
	Value      int64    `json:"value"`
	GasLimit   int64    `json:"gas_limit"`
	GasFeeCap  int64    `json:"gas_feecap"`
	GasPremium int64    `json:"gas_premium"`
	Method     uint64   `json:"method"`
	Params     string   `json:"params"`
	ParamName  string   `json:"param_name"`
	TxCid      string   `json:"tx_cid"`
	TxState    MsgState `json:"tx_state"`
	Detail     string   `json:"detail"`
}

type HistoryStore

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

type KeyStore

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

type MsgState

type MsgState string
const (
	Pending MsgState = "pending"
	Success MsgState = "success"
	Failed  MsgState = "failed"
)

type MsigWallet

type MsigWallet struct {
	MsigAddr              string   `json:"msig_addr"`
	Signers               []string `json:"signers"`
	NumApprovalsThreshold uint64   `json:"num_approvals_threshold"`
	UnlockDuration        int64    `json:"unlock_duration"`
	StartEpoch            int64    `json:"start_epoch"`
}

type NodeInfo

type NodeInfo struct {
	Name     string `json:"name"`
	Endpoint string `json:"endpoint"`
	Token    string `json:"token"`
}

type NodeStore

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

type PrivateWallet

type PrivateWallet struct {
	PriKey  []byte `json:"pri_key"`
	Address string `json:"address"`
	KeyHash []byte `json:"key_hash"`
	Path    string `json:"path"`
}

type ScryptStore

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

type StateStore

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

func NewStateStore

func NewStateStore(ds datastore.Datastore) *StateStore

func (*StateStore) Begin

func (st *StateStore) Begin(i interface{}, state interface{}, force bool) error

func (*StateStore) Get

func (st *StateStore) Get(i interface{}) *StoredState

func (*StateStore) Has

func (st *StateStore) Has(i interface{}) (bool, error)

func (*StateStore) List

func (st *StateStore) List(out interface{}) error

type StoredIndex

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

StoredIndex is a counter that persists to a datastore as it increments

func NewStoredIndex

func NewStoredIndex(ds datastore.Datastore, name datastore.Key) *StoredIndex

NewStoredIndex returns a new StoredCounter for the given datastore and key

func (*StoredIndex) Get

func (si *StoredIndex) Get() (uint64, error)

Get returns current counter value

func (*StoredIndex) Next

func (si *StoredIndex) Next() (uint64, error)

Next returns the next counter value, updating it on disk in the process if no counter is present, it creates one and returns a 0 value

type StoredState

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

func (*StoredState) Delete

func (st *StoredState) Delete() error

func (*StoredState) Get

func (st *StoredState) Get() ([]byte, error)

func (*StoredState) Mutate

func (st *StoredState) Mutate(mutator interface{}) error

type WalletDB

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

func NewWalletDB

func NewWalletDB(ds datastore.Batching) WalletDB

func (*WalletDB) DeleteLoginPassword

func (db *WalletDB) DeleteLoginPassword() error

func (*WalletDB) DeleteMasterPassword

func (db *WalletDB) DeleteMasterPassword() error

func (*WalletDB) DeleteMnemonic

func (db *WalletDB) DeleteMnemonic() error

func (*WalletDB) DeleteMsig

func (db *WalletDB) DeleteMsig(addr string) error

func (*WalletDB) DeleteNode

func (db *WalletDB) DeleteNode(name string) error

func (*WalletDB) DeletePrivate

func (db *WalletDB) DeletePrivate(addr string) error

func (*WalletDB) GetHistory

func (db *WalletDB) GetHistory(addr string, nonce uint64) (*History, error)

func (*WalletDB) GetLoginPassword

func (db *WalletDB) GetLoginPassword() ([]byte, error)

func (*WalletDB) GetMasterPassword

func (db *WalletDB) GetMasterPassword() ([]byte, error)

func (*WalletDB) GetMnemonic

func (db *WalletDB) GetMnemonic() (*HdWallet, error)

func (*WalletDB) GetMsig

func (db *WalletDB) GetMsig(addr string) (*MsigWallet, error)

func (*WalletDB) GetNode

func (db *WalletDB) GetNode(name string) (*NodeInfo, error)

func (*WalletDB) GetPrivate

func (db *WalletDB) GetPrivate(addr string) (*PrivateWallet, error)

func (*WalletDB) HasLoginPassword

func (db *WalletDB) HasLoginPassword() (bool, error)

func (*WalletDB) HasMasterPassword

func (db *WalletDB) HasMasterPassword() (bool, error)

func (*WalletDB) HasMnemonic

func (db *WalletDB) HasMnemonic() (bool, error)

func (*WalletDB) HistoryList

func (db *WalletDB) HistoryList(addr string) ([]History, error)

func (*WalletDB) MnemonicIndex

func (db *WalletDB) MnemonicIndex() (uint64, error)

func (*WalletDB) MsigWalletList

func (db *WalletDB) MsigWalletList() ([]MsigWallet, error)

func (*WalletDB) NextMnemonicIndex

func (db *WalletDB) NextMnemonicIndex() (uint64, error)

func (*WalletDB) NodeList

func (db *WalletDB) NodeList() ([]NodeInfo, error)

func (*WalletDB) SetHistory

func (db *WalletDB) SetHistory(msg *History) error

func (*WalletDB) SetLoginPassword

func (db *WalletDB) SetLoginPassword(password []byte) error

func (*WalletDB) SetMasterPassword

func (db *WalletDB) SetMasterPassword(password []byte) error

func (*WalletDB) SetMnemonic

func (db *WalletDB) SetMnemonic(hdWallet *HdWallet) error

func (*WalletDB) SetMsig

func (db *WalletDB) SetMsig(msigWallet *MsigWallet) error

func (*WalletDB) SetNode

func (db *WalletDB) SetNode(nodeInfo *NodeInfo) error

func (*WalletDB) SetPrivate

func (db *WalletDB) SetPrivate(priWallet *PrivateWallet) error

func (*WalletDB) UpdateHistory

func (db *WalletDB) UpdateHistory(msg *History) error

func (*WalletDB) UpdateLoginPassword

func (db *WalletDB) UpdateLoginPassword(password []byte) error

func (*WalletDB) UpdateMasterPassword

func (db *WalletDB) UpdateMasterPassword(password []byte) error

func (*WalletDB) UpdateMnemonic

func (db *WalletDB) UpdateMnemonic(hdWallet *HdWallet) error

func (*WalletDB) UpdateMsig

func (db *WalletDB) UpdateMsig(msigWallet *MsigWallet) error

func (*WalletDB) UpdateNode

func (db *WalletDB) UpdateNode(nodeInfo *NodeInfo) error

func (*WalletDB) UpdatePrivate

func (db *WalletDB) UpdatePrivate(priWallet *PrivateWallet) error

func (*WalletDB) WalletList

func (db *WalletDB) WalletList() ([]PrivateWallet, error)

Jump to

Keyboard shortcuts

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