# By developers, for developers

Do you have a website? Nice! Let your users use xBull Wallet with your website, the process is easy and the wallet has an SDK built into it.

The first thing you need to do before trying to talk with the Wallet is always checking if the object xBullSDK is available, this means your customer has the wallet installed in its browser.


# Requesting connection

const permissions = await xBullSDK.connect({
  canRequestPublicKey: true,
  canRequestSign: true
});

By default xBull Wallet denies every request from a website which the user hasn't approved yet so the connect() function is the first function you will need to call when interacting to the wallet.

This wallet requires an object as a parameter with the permissions you're requesting the user to accept. Currently these are the supported ones:

  • canRequestPublicKey
  • canRequestSign

The response from this method is an object with the permissions the site has with the wallet.

We recommend you to always use this function before doing other requests, users of xBull Wallet can remove sites' connections if they want.


# Get Public Key

const publicKey = await xBullSDK.getPublicKey();

If you need to get the public key of the active account from the user, you will need to use getPublicKey() method. This method returns a Promise with an string which is the public key.


# Request signing a transaction

const signedTransaction = await xBullSDK.signXDR('XDR STRING HERE');

Like the name of the method says, signXDR() method should be used when you need that the user signs a transaction. This method returns a Promise with an string value, this value is the signed XDR.

This function also accepts an object as a second parameter, this second parameter is optional. This object looks like this:

{
    publicKey: 'PUBLIC_KEY',
    network: 'NETWORK_PASSPHRASE'
}

We are constantly updating the SDK, keep in mind this and try to always have your code updated so your users can use the latest features from our wallet with your website.