
Perform operations over the Lightning Network
These queries & mutations can be used to send and receive payments from any other Lightning Network enabled wallet on the Bitcoin network. The operations are generally divided into “with amount” and “no amount” operations.
Queries/mutations #
-
Invoices
An authenticated user can create both “with amount” and “no amount” invoices to receive funds over lightning against. An unauthenticated user (anyone really) can create invoices on behalf of other users on the instance.
- Create “with amount” invoice for authenticated user
mutation lnInvoiceCreateInput($input: LnInvoiceCreateInput!) { lnInvoiceCreate(input: $input) { invoice { paymentRequest paymentHash paymentSecret satoshis } errors { message } } }
Variables:
{ "input": { "walletId": "<walletId>", "amount": <number>, "memo": "<memo>" } }
- Create “no amount” invoice for authenticated user
mutation lnNoAmountInvoiceCreate($input: LnNoAmountInvoiceCreateInput!) { lnNoAmountInvoiceCreate(input: $input) { invoice { paymentRequest paymentHash paymentSecret } errors { message } } }
Variables:
{ "input": { "walletId": "", "memo": "Test" } }
- Create “with amount” invoice on behalf of another user. The user would
need to query the target user’s “default walletId” to include.
mutation lnInvoiceCreateOnBehalfOfRecipient($input: LnInvoiceCreateOnBehalfOfRecipientInput!) { lnInvoiceCreateOnBehalfOfRecipient(input: $input) { errors { message } invoice { paymentRequest paymentHash paymentSecret } } }
Variables:
{ "input": { "amount": 10, "memo": "<memo>", "recipientWalletId": "<walletId>" } }
- Create “no amount” invoice on behalf of another user. The user would need to query the target user’s “default walletId” to include.
mutation lnNoAmountInvoiceCreateOnBehalfOfRecipient($input: LnNoAmountInvoiceCreateOnBehalfOfRecipientInput!) { lnNoAmountInvoiceCreateOnBehalfOfRecipient(input: $input) { errors { message } invoice { paymentRequest paymentHash paymentSecret } } }
Variables:
{ "input": { "memo": "memo", "recipientWalletId": "<walletId>" } }
- Create “with amount” invoice for authenticated user
-
Payments
An authenticated user can use the following mutations to query the fees for a given invoice and to also pay the invoice. Both “with amount” and “no amount” invoice are supoported.
- Probe fee for a “with amount” invoice
mutation lnInvoiceFeeProbe($input: LnInvoiceFeeProbeInput!) { lnInvoiceFeeProbe(input: $input) { errors { message } amount } }
Variables:
{ "input": { "paymentRequest": "<payment request>", "walletId": "<walletId>" } }
- Pay a “with amount” invoice from user’s authenticated balance
mutation lnInvoicePaymentSend($input: LnInvoicePaymentInput!) { lnInvoicePaymentSend(input:$input) { status errors { message } } }
Variables:
{ "input": { "walletId": "<walletId>", "paymentRequest": "<payment request>", "memo": "<memo>" } }
- Probe fee for a “no amount” invoice
mutation LnNoAmountInvoiceFeeProbe($input: LnNoAmountInvoiceFeeProbeInput!) { lnNoAmountInvoiceFeeProbe(input: $input) { errors { message } amount } }
Variables:
{ "input": { "paymentRequest": "<payment request>", "amount": <amount>, "walletId": "<walletId>" } }
- Pay a “no amount” invoice from user’s authenticated balance
mutation lnNoAmountInvoicePaymentSend($input: LnNoAmountInvoicePaymentInput!) { lnNoAmountInvoicePaymentSend(input:$input) { status errors { message } } }
Variables:
{ "input": { "walletId": "<walletId>", "paymentRequest": "<payment request>", "amount": <amount>, "memo": "<memo>" } }
- Probe fee for a “with amount” invoice