Do you have a website? Nice! Let your users connect xBull Wallet with your website, each version of xBull (extension, mobile and website) has its own way to communicate so to avoid the pain of needing to integrate all of them, we have developed a library that will help you and make your life easier when interacting with our wallet.

Install the library

You can add the library to your project by installing it with NPM:

npm i --save github:Creit-Tech/xBull-Wallet-Connect

You might be asking why do we use Github instead of NPM, well that’s because this way you can check the code before intalling it which in our view is safer.

We recommend you using version tags when installing the library, this way you have control when doing an npm i

The xBullWalletConnect Class

Yes, we know most people recommend that Classes start with capital case but… That’s how we do it. First you need to create a new instance of the class by doing:

const bridge = new xBullWalletConnect();

This will generate an object with internal events handlers and keys needed to talk with the xBull Wallet. It’s better if you create a new bridge for each connection, each time the bridge is created it has a new keypair and session id, this helps in avoiding receiving messages from unwanted parties.

NOTE: Each time you create a new bridge, we set observables and events handlers for the instance so is important you close them after you have used the bridge. More about this at the end of this guide

The xBullWalletConnect constructor accepts an optional object where you can specify the options for this instance:

interface ISDKConstructor {
  url?: string;
  preferredTarget?: 'extension' | 'website'; // Default is extension

Connect with xBull Wallet

const publicKey = await bridge.connect();

Connecting to the wallet means requesting the public key selected by the user, this method will also check if the extension is available in the browser and if is not it will automatically launch the webapp version.

Sign a transaction

const signedXDR = await bridge.sign({
  xdr: "XDR_TO_SIGN"

This method will launch the wallet and request the user to sign the transaction, after it’s confirmed it will return a string which is the signed XDR. If you want you can specify which user and network should be used to sign the transaction:

interface ISignParams {
  xdr: string;
  publicKey?: string;
  network?: string;

NOTE: When specifying the account or the network, both values must be supplied.

Close the connection

Once you have completed interacting with the wallet, you should close the connection by doing this:


If you don’t do this the next time we create a new bridge we could have unexpected behaviour because old listener will still be in memory.