# MintbaseDocumentLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/mintbase/MintbaseDocumentLoader)

Load elements from a blockchain smart contract.

The supported blockchains are: Near mainnet, Near testnet.

If no BlockchainType is specified, the default is Near mainnet.

The Loader uses the Mintbase API to interact with the blockchain.
MB_API_KEY environment variable must be set to use this loader.

The API returns 100 NFTs per request and can be paginated using the
startToken parameter.

If get_all_tokens is set to True, the loader will get all tokens
on the contract.  Note that for contracts with a large number of tokens,
this may take a long time (e.g. 10k tokens is 100 requests).
Default value is false for this reason.

The max_execution_time (sec) can be set to limit the execution time
of the loader.

## Signature

```python
MintbaseDocumentLoader(
    self,
    contract_address: str,
    *,
    blockchain_type: Literal['mainnet', 'testnet'],
    api_key: str = '',
    table: str = '',
    select: str = '',
    fields: Optional[List[str]] = None,
    get_all_tokens: bool = False,
    max_execution_time: Optional[int] = None,
)
```

## Description

**Future versions of this loader can:**

- Support additional Mintbase APIs (e.g. getTokens, etc.)

**Example:**

.. code-block:: python

contractAddress = "nft.yearofchef.near"  # Year of chef contract address
blockchainLoader = MintbaseDocumentLoader(
    contract_address=contractAddress, blockchain_type="mainnet",api_key="omni-site"
)

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `contract_address` | `str` | Yes | The address of the smart contract. |
| `blockchainType` | `unknown` | Yes | The blockchain type. |
| `api_key` | `str` | No | The Mintbase API key. (default: `''`) |
| `table` | `str` | No | name of the table to query (default: `''`) |
| `select` | `str` | No | Conditions for querying (default: `''`) |
| `fields` | `Optional[List[str]]` | No | Information to display after query (default: `None`) |
| `get_all_tokens` | `bool` | No | Whether to get all tokens on the contract. (default: `False`) |
| `max_execution_time` | `Optional[int]` | No | The maximum execution time (sec). (default: `None`) |

## Extends

- `BaseLoader`

## Constructors

```python
__init__(
    self,
    contract_address: str,
    *,
    blockchain_type: Literal['mainnet', 'testnet'],
    api_key: str = '',
    table: str = '',
    select: str = '',
    fields: Optional[List[str]] = None,
    get_all_tokens: bool = False,
    max_execution_time: Optional[int] = None,
)
```

| Name | Type |
|------|------|
| `contract_address` | `str` |
| `blockchain_type` | `Literal['mainnet', 'testnet']` |
| `api_key` | `str` |
| `table` | `str` |
| `select` | `str` |
| `fields` | `Optional[List[str]]` |
| `get_all_tokens` | `bool` |
| `max_execution_time` | `Optional[int]` |


## Properties

- `contract_address`
- `blockchainType`
- `api_key`
- `table`
- `select`
- `fields`
- `get_all_tokens`
- `max_execution_time`

## Methods

- [`load()`](https://reference.langchain.com/python/langchain-community/document_loaders/mintbase/MintbaseDocumentLoader/load)
- [`lazy_load()`](https://reference.langchain.com/python/langchain-community/document_loaders/mintbase/MintbaseDocumentLoader/lazy_load)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/document_loaders/mintbase.py#L13)