Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - Variables
 - func UseLogger(logger btclog.Logger)
 - type Manager
 - func (m *Manager) GetStaticAddress(ctx context.Context) (*script.StaticAddress, error)
 - func (m *Manager) GetStaticAddressParameters(ctx context.Context) (*Parameters, error)
 - func (m *Manager) GetTaprootAddress(clientPubkey, serverPubkey *btcec.PublicKey, expiry int64) (*btcutil.AddressTaproot, error)
 - func (m *Manager) ListUnspent(ctx context.Context, minConfs, maxConfs int32) ([]*lnwallet.Utxo, error)
 - func (m *Manager) ListUnspentRaw(ctx context.Context, minConfs, maxConfs int32) (*btcutil.AddressTaproot, []*lnwallet.Utxo, error)
 - func (m *Manager) NewAddress(ctx context.Context) (*btcutil.AddressTaproot, error)
 - func (m *Manager) Run(ctx context.Context) error
 
- type ManagerConfig
 - type Parameters
 - type SqlStore
 - type Store
 
Constants ¶
const Subsystem = "SADDR"
    Subsystem defines the sub system name of this package.
Variables ¶
var (
	ErrAddressAlreadyExists = fmt.Errorf("address already exists")
)
    Functions ¶
Types ¶
type Manager ¶
Manager manages the address state machines.
func NewManager ¶
func NewManager(cfg *ManagerConfig) *Manager
NewManager creates a new address manager.
func (*Manager) GetStaticAddress ¶
GetStaticAddress returns a taproot address for the given client and server public keys and expiry.
func (*Manager) GetStaticAddressParameters ¶
func (m *Manager) GetStaticAddressParameters(ctx context.Context) (*Parameters, error)
GetStaticAddressParameters returns the parameters of the static address.
func (*Manager) GetTaprootAddress ¶
func (m *Manager) GetTaprootAddress(clientPubkey, serverPubkey *btcec.PublicKey, expiry int64) (*btcutil.AddressTaproot, error)
GetTaprootAddress returns a taproot address for the given client and server public keys and expiry.
func (*Manager) ListUnspent ¶
func (m *Manager) ListUnspent(ctx context.Context, minConfs, maxConfs int32) ([]*lnwallet.Utxo, error)
ListUnspent returns a list of utxos at the static address.
func (*Manager) ListUnspentRaw ¶
func (m *Manager) ListUnspentRaw(ctx context.Context, minConfs, maxConfs int32) (*btcutil.AddressTaproot, []*lnwallet.Utxo, error)
ListUnspentRaw returns a list of utxos at the static address.
func (*Manager) NewAddress ¶
NewAddress starts a new address creation flow.
type ManagerConfig ¶
type ManagerConfig struct {
	// AddressClient is the client that communicates with the loop server
	// to manage static addresses.
	AddressClient staticaddressrpc.StaticAddressServerClient
	// FetchL402 is the function used to fetch the l402 token.
	FetchL402 func(context.Context) error
	// Store is the database store that is used to store static address
	// related records.
	Store Store
	// WalletKit is the wallet client that is used to derive new keys from
	// lnd's wallet.
	WalletKit lndclient.WalletKitClient
	// ChainParams is the chain configuration(mainnet, testnet...) this
	// manager uses.
	ChainParams *chaincfg.Params
	// ChainNotifier is the chain notifier that is used to listen for new
	// blocks.
	ChainNotifier lndclient.ChainNotifierClient
}
    ManagerConfig holds the configuration for the address manager.
type Parameters ¶
type Parameters struct {
	// ClientPubkey is the client's pubkey for the static address. It is
	// used for the 2-of-2 funding output as well as for the client's
	// timeout path.
	ClientPubkey *btcec.PublicKey
	// ClientPubkey is the client's pubkey for the static address. It is
	// used for the 2-of-2 funding output.
	ServerPubkey *btcec.PublicKey
	// Expiry is the CSV timout value at which the client can claim the
	// static address's timout path.
	Expiry uint32
	// PkScript is the unique static address's output script.
	PkScript []byte
	// KeyLocator is the locator of the client's key.
	KeyLocator keychain.KeyLocator
	// ProtocolVersion is the protocol version of the static address.
	ProtocolVersion version.AddressProtocolVersion
	// InitiationHeight is the height at which the address was initiated.
	InitiationHeight int32
}
    Parameters holds all the necessary information for the 2-of-2 multisig address.
type SqlStore ¶
type SqlStore struct {
	// contains filtered or unexported fields
}
    SqlStore is the backing store for static addresses.
func NewSqlStore ¶
NewSqlStore constructs a new SQLStore from a BaseDB. The BaseDB is agnostic to the underlying driver which can be postgres or sqlite.
func (*SqlStore) CreateStaticAddress ¶
func (s *SqlStore) CreateStaticAddress(ctx context.Context, addrParams *Parameters) error
CreateStaticAddress creates a static address record in the database.
func (*SqlStore) GetAllStaticAddresses ¶
func (s *SqlStore) GetAllStaticAddresses(ctx context.Context) ([]*Parameters, error)
GetAllStaticAddresses returns all address known to the server.
func (*SqlStore) GetStaticAddress ¶
GetStaticAddress retrieves static address parameters for a given pkScript.
type Store ¶
type Store interface {
	// CreateStaticAddress inserts a new static address with its parameters
	// into the store.
	CreateStaticAddress(ctx context.Context, addrParams *Parameters) error
	// GetStaticAddress fetches static address parameters for a given
	// address ID.
	GetStaticAddress(ctx context.Context, pkScript []byte) (*Parameters,
		error)
	// GetAllStaticAddresses retrieves all static addresses from the store.
	GetAllStaticAddresses(ctx context.Context) ([]*Parameters,
		error)
}
    Store is the database interface that is used to store and retrieve static addresses.