Documentation ¶
Index ¶
- Constants
- Variables
- func Run(ctx context.Context, config *Config) error
- type ABClient
- type AddKeyRequest
- type BalanceResponse
- type Bill
- type BillStore
- type BillStoreTx
- type Bills
- type BlockProcessor
- type Config
- type InitialBill
- type ListBillsResponse
- type Observability
- type Pubkey
- type WalletBackend
- func (w *WalletBackend) GetBill(unitID []byte) (*Bill, error)
- func (w *WalletBackend) GetBills(pubkey []byte, includeDCBills bool, offsetKey []byte, limit int) ([]*Bill, []byte, error)
- func (w *WalletBackend) GetFeeCreditBill(unitID []byte) (*Bill, error)
- func (w *WalletBackend) GetRoundNumber(ctx context.Context) (*sdk.RoundNumber, error)
- func (w *WalletBackend) GetTxHistoryRecords(hash sdk.PubKeyHash, dbStartKey []byte, count int) ([]*sdk.TxHistoryRecord, []byte, error)
- func (w *WalletBackend) GetTxProof(unitID types.UnitID, txHash sdk.TxHash) (*sdk.Proof, error)
- func (w *WalletBackend) HandleTransactionsSubmission(egp *errgroup.Group, sender sdk.PubKey, txs []*types.TransactionOrder)
- func (w *WalletBackend) SendTransactions(ctx context.Context, txs []*types.TransactionOrder) map[string]string
- type WalletBackendService
Constants ¶
const ( DustBillDeletionTimeout = 65536 ExpiredBillDeletionTimeout = 65536 )
const BoltBillStoreFileName = "bills.db"
Variables ¶
var (
ErrOwnerPredicateIsNil = errors.New("unit owner predicate is nil")
)
Functions ¶
Types ¶
type AddKeyRequest ¶
type AddKeyRequest struct {
Pubkey string `json:"pubkey"`
}
type BalanceResponse ¶
type BalanceResponse struct {
Balance uint64 `json:"balance,string"`
}
type Bill ¶
type Bill struct { Id []byte `json:"id"` Value uint64 `json:"value"` TxHash []byte `json:"txHash"` DCTargetUnitID []byte `json:"dcTargetUnitId,omitempty"` DCTargetUnitBacklink []byte `json:"dcTargetUnitBacklink,omitempty"` OwnerPredicate []byte `json:"ownerPredicate"` Locked sdk.LockReason `json:"locked"` }
func (*Bill) ToGenericBill ¶
func (*Bill) ToGenericBills ¶
type BillStore ¶
type BillStore interface { Do() BillStoreTx WithTransaction(func(tx BillStoreTx) error) error }
BillStore type for creating BillStoreTx transactions
type BillStoreTx ¶
type BillStoreTx interface { GetBlockNumber() (uint64, error) SetBlockNumber(blockNumber uint64) error GetBill(unitID []byte) (*Bill, error) GetBills(ownerCondition []byte, includeDCBills bool, offsetKey []byte, limit int) ([]*Bill, []byte, error) SetBill(bill *Bill, proof *sdk.Proof) error RemoveBill(unitID []byte) error SetBillExpirationTime(blockNumber uint64, unitID []byte) error DeleteExpiredBills(blockNumber uint64) error GetFeeCreditBill(unitID []byte) (*Bill, error) SetFeeCreditBill(fcb *Bill, proof *sdk.Proof) error GetSystemDescriptionRecords() ([]*genesis.SystemDescriptionRecord, error) SetSystemDescriptionRecords(sdrs []*genesis.SystemDescriptionRecord) error GetTxProof(unitID types.UnitID, txHash sdk.TxHash) (*sdk.Proof, error) StoreTxHistoryRecord(hash sdk.PubKeyHash, rec *sdk.TxHistoryRecord) error GetTxHistoryRecords(hash sdk.PubKeyHash, dbStartKey []byte, count int) ([]*sdk.TxHistoryRecord, []byte, error) StoreTxProof(unitID types.UnitID, txHash sdk.TxHash, txProof *sdk.Proof) error }
BillStoreTx type for managing units by their ID and owner condition
type BlockProcessor ¶
type BlockProcessor struct {
// contains filtered or unexported fields
}
func NewBlockProcessor ¶
func (*BlockProcessor) ProcessBlock ¶
type Config ¶
type Config struct { ABMoneySystemIdentifier types.SystemID AlphabillUrl string ServerAddr string DbFile string ListBillsPageLimit int InitialBill InitialBill SystemDescriptionRecords []*genesis.SystemDescriptionRecord Logger *slog.Logger Observe Observability }
type InitialBill ¶
type ListBillsResponse ¶
type Observability ¶
type Observability interface { Tracer(name string, options ...trace.TracerOption) trace.Tracer TracerProvider() trace.TracerProvider Logger() *slog.Logger }
type WalletBackend ¶
type WalletBackend struct {
// contains filtered or unexported fields
}
func (*WalletBackend) GetBill ¶
func (w *WalletBackend) GetBill(unitID []byte) (*Bill, error)
GetBill returns most recently seen bill with given unit id.
func (*WalletBackend) GetBills ¶
func (w *WalletBackend) GetBills(pubkey []byte, includeDCBills bool, offsetKey []byte, limit int) ([]*Bill, []byte, error)
GetBills returns first N=limit bills for given owner predicate starting from the offsetKey or if offsetKey is nil then starting from the very first key. Always returns the next key if it exists i.e. even if limit=0. Furthermore, the next key might not match the filter (isDCBill).
func (*WalletBackend) GetFeeCreditBill ¶
func (w *WalletBackend) GetFeeCreditBill(unitID []byte) (*Bill, error)
GetFeeCreditBill returns most recently seen fee credit bill with given unit id.
func (*WalletBackend) GetRoundNumber ¶
func (w *WalletBackend) GetRoundNumber(ctx context.Context) (*sdk.RoundNumber, error)
GetRoundNumber returns the latest round number in node and backend.
func (*WalletBackend) GetTxHistoryRecords ¶
func (w *WalletBackend) GetTxHistoryRecords(hash sdk.PubKeyHash, dbStartKey []byte, count int) ([]*sdk.TxHistoryRecord, []byte, error)
func (*WalletBackend) GetTxProof ¶
func (*WalletBackend) HandleTransactionsSubmission ¶
func (w *WalletBackend) HandleTransactionsSubmission(egp *errgroup.Group, sender sdk.PubKey, txs []*types.TransactionOrder)
func (*WalletBackend) SendTransactions ¶
func (w *WalletBackend) SendTransactions(ctx context.Context, txs []*types.TransactionOrder) map[string]string
TODO: Share functionaly with tokens partiton SendTransactions forwards transactions to partiton node(s).
type WalletBackendService ¶
type WalletBackendService interface { GetBills(pubKey []byte, includeDCBills bool, offsetKey []byte, limit int) ([]*Bill, []byte, error) GetBill(unitID []byte) (*Bill, error) GetFeeCreditBill(unitID []byte) (*Bill, error) GetRoundNumber(ctx context.Context) (*sdk.RoundNumber, error) SendTransactions(ctx context.Context, txs []*types.TransactionOrder) map[string]string GetTxProof(unitID types.UnitID, txHash sdk.TxHash) (*sdk.Proof, error) HandleTransactionsSubmission(egp *errgroup.Group, sender sdk.PubKey, txs []*types.TransactionOrder) GetTxHistoryRecords(hash sdk.PubKeyHash, dbStartKey []byte, count int) ([]*sdk.TxHistoryRecord, []byte, error) }