> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tayho.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Connect to Tayho development, validate the deployment, and perform an authenticated market read.

# Quickstart

This guide creates a provider-neutral Tayho client, validates the development deployment, and reads
the current markets. It performs no transaction and needs no wallet.

## Before you begin

You need:

* Bun, Node.js, or another modern JavaScript runtime with `fetch`.
* A Tayho development API key. Keys are created by Tayho operators on request; there is no public
  key-creation endpoint.
* The development-preview `@tayho/sdk` package supplied with your integration or available in this
  monorepo. A public npm release is not currently advertised.

<Note>
  Browser applications use an origin-restricted publishable key beginning with `th_pk_`. A secret
  key beginning with `th_sk_` is server-only and must never be bundled into client code.
</Note>

## 1. Install the SDK

Inside this monorepo, install the workspace and import `@tayho/sdk` normally:

```bash theme={null}
bun install
```

For an external integration, install the approved package artifact provided by Tayho. Do not depend
on an unverified package using the same name.

## 2. Create a client

```ts theme={null}
import { createTayhoClient } from "@tayho/sdk";

const client = createTayhoClient({
  environment: "development",
  apiKey: "th_pk_example",
});
```

The development client uses `https://api.testnet.tayho.io` unless `apiUrl` is explicitly
overridden. Overrides must use HTTPS except for `localhost` and `127.0.0.1`.

## 3. Validate the deployment

```ts theme={null}
const configuration = await client.configuration();

console.log(configuration.deployment.chainId);
console.log(configuration.deployment.contracts);
console.log(configuration.sdk.relayedActions);
```

`configuration()` verifies that the API environment matches the requested environment. When an RPC
reader is configured, it also verifies the RPC chain before returning.

## 4. Read markets

```ts theme={null}
const page = await client.markets.list({ limit: 25 });

for (const market of page.data) {
  console.log(market);
}
console.log(page.requestId, page.checkpoint, page.cursor);
```

Amounts and onchain identifiers are decoded to `bigint`. Cursors are opaque strings: persist and
return them unchanged rather than parsing or constructing them.

## Add direct onchain reads

API reads are sufficient for history and aggregation. Add RPC configuration when your application
prepares actions or needs execution-critical state directly from HyperEVM:

```ts theme={null}
const client = createTayhoClient({
  environment: "development",
  apiKey: "th_pk_example",
  rpc: {
    urls: [
      "https://your-managed-hyperevm-endpoint.example",
      "https://rpcs.chain.link/hyperevm/testnet",
    ],
    timeoutMs: 8_000,
    retryCount: 1,
  },
});
```

RPC URLs stay inside your application and are never sent to Tayho. The built-in reader supports
only chain ID, block number, balance, receipt, and pinned-block `eth_call`; it cannot scan logs,
broadcast transactions, or forward arbitrary provider methods.

## Handle failures

```ts theme={null}
import { TayhoError } from "@tayho/sdk";

try {
  await client.markets.list();
} catch (error) {
  if (error instanceof TayhoError) {
    console.error(error.code, error.status, error.requestId);
  }
}
```

Respect `retryAfterSeconds` when present. Authentication, forbidden scope, invalid request, and
chain mismatch errors require configuration changes rather than blind retries.

## Next steps

<CardGroup cols={2}>
  <Card title="SDK configuration" href="/public/sdk/configuration" icon="sliders-horizontal">
    Add EIP-1193, viem, ethers, or native RPC adapters.
  </Card>

  <Card title="Read data" href="/public/sdk/reads" icon="database">
    Explore markets, positions, portfolio, vault, staking, orders, and transactions.
  </Card>

  <Card title="Submit actions" href="/public/sdk/actions" icon="signature">
    Prepare, inspect, sign, and relay account, vault, and staking writes.
  </Card>

  <Card title="REST authentication" href="/public/reference/authentication-and-limits" icon="key-round">
    Understand scopes, quotas, idempotency, and receipts.
  </Card>
</CardGroup>
