Quick Start

Get up and running with UGTP in a few minutes. Install the SDK, connect to the protocol, and make your first API call.

Prerequisites

  • Node.js 18 or later
  • npm, yarn, or pnpm
  • A TypeScript project (recommended)

1. Install the SDK

Install the UGTP SDK from npm:

Terminal
npm install @ugtp/sdk

Or with yarn/pnpm:

yarn add @ugtp/sdk
# or
pnpm add @ugtp/sdk

2. Initialize the Client

Create a UGTP client instance connected to Avalanche mainnet:

src/ugtp.ts
import { UGTPClient } from '@ugtp/sdk'

// Initialize the UGTP client
const ugtp = new UGTPClient({
  chainId: 43114,                    // Avalanche C-Chain
  rpcUrl: 'https://api.avax.network/ext/bc/C/rpc',
  apiUrl: 'https://api.ugtp.net',    // UGTP REST API
})

export default ugtp

3. Basic Usage

Query protocol status, look up identities, and check contract state:

src/example.ts
import ugtp from './ugtp'

async function main() {
  // Check protocol health
  const health = await ugtp.api.getHealth()
  console.log('Protocol status:', health.status)

  // Get protocol version
  const version = await ugtp.api.getVersion()
  console.log('Protocol version:', version.protocol)

  // List supported chains
  const chains = await ugtp.api.getChains()
  console.log('Supported chains:', chains)

  // Get contract addresses
  const contracts = await ugtp.api.getContracts()
  console.log('Contracts:', contracts)

  // Get current fee configuration
  const fees = await ugtp.api.getFees()
  console.log('Fees:', fees)
}

main().catch(console.error)

4. Check Contract Status via API

You can also interact with the UGTP REST API directly. Here is how to check the protocol health using curl:

PowerShell
curl.exe -s #a5d6ff">"https://api.ugtp.net/api/health"

Example response:

Response
{
  "status": "healthy",
  "timestamp": "2025-06-15T12: 00: 00.000Z",
  "uptime": 86400
}

Check the deployed contract addresses:

PowerShell
curl.exe -s #a5d6ff">"https://api.ugtp.net/api/contracts"

Next Steps