controllers

package
v0.0.0-...-5abcb53 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SAT_PER_BTC = 1e8
)

Variables

This section is empty.

Functions

func AddInvoice

func AddInvoice(c echo.Context, svc *service.LndhubService, userID int64) error

func Max

func Max(x, y int) int

Max returns the larger of x or y.

Types

type AddInvoiceController

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

AddInvoiceController : Add invoice controller struct

func NewAddInvoiceController

func NewAddInvoiceController(svc *service.LndhubService) *AddInvoiceController

func (*AddInvoiceController) AddInvoice

func (controller *AddInvoiceController) AddInvoice(c echo.Context) error

type AddInvoiceRequestBody

type AddInvoiceRequestBody struct {
	Amount          interface{} `json:"amt"` // amount in Satoshi
	Memo            string      `json:"memo"`
	DescriptionHash string      `json:"description_hash" validate:"omitempty,hexadecimal,len=64"`
}

type AddInvoiceResponseBody

type AddInvoiceResponseBody struct {
	RHash          string `json:"r_hash"`
	PaymentRequest string `json:"payment_request"`
	PayReq         string `json:"pay_req"`
}

type AuthController

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

AuthController : AuthController struct

func NewAuthController

func NewAuthController(svc *service.LndhubService) *AuthController

func (*AuthController) Auth

func (controller *AuthController) Auth(c echo.Context) error

Auth godoc @Summary Authenticate @Description Exchanges a login + password for a token @Accept json @Produce json @Tags Account @Param AuthRequestBody body AuthRequestBody false "Login and password" @Success 200 {object} AuthResponseBody @Failure 400 {object} responses.ErrorResponse @Failure 500 {object} responses.ErrorResponse @Router /auth [post]

type AuthRequestBody

type AuthRequestBody struct {
	Login        string `json:"login"`
	Password     string `json:"password"`
	RefreshToken string `json:"refresh_token"`
}

type AuthResponseBody

type AuthResponseBody struct {
	RefreshToken string `json:"refresh_token"`
	AccessToken  string `json:"access_token"`
}

type BalanceController

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

BalanceController : BalanceController struct

func NewBalanceController

func NewBalanceController(svc *service.LndhubService) *BalanceController

func (*BalanceController) Balance

func (controller *BalanceController) Balance(c echo.Context) error

type BalanceResponse

type BalanceResponse struct {
	BTC struct {
		AvailableBalance int64
	}
}

type BlankController

type BlankController struct{}

BlankController : BlankController struct

func NewBlankController

func NewBlankController(svc *service.LndhubService) *BlankController

func (*BlankController) GetBtc

func (controller *BlankController) GetBtc(c echo.Context) error

We do NOT currently support onchain transactions thus we only return an empty array for backwards compatibility

func (*BlankController) GetPending

func (controller *BlankController) GetPending(c echo.Context) error

func (*BlankController) Home

func (controller *BlankController) Home(c echo.Context) error

type Chain

type Chain struct {
	// The blockchain the node is on (eg bitcoin, litecoin)
	Chain string `protobuf:"bytes,1,opt,name=chain,proto3" json:"chain,omitempty"`
	// The network the node is on (eg regtest, testnet, mainnet)
	Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"`
}

type Channel

type Channel struct {
	Name         string
	RemotePubkey string
	CapacityBTC  float64
	Local        int
	Total        int
	Size         int
	Active       bool
}

type CheckPaymentController

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

CheckPaymentController : CheckPaymentController struct

func NewCheckPaymentController

func NewCheckPaymentController(svc *service.LndhubService) *CheckPaymentController

func (*CheckPaymentController) CheckPayment

func (controller *CheckPaymentController) CheckPayment(c echo.Context) error

type CheckPaymentResponseBody

type CheckPaymentResponseBody struct {
	IsPaid bool `json:"paid"`
}

type CreateUserController

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

CreateUserController : Create user controller struct

func NewCreateUserController

func NewCreateUserController(svc *service.LndhubService) *CreateUserController

func (*CreateUserController) CreateUser

func (controller *CreateUserController) CreateUser(c echo.Context) error

type CreateUserRequestBody

type CreateUserRequestBody struct {
	Login       string `json:"login"`
	Password    string `json:"password"`
	PartnerID   string `json:"partnerid"`
	AccountType string `json:"accounttype"`
}

type CreateUserResponseBody

type CreateUserResponseBody struct {
	Login    string `json:"login"`
	Password string `json:"password"`
}

