flnwallet

package
v0.1.5-beta Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlndEndpoint = "localhost:10005"
)

Variables

View Source
var (
	ErrWalletNotFound      = errors.New("wallet not found")
	ErrWalletAlreadyExists = errors.New("wallet already exists")
	ErrWalletMustBeLocked  = errors.New("wallet must be locked to change password")
)
View Source
var (
	ErrDaemonNotRunning = errors.New("daemon is not running")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, conn *grpc.ClientConn, config *flnd.Config) *Client

func (*Client) Balance

func (c *Client) Balance() (*lnrpc.WalletBalanceResponse, error)

func (*Client) ChangePassphrase

func (c *Client) ChangePassphrase(old, new string) error

func (*Client) Create

func (c *Client) Create(passphrase string) (string, []string, error)

func (*Client) FetchTransactions

func (c *Client) FetchTransactions() ([]*lnrpc.Transaction, error)

func (*Client) FinalizePsbt

func (c *Client) FinalizePsbt(packet *psbt.Packet) (*chainutil.Tx, error)

func (*Client) FundPsbt

func (c *Client) FundPsbt(addrToAmount map[string]int64, lokiPerVbyte uint64, lockExpirationSeconds uint64) (*FundedPsbt, error)

func (*Client) GetNextAddress

func (c *Client) GetNextAddress(addrType lnrpc.AddressType) (chainutil.Address, error)

func (*Client) Health

func (c *Client) Health() <-chan *Update

func (*Client) IsLocked

func (c *Client) IsLocked() (bool, error)

func (*Client) IsSynced

func (c *Client) IsSynced() (bool, uint32, error)

func (*Client) ListAddresses

func (c *Client) ListAddresses() ([]*walletrpc.AccountWithAddresses, error)

func (*Client) LoadMacaroon

func (c *Client) LoadMacaroon(path string) error

func (*Client) PublishTransaction

func (c *Client) PublishTransaction(tx *chainutil.Tx) error

func (*Client) ReleaseOutputs

func (c *Client) ReleaseOutputs(locks []*OutputLock) error

func (*Client) RestoreByEncipheredSeed

func (c *Client) RestoreByEncipheredSeed(strEncipheredSeed, passphrase string) ([]string, error)

func (*Client) RestoreByMnemonic

func (c *Client) RestoreByMnemonic(mnemonic []string, passphrase string) (string, error)

func (*Client) SetMaxTransactionsLimit

func (c *Client) SetMaxTransactionsLimit(limit uint32)

func (*Client) SimpleManyTransfer

func (c *Client) SimpleManyTransfer(addrToAmount map[string]int64, lokiPerVbyte uint64) (string, error)

func (*Client) SimpleManyTransferFee

func (c *Client) SimpleManyTransferFee(addrToAmount map[string]int64) (*lnrpc.EstimateFeeResponse, error)

func (*Client) SimpleTransfer

func (c *Client) SimpleTransfer(address chainutil.Address, amount chainutil.Amount, lokiPerVbyte uint64) (string, error)

func (*Client) SimpleTransferFee

func (c *Client) SimpleTransferFee(address chainutil.Address, amount chainutil.Amount) (*lnrpc.EstimateFeeResponse, error)

func (*Client) Unlock

func (c *Client) Unlock(passphrase string) error

func (*Client) WalletExists

func (c *Client) WalletExists() (bool, error)

type FundedPsbt

type FundedPsbt struct {
	Packet *psbt.Packet
	Locks  []*OutputLock
}

type OutputLock

type OutputLock struct {
	ID       []byte
	Outpoint *lnrpc.OutPoint
}

type Service

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

func New

func New(pctx context.Context, cfg *ServiceConfig) *Service

func (*Service) Balance

func (s *Service) Balance() (*lnrpc.WalletBalanceResponse, error)

func (*Service) ChangePassphrase

func (s *Service) ChangePassphrase(old, new string) error

func (*Service) CreateWallet

func (s *Service) CreateWallet(passphrase string) (string, []string, error)

func (*Service) Fee

func (*Service) FetchTransactions

func (s *Service) FetchTransactions() ([]*lnrpc.Transaction, error)

func (*Service) FinalizePsbt

