nip47

package
v0.0.0-...-b4f8ce2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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 ListTransactionsParams struct {
	From           uint64 `json:"from"`
	To             uint64 `json:"to"`
	Limit          uint16 `json:"limit"`
	Offset         uint32 `json:"offset"`
	Unpaid         bool   `json:"unpaid"`
	UnpaidOutgoing bool   `json:"unpaid_outgoing"`
	UnpaidIncoming bool   `json:"unpaid_incoming"`
	Type           string `json:"type"`
}

type ListTransactionsResult

type ListTransactionsResult struct {
	Transactions []Transaction `json:"transactions"`
	TotalCount   uint32        `json:"total_count"`
}

type LookupInvoiceParams

type LookupInvoiceParams struct {
	PaymentHash string `json:"payment_hash"`
	Invoice     string `json:"invoice"`
}

type LookupInvoiceResult

type LookupInvoiceResult = Transaction

type MakeInvoiceParams

type MakeInvoiceParams struct {
	Amount          uint64      `json:"amount"`
	Expiry          *uint32     `json:"expiry"`
	Description     string      `json:"description"`
	DescriptionHash string      `json:"description_hash"`
	Metadata        interface{} `json:"metadata"`
}

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

func (NWCClient) RPC

func (client NWCClient) RPC(ctx context.Context, method string, params interface{}, result interface{}, opts *rpcOptions) error

executes a custom NIP-47 request method and waits for the response

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 PayInvoiceParams struct {
	Invoice  string      `json:"invoice"`
	Amount   *uint64     `json:"amount"`
	Metadata interface{} `json:"metadata"`
}

type PayInvoiceResult

type PayInvoiceResult struct {
	Preimage string `json:"preimage"`
	FeesPaid uint64 `json:"fees_paid"`
}

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

type ResponseError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

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

type WalletServiceInfo struct {
	EncryptionTypes   []string
	Capabilities      []string
	NotificationTypes []string
}

Jump to

Keyboard shortcuts

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