Skip to main content

UserNodeRunApi

Trait UserNodeRunApi 

Source
pub trait UserNodeRunApi {
Show 37 methods // Required methods async fn node_info(&self) -> Result<NodeInfo, NodeApiError>; async fn debug_info(&self) -> Result<DebugInfo, NodeApiError>; async fn list_channels(&self) -> Result<ListChannelsResponse, NodeApiError>; async fn sign_message( &self, req: SignMsgRequest, ) -> Result<SignMsgResponse, NodeApiError>; async fn verify_message( &self, req: VerifyMsgRequest, ) -> Result<VerifyMsgResponse, NodeApiError>; async fn open_channel( &self, req: OpenChannelRequest, ) -> Result<OpenChannelResponse, NodeApiError>; async fn open_channel_preflight( &self, req: OpenChannelPreflightRequest, ) -> Result<OpenChannelPreflightResponse, NodeApiError>; async fn close_channel( &self, req: CloseChannelRequest, ) -> Result<Empty, NodeApiError>; async fn close_channel_preflight( &self, req: CloseChannelRequest, ) -> Result<CloseChannelPreflightResponse, NodeApiError>; async fn create_invoice( &self, req: CreateInvoiceRequest, ) -> Result<CreateInvoiceResponse, NodeApiError>; async fn pay_invoice( &self, req: PayInvoiceRequest, ) -> Result<PayInvoiceResponse, NodeApiError>; async fn pay_invoice_preflight( &self, req: PayInvoicePreflightRequest, ) -> Result<PayInvoicePreflightResponse, NodeApiError>; async fn create_offer( &self, req: CreateOfferRequest, ) -> Result<CreateOfferResponse, NodeApiError>; async fn pay_offer( &self, req: PayOfferRequest, ) -> Result<PayOfferResponse, NodeApiError>; async fn pay_offer_preflight( &self, req: PayOfferPreflightRequest, ) -> Result<PayOfferPreflightResponse, NodeApiError>; async fn get_next_unused_address( &self, ) -> Result<GetNextUnusedAddressResponse, NodeApiError>; async fn pay_onchain( &self, req: PayOnchainRequest, ) -> Result<PayOnchainResponse, NodeApiError>; async fn pay_onchain_preflight( &self, req: PayOnchainPreflightRequest, ) -> Result<PayOnchainPreflightResponse, NodeApiError>; async fn get_payment_by_id( &self, req: PaymentIdStruct, ) -> Result<MaybeBasicPaymentV2, NodeApiError>; async fn get_payments_by_indexes( &self, req: PaymentCreatedIndexes, ) -> Result<VecBasicPaymentV1, NodeApiError>; async fn get_new_payments( &self, req: GetNewPayments, ) -> Result<VecBasicPaymentV1, NodeApiError>; async fn get_updated_payments( &self, req: GetUpdatedPayments, ) -> Result<VecBasicPaymentV2, NodeApiError>; async fn update_personal_note( &self, req: UpdatePersonalNote, ) -> Result<Empty, NodeApiError>; async fn list_revocable_clients( &self, req: ListRevocableClients, ) -> Result<RevocableClients, NodeApiError>; async fn create_revocable_client( &self, req: CreateRevocableClientRequest, ) -> Result<CreateRevocableClientResponse, NodeApiError>; async fn update_revocable_client( &self, req: UpdateClientRequest, ) -> Result<UpdateClientResponse, NodeApiError>; async fn list_broadcasted_txs(&self) -> Result<Value, NodeApiError>; async fn backup_info(&self) -> Result<BackupInfo, NodeApiError>; async fn setup_gdrive( &self, req: SetupGDrive, ) -> Result<Empty, NodeApiError>; async fn get_human_bitcoin_address( &self, ) -> Result<GetHumanBitcoinAddressResponse, NodeApiError>; async fn get_human_bitcoin_address_v1( &self, ) -> Result<HumanBitcoinAddressV1, NodeApiError>; async fn upsert_custom_human_bitcoin_address( &self, req: UsernameStruct, ) -> Result<UpsertHumanBitcoinAddressResponse, NodeApiError>; async fn get_payment_address_v1( &self, ) -> Result<HumanBitcoinAddressV1, NodeApiError>; async fn list_nwc_clients( &self, ) -> Result<ListNwcClientResponse, NodeApiError>; async fn create_nwc_client( &self, req: CreateNwcClientRequest, ) -> Result<CreateNwcClientResponse, NodeApiError>; async fn update_nwc_client( &self, req: UpdateNwcClientRequest, ) -> Result<UpdateNwcClientResponse, NodeApiError>; async fn delete_nwc_client( &self, req: NostrPkStruct, ) -> Result<Empty, NodeApiError>;
}
Expand description

Defines the api that the node exposes to the user during normal operation.

Required Methods§

Source

async fn node_info(&self) -> Result<NodeInfo, NodeApiError>

GET /user/v2/node_info Empty -> NodeInfo

Source

async fn debug_info(&self) -> Result<DebugInfo, NodeApiError>

