Documentation
¶
Overview ¶
Package payer defines the interfaces for actual payment transactions.
Index ¶
- type Auditor
- type Payer
- type SimAuditor
- type SimPayer
- func (s *SimPayer) CheckConfirmedTransactionState(ctx context.Context, hash string) (pipelinedb.TxState, error)
- func (s *SimPayer) CheckNonceGroup(ctx context.Context, log *zap.Logger, nonceGroup *pipelinedb.NonceGroup, ...) (pipelinedb.TxState, []*pipelinedb.TxStatus, error)
- func (s *SimPayer) CheckPreconditions(ctx context.Context) ([]string, error)
- func (s *SimPayer) CheckTransactionState(ctx context.Context, hash string) (pipelinedb.TxState, error)
- func (s *SimPayer) CreateRawTransaction(ctx context.Context, log *zap.Logger, payouts []*pipelinedb.Payout, ...) (tx Transaction, from common.Address, err error)
- func (s *SimPayer) GetTokenBalance(ctx context.Context) (*big.Int, error)
- func (s *SimPayer) GetTokenDecimals(ctx context.Context) (int32, error)
- func (s *SimPayer) NextNonce(ctx context.Context) (uint64, error)
- func (s *SimPayer) PrintEstimate(ctx context.Context, remaining int64) error
- func (s *SimPayer) SendTransaction(ctx context.Context, log *zap.Logger, tx Transaction) error
- func (s *SimPayer) String() string
- type Transaction
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auditor ¶
type Auditor interface { // CheckTransactionState checks the transaction state of any transaction. CheckTransactionState(ctx context.Context, hash string) (pipelinedb.TxState, error) // CheckConfirmedTransactionState checks the state from the confirmation receipt. CheckConfirmedTransactionState(ctx context.Context, hash string) (pipelinedb.TxState, error) }
Auditor helps to validate transaction created by the appropriate payer.
type Payer ¶
type Payer interface { // Strings returns a string describing the payer type. String() string // NextNonce queries chain for the next available nonce value. NextNonce(ctx context.Context) (uint64, error) // CheckPreconditions checks if transaction can be initiated. If unmet preconditions are returned then pipeline will try again after a short sleep. CheckPreconditions(ctx context.Context) (unmet []string, err error) // GetTokenBalance returns with the available token balance in real value (with decimals). GetTokenBalance(ctx context.Context) (*big.Int, error) // GetTokenDecimals returns with the decimal precision of the token. GetTokenDecimals(ctx context.Context) (int32, error) // CreateRawTransaction creates the chain transaction which will be persisted to the db. CreateRawTransaction(ctx context.Context, log *zap.Logger, payouts []*pipelinedb.Payout, nonce uint64, storjPrice decimal.Decimal) (tx Transaction, from common.Address, err error) // SendTransaction submits the transaction created earlier. SendTransaction(ctx context.Context, log *zap.Logger, tx Transaction) error // CheckNonceGroup returns with the status of the submitted transactions. CheckNonceGroup(ctx context.Context, log *zap.Logger, nonceGroup *pipelinedb.NonceGroup, checkOnly bool) (pipelinedb.TxState, []*pipelinedb.TxStatus, error) // PrintEstimate prints out additional information about the planned actions. PrintEstimate(ctx context.Context, remaining int64) error }
Payer is responsible for the final payment transfer.
type SimAuditor ¶
type SimAuditor struct { }
func (SimAuditor) CheckConfirmedTransactionState ¶
func (s SimAuditor) CheckConfirmedTransactionState(ctx context.Context, hash string) (pipelinedb.TxState, error)
func (SimAuditor) CheckTransactionState ¶
func (s SimAuditor) CheckTransactionState(ctx context.Context, hash string) (pipelinedb.TxState, error)
type SimPayer ¶
type SimPayer struct {
// contains filtered or unexported fields
}
func NewSimPayer ¶
func (*SimPayer) CheckConfirmedTransactionState ¶
func (*SimPayer) CheckNonceGroup ¶
func (s *SimPayer) CheckNonceGroup(ctx context.Context, log *zap.Logger, nonceGroup *pipelinedb.NonceGroup, checkOnly bool) (pipelinedb.TxState, []*pipelinedb.TxStatus, error)
func (*SimPayer) CheckPreconditions ¶
func (*SimPayer) CheckTransactionState ¶
func (*SimPayer) CreateRawTransaction ¶
func (*SimPayer) GetTokenBalance ¶
func (*SimPayer) GetTokenDecimals ¶
func (*SimPayer) PrintEstimate ¶
func (*SimPayer) SendTransaction ¶
type Transaction ¶
type Transaction struct { // Hash is the generic (unique) identifier of the transaction. Hash string // Nonce is the nonce from the group. Nonce uint64 // Raw is the internal representation of transaction data. Raw any }
Transaction is a generic representation of a payment.
type Type ¶
type Type string
Type represents the payment method.
func TypeFromString ¶
TypeFromString parses string to a Type const.
Click to show internal directories.
Click to hide internal directories.