func (s *Service) FinalizePsbt(packet *psbt.Packet) (*chainutil.Tx, error)

func (*Service) FundPsbt

func (s *Service) FundPsbt(addrToAmount map[string]int64, lokiPerVbyte uint64, lockExpirationSeconds uint64) (*FundedPsbt, error)

func (*Service) GetLastEvent

func (s *Service) GetLastEvent() *Update

func (*Service) GetNextAddress

func (s *Service) GetNextAddress(t lnrpc.AddressType) (chainutil.Address, error)

func (*Service) IsLocked

func (s *Service) IsLocked() (bool, error)

func (*Service) PublishTransaction

func (s *Service) PublishTransaction(tx *chainutil.Tx) error

func (*Service) ReleaseOutputs

func (s *Service) ReleaseOutputs(locks []*OutputLock) error

func (*Service) Restart

func (s *Service) Restart(pctx context.Context)

func (*Service) RestoreByEncipheredSeed

func (s *Service) RestoreByEncipheredSeed(strEncipheredSeed, passphrase string) ([]string, error)

func (*Service) RestoreByMnemonic

func (s *Service) RestoreByMnemonic(mnemonic []string, passphrase string) (string, error)

func (*Service) Stop

func (s *Service) Stop()

func (*Service) Subscribe

func (s *Service) Subscribe() <-chan *Update

func (*Service) Transfer

func (s *Service) Transfer(address chainutil.Address, amount chainutil.Amount, lokiPerVbyte uint64) (string, error)

func (*Service) Unlock

func (s *Service) Unlock(passphrase string) error

func (*Service) Unsubscribe

func (s *Service) Unsubscribe(ch <-chan *Update)

func (*Service) WalletExists

func (s *Service) WalletExists() (bool, error)

type ServiceConfig

type ServiceConfig struct {
	Walletdir            string        `short:"w" long:"walletdir"  description:"Directory for Flokicoin Lightning Network"`
	RegressionTest       bool          `long:"regtest" description:"Use the regression test network"`
	Testnet              bool          `long:"testnet" description:"Use the test network"`
	ConnectionTimeout    time.Duration `` /* 141-byte string literal not displayed */
	DebugLevel           string        `` /* 133-byte string literal not displayed */
	ConnectPeers         []string      `long:"connect" description:"Connect only to the specified peers at startup"`
	Feeurl               string        `long:"feeurl" description:"Custom fee estimation API endpoint (Required on mainnet)"`
	MaxTransactionsLimit int           `long:"maxtransactionslimit" description:"Maximum number of transactions to fetch per request"`

	TLSExtraIPs     []string `long:"tlsextraip" description:"Adds an extra ip to the generated certificate"`
	TLSExtraDomains []string `long:"tlsextradomain" description:"Adds an extra domain to the generated certificate"`
	TLSAutoRefresh  bool     `long:"tlsautorefresh" description:"Re-generate TLS certificate and key if the IPs or domains are changed"`

	RawRPCListeners  []string `long:"rpclisten" description:"Add an interface/port/socket to listen for RPC connections"`
	RawRESTListeners []string `long:"restlisten" description:"Add an interface/port/socket to listen for REST connections"`
	RawListeners     []string `long:"listen" description:"Add an interface/port to listen for peer connections"`

	RestCORS []string `long:"restcors" description:"Add an ip:port/hostname to allow cross origin access from. To allow all origins, set as \"*\"."`

	Network *chaincfg.Params
}

type Status

type Status string
const (
	StatusInit        Status = "init"
	StatusNone        Status = "none"
	StatusLocked      Status = "locked"
	StatusUnlocked    Status = "unlocked"
	StatusSyncing     Status = "syncing"
	StatusReady       Status = "ready"
	StatusNoWallet    Status = "noWallet"
	StatusDown        Status = "down"
	StatusTransaction Status = "tx"
	StatusBlock       Status = "block"
	StatusScanning    Status = "scanning"
	StatusQuit        Status = "quit"
)

type Update

type Update struct {
	State                     Status
	Err                       error
	Transaction               *lnrpc.Transaction
	BlockHeight, SyncedHeight uint32
	BlockHash                 string
}

Jump to

Keyboard shortcuts

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