Documentation ¶
Index ¶
- Variables
- func DeriveP2PK(key *hdkeychain.ExtendedKey) (*btcec.PrivateKey, error)
- func GetActiveKeysets(mintURL string) (*nut01.GetKeysResponse, error)
- func GetAllKeysets(mintURL string) (*nut02.GetKeysetsResponse, error)
- func GetKeysetById(mintURL, id string) (*nut01.GetKeysResponse, error)
- func GetMeltQuoteState(mintURL, quoteId string) (*nut05.PostMeltQuoteBolt11Response, error)
- func GetMintActiveKeysets(mintURL string) (map[string]crypto.WalletKeyset, error)
- func GetMintInactiveKeysets(mintURL string) (map[string]crypto.WalletKeyset, error)
- func GetMintInfo(mintURL string) (*nut06.MintInfo, error)
- func GetMintQuoteState(mintURL, quoteId string) (*nut04.PostMintQuoteBolt11Response, error)
- func InitStorage(path string) (storage.WalletDB, error)
- func PostCheckProofState(mintURL string, stateRequest nut07.PostCheckStateRequest) (*nut07.PostCheckStateResponse, error)
- func PostMeltBolt11(mintURL string, meltRequest nut05.PostMeltBolt11Request) (*nut05.PostMeltQuoteBolt11Response, error)
- func PostMeltQuoteBolt11(mintURL string, meltQuoteRequest nut05.PostMeltQuoteBolt11Request) (*nut05.PostMeltQuoteBolt11Response, error)
- func PostMintBolt11(mintURL string, mintRequest nut04.PostMintBolt11Request) (*nut04.PostMintBolt11Response, error)
- func PostMintQuoteBolt11(mintURL string, mintQuoteRequest nut04.PostMintQuoteBolt11Request) (*nut04.PostMintQuoteBolt11Response, error)
- func PostRestore(mintURL string, restoreRequest nut09.PostRestoreRequest) (*nut09.PostRestoreResponse, error)
- func PostSwap(mintURL string, swapRequest nut03.PostSwapRequest) (*nut03.PostSwapResponse, error)
- func Restore(walletPath, mnemonic string, mintsToRestore []string) (cashu.Proofs, error)
- type Config
- type Wallet
- func (w *Wallet) CheckMeltQuoteState(quoteId string) (*nut05.PostMeltQuoteBolt11Response, error)
- func (w *Wallet) CurrentMint() string
- func (w *Wallet) GetAllInvoices() []storage.Invoice
- func (w *Wallet) GetBalance() uint64
- func (w *Wallet) GetBalanceByMints() map[string]uint64
- func (w *Wallet) GetInvoiceByPaymentHash(hash string) *storage.Invoice
- func (w *Wallet) GetInvoiceByPaymentRequest(pr string) (*storage.Invoice, error)
- func (w *Wallet) GetPendingMeltQuotes() []string
- func (w *Wallet) GetReceivePubkey() *btcec.PublicKey
- func (w *Wallet) HTLCLockedProofs(amount uint64, mintURL string, preimage string, tags *nut11.P2PKTags, ...) (cashu.Proofs, error)
- func (w *Wallet) Melt(invoice, mintURL string) (*nut05.PostMeltQuoteBolt11Response, error)
- func (w *Wallet) MintQuoteState(quoteId string) (*nut04.PostMintQuoteBolt11Response, error)
- func (w *Wallet) MintTokens(quoteId string) (uint64, error)
- func (w *Wallet) Mnemonic() string
- func (w *Wallet) PendingBalance() uint64
- func (w *Wallet) Receive(token cashu.Token, swapToTrusted bool) (uint64, error)
- func (w *Wallet) ReceiveHTLC(token cashu.Token, preimage string) (uint64, error)
- func (w *Wallet) RequestMint(amount uint64) (*nut04.PostMintQuoteBolt11Response, error)
- func (w *Wallet) Send(amount uint64, mintURL string, includeFees bool) (cashu.Proofs, error)
- func (w *Wallet) SendToPubkey(amount uint64, mintURL string, pubkey *btcec.PublicKey, tags *nut11.P2PKTags, ...) (cashu.Proofs, error)
- func (w *Wallet) TrustedMints() []string
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DeriveP2PK ¶ added in v0.2.0
func DeriveP2PK(key *hdkeychain.ExtendedKey) (*btcec.PrivateKey, error)
Derive key that wallet will use to receive locked ecash
func GetActiveKeysets ¶
func GetActiveKeysets(mintURL string) (*nut01.GetKeysResponse, error)
func GetAllKeysets ¶
func GetAllKeysets(mintURL string) (*nut02.GetKeysetsResponse, error)
func GetKeysetById ¶ added in v0.2.0
func GetKeysetById(mintURL, id string) (*nut01.GetKeysResponse, error)
func GetMeltQuoteState ¶ added in v0.3.0
func GetMeltQuoteState(mintURL, quoteId string) (*nut05.PostMeltQuoteBolt11Response, error)
func GetMintActiveKeysets ¶
func GetMintActiveKeysets(mintURL string) (map[string]crypto.WalletKeyset, error)
func GetMintInactiveKeysets ¶
func GetMintInactiveKeysets(mintURL string) (map[string]crypto.WalletKeyset, error)
func GetMintQuoteState ¶
func GetMintQuoteState(mintURL, quoteId string) (*nut04.PostMintQuoteBolt11Response, error)
func PostCheckProofState ¶ added in v0.2.0
func PostCheckProofState(mintURL string, stateRequest nut07.PostCheckStateRequest) ( *nut07.PostCheckStateResponse, error)
func PostMeltBolt11 ¶
func PostMeltBolt11(mintURL string, meltRequest nut05.PostMeltBolt11Request) ( *nut05.PostMeltQuoteBolt11Response, error)
func PostMeltQuoteBolt11 ¶
func PostMeltQuoteBolt11(mintURL string, meltQuoteRequest nut05.PostMeltQuoteBolt11Request) ( *nut05.PostMeltQuoteBolt11Response, error)
func PostMintBolt11 ¶
func PostMintBolt11(mintURL string, mintRequest nut04.PostMintBolt11Request) ( *nut04.PostMintBolt11Response, error)
func PostMintQuoteBolt11 ¶
func PostMintQuoteBolt11(mintURL string, mintQuoteRequest nut04.PostMintQuoteBolt11Request) ( *nut04.PostMintQuoteBolt11Response, error)
func PostRestore ¶ added in v0.2.0
func PostRestore(mintURL string, restoreRequest nut09.PostRestoreRequest) ( *nut09.PostRestoreResponse, error)
func PostSwap ¶
func PostSwap(mintURL string, swapRequest nut03.PostSwapRequest) (*nut03.PostSwapResponse, error)
Types ¶
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func LoadWallet ¶
func (*Wallet) CheckMeltQuoteState ¶ added in v0.3.0
func (w *Wallet) CheckMeltQuoteState(quoteId string) (*nut05.PostMeltQuoteBolt11Response, error)
func (*Wallet) CurrentMint ¶
CurrentMint returns the current mint url
func (*Wallet) GetAllInvoices ¶
func (*Wallet) GetBalance ¶
GetBalance returns the total balance aggregated from all proofs
func (*Wallet) GetBalanceByMints ¶
GetBalanceByMints returns a map of string mint and a uint64 that represents the balance for that mint
func (*Wallet) GetInvoiceByPaymentHash ¶
func (*Wallet) GetInvoiceByPaymentRequest ¶
func (*Wallet) GetPendingMeltQuotes ¶ added in v0.3.0
GetPendingMeltQuotes return a list of pending quote ids
func (*Wallet) GetReceivePubkey ¶ added in v0.2.0
func (w *Wallet) GetReceivePubkey() *btcec.PublicKey
GetReceivePubkey retrieves public key to which the wallet can receive locked ecash
func (*Wallet) HTLCLockedProofs ¶ added in v0.3.0
func (w *Wallet) HTLCLockedProofs( amount uint64, mintURL string, preimage string, tags *nut11.P2PKTags, includeFees bool, ) (cashu.Proofs, error)
HTLCLockedProofs returns proofs that are locked to the hash of the preimage
func (*Wallet) Melt ¶
func (w *Wallet) Melt(invoice, mintURL string) (*nut05.PostMeltQuoteBolt11Response, error)
Melt will request the mint to pay the given invoice
func (*Wallet) MintQuoteState ¶ added in v0.3.0
func (w *Wallet) MintQuoteState(quoteId string) (*nut04.PostMintQuoteBolt11Response, error)
func (*Wallet) MintTokens ¶
MintTokens will check whether if the mint quote has been paid. If yes, it will create blinded messages that will send to the mint to get the blinded signatures. If successful, it will unblind the signatures to generate proofs and store the proofs in the db.
func (*Wallet) PendingBalance ¶ added in v0.3.0
func (*Wallet) Receive ¶
Receives Cashu token. If swap is true, it will swap the funds to the configured default mint. If false, it will add the proofs from the mint and add that mint to the list of trusted mints.
func (*Wallet) ReceiveHTLC ¶ added in v0.3.0
ReceiveHTLC will add the preimage and any signatures if needed in order to redeem the locked ecash. If successful, it will make a swap and store the new proofs. It will add the mint in the token to the list of trusted mints.
func (*Wallet) RequestMint ¶
func (w *Wallet) RequestMint(amount uint64) (*nut04.PostMintQuoteBolt11Response, error)
RequestMint requests a mint quote to the wallet's current mint for the specified amount
func (*Wallet) SendToPubkey ¶ added in v0.2.0
func (w *Wallet) SendToPubkey( amount uint64, mintURL string, pubkey *btcec.PublicKey, tags *nut11.P2PKTags, includeFees bool, ) (cashu.Proofs, error)
SendToPubkey returns proofs that are locked to the passed pubkey