Kana Labs
  • Getting Started
    • Welcome to Kana Labs
  • CROSS CHAIN SWAPS
    • AMM DEX Aggregator
  • INTEGRATE KANA WIDGET
    • Kana Widget
      • Install Widget
      • Configure Widget
      • Configure Aptos Keyless
  • Web3 Aggregator SDK
    • Web3 Aggregator SDK
      • Installation
      • SameChain
      • Cross Chain Swap
      • Aggregator API's
  • SPOT TRADING PLATFORM
    • Kana Trade
      • API Docs
  • PERPETUAL FUTURES
    • Kana Perps
      • Getting Started
        • Mint Tokens on Testnet
      • Breaking Down Kana Perps
        • Assets Supported
        • Order Types
        • Orderbook
        • Funding Rate
        • Leverage
        • Margin and Liquidation
        • Hedge Mode
          • Hedging a Short-Term 2-3% Price Decline
          • Dual Positioning for Flexible Profit-Taking
        • Trading Fees
      • API Docs
        • Installation Setup
        • Kana Perps Typescript REST API
        • Kana Perps Python Websocket API
        • Kana Perps Python REST API
        • Steps to place an order
        • Perps Contract Error Codes
        • Websocket Connection
        • Supported Markets
    • Perpetual Exchange(2)
      • Technical Architecture
      • Features
        • 1-Click Trading in Kana Perps
        • Delegation
      • Tutorials
        • Getting Started
        • Connecting Wallet & Enabling “One Click Transaction”
        • Deposit & Withdraw Tokens
        • Placing a Market Trade Order
        • Placing a Limit Trade Order
        • Partially & Fully Closing a Live Trade Order
        • Adding Margin to an Open Position
        • Defining Take Profit & Stop Loss
      • For Developers & MMs
        • Installation setup
        • Available Markets
        • Integrating REST APIs
          • Typescript
          • Python
          • Walkthrough
        • Integrating WebSockets
        • FAQ
          • Faucets
  • SPOT & PERP APIs
    • Trading APIs
      • Kana Trade API
      • Kana Perps API
        • Installation Setup
        • Example setup functions
        • Kana Perps Typescript REST API
        • Kana Perps Websocket API
        • Kana Perps Python Websocket API
        • Kana Perps Python REST API
        • Steps to place an order
  • PAYMASTER SERVICE
    • Kana Paymaster For Aptos and Supra
      • How it works?
      • How to Register?
      • Deposit Allowance
      • Manage Users
      • Paymaster SDK Tutorial (Typescript)
      • Paymaster API
      • Module & Function Whitelist
      • Subscription - Coming soon
      • FAQS
  • PERPETUAL OPTIONS
    • OPerps
  • Tokenomics & Governance
    • Kana Labs Tokenomics
  • REWARDS & REFERRAL PROGRAM
    • Rewards Program
      • Reward Program Season 1
      • Reward Program Season 2
      • How to Keep Track of Your Points?
      • Where to find the Missions Dashboard?
  • Referral Program
    • How to Generate Referral Link? (For the Referrer)
    • How to map your wallet to the invite IDs? (For the invited users)
Powered by GitBook
On this page
  • Prerequisites
  • Installation
  • Aptos Client & Account Setup
  1. PERPETUAL FUTURES
  2. Perpetual Exchange(2)
  3. For Developers & MMs

Installation setup

Prerequisites

Before using the API, ensure you have the following installed:

  • Node.js (version 18 or higher)

  • npm (for package management)

Installation

Install required dependencies with these commands:

npm install dotenv axios @aptos-labs/ts-sdk

Aptos Client & Account Setup

Configure your TypeScript environment with this template:

// Import required packages
import dotenv from 'dotenv';
import axios from 'axios';
import { 
  AptosConfig, 
  Aptos, 
  Network, 
  Account, 
  Ed25519PrivateKey, 
  PrivateKeyVariants 
} from "@aptos-labs/ts-sdk";

// Load environment variables
dotenv.config();

// Initialize Aptos client
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);

// Configure account
const formattedPrivateKey = PrivateKey.formatPrivateKey(
  process.env.APTOS_PRIVATEKEY || '',
  'ed25519' as PrivateKeyVariants
);

const account = Account.fromPrivateKey({
  privateKey: new Ed25519PrivateKey(formattedPrivateKey),
});
PreviousFor Developers & MMsNextAvailable Markets

Last updated 1 month ago