db

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

func NewConnection

func NewConnection(URI string) (*Connection, error)

func (*Connection) CreateExternalWithdrawals

func (c *Connection) CreateExternalWithdrawals(
	ctx context.Context,
	tasks []core.ExternalWithdrawalTask,
	extMsgUuid uuid.UUID,
	expiredAt time.Time,
) error

func (*Connection) GetExternalWithdrawalStatus

func (c *Connection) GetExternalWithdrawalStatus(ctx context.Context, id int64) (core.WithdrawalStatus, error)

func (*Connection) GetExternalWithdrawalTasks

func (c *Connection) GetExternalWithdrawalTasks(ctx context.Context, limit int) ([]core.ExternalWithdrawalTask, error)

func (*Connection) GetIncome

func (c *Connection) GetIncome(
	ctx context.Context,
	userID string,
	isDepositSide bool,
) (
	[]core.TotalIncome,
	error,
)

GetIncome returns list of incomes by user_id

func (*Connection) GetIncomeHistory

func (c *Connection) GetIncomeHistory(
	ctx context.Context,
	userID string,
	currency string,
	limit int,
	offset int,
) (
	[]core.ExternalIncome,
	error,
)

GetIncomeHistory returns list of external incomes for deposit side by user_id and currency

func (*Connection) GetJettonInternalWithdrawalTasks

func (c *Connection) GetJettonInternalWithdrawalTasks(
	ctx context.Context,
	forbiddenAddresses []core.Address,
	limit int,
) (
	[]core.InternalWithdrawalTask, error,
)

func (*Connection) GetJettonOwnersAddresses

func (c *Connection) GetJettonOwnersAddresses(
	ctx context.Context,
	userID string,
	types []core.WalletType,
) (
	[]core.OwnerWallet,
	error,
)

func (*Connection) GetJettonWallet

func (c *Connection) GetJettonWallet(ctx context.Context, address core.Address) (*core.WalletData, bool, error)

func (*Connection) GetLastSavedBlockID

func (c *Connection) GetLastSavedBlockID(ctx context.Context) (*ton.BlockIDExt, error)

func (*Connection) GetLastSubwalletID

func (c *Connection) GetLastSubwalletID(ctx context.Context) (uint32, error)

GetLastSubwalletID returns last (greatest) used subwallet_id from DB numeration starts from wallet.DefaultSubwallet (this number reserved for main hot wallet) returns wallet.DefaultSubwallet if table is empty

func (*Connection) GetOwner

func (c *Connection) GetOwner(address core.Address) *core.Address

GetOwner returns owner for jetton deposit from address book and nil for other types

func (*Connection) GetServiceDepositWithdrawalTasks

func (c *Connection) GetServiceDepositWithdrawalTasks(ctx context.Context, limit int) ([]core.ServiceWithdrawalTask, error)

GetServiceDepositWithdrawalTasks return tasks for TON deposit wallets

func (*Connection) GetServiceHotWithdrawalTasks

func (c *Connection) GetServiceHotWithdrawalTasks(ctx context.Context, limit int) ([]core.ServiceWithdrawalTask, error)

GetServiceHotWithdrawalTasks return tasks for Hot wallet withdrawals

func (*Connection) GetTonHotWalletAddress

func (c *Connection) GetTonHotWalletAddress(ctx context.Context) (core.Address, error)

func (*Connection) GetTonInternalWithdrawalTasks

func (c *Connection) GetTonInternalWithdrawalTasks(ctx context.Context, limit int) ([]core.InternalWithdrawalTask, error)

func (*Connection) GetTonWalletsAddresses

func (c *Connection) GetTonWalletsAddresses(
	ctx context.Context,
	userID string,
	types []core.WalletType,
) (
	[]core.Address,
	error,
)

func (*Connection) GetUserID added in v0.4.0

func (c *Connection) GetUserID(address core.Address) (string, bool)

func (*Connection) GetWalletType

func (c *Connection) GetWalletType(address core.Address) (core.WalletType, bool)

func (*Connection) GetWalletTypeByTonutilsAddress

func (c *Connection) GetWalletTypeByTonutilsAddress(address *address.Address) (core.WalletType, bool)

func (*Connection) IsActualBlockData

func (c *Connection) IsActualBlockData(ctx context.Context) (bool, error)

func (*Connection) IsInProgressInternalWithdrawalRequest

func (c *Connection) IsInProgressInternalWithdrawalRequest(
	ctx context.Context,
	dest core.Address,
	currency string,
) (
	bool,
	error,
)

func (*Connection) IsWithdrawalRequestUnique

func (c *Connection) IsWithdrawalRequestUnique(ctx context.Context, w core.WithdrawalRequest) (bool, error)

func (*Connection) LoadAddressBook

func (c *Connection) LoadAddressBook(ctx context.Context) error

func (*Connection) SaveInternalWithdrawalTask

func (c *Connection) SaveInternalWithdrawalTask(
	ctx context.Context,
	task core.InternalWithdrawalTask,
	expiredAt time.Time,
	memo uuid.UUID,
) error

func (*Connection) SaveJettonWallet

func (c *Connection) SaveJettonWallet(
	ctx context.Context,
	ownerAddress core.Address,
	walletData core.WalletData,
	notSaveOwner bool,
) error

func (*Connection) SaveParsedBlockData

func (c *Connection) SaveParsedBlockData(ctx context.Context, events core.BlockEvents) error

func (*Connection) SaveServiceWithdrawalRequest

func (c *Connection) SaveServiceWithdrawalRequest(ctx context.Context, w core.ServiceWithdrawalRequest) (
	uuid.UUID,
	error,
)

func (*Connection) SaveTonWallet

func (c *Connection) SaveTonWallet(ctx context.Context, walletData core.WalletData) error

func (*Connection) SaveWithdrawalRequest

func (c *Connection) SaveWithdrawalRequest(ctx context.Context, w core.WithdrawalRequest) (int64, error)

func (*Connection) SetExpired

func (c *Connection) SetExpired(ctx context.Context) error

SetExpired TODO: maybe add block related expiration

func (*Connection) UpdateServiceWithdrawalRequest

func (c *Connection) UpdateServiceWithdrawalRequest(
	ctx context.Context,
	t core.ServiceWithdrawalTask,
	tonAmount core.Coins,
	expiredAt time.Time,
	filled bool,
) error

Jump to

Keyboard shortcuts

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