Getting Started
Quick Start
This guide shows how to authenticate with the Ekiden TypeScript SDK and make your first API request.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import {
Account,
Ed25519PrivateKey,
EkidenClient,
TESTNET,
} from "@ekidenfi/ts-sdk";
const ekiden = new EkidenClient(TESTNET);
const privateKey = new Ed25519PrivateKey(process.env.PRIVATE_KEY!);
const account = Account.fromPrivateKey({ privateKey });
const timestamp_ms = Date.now();
const nonce = Math.random().toString(36).slice(2);
const message = `AUTHORIZE|${timestamp_ms}|${nonce}`;
const signature = account
.sign(new TextEncoder().encode(message))
.toString();
const { token } = await ekiden.user.authorize({
public_key: account.publicKey.toString(),
timestamp_ms,
nonce,
signature,
});
ekiden.setToken(token);
const markets = await ekiden.market.getMarkets();
const balance = await ekiden.account.getBalance();
const positions = await ekiden.position.getPositionInfo({
sub_account_address: "0x...",
symbol: "BTC-USDCx",
});