# Setup

## Installation

```bash
yarn add @torch-finance/sdk @ton/ton @ton/crypto @ton/core
```

## Initialize (Mainnet)

```typescript
import { TorchSDK } from '@torch-finance/sdk';
const sdk = new TorchSDK();
```

## Initialize (Testnet / Custom Network)

```typescript
import { TonClient4 } from '@ton/ton';
import { TorchSDK, TorchSDKOptions } from '@torch-finance/sdk';

const tonClient = new TonClient4({ endpoint: "https://testnet-v4.tonhubapi.com/" });
const factoryAddress = Address.parse("testnet factory address")
const testnetOracle = "https://testnet-oracle.torch.finance"
const testnetAPI = "https://testnet-api.torch.finance"
const config: TorchSDKOptions = {
    tonClient: tonClient,
    factoryAddress: factoryAddress,
    oracleEndpoint: testnetOracle,
    apiEndpoint: testnetAPI,
  };
const sdk = new TorchSDK(config)
```

## Configuration

* Factory Address

<table><thead><tr><th width="199">Network</th><th>Factory Address</th></tr></thead><tbody><tr><td>Mainnet</td><td>EQDQIhFLSzUlaHKM9L2ZQS-o0iNHTbOSBtzNC0VLxPbNFH6E</td></tr><tr><td>Testnet</td><td>EQCNvyhu-VxeL7i-Uk5Uu0m7TO0qQaWQlHmGOUyUh1hoF7au</td></tr></tbody></table>

* Indexer Endpoint

<table><thead><tr><th width="168">Network</th><th>Indexer Endpoint</th></tr></thead><tbody><tr><td>Mainnet</td><td><a href="https://testnet-indexer.torch.finance/">https://indexer.torch.finance/</a></td></tr><tr><td>Testnet</td><td><a href="https://testnet-indexer.torch.finance/">https://testnet-indexer.torch.finance/</a></td></tr></tbody></table>

* Oracle Endpoint

<table><thead><tr><th width="173">Network</th><th>Oracle Endpoint</th></tr></thead><tbody><tr><td>Mainnet</td><td><a href="https://oracle.torch.finance">https://oracle.torch.finance</a></td></tr><tr><td>Testnet</td><td><a href="https://oracle.torch.finance">https://testnet-oracle.torch.finance</a></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.torch.finance/dex/developer-guide/dex-sdk-guide/setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
