From cb26123221006451f2df98db892311962005e5ec Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Wed, 1 Jan 2025 13:04:53 +0100 Subject: [PATCH] Small Velvet fixes --- eth_defi/hotwallet.py | 2 +- eth_defi/vault/base.py | 2 +- eth_defi/velvet/vault.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eth_defi/hotwallet.py b/eth_defi/hotwallet.py index 2c2cb62b..391f88d6 100644 --- a/eth_defi/hotwallet.py +++ b/eth_defi/hotwallet.py @@ -185,7 +185,7 @@ def allocate_nonce(self) -> int: Increase the nonce counter """ - assert self.current_nonce is not None, "Nonce is not yet synced from the blockchain" + assert self.current_nonce is not None, f"Nonce is not yet synced from the blockchain: {self}" nonce = self.current_nonce self.current_nonce += 1 return nonce diff --git a/eth_defi/vault/base.py b/eth_defi/vault/base.py index c73403b2..1a01617a 100644 --- a/eth_defi/vault/base.py +++ b/eth_defi/vault/base.py @@ -41,7 +41,7 @@ class VaultSpec: def __post_init__(self): assert isinstance(self.chain_id, int) - assert isinstance(self.vault_address, str) + assert isinstance(self.vault_address, str), f"Expected str, got {self.vault_address}" assert self.vault_address.startswith("0x") diff --git a/eth_defi/velvet/vault.py b/eth_defi/velvet/vault.py index c2fb10aa..ea8c405e 100644 --- a/eth_defi/velvet/vault.py +++ b/eth_defi/velvet/vault.py @@ -118,8 +118,9 @@ def fetch_info(self) -> VelvetVaultInfo: # url = f"https://api.velvet.capital/api/v3/portfolio/{self.spec.vault_address}" url = f"https://eventsapi.velvetdao.xyz/api/v3/portfolio/{self.spec.vault_address}" data = self.session.get(url).json() - if "error" in data: + if ("error" in data) or ("message" in data): raise VelvetBadConfig(f"Velvet portfolio info failed: {data}") + return data["data"] @cached_property