Skip to main content

AppNodeRunApi

Trait AppNodeRunApi 

Source
pub trait AppNodeRunApi {
Show 36 methods // Required methods async fn node_info(&self) -> Result<NodeInfo, 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 preflight_open_channel( &self, req: PreflightOpenChannelRequest, ) -> Result<PreflightOpenChannelResponse, NodeApiError>; async fn close_channel( &self, req: CloseChannelRequest, ) -> Result<Empty, NodeApiError>; async fn preflight_close_channel( &self, req: PreflightCloseChannelRequest, ) -> Result<PreflightCloseChannelResponse, NodeApiError>; async fn create_invoice( &self, req: CreateInvoiceRequest, ) -> Result<CreateInvoiceResponse, NodeApiError>; async fn pay_invoice( &self, req: PayInvoiceRequest, ) -> Result<PayInvoiceResponse, NodeApiError>; async fn preflight_pay_invoice( &self, req: PreflightPayInvoiceRequest, ) -> Result<PreflightPayInvoiceResponse, NodeApiError>; async fn create_offer( &self, req: CreateOfferRequest, ) -> Result<CreateOfferResponse, NodeApiError>; async fn pay_offer( &self, req: PayOfferRequest, ) -> Result<PayOfferResponse, NodeApiError>; async fn preflight_pay_offer( &self, req: PreflightPayOfferRequest, ) -> Result<PreflightPayOfferResponse, NodeApiError>; async fn get_address(&self) -> Result<GetAddressResponse, NodeApiError>; async fn pay_onchain( &self, req: PayOnchainRequest, ) -> Result<PayOnchainResponse, NodeApiError>; async fn preflight_pay_onchain( &self, req: PreflightPayOnchainRequest, ) -> Result<PreflightPayOnchainResponse, 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_payment_note( &self, req: UpdatePaymentNote, ) -> Result<Empty, NodeApiError>; async fn get_revocable_clients( &self, req: GetRevocableClients, ) -> 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<HumanBitcoinAddress, NodeApiError>; async fn update_human_bitcoin_address( &self, req: UsernameStruct, ) -> Result<HumanBitcoinAddress, 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>; // Provided methods async fn get_payment_address( &self, ) -> Result<HumanBitcoinAddress, NodeApiError> { ... } async fn update_payment_address( &self, req: UsernameStruct, ) -> Result<HumanBitcoinAddress, NodeApiError> { ... }
}
Expand description

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

Required Methods§

Source

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

GET /app/node_info Empty -> NodeInfo

Source

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

GET /app/list_channels Empty -> ListChannelsResponse

Source

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

POST /app/sign_message SignMsgRequest -> SignMsgResponse

Introduced in node-v0.6.5.

Source

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

POST /app/verify_message VerifyMsgRequest -> VerifyMsgResponse

Introduced in node-v0.6.5.

Source

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

POST /app/open_channel OpenChannelRequest -> OpenChannelResponse

Opens a channel to the LSP.

Source

async fn preflight_open_channel( &self, req: PreflightOpenChannelRequest, ) -> Result<PreflightOpenChannelResponse, NodeApiError>

POST /app/preflight_open_channel PreflightOpenChannelRequest -> PreflightOpenChannelResponse

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

Source

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

POST /app/close_channel CloseChannelRequest -> Empty

Closes a channel to the LSP.

Source

async fn preflight_close_channel( &self, req: PreflightCloseChannelRequest, ) -> Result<PreflightCloseChannelResponse, NodeApiError>

POST /app/preflight_close_channel PreflightCloseChannelRequest -> PreflightCloseChannelResponse

Estimate the on-chain fees required for a close_channel.

Source

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

POST /app/create_invoice CreateInvoiceRequest -> CreateInvoiceResponse

Source

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

POST /app/pay_invoice PayInvoiceRequest -> PayInvoiceResponse

Source

async fn preflight_pay_invoice( &self, req: PreflightPayInvoiceRequest, ) -> Result<PreflightPayInvoiceResponse, NodeApiError>

POST /app/preflight_pay_invoice PreflightPayInvoiceRequest -> PreflightPayInvoiceResponse

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 /app/create_offer CreateOfferRequest -> CreateOfferResponse

Create a new Lightning offer (BOLT12).

Source

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

POST /app/pay_offer PayOfferRequest -> PayOfferResponse

Pay a Lightning offer (BOLT12).

Source

async fn preflight_pay_offer( &self, req: PreflightPayOfferRequest, ) -> Result<PreflightPayOfferResponse, NodeApiError>

POST /app/preflight_pay_offer PreflightPayOfferRequest -> PreflightPayOfferResponse

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_address(&self) -> Result<GetAddressResponse, NodeApiError>

POST /app/get_address Empty -> GetAddressResponse

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 /app/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 preflight_pay_onchain( &self, req: PreflightPayOnchainRequest, ) -> Result<PreflightPayOnchainResponse, NodeApiError>

POST /app/preflight_pay_onchain PreflightPayOnchainRequest -> PreflightPayOnchainResponse

Returns estimated network fees for a potential onchain payment.

Source

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

GET /app/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 PaymentCreatedIndexs. 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 /app/payments/updated GetUpdatedPayments -> VecBasicPaymentV2

Source

async fn update_payment_note( &self, req: UpdatePaymentNote, ) -> Result<Empty, NodeApiError>

PUT /app/payments/note UpdatePaymentNote -> Empty

Source

async fn get_revocable_clients( &self, req: GetRevocableClients, ) -> Result<RevocableClients, NodeApiError>

Lists all revocable clients.

GET /app/clients GetRevocableClients -> 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 /app/clients CreateRevocableClientRequest -> CreateRevocableClientResponse

Source

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

Updates this revocable client. Returns the updated client.

PUT /app/clients UpdateClientRequest -> UpdateClientResponse

Source

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

List all broadcasted transactions.

GET /app/list_broadcasted_txs Empty -> Vec<BroadcastedTxInfo>

Source

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

Get the current status of Node backup.

GET /app/backup Empty -> BackupInfo

Source

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

Setup GDrive backup.

POST /app/backup/gdrive SetupGDrive -> Empty

Source

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

Get current user’s human Bitcoin address.

GET /app/human_bitcoin_address Empty -> HumanBitcoinAddress

Source

async fn update_human_bitcoin_address( &self, req: UsernameStruct, ) -> Result<HumanBitcoinAddress, NodeApiError>

Update current user’s human Bitcoin address.

PUT /app/human_bitcoin_address UsernameStruct -> HumanBitcoinAddress

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 /app/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 /app/nwc_clients CreateNwcClientRequest -> CreateNwcClientResponse

Source

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

Update an existing NWC client’s label.

PUT /app/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 /app/nwc_clients NostrPkStruct -> Empty

Provided Methods§

Source

async fn get_payment_address(&self) -> Result<HumanBitcoinAddress, NodeApiError>

👎Deprecated:

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

GET /app/payment_address Empty -> HumanBitcoinAddress

Source

async fn update_payment_address( &self, req: UsernameStruct, ) -> Result<HumanBitcoinAddress, NodeApiError>

👎Deprecated:

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

PUT /app/payment_address UsernameStruct -> HumanBitcoinAddress

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§