store

package
v0.3.2-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DispatchStatus

type DispatchStatus struct {
	OtxId  uint
	Status enum.OtxStatus
}

type MinimalTxInfo

type MinimalTxInfo struct {
	Block           uint64 `json:"block"`
	From            string `json:"from"`
	To              string `json:"to"`
	ContractAddress string `json:"contractAddress"`
	Success         bool   `json:"success"`
	TxHash          string `json:"transactionHash"`
	TxIndex         uint   `json:"transactionIndex"`
	Value           uint64 `json:"value"`
}

type OTX

type OTX struct {
	TrackingId    string
	Type          enum.OtxType
	RawTx         string
	TxHash        string
	From          string
	Data          string
	GasLimit      uint64
	TransferValue uint64
	GasPrice      uint64
	Nonce         uint64
}

type Opts

type Opts struct {
	PostgresPool *pgxpool.Pool
	Queries      *queries.Queries
}

type PostgresStore

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

func (*PostgresStore) ActivateAccount

func (s *PostgresStore) ActivateAccount(ctx context.Context, publicAddress string) error

func (*PostgresStore) CreateDispatchStatus

func (s *PostgresStore) CreateDispatchStatus(ctx context.Context, dispatch DispatchStatus) error

func (*PostgresStore) CreateOtx

func (s *PostgresStore) CreateOtx(ctx context.Context, otx OTX) (uint, error)

func (*PostgresStore) DecrGasQuota

func (s *PostgresStore) DecrGasQuota(ctx context.Context, publicAddress string) error

func (*PostgresStore) GetAccountActivationQuorum

func (s *PostgresStore) GetAccountActivationQuorum(ctx context.Context, trackingId string) (int, error)

func (*PostgresStore) GetAccountStatusByAddress

func (s *PostgresStore) GetAccountStatusByAddress(ctx context.Context, publicAddress string) (bool, int, error)

func (*PostgresStore) GetTxStatusByTrackingId

func (s *PostgresStore) GetTxStatusByTrackingId(ctx context.Context, trackingId string) ([]*TxStatus, error)

func (*PostgresStore) ResetGasQuota

func (s *PostgresStore) ResetGasQuota(ctx context.Context, publicAddress string) error

func (*PostgresStore) UpdateOtxStatusFromChainEvent

func (s *PostgresStore) UpdateOtxStatusFromChainEvent(ctx context.Context, chainEvent MinimalTxInfo) error

type Store

type Store interface {
	CreateOtx(ctx context.Context, otx OTX) (id uint, err error)
	CreateDispatchStatus(ctx context.Context, dispatch DispatchStatus) error
	GetTxStatusByTrackingId(ctx context.Context, trackingId string) ([]*TxStatus, error)
	UpdateOtxStatusFromChainEvent(ctx context.Context, chainEvent MinimalTxInfo) error
	GetAccountStatusByAddress(ctx context.Context, publicAddress string) (bool, int, error)
	GetAccountActivationQuorum(ctx context.Context, trackingId string) (int, error)
	DecrGasQuota(ctx context.Context, publicAddress string) error
	ResetGasQuota(ctx context.Context, publicAddress string) error
	ActivateAccount(ctx context.Context, publicAddress string) error
}

func NewPostgresStore

func NewPostgresStore(o Opts) Store

type TxStatus

type TxStatus struct {
	Type          string    `db:"type" json:"txType"`
	TxHash        string    `db:"tx_hash" json:"txHash"`
	TransferValue uint64    `db:"transfer_value" json:"transferValue"`
	CreatedAt     time.Time `db:"created_at" json:"createdAt"`
	Status        string    `db:"status" json:"status"`
}

Jump to

Keyboard shortcuts

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