type Feature

type Feature struct {
	Name       string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	IsRequired bool   `protobuf:"varint,3,opt,name=is_required,json=isRequired,proto3" json:"is_required,omitempty"`
	IsKnown    bool   `protobuf:"varint,4,opt,name=is_known,json=isKnown,proto3" json:"is_known,omitempty"`
}

type GetInfoController

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

GetInfoController : GetInfoController struct

func NewGetInfoController

func NewGetInfoController(svc *service.LndhubService) *GetInfoController

func (*GetInfoController) GetInfo

func (controller *GetInfoController) GetInfo(c echo.Context) error

type GetInfoResponse

type GetInfoResponse struct {
	// The version of the LND software that the node is running.
	Version string `protobuf:"bytes,14,opt,name=version,proto3" json:"version,omitempty"`
	// The SHA1 commit hash that the daemon is compiled with.
	CommitHash string `protobuf:"bytes,20,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"`
	// The identity pubkey of the current node.
	IdentityPubkey string `protobuf:"bytes,1,opt,name=identity_pubkey,json=identityPubkey,proto3" json:"identity_pubkey,omitempty"`
	// If applicable, the alias of the current node, e.g. "bob"
	Alias string `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"`
	// The color of the current node in hex code format
	Color string `protobuf:"bytes,17,opt,name=color,proto3" json:"color,omitempty"`
	// Number of pending channels
	NumPendingChannels uint32 `protobuf:"varint,3,opt,name=num_pending_channels,json=numPendingChannels,proto3" json:"num_pending_channels,omitempty"`
	// Number of active channels
	NumActiveChannels uint32 `protobuf:"varint,4,opt,name=num_active_channels,json=numActiveChannels,proto3" json:"num_active_channels,omitempty"`
	// Number of inactive channels
	NumInactiveChannels uint32 `protobuf:"varint,15,opt,name=num_inactive_channels,json=numInactiveChannels,proto3" json:"num_inactive_channels,omitempty"`
	// Number of peers
	NumPeers uint32 `protobuf:"varint,5,opt,name=num_peers,json=numPeers,proto3" json:"num_peers,omitempty"`
	// The node's current view of the height of the best block
	BlockHeight uint32 `protobuf:"varint,6,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
	// The node's current view of the hash of the best block
	BlockHash string `protobuf:"bytes,8,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
	// Timestamp of the block best known to the wallet
	BestHeaderTimestamp int64 `protobuf:"varint,13,opt,name=best_header_timestamp,json=bestHeaderTimestamp,proto3" json:"best_header_timestamp,omitempty"`
	// Whether the wallet's view is synced to the main chain
	SyncedToChain bool `protobuf:"varint,9,opt,name=synced_to_chain,json=syncedToChain,proto3" json:"synced_to_chain,omitempty"`
	// Whether we consider ourselves synced with the public channel graph.
	SyncedToGraph bool `protobuf:"varint,18,opt,name=synced_to_graph,json=syncedToGraph,proto3" json:"synced_to_graph,omitempty"`
	//
	//Whether the current node is connected to testnet. This field is
	//deprecated and the network field should be used instead
	//
	// Deprecated: Do not use.
	Testnet bool `protobuf:"varint,10,opt,name=testnet,proto3" json:"testnet,omitempty"`
	// A list of active chains the node is connected to
	Chains []*Chain `protobuf:"bytes,16,rep,name=chains,proto3" json:"chains,omitempty"`
	// The URIs of the current node.
	Uris []string `protobuf:"bytes,12,rep,name=uris,proto3" json:"uris,omitempty"`
	//
	//Features that our node has advertised in our init message, node
	//announcements and invoices.
	Features map[uint32]*Feature `` /* 159-byte string literal not displayed */
}

Copy over struct for swagger purposes

type GetTXSController

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

GetTXSController : GetTXSController struct

func NewGetTXSController

func NewGetTXSController(svc *service.LndhubService) *GetTXSController

func (*GetTXSController) GetTXS

func (controller *GetTXSController) GetTXS(c echo.Context) error

func (*GetTXSController) GetUserInvoices

func (controller *GetTXSController) GetUserInvoices(c echo.Context) error

type HomeController

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

HomeController : HomeController struct

func NewHomeController

func NewHomeController(svc *service.LndhubService, html string) *HomeController

func (*HomeController) Home

func (controller *HomeController) Home(c echo.Context) error

