dc

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DustCollectionResult

type DustCollectionResult struct {
	SwapProof *wallet.Proof
	LockProof *wallet.Proof
}

func (*DustCollectionResult) GetFeeSum

func (d *DustCollectionResult) GetFeeSum() (uint64, error)

GetFeeSum sums spent fees from the result

type DustCollector

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

func NewDustCollector

func NewDustCollector(systemID types.SystemID, maxBillsPerDC int, txTimeout uint64, moneyClient RpcClient, log *slog.Logger) *DustCollector

func (*DustCollector) Close

func (w *DustCollector) Close() error

func (*DustCollector) CollectDust

func (w *DustCollector) CollectDust(ctx context.Context, accountKey *account.AccountKey) (*DustCollectionResult, error)

CollectDust joins up to N units into existing target unit, prioritizing smallest units first. The largest unit is selected as the target unit. Returns swap transaction proof or error or nil if there's not enough bills to swap.

type RpcClient added in v0.4.0

type RpcClient interface {
	GetRoundNumber(ctx context.Context) (uint64, error)
	GetBill(ctx context.Context, unitID types.UnitID, includeStateProof bool) (*api.Bill, error)
	GetFeeCreditRecord(ctx context.Context, unitID types.UnitID, includeStateProof bool) (*api.FeeCreditBill, error)
	GetUnitsByOwnerID(ctx context.Context, ownerID types.Bytes) ([]types.UnitID, error)
	SendTransaction(ctx context.Context, tx *types.TransactionOrder) ([]byte, error)
	GetTransactionProof(ctx context.Context, txHash types.Bytes) (*types.TransactionRecord, *types.TxProof, error)
}

Jump to

Keyboard shortcuts

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