Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidParameters = errors.New("invalid parameters provided to create a subscription contract ORM")
)
View Source
var ErrUserHasNoSubscription = errors.New("user has no subscriptions")
Functions ¶
This section is empty.
Types ¶
type ORM ¶
type ORM interface { GetSubscriptions(offset, limit uint, qopts ...pg.QOpt) ([]StoredSubscription, error) UpsertSubscription(subscription StoredSubscription, qopts ...pg.QOpt) error }
type OnchainSubscriptions ¶
type OnchainSubscriptions interface { job.ServiceCtx // GetMaxUserBalance returns a maximum subscription balance (juels), or error if user has no subscriptions. GetMaxUserBalance(common.Address) (*big.Int, error) }
OnchainSubscriptions maintains a mirror of all subscriptions fetched from the blockchain (EVM-only). All methods are thread-safe.
func NewOnchainSubscriptions ¶
func NewOnchainSubscriptions(client evmclient.Client, config OnchainSubscriptionsConfig, orm ORM, lggr logger.Logger) (OnchainSubscriptions, error)
type OnchainSubscriptionsConfig ¶
type OnchainSubscriptionsConfig struct { ContractAddress common.Address `json:"contractAddress"` BlockConfirmations uint `json:"blockConfirmations"` UpdateFrequencySec uint `json:"updateFrequencySec"` UpdateTimeoutSec uint `json:"updateTimeoutSec"` UpdateRangeSize uint `json:"updateRangeSize"` StoreBatchSize uint `json:"storeBatchSize"` }
type StoredSubscription ¶
type StoredSubscription struct { SubscriptionID uint64 functions_router.IFunctionsSubscriptionsSubscription }
StoredSubscription is used to populate the user subscription maps from a persistent layer like postgres.
type UserSubscriptions ¶
type UserSubscriptions interface { UpdateSubscription(subscriptionId uint64, subscription *functions_router.IFunctionsSubscriptionsSubscription) bool GetMaxUserBalance(user common.Address) (*big.Int, error) }
func NewUserSubscriptions ¶
func NewUserSubscriptions() UserSubscriptions
Click to show internal directories.
Click to hide internal directories.