wallet

package
v0.0.0-...-716e23e Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2019 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DOCKER_EXITED  containerStatus = "exited"
	DOCKER_RUNNING containerStatus = "running"
)

Variables

View Source
var (
	ErrWalletNotFound   = errors.New("wallet not found")
	ErrWalletNotRunning = errors.New("wallet not running")

	ErrWalletAlreadyRunning = errors.New("wallet already running")

	ErrCouldNotStopWallet  = errors.New("wallet could not be stopped")
	ErrCouldNotStartWallet = errors.New("wallet could not be started")
	ErrCouldNotSaveWallet  = errors.New("wallet could not be saved")
	ErrCouldNotKillWallet  = errors.New("wallet could not be killed")
)

Functions

func InitStore

func InitStore(db *mgo.Database)

Types

type Balance

type Balance struct {
	Total  uint64 `json:"total"`
	Locked uint64 `json:"locked"`
}

type BlockHeight

type BlockHeight struct {
	Current uint32 `json:"current"`
	Top     uint32 `json:"top"`
}

type Controller

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

func NewController

func NewController(apiRouter *gin.RouterGroup) Controller

func (*Controller) Routes

func (controller *Controller) Routes()

Routes registers this controllers sub-routing in the main apiRouter. It returns a RouterGroup containing only the routes for the operations on the Wallet model.

type CreateDTO

type CreateDTO struct {
	PasswordDTO
	Name string `json:"name" binding:"required,max=255"`
}

type DetailedWallet

type DetailedWallet struct {
	*LoadedWallet
	Balance     Balance     `json:"balance"`
	BlockHeight BlockHeight `json:"blockHeight"`
	PeerCount   uint8       `json:"peerCount"`
}

type ImportDTO

type ImportDTO struct {
	CreateDTO
	ViewSecretKey  string `json:"viewSecretKey"`
	SpendSecretKey string `json:"spendSecretKey"`
}

type InstanceStatus

type InstanceStatus string
const (
	STOPPED InstanceStatus = "STOPPED"
	RUNNING InstanceStatus = "RUNNING"
	ERROR   InstanceStatus = "ERROR"
)

type LoadedWallet

type LoadedWallet struct {
	*Wallet
}

type PasswordDTO

type PasswordDTO struct {
	Password string `json:"password" binding:"required,min=8"`
}

type Service

type Service interface {
	CreateWallet(dto CreateDTO, userId string) (*DetailedWallet, error)
	ImportWallet(dto ImportDTO, userId string) (*DetailedWallet, error)

	GetWallets(userId string) ([]*Wallet, error)
	GetWallet(walletId string, userId string) (*DetailedWallet, error)

	StartWallet(walletId string, password string, userId string) (*DetailedWallet, error)
	StopWallet(walletId string, userId string) (*Wallet, error)

	FetchDetails(wallet *LoadedWallet, rpc iridium.WalletdRPC) (*DetailedWallet, error)
	NewWalletdClient(walletId string) (iridium.WalletdRPC, error)
}

func InitService

func InitService(dockerClient *client.Client) Service

type StatusEvent

type StatusEvent struct {
	WalletID string
	Status   InstanceStatus
}

type StatusWatcher

type StatusWatcher interface {
	Run() chan *DetailedWallet
	Close()
	AddWallet(wallet *LoadedWallet)
	RemoveWallet(wallet *Wallet)
}

func InitWatcher

func InitWatcher(dockerClient *client.Client, eventService event.Service) StatusWatcher

type Store

type Store interface {
	InsertWallet(wallet *Wallet) error
	FindWalletsByOwner(userId bson.ObjectId) ([]*Wallet, error)
	FindWalletByOwner(walletId bson.ObjectId, userId bson.ObjectId) (*Wallet, error)
}

type Wallet

type Wallet struct {
	Id      bson.ObjectId  `json:"id" bson:"_id,omitempty"`
	Name    string         `json:"name" bson:"name"`
	Address string         `json:"address" bson:"address"`
	Owner   bson.ObjectId  `json:"owner" bson:"owner"`
	Status  InstanceStatus `json:"status" bson:"-"`
}

Jump to

Keyboard shortcuts

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