backend

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: BSD-3-Clause Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicate    = errors.New("duplicate")
	ErrAssetMissing = errors.New("asset missing")
)

Functions

This section is empty.

Types

type AddressInfo

type AddressInfo struct {
	Name    string
	Address string
	AddrStr string
}

type Alert

type Alert struct {
	Type    string
	Content string
}

type AssetInfo

type AssetInfo struct {
	ID string

	Symbol    string
	Decimals  int
	Metadata  string
	Supply    string
	Creator   string
	StrSymbol string
}

type Backend

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

func New

func New(fatal func(error)) *Backend

NewApp creates a new App application struct

func (*Backend) AddAddressBook

func (b *Backend) AddAddressBook(name string, address string) error

Any existing address will be overwritten with a new name

func (*Backend) AddAsset

func (b *Backend) AddAsset(asset string) error

func (*Backend) CreateAsset

func (b *Backend) CreateAsset(symbol string, decimals string, metadata string) error

func (*Backend) GetAccountStats

func (b *Backend) GetAccountStats() []*GenericInfo

func (*Backend) GetAddress

func (b *Backend) GetAddress() string

func (*Backend) GetAddressBook

func (b *Backend) GetAddressBook() []*AddressInfo

func (*Backend) GetAllAssets

func (b *Backend) GetAllAssets() []*AssetInfo

func (*Backend) GetBalance

func (b *Backend) GetBalance() ([]*BalanceInfo, error)

func (*Backend) GetChainID

func (b *Backend) GetChainID() string

func (*Backend) GetFaucetSolutions

func (b *Backend) GetFaucetSolutions() *FaucetSolutions

func (*Backend) GetFeed

func (b *Backend) GetFeed() ([]*FeedObject, error)

func (*Backend) GetFeedInfo

func (b *Backend) GetFeedInfo() (*FeedInfo, error)

func (*Backend) GetLatestBlocks

func (b *Backend) GetLatestBlocks() []*BlockInfo

func (*Backend) GetMyAssets

func (b *Backend) GetMyAssets() []*AssetInfo

func (*Backend) GetTransactionStats

func (b *Backend) GetTransactionStats() []*GenericInfo

func (*Backend) GetTransactions

func (b *Backend) GetTransactions() *Transactions

func (*Backend) GetUnitPrices

func (b *Backend) GetUnitPrices() []*GenericInfo

func (*Backend) Message

func (b *Backend) Message(message string, url string) error

func (*Backend) MintAsset

func (b *Backend) MintAsset(asset string, address string, amount string) error

func (*Backend) Shutdown

func (b *Backend) Shutdown(context.Context) error

func (*Backend) Start

func (b *Backend) Start(ctx context.Context) error

func (*Backend) StartFaucetSearch

func (b *Backend) StartFaucetSearch() (*FaucetSearchInfo, error)

func (*Backend) Transfer

func (b *Backend) Transfer(asset string, address string, amount string, memo string) error

type BalanceInfo

type BalanceInfo struct {
	ID string

	Str string
	Bal string
	Has bool
}

type BlockInfo

type BlockInfo struct {
	Timestamp int64
	ID        string
	Height    uint64
	Size      string
	TPS       string
	Consumed  string
	Prices    string
	StateRoot string

	Txs     int
	FailTxs int

	Latency int64
}

type Config

type Config struct {
	TokenRPC    string `json:"tokenRPC"`
	FaucetRPC   string `json:"faucetRPC"`
	SearchCores int    `json:"searchCores"`
	FeedRPC     string `json:"feedRPC"`
}

type FaucetSearchInfo

type FaucetSearchInfo struct {
	FaucetAddress string
	Salt          string
	Difficulty    uint16

	Solution string
	Attempts uint64
	Elapsed  string

	Amount string
	TxID   string

	Err string
}

type FaucetSolutions

type FaucetSolutions struct {
	Alerts        []*Alert
	CurrentSearch *FaucetSearchInfo
	PastSearches  []*FaucetSearchInfo
}

type FeedInfo

type FeedInfo struct {
	Address string
	Fee     string
}

type FeedObject

type FeedObject struct {
	Address   string
	ID        string
	Timestamp int64
	Fee       string

	Message string
	URL     string

	URLMeta *HTMLMeta
}

type GenericInfo

type GenericInfo struct {
	Timestamp int64
	Count     uint64
	Category  string
}

type HTMLMeta

type HTMLMeta struct {
	URL  string
	Host string

	SiteName    string
	Title       string
	Description string
	Image       string
}

Inspiration: https://gist.github.com/inotnako/c4a82f6723f6ccea5d83c5d3689373dd

func ParseHTML

func ParseHTML(url string, host string, resp io.Reader) *HTMLMeta

type Storage

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

func OpenStorage

func OpenStorage(databasePath string) (*Storage, error)

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) DeleteDBKey

func (s *Storage) DeleteDBKey(k []byte) error

func (*Storage) GetAddresses

func (s *Storage) GetAddresses() ([]*AddressInfo, error)

func (*Storage) GetAssets

func (s *Storage) GetAssets() ([]ids.ID, []bool, error)

func (*Storage) GetKey

func (s *Storage) GetKey() (ed25519.PrivateKey, error)

func (*Storage) GetSolutions

func (s *Storage) GetSolutions() ([]*FaucetSearchInfo, error)

func (*Storage) GetTransactions

func (s *Storage) GetTransactions() ([]*TransactionInfo, error)

func (*Storage) HasAsset

func (s *Storage) HasAsset(assetID ids.ID) (bool, error)

func (*Storage) StoreAddress

func (s *Storage) StoreAddress(address string, nickname string) error

func (*Storage) StoreAsset

func (s *Storage) StoreAsset(assetID ids.ID, owned bool) error

func (*Storage) StoreKey

func (s *Storage) StoreKey(privateKey ed25519.PrivateKey) error

func (*Storage) StoreSolution

func (s *Storage) StoreSolution(solution *FaucetSearchInfo) error

func (*Storage) StoreTransaction

func (s *Storage) StoreTransaction(tx *TransactionInfo) error

type TimeStat

type TimeStat struct {
	Timestamp    int64
	Transactions int
	Accounts     set.Set[string]
	Prices       chain.Dimensions
}

type TransactionInfo

type TransactionInfo struct {
	ID        string
	Size      string
	Timestamp int64
	Actor     string

	Success bool
	Type    string
	Units   string
	Fee     string
	Summary string
}

type Transactions

type Transactions struct {
	Alerts  []*Alert
	TxInfos []*TransactionInfo
}

Jump to

Keyboard shortcuts

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