Documentation ¶
Overview ¶
Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
Index ¶
- func HashUmaIdentifier(identifier string, signingPrivateKey []byte, now time.Time) string
- type LightsparkClient
- func (client *LightsparkClient) CancelInvoice(invoiceId string) (*objects.Invoice, error)
- func (client *LightsparkClient) ClaimUmaInvitation(invitationCode string, inviteeUma string) (*objects.UmaInvitation, error)
- func (client *LightsparkClient) ClaimUmaInvitationWithIncentives(invitationCode string, inviteeUma string, inviteePhoneNumber string, ...) (*objects.UmaInvitation, error)
- func (client *LightsparkClient) CreateApiToken(name string, transact bool, testMode bool) (*scripts.CreateApiTokenOutput, error)
- func (client *LightsparkClient) CreateInvoice(nodeId string, amountMsats int64, memo *string, ...) (*objects.Invoice, error)
- func (client *LightsparkClient) CreateLnurlInvoice(nodeId string, amountMsats int64, metadata string, expirySecs *int32) (*objects.Invoice, error)
- func (client *LightsparkClient) CreateNodeWalletAddress(nodeId string) (string, error)
- func (client *LightsparkClient) CreateNodeWalletAddressWithKeys(nodeId string) (*objects.CreateNodeWalletAddressOutput, error)
- func (client *LightsparkClient) CreateTestModeInvoice(localNodeId string, amountMsats int64, memo *string, ...) (*string, error)
- func (client *LightsparkClient) CreateTestModePayment(localNodeId string, encodedInvoice string, amountMsats *int64) (*objects.IncomingPayment, error)
- func (client *LightsparkClient) CreateUmaInvitation(inviterUma string) (*objects.UmaInvitation, error)
- func (client *LightsparkClient) CreateUmaInvitationWithIncentives(inviterUma string, inviterPhoneNumber string, inviterRegion objects.RegionCode) (*objects.UmaInvitation, error)
- func (client *LightsparkClient) CreateUmaInvoice(nodeId string, amountMsats int64, metadata string, expirySecs *int32) (*objects.Invoice, error)
- func (client *LightsparkClient) CreateUmaInvoiceWithReceiverIdentifier(nodeId string, amountMsats int64, metadata string, expirySecs *int32, ...) (*objects.Invoice, error)
- func (client *LightsparkClient) DecodePaymentRequest(encodedPaymentRequest string) (*objects.PaymentRequestData, error)
- func (client *LightsparkClient) DeleteApiToken(apiTokenId string) error
- func (client *LightsparkClient) ExecuteGraphqlRequest(document string, variables map[string]interface{}) (map[string]interface{}, error)
- func (client *LightsparkClient) FailHtlc(invoiceId string, cancelInvoice bool) (*objects.FailHtlcsOutput, error)
- func (client *LightsparkClient) FetchIncomingPaymentsByInvoice(invoiceId string, statuses *[]objects.TransactionStatus) (*objects.IncomingPaymentsForInvoiceQueryOutput, error)
- func (client *LightsparkClient) FetchInvoiceByPaymentHash(paymentHash string) (*objects.Invoice, error)
- func (client *LightsparkClient) FetchOutgoingPaymentByIdempotencyKey(idempotencyKey string) (*objects.OutgoingPayment, error)
- func (client *LightsparkClient) FetchOutgoingPaymentsByInvoice(encodedInvoice string, statuses *[]objects.TransactionStatus) (*objects.OutgoingPaymentsForInvoiceQueryOutput, error)
- func (client *LightsparkClient) FetchOutgoingPaymentsByPaymentHash(paymentHash string, statuses *[]objects.TransactionStatus) (*[]objects.OutgoingPayment, error)
- func (client *LightsparkClient) FetchUmaInvitation(invitationCode string) (*objects.UmaInvitation, error)
- func (client *LightsparkClient) FundNode(nodeId string, amountSats int64) (*objects.CurrencyAmount, error)
- func (client *LightsparkClient) GetBitcoinFeeEstimate(bitcoinNetwork objects.BitcoinNetwork) (*objects.FeeEstimate, error)
- func (client *LightsparkClient) GetCurrentAccount() (*objects.Account, error)
- func (client *LightsparkClient) GetEntity(id string) (*objects.Entity, error)
- func (client *LightsparkClient) GetLightningFeeEstimateForInvoice(nodeId string, encodedInvoice string, amountMsats *int64) (*objects.LightningFeeEstimateOutput, error)
- func (client *LightsparkClient) GetLightningFeeEstimateForNode(nodeId string, destinationNodePublicKey string, amountMsats int64) (*objects.LightningFeeEstimateOutput, error)
- func (client *LightsparkClient) GetNodeChannelUtxos(nodeId string) ([]string, error)
- func (client *LightsparkClient) GetWithdrawalFeeEstimate(nodeId string, amountSats int64, withdrawMode objects.WithdrawalMode) (*objects.WithdrawalFeeEstimateOutput, error)
- func (client *LightsparkClient) LoadNodeSigningKey(nodeId string, loader SigningKeyLoader)
- func (client *LightsparkClient) PayInvoice(nodeId string, encodedInvoice string, timeoutSecs int, maximumFeesMsats int64, ...) (*objects.OutgoingPayment, error)
- func (client *LightsparkClient) PayInvoiceWithIdempotencyKey(nodeId string, encodedInvoice string, timeoutSecs int, maximumFeesMsats int64, ...) (*objects.OutgoingPayment, error)
- func (client *LightsparkClient) PayUmaInvoice(nodeId string, encodedInvoice string, timeoutSecs int, maximumFeesMsats int64, ...) (*objects.OutgoingPayment, error)
- func (client *LightsparkClient) PayUmaInvoiceWithSenderIdentifier(nodeId string, encodedInvoice string, timeoutSecs int, maximumFeesMsats int64, ...) (*objects.OutgoingPayment, error)
- func (client *LightsparkClient) RegisterPayment(provider objects.ComplianceProvider, paymentId string, nodePubkey string, ...) error
- func (client *LightsparkClient) RequestWithdrawal(nodeId string, amountSats int64, bitcoinAddress string, ...) (*objects.WithdrawalRequest, error)
- func (client *LightsparkClient) RequestWithdrawalWithIdempotencyKey(nodeId string, amountSats int64, bitcoinAddress string, ...) (*objects.WithdrawalRequest, error)
- func (client *LightsparkClient) RequestWithdrawalWithIdempotencyKeyAndFee(nodeId string, amountSats int64, bitcoinAddress string, ...) (*objects.WithdrawalRequest, error)
- func (client *LightsparkClient) ScreenNode(provider objects.ComplianceProvider, nodePubkey string) (*objects.RiskRating, error)
- func (client *LightsparkClient) SendPayment(nodeId string, destinationPublicKey string, amountMsats int64, timeoutSecs int, ...) (*objects.OutgoingPayment, error)
- func (client *LightsparkClient) SetNodeSigningKey(nodeId string, key requester.SigningKey)
- type Option
- type SigningKeyLoader
- func NewSigningKeyLoaderFromNodeIdAndPassword(nodeId string, password string) *SigningKeyLoader
- func NewSigningKeyLoaderFromRsaPrivateKey(rsaPrivateKeyBytes []byte) *SigningKeyLoader
- func NewSigningKeyLoaderFromSignerMasterSeed(masterSeedBytes []byte, network objects.BitcoinNetwork) *SigningKeyLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LightsparkClient ¶
type LightsparkClient struct { Requester *requester.Requester // contains filtered or unexported fields }
func NewLightsparkClient ¶
func NewLightsparkClient(apiTokenClientId string, apiTokenClientSecret string, baseUrl *string, options ...Option, ) *LightsparkClient
NewLightsparkClient creates a new LightsparkClient instance
Args:
apiTokenClientId: the client id of the API token apiTokenClientSecret: the client secret of the API token baseUrl: the base url of the Lightspark API. Should usually be nil to use the default value.
func (*LightsparkClient) CancelInvoice ¶ added in v0.7.0
func (client *LightsparkClient) CancelInvoice(invoiceId string) (*objects.Invoice, error)
CancelInvoice cancels an existing unpaid invoice and returns that invoice. Cancelled invoices cannot be paid.
Args:
invoiceId: The id of the invoice to cancel.
func (*LightsparkClient) ClaimUmaInvitation ¶ added in v0.7.0
func (client *LightsparkClient) ClaimUmaInvitation(invitationCode string, inviteeUma string) (*objects.UmaInvitation, error)
ClaimUmaInvitation claims an existing uma invitation.
Args:
invitationCode: the code of the invitation inviteeUma: the uma of the invitee
Returns:
*objects.UmaInvitation: the claimed invitation
func (*LightsparkClient) ClaimUmaInvitationWithIncentives ¶ added in v0.7.0
func (client *LightsparkClient) ClaimUmaInvitationWithIncentives( invitationCode string, inviteeUma string, inviteePhoneNumber string, inviteeRegion objects.RegionCode, ) (*objects.UmaInvitation, error)
ClaimUmaInvitationWithIncentives claims an existing uma invitation with incentives.
Args:
invitationCode: the code of the invitation inviteeUma: the uma of the invitee inviteePhoneNumber: the phone number of the invitee in E.164 format inviteeRegion: the RegionCode of the invitee
Returns:
*objects.UmaInvitation: the claimed invitation
func (*LightsparkClient) CreateApiToken ¶
func (client *LightsparkClient) CreateApiToken(name string, transact bool, testMode bool, ) (*scripts.CreateApiTokenOutput, error)
CreateApiToken creates a new API token that can be used to authenticate requests for this account when using the Lightspark APIs and SDKs.
Args:
name: the name of the API token transact: whether the API token should be able to used to initiate transactions testMode: whether the API token should be created for test mode or Mainnet mode
func (*LightsparkClient) CreateInvoice ¶
func (client *LightsparkClient) CreateInvoice(nodeId string, amountMsats int64, memo *string, invoiceType *objects.InvoiceType, expirySecs *int32, ) (*objects.Invoice, error)
CreateInvoice generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment from another Lightning Node.
Args:
nodeId: the id of the node that should be paid amountMsats: the amount of the invoice in millisatoshis memo: the memo of the invoice invoiceType: the type of the invoice expirySecs: the expiry of the invoice in seconds. Default value is 86400 (1 day).
func (*LightsparkClient) CreateLnurlInvoice ¶
func (client *LightsparkClient) CreateLnurlInvoice(nodeId string, amountMsats int64, metadata string, expirySecs *int32, ) (*objects.Invoice, error)
CreateLnurlInvoice creates a new LNURL invoice. The metadata is hashed and included in the invoice. This API generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment from another Lightning Node. This should only be used for generating invoices for LNURLs, with `create_invoice` preferred in the general case.
Args:
nodeId: the id of the node that should be paid amountMsats: the amount of the invoice in millisatoshis metadata: the metadata to include with the invoice expirySecs: the expiry of the invoice in seconds. Default value is 86400 (1 day)
func (*LightsparkClient) CreateNodeWalletAddress ¶
func (client *LightsparkClient) CreateNodeWalletAddress(nodeId string) (string, error)
CreateNodeWalletAddress creates a Bitcoin address for the wallet associated with your Lightning Node. You can use this address to send funds to your node. It is a best practice to generate a new wallet address every time you need to send money. You can generate as many wallet addresses as you want.
func (*LightsparkClient) CreateNodeWalletAddressWithKeys ¶ added in v0.11.0
func (client *LightsparkClient) CreateNodeWalletAddressWithKeys(nodeId string) (*objects.CreateNodeWalletAddressOutput, error)
func (*LightsparkClient) CreateTestModeInvoice ¶
func (client *LightsparkClient) CreateTestModeInvoice(localNodeId string, amountMsats int64, memo *string, invoiceType *objects.InvoiceType, ) (*string, error)
CreateTestModeInvoice In test mode, generates a Lightning Invoice which can be paid by a local node. This is useful for testing your integration with Lightspark.
Args:
localNodeId: the id of the node that will pay the invoice amountMsats: the amount of the invoice in millisatoshis memo: the memo of the invoice invoiceType: the type of the invoice
func (*LightsparkClient) CreateTestModePayment ¶
func (client *LightsparkClient) CreateTestModePayment(localNodeId string, encodedInvoice string, amountMsats *int64, ) (*objects.IncomingPayment, error)
CreateTestModePayment In test mode, simulates a payment from other node to an invoice. This is useful for testing your integration with Lightspark.
Args:
localNodeId: The node to where you want to send the payment. encodedInvoice: The invoice you want to be paid (as defined by the BOLT11 standard). amountMsats: The amount you will be paid for this invoice, expressed in msats. It should ONLY be set when the invoice amount is zero.
func (*LightsparkClient) CreateUmaInvitation ¶ added in v0.7.0
func (client *LightsparkClient) CreateUmaInvitation(inviterUma string) (*objects.UmaInvitation, error)
CreateUmaInvitation creates a new uma invitation.
Args:
inviterUma: the uma of the inviter
Returns:
*objects.UmaInvitation: the created invitation
func (*LightsparkClient) CreateUmaInvitationWithIncentives ¶ added in v0.7.0
func (client *LightsparkClient) CreateUmaInvitationWithIncentives( inviterUma string, inviterPhoneNumber string, inviterRegion objects.RegionCode, ) (*objects.UmaInvitation, error)
CreateUmaInvitationWithIncentives creates a new uma invitation with incentives.
Args:
inviterUma: the uma of the inviter inviterPhoneNumber: the phone number of the inviter in E.164 format inviterRegion: the RegionCode of the inviter
Returns:
*objects.UmaInvitation: the created invitation
func (*LightsparkClient) CreateUmaInvoice ¶
func (client *LightsparkClient) CreateUmaInvoice(nodeId string, amountMsats int64, metadata string, expirySecs *int32, ) (*objects.Invoice, error)
CreateUmaInvoice creates a new invoice for the UMA protocol. The metadata is hashed and included in the invoice. This API generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment from another Lightning Node. This should only be used for generating invoices for UMA, with `create_invoice` preferred in the general case.
Args:
nodeId: the id of the node that should be paid amountMsats: the amount of the invoice in millisatoshis metadata: the metadata to include with the invoice expirySecs: the expiry of the invoice in seconds. Default value is 86400 (1 day)
func (*LightsparkClient) CreateUmaInvoiceWithReceiverIdentifier ¶ added in v0.15.0
func (client *LightsparkClient) CreateUmaInvoiceWithReceiverIdentifier(nodeId string, amountMsats int64, metadata string, expirySecs *int32, signingPrivateKey *[]byte, receiverIdentifier *string, ) (*objects.Invoice, error)
CreateUmaInvoiceWithReceiverIdentifier creates a new invoice for the UMA protocol. The metadata is hashed and included in the invoice. This API generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment from another Lightning Node. This should only be used for generating invoices for UMA, with `create_invoice` preferred in the general case.
Args:
nodeId: the id of the node that should be paid amountMsats: the amount of the invoice in millisatoshis metadata: the metadata to include with the invoice expirySecs: the expiry of the invoice in seconds. Default value is 86400 (1 day) signingPrivateKey: the receiver's signing private key. Used to hash the receiver identifier. receiverIdentifier: optional identifier of the receiver. If provided, this will be hashed using a monthly-rotated seed and used for anonymized analysis.
func (*LightsparkClient) DecodePaymentRequest ¶
func (client *LightsparkClient) DecodePaymentRequest(encodedPaymentRequest string) (*objects.PaymentRequestData, error)
DecodePaymentRequest decodes the content of an encoded payment request into structured data that can be used by the client.
Args:
encodedPaymentRequest: The encoded payment request.
func (*LightsparkClient) DeleteApiToken ¶
func (client *LightsparkClient) DeleteApiToken(apiTokenId string) error
DeleteApiToken deletes an existing API token from this account.
Args:
apiTokenId: The id of the API token to delete.
func (*LightsparkClient) ExecuteGraphqlRequest ¶
func (client *LightsparkClient) ExecuteGraphqlRequest(document string, variables map[string]interface{}, ) (map[string]interface{}, error)
ExecuteGraphqlRequest executes a GraphQL request.
Args:
document: The GraphQL document that you want to execute. variables: The variables that you want to pass to the GraphQL document.
func (*LightsparkClient) FailHtlc ¶ added in v0.13.0
func (client *LightsparkClient) FailHtlc(invoiceId string, cancelInvoice bool) (*objects.FailHtlcsOutput, error)
func (*LightsparkClient) FetchIncomingPaymentsByInvoice ¶ added in v0.10.0
func (client *LightsparkClient) FetchIncomingPaymentsByInvoice(invoiceId string, statuses *[]objects.TransactionStatus, ) (*objects.IncomingPaymentsForInvoiceQueryOutput, error)
func (*LightsparkClient) FetchInvoiceByPaymentHash ¶ added in v0.13.0
func (client *LightsparkClient) FetchInvoiceByPaymentHash(paymentHash string) (*objects.Invoice, error)
func (*LightsparkClient) FetchOutgoingPaymentByIdempotencyKey ¶ added in v0.13.0
func (client *LightsparkClient) FetchOutgoingPaymentByIdempotencyKey(idempotencyKey string) (*objects.OutgoingPayment, error)
func (*LightsparkClient) FetchOutgoingPaymentsByInvoice ¶ added in v0.8.0
func (client *LightsparkClient) FetchOutgoingPaymentsByInvoice(encodedInvoice string, statuses *[]objects.TransactionStatus, ) (*objects.OutgoingPaymentsForInvoiceQueryOutput, error)
func (*LightsparkClient) FetchOutgoingPaymentsByPaymentHash ¶ added in v0.13.0
func (client *LightsparkClient) FetchOutgoingPaymentsByPaymentHash( paymentHash string, statuses *[]objects.TransactionStatus, ) (*[]objects.OutgoingPayment, error)
func (*LightsparkClient) FetchUmaInvitation ¶ added in v0.7.0
func (client *LightsparkClient) FetchUmaInvitation(invitationCode string) (*objects.UmaInvitation, error)
FetchUmaInvitation fetches an existing uma invitation by its code.
Args:
invitationCode: the code of the invitation
Returns:
*objects.UmaInvitation: the fetched invitation
func (*LightsparkClient) FundNode ¶
func (client *LightsparkClient) FundNode(nodeId string, amountSats int64) ( *objects.CurrencyAmount, error, )
FundNode adds funds to a Lightspark node on the REGTEST network. If the amount is not specified, 10,000,000 SATOSHI will be added. This API only functions for nodes created on the REGTEST network and will return an error when called for any non-REGTEST node.
Args:
nodeId: The id of the node to fund. amountSats: The amount of funds to add to the node, in SATOSHI.
func (*LightsparkClient) GetBitcoinFeeEstimate ¶
func (client *LightsparkClient) GetBitcoinFeeEstimate( bitcoinNetwork objects.BitcoinNetwork, ) (*objects.FeeEstimate, error)
GetBitcoinFeeEstimate returns an estimate of the fees of a transaction on the Bitcoin Network.
Args:
bitcoinNetwork: The Bitcoin network to use for the estimate.
func (*LightsparkClient) GetCurrentAccount ¶
func (client *LightsparkClient) GetCurrentAccount() (*objects.Account, error)
GetCurrentAccount returns the current connected account.
func (*LightsparkClient) GetEntity ¶
func (client *LightsparkClient) GetEntity(id string) (*objects.Entity, error)
GetEntity returns any `Entity`, identified by its unique ID.
Args:
id: The unique ID of the entity.
func (*LightsparkClient) GetLightningFeeEstimateForInvoice ¶
func (client *LightsparkClient) GetLightningFeeEstimateForInvoice(nodeId string, encodedInvoice string, amountMsats *int64, ) (*objects.LightningFeeEstimateOutput, error)
GetLightningFeeEstimateForInvoice returns an estimate of the fees that will be paid for a Lightning invoice.
Args:
nodeId: The node from where you want to send the payment encodedInvoice: The invoice you want to pay (as defined by the BOLT11 standard). amountMsats: If the invoice does not specify a payment amount, then the amount that you wish to pay, expressed in msats.
func (*LightsparkClient) GetLightningFeeEstimateForNode ¶
func (client *LightsparkClient) GetLightningFeeEstimateForNode(nodeId string, destinationNodePublicKey string, amountMsats int64, ) (*objects.LightningFeeEstimateOutput, error)
GetLightningFeeEstimateForNode returns an estimate of the fees that will be paid to send a payment to another Lightning node.
Args:
nodeId: The node from where you want to send the payment. destinationNodePublicKey: The public key of the node that you want to pay. amountMsats: The amount that you wish to pay, expressed in msats.
func (*LightsparkClient) GetNodeChannelUtxos ¶
func (client *LightsparkClient) GetNodeChannelUtxos(nodeId string) ([]string, error)
GetNodeChannelUtxos returns the utxos of all channels of a node.
Args: nodeId: The id of the node whose utxos will be fetched.
func (*LightsparkClient) GetWithdrawalFeeEstimate ¶ added in v0.8.0
func (client *LightsparkClient) GetWithdrawalFeeEstimate(nodeId string, amountSats int64, withdrawMode objects.WithdrawalMode, ) (*objects.WithdrawalFeeEstimateOutput, error)
func (*LightsparkClient) LoadNodeSigningKey ¶
func (client *LightsparkClient) LoadNodeSigningKey(nodeId string, loader SigningKeyLoader)
LoadNodeSigningKey loads the signing key of a node into the client.
Args:
nodeId: The ID of the node. loader: The SigningKeyLoader that can load the node's key.
func (*LightsparkClient) PayInvoice ¶
func (client *LightsparkClient) PayInvoice(nodeId string, encodedInvoice string, timeoutSecs int, maximumFeesMsats int64, amountMsats *int64, ) (*objects.OutgoingPayment, error)
PayInvoice sends a payment to a node on the Lightning Network, based on the invoice (as defined by the BOLT11 specification) that you provide. If you are in test mode, the invoice has to be generated by create_test_mode_invoice mutation.
Args:
nodeId: The node from where you want to send the payment. encodedInvoice: The invoice you want to pay (as defined by the BOLT11 standard). timeoutSecs: The number of seconds that you are willing to wait for the payment to complete. maximumFeesMsats: The maximum amount of fees that you are willing to pay for this payment, expressed in mSATs. amountMsats: The amount you will pay for this invoice, expressed in msats. It should ONLY be set when the invoice amount is zero.
func (*LightsparkClient) PayInvoiceWithIdempotencyKey ¶ added in v0.13.0
func (client *LightsparkClient) PayInvoiceWithIdempotencyKey(nodeId string, encodedInvoice string, timeoutSecs int, maximumFeesMsats int64, amountMsats *int64, idempotencyKey *string, ) (*objects.OutgoingPayment, error)
PayInvoiceWithIdempotencyKey sends a payment to a node on the Lightning Network, based on the invoice (as defined by the BOLT11 specification) that you provide. If you are in test mode, the invoice has to be generated by create_test_mode_invoice mutation.
Args:
nodeId: The node from where you want to send the payment. encodedInvoice: The invoice you want to pay (as defined by the BOLT11 standard). timeoutSecs: The number of seconds that you are willing to wait for the payment to complete. maximumFeesMsats: The maximum amount of fees that you are willing to pay for this payment, expressed in mSATs. amountMsats: The amount you will pay for this invoice, expressed in msats. It should ONLY be set when the invoice amount is zero. idempotencyKey: A unique key that identifies this payment request. If a payment with the same idempotency key has already been made, the same payment will be returned. This must be unique for each payment. If you do not have a specific idempotency requirement, you can pass nil or just use `PayInvoice`.
func (*LightsparkClient) PayUmaInvoice ¶
func (client *LightsparkClient) PayUmaInvoice(nodeId string, encodedInvoice string, timeoutSecs int, maximumFeesMsats int64, amountMsats *int64, ) (*objects.OutgoingPayment, error)
PayUmaInvoice sends an UMA payment to a node on the Lightning Network, based on the invoice (as defined by the BOLT11 specification) that you provide. This should only be used for paying UMA invoices, with `pay_invoice` preferred in the general case.
Args:
nodeId: The node from where you want to send the payment. encodedInvoice: The invoice you want to pay (as defined by the BOLT11 standard). timeoutSecs: The number of seconds that you are willing to wait for the payment to complete. maximumFeesMsats: The maximum amount of fees that you are willing to pay for this payment, expressed in mSATs. amountMsats: The amount you will pay for this invoice, expressed in msats. It should ONLY be set when the invoice amount is zero.
func (*LightsparkClient) PayUmaInvoiceWithSenderIdentifier ¶ added in v0.15.0
func (client *LightsparkClient) PayUmaInvoiceWithSenderIdentifier(nodeId string, encodedInvoice string, timeoutSecs int, maximumFeesMsats int64, amountMsats *int64, signingPrivateKey *[]byte, senderIdentifier *string, ) (*objects.OutgoingPayment, error)
PayUmaInvoice sends an UMA payment to a node on the Lightning Network, based on the invoice (as defined by the BOLT11 specification) that you provide. This should only be used for paying UMA invoices, with `pay_invoice` preferred in the general case.
Args:
nodeId: The node from where you want to send the payment. encodedInvoice: The invoice you want to pay (as defined by the BOLT11 standard). timeoutSecs: The number of seconds that you are willing to wait for the payment to complete. maximumFeesMsats: The maximum amount of fees that you are willing to pay for this payment, expressed in mSATs. amountMsats: The amount you will pay for this invoice, expressed in msats. It should ONLY be set when the invoice amount is zero. signingPrivateKey: the sender's signing private key. Used to hash the sender identifier. senderIdentifier: optional identifier of the sender. If provided, this will be hashed using a monthly-rotated seed and used for anonymized analysis.
func (*LightsparkClient) RegisterPayment ¶
func (client *LightsparkClient) RegisterPayment(provider objects.ComplianceProvider, paymentId string, nodePubkey string, direction objects.PaymentDirection, ) error
RegisterPayment registers a succeeded payment with a compliance provider. It should only be called if you have a Chainalysis API Key in settings.
Args:
provider: The provider that you want to use to register the payment. paymentId: The unique id of the payment. nodePubkey: The public key of the counterparty node which is the recipient node if the payment is an outgoing payment and the sender node if the payment is an incoming payment.
func (*LightsparkClient) RequestWithdrawal ¶
func (client *LightsparkClient) RequestWithdrawal(nodeId string, amountSats int64, bitcoinAddress string, withdrawalMode objects.WithdrawalMode, ) (*objects.WithdrawalRequest, error)
RequestWithdrawal withdraws funds from the account and sends it to the requested bitcoin address. Depending on the chosen mode, it will first take the funds from the wallet, and if applicable, close channels appropriately to recover enough funds. The process is asynchronous and may take up to a few minutes. You can check the progress by polling the `WithdrawalRequest` that is created, or by subscribing to a webhook.
Args:
nodeId: The node from which you'd like to make the withdrawal. amountSats: The amount you want to withdraw from this node in Satoshis. Use the special value -1 to withdrawal all funds from this node. bitcoinAddress: The bitcoin address where you want to receive the funds. withdrawalMode: The mode that will be used to withdraw the funds.
func (*LightsparkClient) RequestWithdrawalWithIdempotencyKey ¶ added in v0.13.0
func (client *LightsparkClient) RequestWithdrawalWithIdempotencyKey(nodeId string, amountSats int64, bitcoinAddress string, withdrawalMode objects.WithdrawalMode, idempotencyKey *string, ) (*objects.WithdrawalRequest, error)
RequestWithdrawalWithIdempotencyKey withdraws funds from the account and sends it to the requested bitcoin address. Depending on the chosen mode, it will first take the funds from the wallet, and if applicable, close channels appropriately to recover enough funds. The process is asynchronous and may take up to a few minutes. You can check the progress by polling the `WithdrawalRequest` that is created, or by subscribing to a webhook.
Args:
nodeId: The node from which you'd like to make the withdrawal. amountSats: The amount you want to withdraw from this node in Satoshis. Use the special value -1 to withdrawal all funds from this node. bitcoinAddress: The bitcoin address where you want to receive the funds. withdrawalMode: The mode that will be used to withdraw the funds. idempotencyKey: A unique key that identifies this withdrawal. If a withdrawal with the same idempotency key has already been made, the same WithdrawalRequest will be returned. This must be unique for each payment. If you do not have a specific idempotency requirement, you can pass nil or just use `RequestWithdrawal`.
func (*LightsparkClient) RequestWithdrawalWithIdempotencyKeyAndFee ¶ added in v0.14.0
func (client *LightsparkClient) RequestWithdrawalWithIdempotencyKeyAndFee(nodeId string, amountSats int64, bitcoinAddress string, withdrawalMode objects.WithdrawalMode, idempotencyKey *string, feeTarget *objects.OnChainFeeTarget, satsPerVbyte *int, ) (*objects.WithdrawalRequest, error)
RequestWithdrawalWithIdempotencyKeyAndFee withdraws funds from the account and sends it to the requested bitcoin address. Depending on the chosen mode, it will first take the funds from the wallet, and if applicable, close channels appropriately to recover enough funds. The process is asynchronous and may take up to a few minutes. You can check the progress by polling the `WithdrawalRequest` that is created, or by subscribing to a webhook.
Args:
nodeId: The node from which you'd like to make the withdrawal. amountSats: The amount you want to withdraw from this node in Satoshis. Use the special value -1 to withdrawal all funds from this node. bitcoinAddress: The bitcoin address where you want to receive the funds. withdrawalMode: The mode that will be used to withdraw the funds. idempotencyKey: A unique key that identifies this withdrawal. If a withdrawal with the same idempotency key has already been made, the same WithdrawalRequest will be returned. This must be unique for each payment. If you do not have a specific idempotency requirement, you can pass nil or just use `RequestWithdrawal`. feeTarget: The target of the fee that should be used when crafting the L1 transaction. You should only set `feeTarget` or `satsPerVByte`. If neither of them is set, default value of MEDIUM will be used as `feeTarget`. satsPerVByte: A manual fee rate set in sat/vbyte that should be used when crafting the L1 transaction. You should only set `feeTarget` or `satsPerVByte`
func (*LightsparkClient) ScreenNode ¶
func (client *LightsparkClient) ScreenNode( provider objects.ComplianceProvider, nodePubkey string, ) (*objects.RiskRating, error)
ScreenNode performs sanction screening on a lightning node against a given provider. It should only be called if you have a Chainalysis API Key in settings.
Args:
provider: The provider that you want to use to perform the screening. nodePubkey: The public key of the node that needs to be screened.
func (*LightsparkClient) SendPayment ¶
func (client *LightsparkClient) SendPayment(nodeId string, destinationPublicKey string, amountMsats int64, timeoutSecs int, maximumFeesMsats int64, ) (*objects.OutgoingPayment, error)
SendPayment sends a payment directly to a node on the Lightning Network through the public key of the node without an invoice.
Args:
nodeId: The node from where you want to send the payment. destinationPublicKey: The public key of the node that will receive the payment. amountMsats: The amount you will pay for this invoice, expressed in msats. timeoutSecs: The number of seconds that you are willing to wait for the payment to complete. maximumFeesMsats: The maximum amount of fees that you are willing to pay for this payment, expressed in mSATs.
func (*LightsparkClient) SetNodeSigningKey ¶ added in v0.7.4
func (client *LightsparkClient) SetNodeSigningKey(nodeId string, key requester.SigningKey)
SetNodeSigningKey directly sets the signing key of a node in the client.
Args:
nodeId: The ID of the node. key: The SigningKey of the node.
type Option ¶ added in v0.7.1
type Option func(*LightsparkClient)
func WithContext ¶ added in v0.13.0
WithContext allows using a context along the Lightspark client lifecycle.
func WithHTTPClient ¶ added in v0.7.1
WithHTTPClient sets the HTTPClient of the LightsparkClient requester.
type SigningKeyLoader ¶
type SigningKeyLoader struct {
// contains filtered or unexported fields
}
func NewSigningKeyLoaderFromNodeIdAndPassword ¶
func NewSigningKeyLoaderFromNodeIdAndPassword(nodeId string, password string) *SigningKeyLoader
NewSigningKeyLoaderFromNodeIdAndPassword creates a new SigningKeyLoader from a node ID and password. This cannot be used if you are using remote signing. It is used to recover an RSA operation signing key using the password you chose when setting up your node. For REGTEST nodes, the password is "1234!@#$".
func NewSigningKeyLoaderFromRsaPrivateKey ¶
func NewSigningKeyLoaderFromRsaPrivateKey(rsaPrivateKeyBytes []byte) *SigningKeyLoader
NewSigningKeyLoaderFromRsaPrivateKey creates a new SigningKeyLoader from a raw RSA private key.
func NewSigningKeyLoaderFromSignerMasterSeed ¶
func NewSigningKeyLoaderFromSignerMasterSeed(masterSeedBytes []byte, network objects.BitcoinNetwork) *SigningKeyLoader
NewSigningKeyLoaderFromSignerMasterSeed creates a new SigningKeyLoader from a master seed and network. This should be used if you are using remote signing, rather than an RSA operation signing key.
func (*SigningKeyLoader) LoadSigningKey ¶
func (s *SigningKeyLoader) LoadSigningKey(req requester.Requester) (requester.SigningKey, error)