MintbaseDocumentLoader#

class langchain_community.document_loaders.mintbase.MintbaseDocumentLoader(contract_address: str, *, blockchain_type: Literal['mainnet', 'testnet'], api_key: str = '', table: str = '', select: str = '', fields: List[str] | None = None, get_all_tokens: bool = False, max_execution_time: int | None = None)[source]#

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.

Future versions of this loader can:
  • Support additional Mintbase APIs (e.g. getTokens, etc.)

Example

contractAddress = "nft.yearofchef.near"  # Year of chef contract address
blockchainLoader = MintbaseDocumentLoader(
    contract_address=contractAddress, blockchain_type="mainnet",api_key="omni-site"
)
Parameters:
  • contract_address (str) – The address of the smart contract.

  • blockchainType – The blockchain type.

  • api_key (str) – The Mintbase API key.

  • table (str) – name of the table to query

  • select (str) – Conditions for querying

  • fields (List[str] | None) – Information to display after query

  • get_all_tokens (bool) – Whether to get all tokens on the contract.

  • max_execution_time (int | None) – The maximum execution time (sec).

  • blockchain_type (Literal['mainnet', 'testnet']) –

Methods

__init__(contract_address,Β *,Β blockchain_type)

param contract_address:

The address of the smart contract.

alazy_load()

A lazy loader for Documents.

aload()

Load data into Document objects.

lazy_load()

A lazy loader for Documents.

load()

Load data into Document objects.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__(contract_address: str, *, blockchain_type: Literal['mainnet', 'testnet'], api_key: str = '', table: str = '', select: str = '', fields: List[str] | None = None, get_all_tokens: bool = False, max_execution_time: int | None = None)[source]#
Parameters:
  • contract_address (str) – The address of the smart contract.

  • blockchainType – The blockchain type.

  • api_key (str) – The Mintbase API key.

  • table (str) – name of the table to query

  • select (str) – Conditions for querying

  • fields (List[str] | None) – Information to display after query

  • get_all_tokens (bool) – Whether to get all tokens on the contract.

  • max_execution_time (int | None) – The maximum execution time (sec).

  • blockchain_type (Literal['mainnet', 'testnet']) –

async alazy_load() β†’ AsyncIterator[Document]#

A lazy loader for Documents.

Return type:

AsyncIterator[Document]

async aload() β†’ List[Document]#

Load data into Document objects.

Return type:

List[Document]

lazy_load() β†’ Iterator[Document][source]#

A lazy loader for Documents.

Return type:

Iterator[Document]

load() β†’ List[Document][source]#

Load data into Document objects.

Return type:

List[Document]

load_and_split(text_splitter: TextSplitter | None = None) β†’ List[Document]#

Load Documents and split into chunks. Chunks are returned as Documents.

Do not override this method. It should be considered to be deprecated!

Parameters:

text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns:

List of Documents.

Return type:

List[Document]