Comment on page
➕
Adding accounts
Programmatically add new wallet connections and allow users to connect their account to Alby with a click of a button.
Albys extension APIs are provided via the
window.alby
object (very much like WebLN). You don't need to add any dependencies or packages to your project.async function addAccount(request: AddAccountRequest) : AddAccountResponse;
interface AddAccountRequest = {
name: string;
connector: string;
config: object;
}
interface AddAccountResponse = {
success: boolean;
error: string?;
}
The display name for the account you want to add to Alby. (this can be changed by users later on, but make sure to provide some recognizable name)
The parameters vary depending on the type of account you want to add. The following types are available:
citadel
*commando
(Core Lightning)eclair
galoy
kollider
lnbits
*lnc
(Lightning Node Connect)lnd
*lndhub
*
* Prefix the type with
native
if you want to connect via TOR (e.g. nativelnd
)The config contains credentials to connect to the users wallet, they differ by the connector you are trying to connect. Take a look into our repository, choose the connector you are about to add and look for the config object:
This should give you an idea of what parameters need to be provided. Feel free to reach out to us at [email protected] in case of any questions, we're happy to help!
await window.alby.enable();
const result = await window.alby.addAccount({
name: "⚡️ LNbits (legend.lnbits.com)",
connector: "lnbits",
config: {
"adminkey": "...",
"url": "https://legend.lnbits.com"
}
});


Last modified 3mo ago