erc_4626.vault_protocol.t3tris.offchain_metadata

Documentation for eth_defi.erc_4626.vault_protocol.t3tris.offchain_metadata Python module.

T3tris vault offchain metadata.

  • T3tris stores vault page descriptions in their backend, not on-chain

  • The detail endpoint /api/v1/vaults/{chainId}/{vaultAddress} returns the same page view model shown in the T3tris app

  • We fetch and cache this data locally to avoid repeated API calls

  • Two-level caching: disk (2-day TTL) + in-process dictionary

Module Attributes

DEFAULT_API_BASE_URL

T3tris API base URL, reverse-engineered from their Next.js frontend

Functions

fetch_t3tris_vault_metadata(web3, ...[, ...])

Fetch vault metadata from T3tris' offchain web app API.

Classes

T3trisVaultMetadata

Metadata about a T3tris vault from offchain source.

DEFAULT_CACHE_PATH = PosixPath('/home/runner/.tradingstrategy/cache/t3tris')

Where we cache fetched T3tris metadata files

DEFAULT_API_BASE_URL = 'https://api.t3tris.finance/api/v1'

T3tris API base URL, reverse-engineered from their Next.js frontend

class T3trisVaultMetadata

Bases: TypedDict

Metadata about a T3tris vault from offchain source.

Fetched from the T3tris REST API endpoint: GET /api/v1/vaults/{chainId}/{vaultAddress}.

name: str

Vault name shown in the app.

symbol: Optional[str]

Vault share token symbol shown in the app.

description: Optional[str]

Full Markdown vault description.

curator_name: Optional[str]

Human-readable curator or manager name.

curator_url: Optional[str]

Curator website URL.

verified: Optional[bool]

T3tris UI verification flag.

deposits_disabled: Optional[bool]

UI-level deposit disable flag.

category: Optional[str]

App category label.

attributes: list[str]

App attribute labels.

rating: Optional[str]

App risk/rating label.

visibility: Optional[str]

Visibility flag used by the app.

ipfs_hash: Optional[str]

Optional IPFS hash copied from app/indexer metadata.

__init__(*args, **kwargs)
__new__(**kwargs)
clear()

Remove all items from the dict.

copy()

Return a shallow copy of the dict.

fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items()

Return a set-like object providing a view on the dict’s items.

keys()

Return a set-like object providing a view on the dict’s keys.

pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Return an object providing a view on the dict’s values.

fetch_t3tris_vault_metadata(web3, vault_address, *, cache_path=PosixPath('/home/runner/.tradingstrategy/cache/t3tris'), api_base_url='https://api.t3tris.finance/api/v1', now_=None, max_cache_duration=datetime.timedelta(days=2))

Fetch vault metadata from T3tris’ offchain web app API.

  • Uses one JSON cache file per chain and vault

  • Multiprocess safe via file lock

  • Returns None when the vault is not available in the T3tris app API

Parameters
  • web3 (web3.main.Web3) – Web3 instance used to get chain_id and checksum the vault address.

  • vault_address (eth_typing.evm.HexAddress) – Vault contract address.

  • cache_path (pathlib.Path) – Directory for cache files.

  • api_base_url (str) – T3tris API base URL.

  • now – Override current time for testing.

  • max_cache_duration (datetime.timedelta) – How long before refreshing cache.

  • now_ (Optional[datetime.datetime]) –

Return type

Optional[eth_defi.erc_4626.vault_protocol.t3tris.offchain_metadata.T3trisVaultMetadata]