Documentation
¶
Index ¶
- type GetBalanceResult
- type GetInfoResult
- type ListTransactionsParams
- type ListTransactionsResult
- type LookupInvoiceParams
- type LookupInvoiceResult
- type MakeInvoiceParams
- type MakeInvoiceResult
- type NWCClient
- func (client NWCClient) GetBalance(ctx context.Context) (*GetBalanceResult, error)
- func (client NWCClient) GetInfo(ctx context.Context) (*GetInfoResult, error)
- func (client NWCClient) GetWalletServiceInfo(ctx context.Context) (*WalletServiceInfo, error)
- func (client NWCClient) ListTransactions(ctx context.Context, params *ListTransactionsParams) (*ListTransactionsResult, error)
- func (client NWCClient) LookupInvoice(ctx context.Context, params *LookupInvoiceParams) (*LookupInvoiceResult, error)
- func (client NWCClient) MakeInvoice(ctx context.Context, params *MakeInvoiceParams) (*MakeInvoiceResult, error)
- func (client NWCClient) PayInvoice(ctx context.Context, params *PayInvoiceParams) (*PayInvoiceResult, error)
- func (client NWCClient) RPC(ctx context.Context, method string, params interface{}, result interface{}, ...) error
- type NWCURIParts
- type PayInvoiceParams
- type PayInvoiceResult
- type Request
- type Response
- type ResponseError
- type Transaction
- type WalletServiceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetBalanceResult ¶
type GetBalanceResult struct {
Balance uint64 `json:"balance"`
}
type GetInfoResult ¶
type GetInfoResult struct { Alias string `json:"alias"` Color string `json:"color"` Pubkey string `json:"pubkey"` Network string `json:"network"` BlockHeight uint `json:"block_height"` BlockHash string `json:"block_hash"` Methods []string `json:"methods"` Notifications []string `json:"notifications"` }
type ListTransactionsParams ¶
type ListTransactionsResult ¶
type ListTransactionsResult struct { Transactions []Transaction `json:"transactions"` TotalCount uint32 `json:"total_count"` }
type LookupInvoiceParams ¶
type LookupInvoiceResult ¶
type LookupInvoiceResult = Transaction
type MakeInvoiceParams ¶
type MakeInvoiceResult ¶
type MakeInvoiceResult = Transaction
type NWCClient ¶
type NWCClient struct {
// contains filtered or unexported fields
}
func NewNWCClient ¶
func NewNWCClient(ctx context.Context, clientSecretKey string, walletPublicKey string, relays []string, pool *nostr.SimplePool) (client *NWCClient, err error)
creates a new NWC client from NWC URI parts
func NewNWCClientFromURI ¶
func NewNWCClientFromURI(ctx context.Context, nwcUri string, pool *nostr.SimplePool) (client *NWCClient, err error)
creates a new NWC client from a NWC URI
func (NWCClient) GetBalance ¶
func (client NWCClient) GetBalance(ctx context.Context) (*GetBalanceResult, error)
executes the NIP-47 get_balance request method
func (NWCClient) GetInfo ¶
func (client NWCClient) GetInfo(ctx context.Context) (*GetInfoResult, error)
executes the NIP-47 get_info request method
func (NWCClient) GetWalletServiceInfo ¶
func (client NWCClient) GetWalletServiceInfo(ctx context.Context) (*WalletServiceInfo, error)
fetches the NIP-47 info event (kind 13194)
func (NWCClient) ListTransactions ¶
func (client NWCClient) ListTransactions(ctx context.Context, params *ListTransactionsParams) (*ListTransactionsResult, error)
executes the NIP-47 list_transactions request method
func (NWCClient) LookupInvoice ¶
func (client NWCClient) LookupInvoice(ctx context.Context, params *LookupInvoiceParams) (*LookupInvoiceResult, error)
executes the NIP-47 lookup_invoice request method
func (NWCClient) MakeInvoice ¶
func (client NWCClient) MakeInvoice(ctx context.Context, params *MakeInvoiceParams) (*MakeInvoiceResult, error)
executes the NIP-47 make_invoice request method
func (NWCClient) PayInvoice ¶
func (client NWCClient) PayInvoice(ctx context.Context, params *PayInvoiceParams) (*PayInvoiceResult, error)
executes the NIP-47 pay_invoice request method
type NWCURIParts ¶
type NWCURIParts struct {
// contains filtered or unexported fields
}
func ParseNWCURI ¶
func ParseNWCURI(nwcUri string) (*NWCURIParts, error)
extracts the NWC URI parts from a connection URI
type PayInvoiceParams ¶
type PayInvoiceResult ¶
type Request ¶
type Request struct { Method string `json:"method"` Params interface{} `json:"params"` }
type Response ¶
type Response struct { ResultType string `json:"result_type"` Error *ResponseError `json:"error"` Result interface{} `json:"result"` }
type ResponseError ¶
func (*ResponseError) Error ¶
func (err *ResponseError) Error() string
type Transaction ¶
type Transaction struct { Type string `json:"type"` State string `json:"state"` Invoice string `json:"invoice"` Description string `json:"description"` DescriptionHash string `json:"description_hash"` Preimage string `json:"preimage"` PaymentHash string `json:"payment_hash"` Amount uint64 `json:"amount"` FeesPaid uint64 `json:"fees_paid"` CreatedAt uint64 `json:"created_at"` ExpiresAt uint64 `json:"expires_at"` SettledAt *uint64 `json:"settled_at"` Metadata interface{} `json:"metadata"` }
type WalletServiceInfo ¶
Click to show internal directories.
Click to hide internal directories.