client

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePrice

func DecodePrice(invoice string) (uint64, error)

DecodePrice decodes a price from a ln payment request.

func ParseL402Challenge

func ParseL402Challenge(resp *http.Response) (string, string, error)

ParseL402Challenge parses an L402 challenge from an HTTP response.

func PayInvoice

func PayInvoice(accessToken, invoice string) (string, error)

PayInvoice pays a lightning invoice.

Types

type HttpClient

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

HttpClient is an HTTP client for interacting with the Fewsats API.

func NewHTTPClient

func NewHTTPClient() (*HttpClient, error)

NewHTTPClient creates a new HTTP client for interacting with the Fewsats API.

func (*HttpClient) ExecuteL402Request

func (c *HttpClient) ExecuteL402Request(method, url string,
	body []byte) (*http.Response, error)

ExecuteL402Request executes an HTTP request with the given method, path, and body. If the response status code is 402, it will show the user the price of the request and ask if they would like to proceed.

func (*HttpClient) ExecuteRequest

func (c *HttpClient) ExecuteRequest(method, path string,
	body []byte) (*http.Response, error)

ExecuteRequest executes an HTTP request with the given method, path, and body.

type PaymentResponse

type PaymentResponse struct {
	Amount          int    `json:"amount"`
	Description     string `json:"description"`
	Destination     string `json:"destination"`
	Fee             int    `json:"fee"`
	PaymentHash     string `json:"payment_hash"`
	PaymentPreimage string `json:"payment_preimage"`
	PaymentRequest  string `json:"payment_request"`
}

PaymentResponse represents a payment response.

Jump to

Keyboard shortcuts

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