entity

package
v0.0.0-...-fd7996a Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGetNetwork      = errors.New("cannot get networks")
	ErrNetworkNotFound = errors.New("network not found")
	ErrAddWallet       = errors.New("cannot add wallet")
	ErrGetBalance      = errors.New("cannot get balance")
	ErrFindWallet      = errors.New("cannot find wallet")
	ErrDeleteWallet    = errors.New("cannot delete wallet")
)

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Wallet
	Symbol  string  `json:"symbol"`
	Balance float64 `json:"balance"`
}

type Network

type Network struct {
	ChainID  string `json:"chainId"`
	Name     string `gorm:"primaryKey" json:"name"`
	URL      string `json:"url"`
	Symbol   string `json:"symbol"`
	Explorer string `json:"explorer"`
}

type NetworkRepository

type NetworkRepository interface {
	GetAll(ctx context.Context, networks *[]Network) error
}

type NetworkUseCase

type NetworkUseCase interface {
	GetAll(ctx context.Context) ([]Network, error)
}

type Pagination

type Pagination struct {
	IDLte    int `json:"idLte" form:"idLte"`
	Page     int `json:"page" form:"page"`
	PageSize int `json:"pageSize" form:"pageSize"`
}

type Wallet

type Wallet struct {
	ID          int            `json:"id"`
	UserID      string         `json:"-"`
	Address     common.Address `json:"address"`
	NetworkName string         `json:"networkName"`
	Token       common.Address `json:"token"`
	Network     Network        `gorm:"foreignKey:NetworkName" json:"network"`
}

type WalletEthAPI

type WalletEthAPI interface {
	GetSymbol(ctx context.Context, wallet Wallet) (string, error)
	GetBalance(ctx context.Context, wallet Wallet) (float64, error)
}

type WalletRepository

type WalletRepository interface {
	AddOne(ctx context.Context, wallet *Wallet) error
	GetOne(ctx context.Context, userID string, id int, wallet *Wallet) error
	GetManyWithPagination(ctx context.Context, userID string, pagination *Pagination, wallets *[]Wallet) error
	DeleteOne(ctx context.Context, userID string, id int) error
}

type WalletUseCase

type WalletUseCase interface {
	AddOne(ctx context.Context, wallet *Wallet) (Balance, error)
	GetOne(ctx context.Context, userID string, id int) (Balance, error)
	GetManyWithPagination(ctx context.Context, userID string, pagination *Pagination) ([]Balance, *Pagination, error)
	DeleteOne(ctx context.Context, userID string, ID int) error
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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