# Demo

# Generic

This example illustrates a case when you want to allow users to transact to their own personal wallets.

const options = {apiKey: 'test-api-key-007'};
 const widget = new XanPoolWidget(
        options, document.getElementById("root"), onWidgetEvent
 );
 widget.init();

# Pre defined destination wallet

This example illustrates a case when you want to specify destination wallet for buying transactions. In this case a user won't be given a choice to specify his wallet.

const options = {
  apiKey: 'test-api-key-007', 
  wallet: 'bc1qnvl4yza8a306tacuw69lqk8xx5w5rxxycklzwc', 
  cryptoCurrency: 'btc'
  transactionType: 'buy'  
};
const widget = new XanPoolWidget(
    options, document.getElementById("root"), onWidgetEvent
);
widget.init();

# Automatic selling

This example illustrates a case when you want to initiate selling(a user won't be asked to send crypto funds to XanPool deposit address), but rather the developer should initiate upon receiving transaction-created event.

const options = {
  apiKey: 'test-api-key-007', 
  autoSelling: true, 
  cryptoCurrency: 'btc', 
  transactionType: 'sell'
};
const container = document.getElementById("root");
initXanPoolWidget(options, container, (event) => {}));