GET /user/v1/debug_info Empty -> DebugInfo

Source

async fn list_channels(&self) -> Result<ListChannelsResponse, NodeApiError>

GET /user/v1/list_channels Empty -> ListChannelsResponse

Source

async fn sign_message( &self, req: SignMsgRequest, ) -> Result<SignMsgResponse, NodeApiError>

POST /user/v1/sign_message SignMsgRequest -> SignMsgResponse

Introduced in node-v0.6.5.

Source

async fn verify_message( &self, req: VerifyMsgRequest, ) -> Result<VerifyMsgResponse, NodeApiError>

POST /user/v1/verify_message VerifyMsgRequest -> VerifyMsgResponse

Introduced in node-v0.6.5.

Source

async fn open_channel( &self, req: OpenChannelRequest, ) -> Result<OpenChannelResponse, NodeApiError>

POST /user/v1/open_channel OpenChannelRequest -> OpenChannelResponse

Opens a channel to the LSP.

Source

async fn open_channel_preflight( &self, req: OpenChannelPreflightRequest, ) -> Result<OpenChannelPreflightResponse, NodeApiError>

POST /user/v1/open_channel_preflight OpenChannelPreflightRequest -> OpenChannelPreflightResponse

Estimate on-chain fees required for an open_channel to the LSP.

Source

async fn close_channel( &self, req: CloseChannelRequest, ) -> Result<Empty, NodeApiError>

POST /user/v1/close_channel CloseChannelRequest -> Empty

Closes a channel to the LSP.

Source

async fn close_channel_preflight( &self, req: CloseChannelRequest, ) -> Result<CloseChannelPreflightResponse, NodeApiError>

POST /user/v1/close_channel_preflight CloseChannelPreflightRequest -> CloseChannelPreflightResponse

Estimate the on-chain fees required for a close_channel.

Source

async fn create_invoice( &self, req: CreateInvoiceRequest, ) -> Result<CreateInvoiceResponse, NodeApiError>

POST /user/v1/create_invoice CreateInvoiceRequest -> CreateInvoiceResponse

Source

async fn pay_invoice( &self, req: PayInvoiceRequest, ) -> Result<PayInvoiceResponse, NodeApiError>

POST /user/v1/pay_invoice PayInvoiceRequest -> PayInvoiceResponse

Source

async fn pay_invoice_preflight( &self, req: PayInvoicePreflightRequest, ) -> Result<PayInvoicePreflightResponse, NodeApiError>

POST /user/v1/pay_invoice_preflight PayInvoicePreflightRequest -> PayInvoicePreflightResponse

This endpoint lets the app ask its node to “pre-flight” a BOLT11 invoice payment without going through with the actual payment. We verify as much as we can, find a route, and get the fee estimates.

Source

async fn create_offer( &self, req: CreateOfferRequest, ) -> Result<CreateOfferResponse, NodeApiError>

POST /user/v1/create_offer CreateOfferRequest -> CreateOfferResponse

Create a new Lightning offer (BOLT12).

Source

async fn pay_offer( &self, req: PayOfferRequest, ) -> Result<PayOfferResponse, NodeApiError>

POST /user/v1/pay_offer PayOfferRequest -> PayOfferResponse

Pay a Lightning offer (BOLT12).

Source

async fn pay_offer_preflight( &self, req: PayOfferPreflightRequest, ) -> Result<PayOfferPreflightResponse, NodeApiError>

POST /user/v1/pay_offer_preflight PayOfferPreflightRequest -> PayOfferPreflightResponse

This endpoint lets the app ask its node to “pre-flight” a Lightning offer (BOLT12) payment without going through with the actual payment. We verify as much as we can, find a route, and get the fee estimates.

Source

async fn get_next_unused_address( &self, ) -> Result<GetNextUnusedAddressResponse, NodeApiError>

POST /user/v1/get_next_unused_address Empty -> GetNextUnusedAddressResponse

Returns an address which can be used to receive funds. It is unused unless there is an incoming tx and BDK hasn’t detected it yet.

Source

async fn pay_onchain( &self, req: PayOnchainRequest, ) -> Result<PayOnchainResponse, NodeApiError>

POST /user/v1/pay_onchain PayOnchainRequest -> PayOnchainResponse

Pay bitcoin onchain. If the address is valid and we have sufficient onchain funds, this will broadcast a new transaction to the bitcoin mempool.

Source

async fn pay_onchain_preflight( &self, req: PayOnchainPreflightRequest, ) -> Result<PayOnchainPreflightResponse, NodeApiError>

POST /user/v1/pay_onchain_preflight PayOnchainPreflightRequest -> PayOnchainPreflightResponse

Returns estimated network fees for a potential onchain payment.

Source

async fn get_payment_by_id( &self, req: PaymentIdStruct, ) -> Result<MaybeBasicPaymentV2, NodeApiError>

GET /user/v1/payments/id PaymentIdStruct -> MaybeBasicPaymentV2

Source

