store

package
v0.7.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	DSN                  string
	MigrationsFolderPath string
	QueriesFolderPath    string
}

type Otx

type Otx struct {
	TrackingId    string
	Type          enum.OtxType
	RawTx         string
	TxHash        string
	From          string
	Data          string
	GasLimit      uint64
	TransferValue uint64
	GasPrice      *big.Int
	Nonce         uint64
}

type PgStore

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

func (*PgStore) ActivateAccount

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

func (*PgStore) CreateDispatchStatus

func (s *PgStore) CreateDispatchStatus(
	ctx context.Context,
	otxId uint,
	otxStatus enum.OtxStatus,
) error

func (*PgStore) CreateOtx

func (s *PgStore) CreateOtx(
	ctx context.Context,
	otx Otx,
) (uint, error)

func (*PgStore) GasLock

func (s *PgStore) GasLock(
	ctx context.Context,
	publicAddress string,
) error

func (*PgStore) GasUnlock

func (s *PgStore) GasUnlock(
	ctx context.Context,
	publicAddress string,
) error

func (*PgStore) GetAccountStatus

func (s *PgStore) GetAccountStatus(
	ctx context.Context,
	publicAddress string,
) (bool, bool, error)

func (*PgStore) GetNextNonce

func (s *PgStore) GetNextNonce(
	ctx context.Context,
	publicAddress string,
) (uint64, error)

func (*PgStore) GetTxStatus

func (s *PgStore) GetTxStatus(
	ctx context.Context,
	trackingId string,
) (TxStatus, error)

func (*PgStore) LoadPrivateKey

func (s *PgStore) LoadPrivateKey(
	ctx context.Context,
	publicKey string,
) (*ecdsa.PrivateKey, error)

func (*PgStore) UpdateDispatchStatus

func (s *PgStore) UpdateDispatchStatus(
	ctx context.Context,
	txSuccess bool,
	txHash string,
	txBlock uint64,
) error

func (*PgStore) WriteKeyPair

func (s *PgStore) WriteKeyPair(
	ctx context.Context,
	keypair keypair.Key,
) (uint, error)

type Store

type Store interface {
	// Keypair related actions.
	LoadPrivateKey(context.Context, string) (*ecdsa.PrivateKey, error)
	WriteKeyPair(context.Context, keypair.Key) (uint, error)
	// Otx related actions.
	CreateOtx(context.Context, Otx) (uint, error)
	GetNextNonce(context.Context, string) (uint64, error)
	GetTxStatus(context.Context, string) (TxStatus, error)
	CreateDispatchStatus(context.Context, uint, enum.OtxStatus) error
	UpdateDispatchStatus(context.Context, bool, string, uint64) error
	// Account related actions.
	ActivateAccount(context.Context, string) error
	GetAccountStatus(context.Context, string) (bool, bool, error)
	// Gas quota related actions.
	GasLock(context.Context, string) error
	GasUnlock(context.Context, string) error
}

func NewPgStore

func NewPgStore(o Opts) (Store, error)

type TxStatus

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

Jump to

Keyboard shortcuts

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