AKKA Finance
  • 🏠Getting Started
    • 🌟Why AKKA?
    • ❓What is AKKA?
  • AKKA API
    • 👷Introduction
    • 🌐Quick start
    • ⚙️Swagger
    • 3️⃣Use API endpoints of AKKA
    • ↗️Example
  • Smart Contracts
Powered by GitBook
On this page
  1. Install AKKA JS SDK

Set up the SDK

After you have installed the SDK, you first need to set it up.

Last updated 1 year ago

To get started, you have to instantiate and configure the AKKA SDK:

import { AKKA } from '@akkafinance/sdk'
const akka = new AKKA({})

// or

const { AKKA } = require("@akkafinance/sdk")
const akka = new AKKA({})

The optional config parameter can be used to pass custom configuration to the SDK (Currently, only api url can be customized, but in the near future, many personal settings can be made):

type ConfigUpdate = {
  apiUrl: string
}

The apiUrl defines which backend should be called. This only has to be edited when accessing a dedicated API endpoint.

If you are interested in a dedicated API endpoint for your service, reach out via our or file an issue in our repository .

Node.js Compatibility

SDK uses native Fetch API and in Node.js 16 and lower versions fetch is not natively included, so it needs to be added manually. To provide access to Fetch API you need to patch global object using or .

Here is an using cross-fetch:

import fetch, { Headers, Request, Response } from 'cross-fetch'

if (!globalThis.fetch) {
  const globalThisAny: any = globalThis
  globalThisAny.fetch = fetch
  globalThisAny.Headers = Headers
  globalThisAny.Request = Request
  globalThisAny.Response = Response
}
2️⃣
Discord
here
node-fetch
cross-fetch
example