LightsparkCoroutinesWalletClient
Main entry point for the Lightspark Wallet SDK.
// Initialize the client with account token info:
val oAuthHelper = OauthHelper(applicationContext)
val lightsparkClient = LightsparkCoroutinesWalletClient(ClientConfig(
authProvider = OAuthProvider(oAuthHelper)
))
// An example API call fetching the dashboard info for the active account:
val dashboard = lightsparkClient.getWalletDashboard()
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 from 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
).
Deploys a wallet in the Lightspark infrastructure and triggers updates as state changes. This is an asynchronous operation, which will continue sending the wallet state updates until the Wallet status changes 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
).
Initializes a wallet in the Lightspark infrastructure and syncs it to the Bitcoin network and triggers updates as state changes. This is an asynchronous operation, which will continue sending the wallet state updates until the Wallet status changes 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.
Unlocks the wallet for use with the SDK for the current application session by specifying a key alias in the KeyStore where the wallet's key is stored.
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.
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.