tks

package
v0.0.0-...-8cd81b6 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PAYMENT_GATE_SETTINGS = settings.LoadPaymentGateSettings()
)

Functions

func SetupViews

func SetupViews()

Types

type DisplayTKSWallet

type DisplayTKSWallet struct {
	PublicKey  string  `json:"address"`
	ETHBalance float64 `json:"eth_balance"`
	TKSBalance float64 `json:"tks_balance"`
	Type       string  `json:"type"`

	UpdatedAt *time.Time `json:"updated_at,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
}

type TKSPayment

type TKSPayment struct {
	Address string  `json:"address"`
	Percent float64 `json:"percent"`
	Amount  float64 `json:"amount"`
}

type TKSPaymentResult

type TKSPaymentResult struct {
	Hash       string `json:"hash"`
	RawTx      string `json:"rawTransaction"`
	WalletFrom string `json:"wallet_from"`
	WalletTo   string `json:"wallet_to"`
	Cost       int64  `json:"cost"`
	Amount     int64  `json:"amount"`
}

type TKSWallet

type TKSWallet struct {
	PublicKey  string `json:"address" gorm:"primary_key"`
	PrivateKey string `json:"private_key,omitempty" sql:"type:varchar(1024)"`

	Type string `json:"type"`

	CreatedAt *time.Time `json:"created_at" gorm:"index"`
	UpdatedAt *time.Time `json:"updated_at" gorm:"index"`
	DeletedAt *time.Time `json:"deleted_at" gorm:"index"`
}

func CreateTKSWallet

func CreateTKSWallet(tp string) (TKSWallet, error)

func FindTKSWalletByPublicKey

func FindTKSWalletByPublicKey(publicKey string) (*TKSWallet, error)

func GetAllTKSWallets

func GetAllTKSWallets() ([]TKSWallet, error)

func (TKSWallet) CurrentBalance

func (w TKSWallet) CurrentBalance() (*TKSWalletBalance, error)

func (TKSWallet) Save

func (w TKSWallet) Save() error

func (TKSWallet) SaveToDatabase

func (w TKSWallet) SaveToDatabase() error

func (TKSWallet) Send

func (w TKSWallet) Send(to string, value int64) (TKSPaymentResult, error)

func (TKSWallet) UpdateBalance

func (w TKSWallet) UpdateBalance() (*TKSWalletBalance, error)

func (TKSWallet) Validate

func (w TKSWallet) Validate() error

type TKSWalletBalance

type TKSWalletBalance struct {
	ID         int       `json:"id" gorm:"primary_key"`
	PublicKey  string    `json:"address" gorm:"index"`
	ETHBalance uint64    `json:"eth_balance`
	TKSBalance uint64    `json:"tks_balance`
	TKSWallet  TKSWallet `json:"-" gorm:"ForeignKey:PublicKey;AssociationForeignKey:PublicKey"`

	CreatedAt *time.Time `json:"created_at" gorm:"index"`
	UpdatedAt *time.Time `json:"updated_at" gorm:"index"`
	DeletedAt *time.Time `json:"deleted_at" gorm:"index"`
}

func FindTKSWalletsWithNonZeroBalance

func FindTKSWalletsWithNonZeroBalance() ([]TKSWalletBalance, error)

func (TKSWalletBalance) DisplayTKSWallet

func (w TKSWalletBalance) DisplayTKSWallet() DisplayTKSWallet

func (TKSWalletBalance) Save

func (w TKSWalletBalance) Save() error

type TKSWallets

type TKSWallets []TKSWallet

Jump to

Keyboard shortcuts

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