LogoLogo
  • Horizon Network
    • What is Horizon Network?
    • API Document
      • Horizon Network API
      • Quick Start
      • API Reference
        • Assets
        • Collections
        • Orders
        • Offers
        • Events
        • Statistics
        • Categories
        • Chains
        • Request an API key
    • SDKs Document
      • SDKs overview
      • NODE SDK
        • Installation
        • Initialization
        • Basic Example
          • Assets Management
          • Marketplace
        • Reference
          • Assets
          • Collections
          • Offers
          • Orders
          • Categories
          • Events
          • Statistics
          • Blockchain and Layer 2
      • JAVASCRIPT SDK
        • Overview
        • Installation
        • Quickstart
        • Reference
    • Launching NFT Collection
      • Launch A Collection
        • Overview
        • Part 1: Register as a user
        • Part 2: Deploy a smart contract
        • Part 3: Set creator earnings
        • Horizon Example Repository
      • Creating Your NFT Smart Contract
        • Overview
        • Getting Started
        • Setting a basic project
        • Minting from your new contract
        • Add your own NFT contract to Horizon Network
    • Horizon Network's Layer 2 Solution
      • Why Horizon Network?
      • Horizon Network's layer 2 Solutions
      • Basic Concepts
  • Horizon Land Metaverse
    • Feature
      • LAND in the metaverse
      • NFT Avatar
      • Horizon Center
      • Game Center
      • Shopping Center
      • Music Center
      • Play to Earn
      • Social Activities
      • Finance Center
      • Marketplace
      • Experience Mode
      • Zon Token
    • Stake Holder
      • Players
      • Creators
      • Land Owners
      • Partners
      • Investors
    • Economy
      • Revenue Stream
  • Technology
    • Blockchain
    • Product
    • System
    • Wallet
    • Security
    • Token
  • Tokenomic
  • Investor & Partner
  • Roadmap
  • Contact
  • Conclusion
  • Recommendation
  • FAQs
    • Policy
    • Terms of Use
Powered by GitBook
On this page
  1. Horizon Network
  2. SDKs Document
  3. JAVASCRIPT SDK

Quickstart

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

import {
  ENV,
  PROVIDERS,
  HorizonWalletSDK,
} 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
})();
PreviousInstallationNextReference

Last updated 2 years ago