model

package
v0.0.0-...-37ca617 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionMngdAccounts                 = "managed_accounts"
	KindEOA                mngdAccountKind = "eoa"
	KindContract           mngdAccountKind = "contract"

	RoleSupervisor mngdAccountRole = "supervisor" // main-ca-owner
	RoleManager    mngdAccountRole = "manager"    // exec createAccount, faucet
	RoleOperator   mngdAccountRole = "operator"   // exec userOp
)
View Source
const (
	CollectionTxLogs          = "tx_logs"
	TxStatusPending  txStatus = 0
	TxStatusSuccess  txStatus = 1
	TxStatusFailure  txStatus = 2
)
View Source
const CollectionEmitLogs = "emitted_logs"
View Source
const (
	CollectionParameters = "parameters"
)
View Source
const CollectionUserAccounts = "user_accounts"

Variables

View Source
var (
	ErrEmptyDocumentId   = errors.New("empty document id")
	ErrEmptyDocumentBody = errors.New("empty document body")
	ErrInvalidDocumentId = errors.New("invalid document id")
	ErrInsufficientField = errors.New("insufficient required field")
)

errors used by Document implements

Functions

This section is empty.

Types

type CreateAccount

type CreateAccount struct {
	UserId string         `json:"userId"`
	Owner  common.Address `json:"owner"`
}

func (CreateAccount) Hint

func (m CreateAccount) Hint() *string

func (CreateAccount) KeyValue

func (m CreateAccount) KeyValue() (key sarama.Encoder, value sarama.Encoder, err error)

func (*CreateAccount) Parse

func (m *CreateAccount) Parse(msg *sarama.ConsumerMessage) error

func (CreateAccount) RawData

func (m CreateAccount) RawData() (hint *string, data map[string]interface{})

func (CreateAccount) Topic

func (m CreateAccount) Topic() kafka.Topic

type Document

type Document interface {
	ID() string
	Collection() string
}

todo: PreInsert -> bson/marshaler & unmarshaler

type EmittedLog

type EmittedLog struct {
	Id               string `bson:"_id" json:"_id"`
	BlockNumber      uint64 `bson:"-" json:"blockNumber,omitempty"`
	TransactionIndex uint   `bson:"-" json:"transactionIndex,omitempty"`
	LogIndex         uint   `bson:"-" json:"logIndex,omitempty"`

	Removed         bool           `bson:"removed" json:"removed"`
	TransactionHash string         `bson:"transactionHash" json:"transactionHash"`
	Address         common.Address `bson:"address" json:"address"`
	Topics          []common.Hash  `bson:"-" json:"topics"`
	Data            []byte         `bson:"-" json:"data"`

	EventName   string                 `bson:"eventName" json:"eventName"`
	Parameters  map[string]interface{} `bson:"parameters,omitempty" json:"parameters,omitempty"`
	ErrorName   *string                `bson:"errorName,omitempty" json:"errorName,omitempty"`
	Errors      map[string]interface{} `bson:"errors,omitempty" json:"errors,omitempty"`
	Additionals map[string]interface{} `bson:"additionals,omitempty" json:"additionals,omitempty"`
}

func (EmittedLog) Collection

func (d EmittedLog) Collection() string

func (*EmittedLog) ID

func (d *EmittedLog) ID() string

func (EmittedLog) MarshalBSON

func (d EmittedLog) MarshalBSON() ([]byte, error)

func (*EmittedLog) ParseByAbi

func (d *EmittedLog) ParseByAbi(eventMap map[string]abi.Event, errorMap map[string]abi.Error) error

func (*EmittedLog) UnmarshalBSON

func (l *EmittedLog) UnmarshalBSON(data []byte) error

func (*EmittedLog) UnmarshalJSON

func (d *EmittedLog) UnmarshalJSON(input []byte) error

type Faucet

type Faucet struct {
	Receiver common.Address `json:"receiver"`
	Value    *big.Int       `json:"value"`
}

func (Faucet) Hint

func (m Faucet) Hint() *string

func (Faucet) KeyValue

func (m Faucet) KeyValue() (key sarama.Encoder, value sarama.Encoder, err error)

func (*Faucet) Parse

func (m *Faucet) Parse(msg *sarama.ConsumerMessage) error

func (Faucet) RawData

func (m Faucet) RawData() (hint *string, data map[string]interface{})

func (Faucet) Topic

func (m Faucet) Topic() kafka.Topic

type ManagedAccount

type ManagedAccount struct {
	Id             string            `bson:"_id" json:"_id"`
	Kind           mngdAccountKind   `bson:"kind" json:"kind"`
	Role           *mngdAccountRole  `bson:"role,omitempty" json:"role,omitempty"`
	Address        common.Address    `bson:"address" json:"address"`
	PrivateKey     *ecdsa.PrivateKey `bson:"privateKey,omitempty" json:"privateKey,omitempty"`
	DeployedTxHash *string           `bson:"deployedTxn,omitempty" json:"deployedTxn,omitempty"`
	Deployer       *common.Address   `bson:"deployer,omitempty" json:"deployer,omitempty"`
	Occupied       bool              `bson:"occupied" json:"occupied"`
	OccupiedAt     int64             `bson:"occupiedAt" json:"occupiedAt"`
}

func (ManagedAccount) Collection

func (d ManagedAccount) Collection() string

func (ManagedAccount) ID

func (d ManagedAccount) ID() string

