wallet

package
v2.3.5-0...-2fac4e2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAutoConsolidateThreshold = uint64(200)
View Source
const GapLimit = 100
View Source
const MaxInputs = uint64(255) // TODO: change back to 256 when gdk is fixed
View Source
const MinFeeRate = 0.01

Variables

View Source
var ErrSubAccountNotSet = errors.New("subaccount not set")
View Source
var TransactionNotifier = utils.ForwardChannel(make(chan TransactionNotification), 0, false)

Functions

func GenerateMnemonic

func GenerateMnemonic() (string, error)

func Init

func Init(walletConfig Config) error

func Initialized

func Initialized() bool

func UpdateConfig

func UpdateConfig(walletConfig Config)

Types

type AuthHandler

type AuthHandler = *C.struct_GA_auth_handler

type Config

type Config struct {
	DataDir                  string
	Network                  *boltz.Network
	Debug                    bool
	Electrum                 onchain.ElectrumConfig
	AutoConsolidateThreshold uint64
	MaxInputs                uint64
}

func (*Config) Validate

func (c *Config) Validate() error

type Credentials

type Credentials struct {
	onchain.WalletInfo
	Mnemonic       string  `json:"mnemonic"`
	Subaccount     *uint64 `json:"subaccount"`
	Xpub           string  `json:"xpub"`
	CoreDescriptor string  `json:"core_descriptor"`
	Salt           string
}

func (*Credentials) Decrypt

func (c *Credentials) Decrypt(password string) (*Credentials, error)

func (*Credentials) Encrypt

func (c *Credentials) Encrypt(password string) (*Credentials, error)

func (*Credentials) Encrypted

func (c *Credentials) Encrypted() bool

type Json

type Json = *C.GA_json

type Notification

type Notification string

type Session

type Session = *C.struct_GA_session

type Subaccount

type Subaccount struct {
	Pointer         uint64   `json:"pointer"`
	Name            string   `json:"name"`
	Type            string   `json:"type"`
	Used            bool     `json:"bip44_discovered"`
	CoreDescriptors []string `json:"core_descriptors"`
}

type TransactionNotification

type TransactionNotification struct {
	TxId     string
	Currency boltz.Currency
}

type Wallet

type Wallet struct {
	onchain.WalletInfo
	// contains filtered or unexported fields
}

func Login

func Login(credentials *Credentials) (*Wallet, error)

func (*Wallet) Connect

func (wallet *Wallet) Connect() error

func (*Wallet) CurrentSubaccount

func (wallet *Wallet) CurrentSubaccount() (uint64, error)

func (*Wallet) Disconnect

func (wallet *Wallet) Disconnect() error

func (*Wallet) GetBalance

func (wallet *Wallet) GetBalance() (*onchain.Balance, error)

func (*Wallet) GetOutputs

func (wallet *Wallet) GetOutputs(address string) ([]*onchain.Output, error)

func (*Wallet) GetSendFee

func (wallet *Wallet) GetSendFee(address string, amount uint64, satPerVbyte float64, sendAll bool) (send uint64, fee uint64, err error)

func (*Wallet) GetSubaccount

func (wallet *Wallet) GetSubaccount(pointer uint64) (*Subaccount, error)

func (*Wallet) GetSubaccountBalance

func (wallet *Wallet) GetSubaccountBalance(subaccount uint64) (*onchain.Balance, error)

func (*Wallet) GetSubaccounts

func (wallet *Wallet) GetSubaccounts(refresh bool) ([]*Subaccount, error)

func (*Wallet) GetTransactions

func (wallet *Wallet) GetTransactions(limit, offset uint64) ([]*onchain.WalletTransaction, error)

func (*Wallet) GetWalletInfo

func (wallet *Wallet) GetWalletInfo() onchain.WalletInfo

func (*Wallet) NewAddress

func (wallet *Wallet) NewAddress() (string, error)

func (*Wallet) Ready

func (wallet *Wallet) Ready() bool

func (*Wallet) SendToAddress

func (wallet *Wallet) SendToAddress(address string, amount uint64, satPerVbyte float64, sendAll bool) (tx string, err error)

func (*Wallet) SetSpentOutputs

func (wallet *Wallet) SetSpentOutputs(outputs []string)

func (*Wallet) SetSubaccount

func (wallet *Wallet) SetSubaccount(subaccount *uint64) (*uint64, error)

func (*Wallet) SetTxProvider

func (wallet *Wallet) SetTxProvider(txProvider onchain.TxProvider)

Jump to

Keyboard shortcuts

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