store

package
v0.0.0-...-4d36670 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllTables = []any{&UserOp{}, &Config{}}

Functions

This section is empty.

Types

type Config

type Config struct {
	Model

	Name  string `gorm:"size:64;not null;unique"`
	Value string `gorm:"size:1024;not null"`
}

type ConfigStore

type ConfigStore struct {
	// contains filtered or unexported fields
}

func NewConfigStore

func NewConfigStore(store *store.Store) *ConfigStore

func (*ConfigStore) Get

func (store *ConfigStore) Get(name string) (string, bool, error)

Get returns the value of the config by name. If the config does not exist, it returns false.

func (*ConfigStore) Upsert

func (store *ConfigStore) Upsert(name, value string, tx ...*gorm.DB) error

Upsert updates the value of the config by name. If the config does not exist, it creates a new config with the given name and value.

type Model

type Model struct {
	ID        uint64    `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"not null"`
	UpdatedAt time.Time `gorm:"not null"`
}

type PackedUserOperation

type PackedUserOperation struct {
	Sender                        common.Address `json:"sender"`
	Nonce                         *big.Int       `json:"nonce"`
	InitCode                      hexutil.Bytes  `json:"initCode"`
	CallData                      hexutil.Bytes  `json:"callData"`
	VerificationGasLimit          *big.Int       `json:"verificationGasLimit"`
	CallGasLimit                  *big.Int       `json:"callGasLimit"`
	PreVerificationGas            *big.Int       `json:"preVerificationGas"`
	MaxPriorityFeePerGas          *big.Int       `json:"maxPriorityFeePerGas"`
	MaxFeePerGas                  *big.Int       `json:"maxFeePerGas"`
	Signature                     hexutil.Bytes  `json:"signature"`
	Paymaster                     common.Address `json:"paymaster"`
	PaymasterVerificationGasLimit *big.Int       `json:"paymasterVerificationGasLimit"`
	PaymasterPostOpGasLimit       *big.Int       `json:"paymasterPostOpGasLimit"`
	PaymasterData                 hexutil.Bytes  `json:"paymasterData"`
}

type Store

type Store struct {
	*store.Store

	UserOp *UserOpStore
	Config *ConfigStore
}

func NewStore

func NewStore(db *gorm.DB) *Store

type UserOp

type UserOp struct {
	Model

	Hash    string `gorm:"size:66;not null;unique"`
	Sender  string `gorm:"size:42;not null;index:idx_sender_time"`
	Nonce   string `gorm:"size:66;not null"`
	Success bool   `gorm:"not null"`

	ActualGasCost decimal.Decimal `gorm:"type:decimal(32,0);not null"`
	ActualGasUsed uint64          `gorm:"not null"`
	BlockTime     time.Time       `gorm:"not null;index:idx_sender_time;index:idx_block_time"`

	RawUserOp string `gorm:"type:text;not null"` // Empty when raw input is unavailable for an indirect EntryPoint call.
}

type UserOpStore

type UserOpStore struct {
	// contains filtered or unexported fields
}

func NewUserOpStore

func NewUserOpStore(store *store.Store) *UserOpStore

func (*UserOpStore) Create

func (store *UserOpStore) Create(userOp *contract.PackedUserOperation, event *account.EntryPointUserOperationEvent, blockTime time.Time, tx ...*gorm.DB) error

Create records the finalized event even if the raw UserOperation is unavailable.

func (*UserOpStore) GetCountByBlockTimestamp

func (store *UserOpStore) GetCountByBlockTimestamp(sender common.Address, since time.Time) (int64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL