Documentation
¶
Index ¶
- type Cache
- type DecodedCall
- type Decoder
- type FilterRule
- type MemoryCache
- type RedisAdapter
- func (c *RedisAdapter) Close() error
- func (c *RedisAdapter) Get(ctx context.Context, key string) *redis.StringCmd
- func (c *RedisAdapter) GetString(ctx context.Context, key string) (string, error)
- func (c *RedisAdapter) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- func (c *RedisAdapter) SetClient(client RedisClient)
- func (c *RedisAdapter) SetString(ctx context.Context, key string, value string, expiration time.Duration) error
- type RedisClient
- type RedisClientAdapter
- func (c *RedisClientAdapter) Close() error
- func (c *RedisClientAdapter) Get(ctx context.Context, key string) *redis.StringCmd
- func (c *RedisClientAdapter) GetCmd(ctx context.Context, key string) *redis.StringCmd
- func (c *RedisClientAdapter) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- func (c *RedisClientAdapter) SetCmd(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- type SelectorCache
- type SelectorEntry
- type SignatureEntry
- type Template
- type TemplateManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { GetString(ctx context.Context, key string) (string, error) SetString(ctx context.Context, key string, value string, expiration time.Duration) error }
Cache interface for storing and retrieving values
type DecodedCall ¶
type DecodedCall struct { Function string `json:"function"` Params map[string]interface{} `json:"params"` }
DecodedCall represents a decoded transaction call
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder handles transaction decoding using ABI signatures
func NewDecoder ¶
NewDecoder creates a new transaction decoder
func (*Decoder) DecodeTransaction ¶
func (d *Decoder) DecodeTransaction(ctx context.Context, tx *blockchain.Transaction) error
DecodeTransaction attempts to decode a transaction using cached ABI signatures
type FilterRule ¶
type FilterRule struct { Field string `json:"field"` // Field to filter on (e.g., "to", "value", "method") Operator string `json:"operator"` // eq, neq, gt, lt, contains Value string `json:"value"` // Value to compare against }
FilterRule defines a rule for filtering transactions
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache implements an in-memory cache with TTL
func NewMemoryCache ¶
func NewMemoryCache() *MemoryCache
NewMemoryCache creates a new in-memory cache
type RedisAdapter ¶
type RedisAdapter struct {
// contains filtered or unexported fields
}
RedisAdapter implements both Cache and RedisClient interfaces
func NewRedisAdapter ¶
func NewRedisAdapter(client RedisClient) *RedisAdapter
NewRedisAdapter creates a new Redis adapter
func (*RedisAdapter) Get ¶
func (c *RedisAdapter) Get(ctx context.Context, key string) *redis.StringCmd
Get implements both Cache.Get and RedisClient.Get
func (*RedisAdapter) Set ¶
func (c *RedisAdapter) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
Set implements both Cache.Set and RedisClient.Set
func (*RedisAdapter) SetClient ¶
func (c *RedisAdapter) SetClient(client RedisClient)
SetClient sets the Redis client - used for testing
type RedisClient ¶
type RedisClient interface { Get(ctx context.Context, key string) *redis.StringCmd Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd Close() error }
RedisClient is an interface for Redis operations
type RedisClientAdapter ¶
type RedisClientAdapter struct {
// contains filtered or unexported fields
}
RedisClientAdapter adapts redis.Client to RedisClient interface
func NewRedisClientAdapter ¶
func NewRedisClientAdapter(client *redis.Client) *RedisClientAdapter
NewRedisClientAdapter creates a new Redis client adapter
func (*RedisClientAdapter) Close ¶
func (c *RedisClientAdapter) Close() error
Close implements RedisClient.Close
func (*RedisClientAdapter) Get ¶
func (c *RedisClientAdapter) Get(ctx context.Context, key string) *redis.StringCmd
Get implements RedisClient.Get
func (*RedisClientAdapter) GetCmd ¶
func (c *RedisClientAdapter) GetCmd(ctx context.Context, key string) *redis.StringCmd
GetCmd implements RedisClient.GetCmd
type SelectorCache ¶
type SelectorCache struct {
// contains filtered or unexported fields
}
SelectorCache provides fast access to ABI method selectors
func NewSelectorCache ¶
func NewSelectorCache(redis RedisClient, chainID string) *SelectorCache
NewSelectorCache creates a new selector cache
func (*SelectorCache) GetSelector ¶
func (c *SelectorCache) GetSelector(ctx context.Context, selector string) (*SelectorEntry, error)
GetSelector retrieves a selector entry from cache or Redis
func (*SelectorCache) GetSelectorByAddress ¶
func (c *SelectorCache) GetSelectorByAddress(ctx context.Context, address, selector string) (*SelectorEntry, error)
GetSelectorByAddress tries to get a selector specific to an address
func (*SelectorCache) SetTemplate ¶
func (c *SelectorCache) SetTemplate(t *Template)
SetTemplate sets the current template for decoding
type SelectorEntry ¶
type SelectorEntry struct { Name string `json:"name"` Inputs []abi.Argument `json:"inputs"` Method *abi.Method `json:"-"` }
SelectorEntry represents a cached ABI selector
type SignatureEntry ¶
SignatureEntry represents an ABI function signature
type Template ¶
type Template struct { Name string `json:"name"` ABI string `json:"abi"` Selectors []string `json:"selectors"` Methods []abi.Method `json:"methods"` Filters []FilterRule `json:"filters"` }
Template represents a transaction decoding template
type TemplateManager ¶
type TemplateManager struct {
// contains filtered or unexported fields
}
TemplateManager manages transaction decoding templates
func NewTemplateManager ¶
func NewTemplateManager(redis RedisClient) *TemplateManager
NewTemplateManager creates a new template manager
func (*TemplateManager) ApplyTemplate ¶
func (tm *TemplateManager) ApplyTemplate(tx map[string]interface{}, template *Template) bool
ApplyTemplate applies a template's filters to a transaction
func (*TemplateManager) GetTemplate ¶
GetTemplate retrieves a template by name
func (*TemplateManager) SaveTemplate ¶
func (tm *TemplateManager) SaveTemplate(ctx context.Context, template *Template) error
SaveTemplate saves a template to Redis