Documentation
¶
Index ¶
- Constants
- Variables
- type AddFeeCmd
- type AddFeeCmdResponse
- type FeeManager
- func (w *FeeManager) AddFeeCredit(ctx context.Context, cmd AddFeeCmd) (*AddFeeCmdResponse, error)
- func (w *FeeManager) Close()
- func (w *FeeManager) GetFeeCredit(ctx context.Context, cmd GetFeeCreditCmd) (*wallet.Bill, error)
- func (w *FeeManager) ReclaimFeeCredit(ctx context.Context, cmd ReclaimFeeCmd) (*ReclaimFeeCmdResponse, error)
- type GenerateFcrIDFromPublicKey
- type GetFeeCreditCmd
- type MoneyClient
- type PartitionDataProvider
- type ReclaimFeeCmd
- type ReclaimFeeCmdResponse
- type TxPublisher
- type UnitLocker
Constants ¶
const (
MinimumFeeAmount = 3 * txbuilder.MaxFee
)
Variables ¶
var ( ErrMinimumFeeAmount = errors.New("insufficient fee amount") ErrLockedBillWrongPartition = errors.New("locked bill for wrong partition") )
Functions ¶
This section is empty.
Types ¶
type AddFeeCmdResponse ¶
type FeeManager ¶
type FeeManager struct {
// contains filtered or unexported fields
}
func NewFeeManager ¶
func NewFeeManager( am account.Manager, unitLocker UnitLocker, moneySystemID []byte, moneyTxPublisher TxPublisher, moneyBackendClient MoneyClient, partitionSystemID []byte, partitionTxPublisher TxPublisher, partitionBackendClient PartitionDataProvider, fcrIDFn GenerateFcrIDFromPublicKey, ) *FeeManager
NewFeeManager creates new fee credit manager. Parameters: - account manager - unit locker
- money partition:
- systemID
- tx publisher with proof confirmation
- money backend client
- user partition:
- systemID
- tx publisher with proof confirmation
- partition data provider e.g. backend client
func (*FeeManager) AddFeeCredit ¶
func (w *FeeManager) AddFeeCredit(ctx context.Context, cmd AddFeeCmd) (*AddFeeCmdResponse, error)
AddFeeCredit creates fee credit for the given amount. Wallet must have a bill large enough for the required amount plus fees. Returns transferFC and/or addFC transaction proofs.
func (*FeeManager) Close ¶
func (w *FeeManager) Close()
func (*FeeManager) GetFeeCredit ¶
func (w *FeeManager) GetFeeCredit(ctx context.Context, cmd GetFeeCreditCmd) (*wallet.Bill, error)
GetFeeCredit returns fee credit bill for given account, can return nil if fee credit bill has not been created yet.
func (*FeeManager) ReclaimFeeCredit ¶
func (w *FeeManager) ReclaimFeeCredit(ctx context.Context, cmd ReclaimFeeCmd) (*ReclaimFeeCmdResponse, error)
ReclaimFeeCredit reclaims fee credit. Reclaimed fee credit is added to the largest bill in wallet. Returns closeFC and/or reclaimFC transaction proofs.
type GenerateFcrIDFromPublicKey ¶
GenerateFcrIDFromPublicKey function to generate fee credit UnitID from shard number nad public key
type GetFeeCreditCmd ¶
type GetFeeCreditCmd struct {
AccountIndex uint64
}
type MoneyClient ¶
type PartitionDataProvider ¶
type ReclaimFeeCmd ¶
type ReclaimFeeCmd struct {
AccountIndex uint64
}
type ReclaimFeeCmdResponse ¶
type TxPublisher ¶
type UnitLocker ¶
type UnitLocker interface {
GetUnits(accountID []byte) ([]*unitlock.LockedUnit, error)
GetUnit(accountID, unitID []byte) (*unitlock.LockedUnit, error)
LockUnit(lockedBill *unitlock.LockedUnit) error
UnlockUnit(accountID, unitID []byte) error
Close() error
}