LightsparkFuturesWalletClient
Main entry point for the Lightspark SDK using the Java Futures API.
This client is meant to be used in Java codebases that do not support Kotlin coroutines.
// Initialize the client with oauth:
OAuthHelper oAuthHelper = new OAuthHelper(applicationContext);
LightsparkFuturesWalletClient lightsparkClient = new LightsparkFuturesWalletClient(new ClientConfig(
authProvider = new OAuthProvider(oAuthHelper)
));
// An example API call fetching the dashboard info for the active account:
WalletDashboard dashboard = lightsparkClient.getWalletDashboard().get(5, TimeUnit.SECONDS);
Note: This client object keeps a local cache in-memory, so a single instance should be reused throughout the lifetime of your app.
Functions
Creates an L1 Bitcoin wallet address which can be used to deposit or withdraw funds from the Lightning wallet.
Creates a lightning invoice for the current wallet.
Decode a lightning invoice to get its details included payment amount, destination, etc.
Deploys a wallet in the Lightspark infrastructure. This is an asynchronous operation, the caller should then poll the wallet frequently (or subscribe to its modifications). When this process is over, the Wallet status will change to DEPLOYED
(or FAILED
).
Executes a raw graphql query against the server.
Get the L1 fee estimate for a deposit or withdrawal.
Gets an estimate of the fees that will be paid for a Lightning invoice.
Returns an estimate of the fees that will be paid to send a payment to another Lightning node.
Get the dashboard overview for a Lightning wallet. Includes balance info and the most recent transactions and payment requests.
Initializes a wallet in the Lightspark infrastructure and syncs it to the Bitcoin network. This is an asynchronous operation, the caller should then poll the wallet frequently (or subscribe to its modifications). When this process is over, the Wallet status will change to READY
(or FAILED
).
Unlocks the wallet for use with the SDK for the current application session. This function must be called before any other functions that require wallet signing keys, including payInvoice.
Login using the Custom JWT authentication scheme described in our documentation.
Pay a lightning invoice from the current wallet.
Withdraws funds from the account and sends it to the requested bitcoin address.
Sends a payment directly to a node on the Lightning Network through the public key of the node without an invoice.
Override the auth token provider for this client to provide custom headers on all API calls.
Removes the wallet from Lightspark infrastructure. It won't be connected to the Lightning network anymore and its funds won't be accessible outside of the Funds Recovery Kit process.