BlockchainDocumentLoader(
self,
contract_address: str,
blockchainType: BlockchainType = BlockchainType.ETH_MAINNET| Name | Type | Description |
|---|---|---|
contract_address* | str | The address of the smart contract. |
blockchainType | BlockchainType | Default: BlockchainType.ETH_MAINNETThe blockchain type. |
api_key | str | Default: 'docs-demo'The Alchemy API key. |
startToken | str | Default: '' |
get_all_tokens | bool | Default: False |
max_execution_time | Optional[int] | Default: None |
Load elements from a blockchain smart contract.
See supported blockchains here: https://python.langchain.com/v0.2/api_reference/community/document_loaders/langchain_community.document_loaders.blockchain.BlockchainType.html
If no BlockchainType is specified, the default is Ethereum mainnet.
The Loader uses the Alchemy API to interact with the blockchain. ALCHEMY_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:
The start token for pagination.
Whether to get all tokens on the contract.
The maximum execution time (sec).