# API

## Table of content

* [init](#init)
  * [config](#config)
  * [project](#project)
* [api](#api)
  * [collection](#collection)
    * [info](#info)
    * [nfts](#nfts)
    * [search](#search-1)
  * [nft](#nft)
    * [bulk](#bulk)
    * [info](#info-1)
    * [search](#search-1)
  * [transaction](#transaction)
    * [info](#info-2)
    * [search](#search-2)
* [wallet](#wallet)
  * [info](#info-3)
  * [sebd](#sebd)
* [collection](#collection-1)
  * [data](#data)
  * [deploy](#deploy)

## Legend

* `[]` - optional parameter
* `<>` - required parameter
* `OPTIONS...` - list of options

## init

### config

Create `nft.config.ts`

```shell
npx tonnft init config [OPTIONS...]
```

* `-c, --current` - init in current directory. Ignore `--directory` option
* `-d, --directory <directory>` - destination directory

### project

Create project with `nft.config.ts`

```shell
npx tonnft init project <OPTIONS...>
```

* `-c, --current` - init in current directory. Ignore `--directory` option
* `-d, --directory [directory]` - destination directory
* `-j, --json` - output result in JSON format

## api

Call API and return NFT/Collection info

* `<network>` - network name from `ton.config.ts`. If config doesn't exist use [default networks](DEFAULT_NETWORKS.md)
* `-c, --config [config]` - raw config string in JSON format. Ignore `--file` option
* `-f, --file [file]` - path to config
* `-j, --json` - output result in JSON format
* `-r, --response` - add raw response from API to output

### collection

#### info

Get collection info

```shell
npx tonnft api <network> collection info <OPTIONS...>
```

* `-a, --address <address>` - collection address

#### nfts

Search collection NFTs

```shell
npx tonnft api <network> collection nfts <OPTIONS...>
```

* `-a, --address <address>` - collection address
* `-o, --offset [offset]` - offset
* `-l, --limit [limit]` - limit

#### search

Search collections

```shell
npx tonnft api <network> collection search <OPTIONS...>
```

* `-o, --offset [offset]` - offset
* `-l, --limit [limit]` - limit

### nft

#### info

Get nft info

```shell
npx tonnft api <network> nft info <OPTIONS...>
```

* `-a, --address <address>` - nft address

#### search

Search NFTs by owner and collection 

```shell
npx tonnft api <network> nft search <OPTIONS...>
```

* `-a, --address <address>` - owner address
* `-e, --collection [collection]` - collection address
* `-o, --offset [offset]` - offset
* `-l, --limit [limit]` - limit

#### bulk

Get NFTs info

```shell
npx tonnft api <network> nft bulk <OPTIONS...>
```

* `-d, --addresses <addresses...>` - comma separated NFT addresses e.g `0:3C..45,0:A3..F7`


### transaction

#### info

Get transaction info

```shell
npx tonnft api <network> transaction info <OPTIONS...>
```

* `-h, --hash <hash>` - transaction hash

#### search

Search transactions by address

```shell
npx tonnft api <network> transaction info <OPTIONS...>
```

* `-a, --address <address>` - collection or nft address
* `--after [after]` - search after transaction logical time
* `--before [before]` - search before transaction logical time
* `-l, --limit [limit]` - limit

## wallet

Interaction with wallet

* `<network>` - network name from `ton.config.ts`. If config doesn't exist use [default networks](DEFAULT_NETWORKS.md)
* `-c, --config [config]` - raw config string in JSON format. Ignore `--file` option
* `-f, --file [file]` - path to config
* `-j, --json` - output result in JSON format

### info

Get wallet info

```shell
npx tonnft api <network> wallet info <OPTIONS...>
```

#### nfts

Search collection NFTs

```shell
npx tonnft api <network> wallet send <OPTIONS...>
```

* `-t, --to <to>` - destination address
* `-v, --value <value>` - coins in nano TON
* `-b, --bounce <bounce>` - Bounce if destination contract is not deployed

## collection

Interaction with collection. The data for the collection is read from a collection config

* `<network>` - network name from `ton.config.ts`. If config doesn't exist use [default networks](DEFAULT_NETWORKS.md)
* `-c, --config [config]` - raw config string in JSON format. Ignore `--file` option
* `-f, --file [file]` - path to config
* `-j, --json` - output result in JSON format

### deploy

```shell
npx tonnft collection <network> data <OPTIONS...>
```

* `-c, --collection <collection>` - relative path from `collections` directory to collection config e.g. `dogs/data.ts`

### data

```shell
npx tonnft collection <network> deploy <OPTIONS...>
```

* `-c, --collection <collection>` - relative path from `collections` directory to collection config e.g. `dogs/data.ts`
* `-v, --value <value>` - coins in nano TON
