Skip to main content
The @token-layer/sdk-typescript package wraps POST /token-layer and POST /info with typed request builders, auth helpers, and generated OpenAPI types.

Install

Quick start

Authentication modes

  • jwt: server-side automation with a bearer token
  • apiKey: direct API key authentication
  • wallet: EIP-712 signing flows for wallet-authenticated actions such as register and signed createToken

Wallet auth example

Common methods

Actions

  • action.register(params?)
  • action.createToken(params)
  • action.tradeToken(params)
  • action.sendTransaction(params)
  • action.transferToken(params)
  • action.claimRewards(params)
  • action.createReferralCode(params)
  • action.enterReferralCode(params)
  • action.mintUsd(params) for testnet flows

Info

  • info.getTokensV2(params)
  • info.quoteToken(params)
  • info.me(params?)
  • info.getPoolData(params)
  • info.getUserBalance(params)
  • info.searchToken(params)
  • info.checkTokenOwnership(params)
  • info.getUserFees(params?)
  • info.getUserFeeHistory(params?)
  • info.getLeaderboard(params?)
  • info.getUserPortfolio(params?)

Builder defaults

Set builder attribution once and let the SDK inject it when the per-call payload does not provide one:
This affects:
  • action.createToken
  • info.getTokensV2
Explicit per-call values still win.

Auth switching

If you need the same client configuration with different auth contexts:

Error handling

Requests throw TokenLayerApiError with:
  • status
  • code
  • message
  • details

Local development in this repo

The generated types come from the repo-wide OpenAPI spec published in this docs site.

Examples

Example scripts live in packages/sdk-typescript/examples for:
  • token creation
  • trading
  • transfers
  • referral actions
  • token search and pool reads
  • fee, leaderboard, and portfolio reads