> For the complete documentation index, see [llms.txt](https://andrewkimjoseph.gitbook.io/celina-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andrewkimjoseph.gitbook.io/celina-sdk/services/nftservice.md).

# NftService

[**@andrewkimjoseph/celina-sdk**](/celina-sdk/api-reference/api-reference.md)

***

[@andrewkimjoseph/celina-sdk](/celina-sdk/api-reference/api-reference.md) / [services/nft.service](https://github.com/andrewkimjoseph/celina-sdk/blob/main/docs/api-reference/services/nft.service/README.md) / NftService

## Class: NftService

Defined in: [src/services/nft.service.ts:37](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/nft.service.ts#L37)

ERC-721 / ERC-1155 collection and balance reads with optional metadata fetch.

### Constructors

#### Constructor

> **new NftService**(`clientFactory`): `NftService`

Defined in: [src/services/nft.service.ts:38](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/nft.service.ts#L38)

**Parameters**

**clientFactory**

`CeloClientFactory`

**Returns**

`NftService`

### Methods

#### getNftBalance()

> **getNftBalance**(`contractAddress`, `ownerAddress`, `tokenId?`): `Promise`<{ `balance`: `string`; `contractAddress`: `` `0x${string}` ``; `network`: `"mainnet"`; `ownerAddress`: `` `0x${string}` ``; `standard`: `"ERC721"`; `tokenId`: `string` | `null`; } | { `balance`: `string`; `contractAddress`: `` `0x${string}` ``; `network`: `"mainnet"`; `ownerAddress`: `` `0x${string}` ``; `standard`: `"ERC1155"`; `tokenId`: `string`; }>

Defined in: [src/services/nft.service.ts:202](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/nft.service.ts#L202)

NFT balance for an owner (ERC-721 collection total or ERC-1155 id-specific balance).

**Parameters**

**contractAddress**

`` `0x${string}` ``

NFT collection contract

**ownerAddress**

`` `0x${string}` ``

Holder wallet address

**tokenId?**

`string`

Required for ERC-1155; ignored for ERC-721 collection balance

**Returns**

`Promise`<{ `balance`: `string`; `contractAddress`: `` `0x${string}` ``; `network`: `"mainnet"`; `ownerAddress`: `` `0x${string}` ``; `standard`: `"ERC721"`; `tokenId`: `string` | `null`; } | { `balance`: `string`; `contractAddress`: `` `0x${string}` ``; `network`: `"mainnet"`; `ownerAddress`: `` `0x${string}` ``; `standard`: `"ERC1155"`; `tokenId`: `string`; }>

Balance as decimal string and detected standard

**Throws**

When ERC-1155 is detected but `tokenId` is omitted

***

#### getNftInfo()

> **getNftInfo**(`contractAddress`, `tokenId`): `Promise`<{ `attributes`: { }; `collection`: { `name`: `string`; `symbol`: `string`; `totalSupply`: `string` | `undefined`; }; `contractAddress`: `` `0x${string}` ``; `description`: `string` | `undefined`; `image`: `string` | `undefined`; `metadata`: `Record`<`string`, `unknown`> | `null`; `metadataUri`: `string` | `null`; `name`: `string`; `network`: `"mainnet"`; `owner`: `` `0x${string}` `` | `null`; `standard`: `NftStandard`; `tokenId`: `string`; }>

Defined in: [src/services/nft.service.ts:92](https://github.com/andrewkimjoseph/celina-sdk/blob/970ab720c805303ead8b20406c6579ecdcf2193a/src/services/nft.service.ts#L92)

Collection and token metadata for an ERC-721 or ERC-1155 contract.

**Parameters**

**contractAddress**

`` `0x${string}` ``

NFT collection contract

**tokenId**

`string`

Token id as decimal string

**Returns**

`Promise`<{ `attributes`: { }; `collection`: { `name`: `string`; `symbol`: `string`; `totalSupply`: `string` | `undefined`; }; `contractAddress`: `` `0x${string}` ``; `description`: `string` | `undefined`; `image`: `string` | `undefined`; `metadata`: `Record`<`string`, `unknown`> | `null`; `metadataUri`: `string` | `null`; `name`: `string`; `network`: `"mainnet"`; `owner`: `` `0x${string}` `` | `null`; `standard`: `NftStandard`; `tokenId`: `string`; }>

Standard, owner, collection info, and fetched JSON metadata when available

**Throws**

When the address is not a deployed NFT contract


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://andrewkimjoseph.gitbook.io/celina-sdk/services/nftservice.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.
