We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9875504 commit 1f2cc91Copy full SHA for 1f2cc91
1 file changed
tokens/portfolio.py
@@ -1,5 +1,6 @@
1
from typing import List, Optional
2
import os
3
+import cachetools.func
4
5
from solana.rpc.api import Client
6
from solana.rpc.types import TokenAccountOpts, Pubkey
@@ -19,6 +20,7 @@ def __init__(self, token_metadata_repo: TokenMetadataRepo):
19
20
self.token_metadata_repo = token_metadata_repo
21
self.http_client = Client(self.RPC_URL)
22
23
+ @cachetools.func.ttl_cache(maxsize=1000, ttl=300)
24
def get_portfolio(self, wallet_address: str) -> Portfolio:
25
"""Get the complete portfolio of token holdings for a wallet address."""
26
token_accounts = self.get_token_accounts(wallet_address)
0 commit comments