func (ManagedAccount) MarshalBSON

func (d ManagedAccount) MarshalBSON() ([]byte, error)

func (*ManagedAccount) UnmarshalBSON

func (d *ManagedAccount) UnmarshalBSON(data []byte) error

type Message

type Message interface {
	Topic() kafka.Topic
	KeyValue() (key sarama.Encoder, value sarama.Encoder, err error)
	Parse(msg *sarama.ConsumerMessage) error
}

type MngdWallet

type MngdWallet struct {
	Supervisor ManagedAccount
	Manager    ManagedAccount
	Operators  []ManagedAccount
}

type PackedUserOperation

type PackedUserOperation struct {
	Sender             common.Address `json:"sender"`
	Nonce              *big.Int       `json:"nonce"`
	InitCode           []byte         `json:"initCode,omitempty"`
	CallData           []byte         `json:"callData"`
	AccountGasLimits   [32]byte       `json:"accountGasLimits"`
	PreVerificationGas *big.Int       `json:"preVerificationGas"`
	GasFees            [32]byte       `json:"gasFees"`
	PaymasterAndData   []byte         `json:"paymasterAndData,omitempty"`
	Signature          []byte         `json:"signature"`
}

func (PackedUserOperation) Hint

func (m PackedUserOperation) Hint() *string

func (PackedUserOperation) KeyValue

func (m PackedUserOperation) KeyValue() (key sarama.Encoder, value sarama.Encoder, err error)

func (PackedUserOperation) MarshalJSON

func (o PackedUserOperation) MarshalJSON() ([]byte, error)

func (*PackedUserOperation) Parse

func (PackedUserOperation) RawData

func (m PackedUserOperation) RawData() (hint *string, data map[string]interface{})

func (PackedUserOperation) Topic

func (m PackedUserOperation) Topic() kafka.Topic

func (*PackedUserOperation) UnmarshalJSON

func (o *PackedUserOperation) UnmarshalJSON(input []byte) error

type Parameter

type Parameter struct {
	Id        string      `bson:"_id" json:"_id"`
	Kind      string      `bson:"kind" json:"-"`
	Seq       *uint64     `bson:"seq,omitempty" json:"seq,omitempty"`
	Value     string      `bson:"value" json:"-"`
	Parameter interface{} `bson:"-" json:"value"`
}

func (Parameter) Collection

func (p Parameter) Collection() string

func (Parameter) ID

func (d Parameter) ID() string

func (*Parameter) IncSeq

func (p *Parameter) IncSeq(inc uint64) *Parameter

func (Parameter) MarshalBSON

func (d Parameter) MarshalBSON() ([]byte, error)

func (*Parameter) UnmarshalBSON

func (d *Parameter) UnmarshalBSON(data []byte) error

func (*Parameter) V

func (p *Parameter) V(v interface{}) error

type RawDataHelper

type RawDataHelper interface {
	Hint() *string
	RawData() (hint *string, data map[string]interface{}) // hint can nil
}

type TxLog

type TxLog struct {
	Id                string         `bson:"_id" json:"transactionHash"` // transaction hash
	Status            txStatus       `bson:"status" json:"status"`
	From              common.Address `bson:"from" json:"from"`
	To                common.Address `bson:"to" json:"to"`
	BlockNumber       uint64         `bson:"blockNumber" json:"blockNumber"`
	GasUsed           uint64         `bson:"gasUsed" json:"gasUsed"`
	EffectiveGasPrice string         `bson:"effectiveGasPrice" json:"effectiveGasPrice"`

	Hint         *string                `bson:"hint,omitempty" json:"hint,omitempty"`
	RawData      map[string]interface{} `bson:"rawData,omitempty" json:"rawData,omitempty"`
	FailedReason *string                `bson:"failedReason,omitempty" json:"failedReason,omitempty"`
}

func (TxLog) Collection

func (d TxLog) Collection() string

func (TxLog) ID

func (d TxLog) ID() string

func (TxLog) MarshalBSON

func (d TxLog) MarshalBSON() ([]byte, error)

func (*TxLog) UnmarshalBSON

func (d *TxLog) UnmarshalBSON(data []byte) error

type UserAccount

type UserAccount struct {
	UserId            string          `bson:"_id" json:"userId"`
	Password          string          `bson:"password" json:"password"`
	Owner             *common.Address `bson:"owner,omitempty" json:"owner,omitempty"`
	Account           *common.Address `bson:"account,omitempty" json:"account,omitempty"`
	CreatedAt         int64           `bson:"createdAt" json:"createdAt"`
	LastFaucet        int64           `bson:"lastFaucet" json:"lastFaucet"`
	LastUsedNonce     uint64          `bson:"lastUsedNonce" json:"lastUsedNonce"`
	LastTxnHash       string          `bson:"lastTxnHash" json:"lastTxnHash"`
	Pending           bool            `bson:"pending" json:"pending"`
	SyncedBlockNumber uint64          `bson:"syncedBlockNumber" json:"syncedBlockNumber"`
}

func (UserAccount) Collection

func (d UserAccount) Collection() string

func (UserAccount) ID

func (d UserAccount) ID() string

func (UserAccount) MarshalBSON

func (d UserAccount) MarshalBSON() ([]byte, error)

func (*UserAccount) UnmarshalBSON

func (d *UserAccount) UnmarshalBSON(data []byte) error

Jump to

Keyboard shortcuts

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