utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSuspended      = errors.New("[algalon]: the current service has been suspended")
	ErrEOF            = errors.New("[algalon]: at EOF")
	ErrAppKeyInvalid  = errors.New("[algalon]: invalid algalon app key")
	ErrAddressInvalid = errors.New("[algalon]: invalid address")
	ErrClosed         = errors.New("[algalon]: the service has been closed")
	ErrGenerateWallet = errors.New("[algalon]: generate wallet failed")
	ErrTimeOut        = errors.New("[algalon]: timeout")
	ErrUnknown        = errors.New("[algalon]: unknown error")
)

Functions

This section is empty.

Types

type App

type App struct {
	AlgalonAppKey string `json:"algalon_app_key,omitempty"`

	Threshold string `json:"threshold" binding:"required"`
	Remainder string `json:"remainder" binding:"required"`
	// Minimum transaction amount
	Mta string `json:"mta" binding:"required"`

	Trx20 []Token `json:"trx20" binding:"required"`

	Address []string `json:"address" binding:"required"`
}

type AppInfo

type AppInfo struct {
	Threshold string `json:"threshold" binding:"required"`
	Remainder string `json:"remainder" binding:"required"`
	// Minimum transaction amount
	Mta string `json:"mta" binding:"required"`

	Trx20 []Token `json:"trx20" binding:"required"`

	Address []string `json:"address"`
}

type Apps

type Apps struct {
	Apps []App `json:"apps"`
}

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[T any]() *Queue[T]

func (*Queue[T]) BatchIn

func (q *Queue[T]) BatchIn(items []*T) error

func (*Queue[T]) BatchOut

func (q *Queue[T]) BatchOut() ([]*T, error)

func (*Queue[T]) Continue

func (q *Queue[T]) Continue()

func (*Queue[T]) Counter

func (q *Queue[T]) Counter() int

func (*Queue[T]) Dequeue

func (q *Queue[T]) Dequeue() (*T, error)

func (*Queue[T]) Enqueue

func (q *Queue[T]) Enqueue(item *T) error

func (*Queue[T]) IsEmpty

func (q *Queue[T]) IsEmpty() bool

func (*Queue[T]) IsSuspended

func (q *Queue[T]) IsSuspended() bool

func (*Queue[T]) Suspend

func (q *Queue[T]) Suspend()

type Queuer

type Queuer[T any] interface {
	Enqueue(item *T) error
	Dequeue() (*T, error)
	Suspend()
	Continue()

	IsEmpty() bool
	Counter() int
	IsSuspended() bool
}

type ReadWriter

type ReadWriter interface {
	Read(appKey ...string) ([]App, error)
	Write(app ...App) error

	ReadWallets(appKey string) ([]provider.Wallet, error)
	WriteWallets(appKey string, wallets []provider.Wallet) error
}

type Record

type Record struct {
	PrivKey string `json:"private_key,omitempty"`

	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`

	Amount string `json:"amount,omitempty"`
	Type   string `json:"type,omitempty"`
	Coin   string `json:"coin"`
	Fee    string `json:"fee,omitempty"`
	TxId   string `json:"txID,omitempty"`

	Timestamp int64 `json:"timestamp"`

	Owner string `json:"owner"`

	Err string `json:"error,omitempty"`
}

type Records

type Records struct {
	Inflow  []Record `json:"inflow,omitempty"`
	Outflow []Record `json:"outflow,omitempty"`
}

func (*Records) IsEmpty

func (r *Records) IsEmpty() bool

type Table

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

func (*Table) Inflow

func (t *Table) Inflow(record *Record)

func (*Table) Outflow

func (t *Table) Outflow(record *Record)

func (*Table) Swap

func (t *Table) Swap(records Records) Records

type Token

type Token struct {
	Coin      string `json:"coin" binding:"required"`
	Threshold string `json:"threshold" binding:"required"`
	Remainder string `json:"remainder" binding:"required"`
	Mta       string `json:"mta" binding:"required"`
}

type Writer

type Writer interface {
	Write(record Record) error
}

Jump to

Keyboard shortcuts

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