func (*HomeController) QR

func (controller *HomeController) QR(c echo.Context) error

type HomepageContent

type HomepageContent struct {
	NumActiveChannels  int
	NumPendingChannels int
	NumPeers           int
	SyncedToChain      bool
	BlockHeight        int
	Uris               []string
	Channels           []Channel
	Branding           service.BrandingConfig
}

type IncomingInvoice

type IncomingInvoice struct {
	RHash          interface{}       `json:"r_hash,omitempty"`
	PaymentHash    interface{}       `json:"payment_hash"`
	PaymentRequest string            `json:"payment_request"`
	Description    string            `json:"description"`
	PayReq         string            `json:"pay_req"`
	Timestamp      int64             `json:"timestamp"`
	Type           string            `json:"type"`
	ExpireTime     int64             `json:"expire_time"`
	Amount         int64             `json:"amt"`
	IsPaid         bool              `json:"ispaid"`
	Keysend        bool              `json:"keysend"`
	CustomRecords  map[uint64][]byte `json:"custom_records"`
}

type InvoiceController

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

InvoiceController : Add invoice controller struct

func NewInvoiceController

func NewInvoiceController(svc *service.LndhubService) *InvoiceController

func (*InvoiceController) Invoice

func (controller *InvoiceController) Invoice(c echo.Context) error

type KeySendController

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

KeySendController : Key send controller struct

func NewKeySendController

func NewKeySendController(svc *service.LndhubService) *KeySendController

func (*KeySendController) KeySend

func (controller *KeySendController) KeySend(c echo.Context) error

type KeySendRequestBody

type KeySendRequestBody struct {
	Amount        int64             `json:"amount" validate:"required,gt=0"`
	Destination   string            `json:"destination" validate:"required"`
	Memo          string            `json:"memo" validate:"omitempty"`
	CustomRecords map[string]string `json:"customRecords" validate:"omitempty"`
}

type KeySendResponseBody

type KeySendResponseBody struct {
	RHash              *lib.JavaScriptBuffer `json:"payment_hash,omitempty"`
	Amount             int64                 `json:"num_satoshis,omitempty"`
	Description        string                `json:"description,omitempty"`
	Destination        string                `json:"destination,omitempty"`
	DescriptionHashStr string                `json:"description_hash,omitempty"`
	PaymentError       string                `json:"payment_error,omitempty"`
	PaymentPreimage    *lib.JavaScriptBuffer `json:"payment_preimage,omitempty"`
	PaymentRoute       *service.Route        `json:"payment_route,omitempty"`
}

type OutgoingInvoice

type OutgoingInvoice struct {
	RHash           interface{}       `json:"r_hash,omitempty"`
	PaymentHash     interface{}       `json:"payment_hash"`
	PaymentPreimage string            `json:"payment_preimage"`
	Value           int64             `json:"value"`
	Type            string            `json:"type"`
	Fee             int64             `json:"fee"`
	Timestamp       int64             `json:"timestamp"`
	Memo            string            `json:"memo"`
	Keysend         bool              `json:"keysend"`
	CustomRecords   map[uint64][]byte `json:"custom_records"`
}

type PayInvoiceController

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

PayInvoiceController : Pay invoice controller struct

func NewPayInvoiceController

func NewPayInvoiceController(svc *service.LndhubService) *PayInvoiceController

func (*PayInvoiceController) PayInvoice

func (controller *PayInvoiceController) PayInvoice(c echo.Context) error

type PayInvoiceRequestBody

type PayInvoiceRequestBody struct {
	Invoice string      `json:"invoice" validate:"required"`
	Amount  interface{} `json:"amount" validate:"omitempty"`
}

type PayInvoiceResponseBody

type PayInvoiceResponseBody struct {
	RHash              *lib.JavaScriptBuffer `json:"payment_hash,omitempty"`
	PaymentRequest     string                `json:"payment_request,omitempty"`
	PayReq             string                `json:"pay_req,omitempty"`
	Amount             int64                 `json:"num_satoshis,omitempty"`
	Description        string                `json:"description,omitempty"`
	DescriptionHashStr string                `json:"description_hash,omitempty"`
	PaymentError       string                `json:"payment_error"`
	PaymentPreimage    *lib.JavaScriptBuffer `json:"payment_preimage,omitempty"`
	PaymentRoute       *service.Route        `json:"payment_route,omitempty"`
}

Jump to

Keyboard shortcuts

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