It is easy to set up and start using Horizon Javascript SDK:

import {
} from '@imtbl/wallet-sdk-web';

(async () => {
  // Builds the Wallet SDK object
  const sdk = await HorizonWalletSDK.build({
    env: ENV.SANDBOX,
    chainID: 56, // Visit https://chainlist.org/ for more information

  // Connects on the chosen provider - Metamask
  const walletConnection = await sdk.connect({ provider: PROVIDERS.METAMASK });

  // get the current account from walletConnection
  const accounts = await walletConnection.getAccounts();
  const currentAccount = accounts[0];
  // define the data to be signed
  const message = "Hello, world!";
  // sign the data with HorizonWalletSDK
  const signature = await walletConnection.sign(message, currentAccount, '');
  // We will use signature to make requests to the Horizon Node SDK

Last updated