Skip to content

Commit

Permalink
Implemented PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielfior committed Aug 9, 2024
1 parent 7625606 commit 63717a5
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 27 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/python_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ on:
workflow_dispatch:

env:
MANIFOLD_API_KEY: ${{ secrets.MANIFOLD_API_KEY }}
SERP_API_KEY: ${{ secrets.SERP_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
BET_FROM_ADDRESS: ${{ secrets.BET_FROM_ADDRESS }}
BET_FROM_PRIVATE_KEY: ${{ secrets.BET_FROM_PRIVATE_KEY }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
GNOSIS_RPC_URL: ${{ secrets.GNOSIS_RPC_URL }}
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
COWSWAP_TEST_PRIVATE_KEY: ${{ secrets.COWSWAP_TEST_PRIVATE_KEY }}

jobs:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from loguru import logger
from web3 import Web3

from cowswap_python_client.encoding import (
from cowswap_client.encoding import (
DOMAIN,
MESSAGE_TYPES,
MESSAGE_TYPES_CANCELLATION,
)
from cowswap_python_client.gtypes import Wei
from cowswap_python_client.models import (
from cowswap_client.gtypes import Wei
from cowswap_client.models import (
CowServer,
OrderKind,
OrderStatus,
Expand Down Expand Up @@ -52,9 +52,9 @@ def build_swap_params(
def _if_error_log_and_raise(r: requests.Response) -> None:
try:
r.raise_for_status()
except:
logger.error(f"Error occured on response: {r.text}")
r.raise_for_status()
except Exception as e:
logger.error(f"Error occured on response: {r.text}, Exception - {e}")
raise

def post_quote(self, quote: QuoteInput) -> QuoteOutput:
quote_dict = quote.dict(by_alias=True, exclude_none=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from eth_typing import ChecksumAddress
from web3 import Web3
from cowswap_python_client.gtypes import ChainID
from cowswap_client.gtypes import ChainID

MESSAGE_TYPES_CANCELLATION = {
"OrderCancellations": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[mypy]
python_version = 3.10
files = cowswap_python_client/, tests/
files = cowswap_client/, tests/
plugins = pydantic.mypy
warn_redundant_casts = True
warn_unused_ignores = True
Expand All @@ -19,9 +19,7 @@ ignore_missing_imports = True
# We don't want to ignore all missing imports as we want to catch those in our own code
# But for certain libraries they don't have a stub file, so we only enforce import checking for our own libraries.
# Another alternative would be to list out every single dependency that does not have a stub.
[mypy-prediction_market_agent.*]
ignore_missing_imports = False
[mypy-scripts.*]
[mypy-cowswap_client.*]
ignore_missing_imports = False
[mypy-tests.*]
ignore_missing_imports = False
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cowswap-python-client"
version = "0.1.1"
name = "cowswap-client"
version = "0.1.2"
description = ""
authors = ["gabrielfior <fior.gbm@gmail.com>"]
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from eth_account.signers.local import LocalAccount
from pydantic_settings import BaseSettings, SettingsConfigDict

from cowswap_python_client.gtypes import PrivateKey
from cowswap_python_client.utils import check_not_none
from cowswap_client.gtypes import PrivateKey
from cowswap_client.utils import check_not_none


class CowswapKey(BaseSettings):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_cow_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from eth_account.signers.local import LocalAccount
from web3 import Web3

from cowswap_python_client.cow_client import CowClient, CowServer
from cowswap_python_client.models import OrderKind, OrderStatus, QuoteInput, QuoteOutput
from cowswap_python_client.utils import check_not_none
from cowswap_client.cow_client import CowClient, CowServer
from cowswap_client.models import OrderKind, OrderStatus, QuoteInput, QuoteOutput
from cowswap_client.utils import check_not_none

wxDAI = Web3.to_checksum_address("0xe91d153e0b41518a2ce8dd3d7944fa863463a97d")
COW = Web3.to_checksum_address("0x177127622c4A00F3d409B75571e12cB3c8973d3c")
Expand Down Expand Up @@ -62,7 +62,7 @@ def test_post_order(
test_mock_client: CowClient, test_quote: QuoteInput, id_holder_fixture: IdHolder
) -> None:
with patch(
"cowswap_python_client.cow_client.CowClient.build_order_with_fee_and_sell_amounts",
"cowswap_client.cow_client.CowClient.build_order_with_fee_and_sell_amounts",
Mock(side_effect=fake_build_quote),
):
quote = test_mock_client.post_quote(test_quote)
Expand Down

0 comments on commit 63717a5

Please sign in to comment.