async fn get_payments_by_indexes( &self, req: PaymentCreatedIndexes, ) -> Result<VecBasicPaymentV1, NodeApiError>

👎Deprecated:

since app-v0.8.9+29 and sdk-sidecar-v0.3.1: Use get_payments_by_ids instead

POST /app/payments/indexes PaymentCreatedIndexes -> VecDbPaymentV1

Fetch a batch of payments by their [PaymentCreatedIndex]s. This is typically used by a mobile client to poll for updates on payments which it currently has stored locally as “pending”; the intention is to check if any of these payments have been updated.

Source

async fn get_new_payments( &self, req: GetNewPayments, ) -> Result<VecBasicPaymentV1, NodeApiError>

👎Deprecated:

since app-v0.8.9+29 and sdk-sidecar-v0.3.1: Use get_updated_payments instead

GET /app/payments/new GetNewPayments -> VecBasicPaymentV1

Source

async fn get_updated_payments( &self, req: GetUpdatedPayments, ) -> Result<VecBasicPaymentV2, NodeApiError>

GET /user/v1/payments/updated GetUpdatedPayments -> VecBasicPaymentV2

Source

async fn update_personal_note( &self, req: UpdatePersonalNote, ) -> Result<Empty, NodeApiError>

PUT /user/v1/payments/note UpdatePersonalNote -> Empty

Source

async fn list_revocable_clients( &self, req: ListRevocableClients, ) -> Result<RevocableClients, NodeApiError>

Lists all revocable clients.

GET /user/v1/clients ListRevocableClients -> RevocableClients

Source

async fn create_revocable_client( &self, req: CreateRevocableClientRequest, ) -> Result<CreateRevocableClientResponse, NodeApiError>

Creates a new revocable client. Returns the newly issued client cert.

POST /user/v1/clients CreateRevocableClientRequest -> CreateRevocableClientResponse

Source

async fn update_revocable_client( &self, req: UpdateClientRequest, ) -> Result<UpdateClientResponse, NodeApiError>

Updates this revocable client. Returns the updated client.

PUT /user/v1/clients UpdateClientRequest -> UpdateClientResponse

Source

async fn list_broadcasted_txs(&self) -> Result<Value, NodeApiError>

List all broadcasted transactions.

GET /user/v1/list_broadcasted_txs Empty -> Vec<BroadcastedTxInfo>

Source

async fn backup_info(&self) -> Result<BackupInfo, NodeApiError>

Get the current status of Node backup.

GET /user/v1/backup Empty -> BackupInfo

Source

async fn setup_gdrive(&self, req: SetupGDrive) -> Result<Empty, NodeApiError>

Setup GDrive backup.

POST /user/v1/backup/gdrive SetupGDrive -> Empty

Source

async fn get_human_bitcoin_address( &self, ) -> Result<GetHumanBitcoinAddressResponse, NodeApiError>

GET /user/v2/human_bitcoin_address Empty -> GetHumanBitcoinAddressResponse

Source

async fn get_human_bitcoin_address_v1( &self, ) -> Result<HumanBitcoinAddressV1, NodeApiError>

👎Deprecated:

since app-v0.9.11+49 and sdk-sidecar-v0.4.13: Use get_human_bitcoin_address instead

GET /app/human_bitcoin_address Empty -> HumanBitcoinAddressV1

Source

async fn upsert_custom_human_bitcoin_address( &self, req: UsernameStruct, ) -> Result<UpsertHumanBitcoinAddressResponse, NodeApiError>

PUT /user/v2/human_bitcoin_address UsernameStruct -> UpsertHumanBitcoinAddressResponse

Source

async fn get_payment_address_v1( &self, ) -> Result<HumanBitcoinAddressV1, NodeApiError>

👎Deprecated:

since app-v0.9.3 and sdk-sidecar-v0.4.2: Use get_human_bitcoin_address_v1 instead

GET /app/payment_address Empty -> HumanBitcoinAddressV1

Source

async fn list_nwc_clients(&self) -> Result<ListNwcClientResponse, NodeApiError>

List NWC clients for the current user. Returns client info without sensitive data (no connection strings).

GET /user/v1/nwc_clients Empty -> ListNwcClientResponse

Source

async fn create_nwc_client( &self, req: CreateNwcClientRequest, ) -> Result<CreateNwcClientResponse, NodeApiError>

Create a new NWC client. Generates new keys and returns the connection string.

POST /user/v1/nwc_clients CreateNwcClientRequest -> CreateNwcClientResponse

Source

async fn update_nwc_client( &self, req: UpdateNwcClientRequest, ) -> Result<UpdateNwcClientResponse, NodeApiError>

Update an existing NWC client’s label.

PUT /user/v1/nwc_clients UpdateNwcClientRequest -> UpdateNwcClientResponse

Source

async fn delete_nwc_client( &self, req: NostrPkStruct, ) -> Result<Empty, NodeApiError>

Delete an NWC client given its nostr client public key.

DELETE /user/v1/nwc_clients NostrPkStruct -> Empty

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§