Documentation
¶
Index ¶
- type ActionGateway
- type Handler
- type MockActionGateway
- type MockStore
- func (m *MockStore) GetAppCount(_ string) (uint64, error)
- func (m *MockStore) GetTotalUserStaked(_ string) (decimal.Decimal, error)
- func (m *MockStore) GetUserActionCount(_ string, _ core.GatedAction, _ time.Duration) (uint64, error)
- func (m *MockStore) GetUserActionCounts(_ string, _ time.Duration) (map[core.GatedAction]uint64, error)
- func (m *MockStore) GetUserBalances(wallet string) ([]core.BalanceEntry, error)
- func (m *MockStore) GetUserTransactions(Wallet string, Asset *string, TxType *core.TransactionType, FromTime *uint64, ...) ([]core.Transaction, core.PaginationMetadata, error)
- func (m *MockStore) RecordAction(_ string, _ core.GatedAction) error
- type Store
- type StoreTxHandler
- type StoreTxProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionGateway ¶
type ActionGateway interface {
// GetUserAllowances retrieves the action allowances for a user, which define what actions the user is permitted to perform.
GetUserAllowances(tx action_gateway.Store, userAddress string) ([]core.ActionAllowance, error)
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler manages user data operations and provides RPC endpoints.
func NewHandler ¶
func NewHandler( store Store, useStoreInTx StoreTxProvider, actionGateway ActionGateway, ) *Handler
NewHandler creates a new Handler instance with the provided dependencies.
func (*Handler) GetActionAllowances ¶
GetActionAllowances retrieves the action allowances for a user.
func (*Handler) GetBalances ¶
GetBalances retrieves the balances of the user.
func (*Handler) GetTransactions ¶
GetTransactions retrieves transaction history for a user with optional filters.
type MockActionGateway ¶
type MockActionGateway struct {
Allowances []core.ActionAllowance
Err error
}
func (*MockActionGateway) GetUserAllowances ¶
func (m *MockActionGateway) GetUserAllowances(_ action_gateway.Store, _ string) ([]core.ActionAllowance, error)
type MockStore ¶
MockStore is a mock implementation of the Store interface
func (*MockStore) GetTotalUserStaked ¶
func (*MockStore) GetUserActionCount ¶
func (*MockStore) GetUserActionCounts ¶
func (*MockStore) GetUserBalances ¶
func (m *MockStore) GetUserBalances(wallet string) ([]core.BalanceEntry, error)
func (*MockStore) GetUserTransactions ¶
func (m *MockStore) GetUserTransactions(Wallet string, Asset *string, TxType *core.TransactionType, FromTime *uint64, ToTime *uint64, Paginate *core.PaginationParams) ([]core.Transaction, core.PaginationMetadata, error)
func (*MockStore) RecordAction ¶
func (m *MockStore) RecordAction(_ string, _ core.GatedAction) error
type Store ¶
type Store interface {
// GetUserBalances retrieves the balances for a user's wallet.
GetUserBalances(wallet string) ([]core.BalanceEntry, error)
// GetUserTransactions retrieves transaction history for a user with optional filters.
GetUserTransactions(Wallet string,
Asset *string,
TxType *core.TransactionType,
FromTime *uint64,
ToTime *uint64,
Paginate *core.PaginationParams) ([]core.Transaction, core.PaginationMetadata, error)
action_gateway.Store
}
Store defines the persistence layer interface for user data management. All methods should be implemented to work within database transactions.
type StoreTxHandler ¶
StoreTxHandler is a function that executes Store operations within a transaction. If the handler returns an error, the transaction is rolled back; otherwise it's committed.
type StoreTxProvider ¶
type StoreTxProvider func(StoreTxHandler) error
StoreTxProvider wraps Store operations in a database transaction. It accepts a StoreTxHandler and manages transaction lifecycle (begin, commit, rollback). Returns an error if the handler fails or the transaction cannot be committed.