Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/misc #28

Merged
merged 3 commits into from
Mar 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions mech_client/interact.py
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@
"""

import asyncio
import json
import os
import time
import warnings
@@ -66,15 +65,23 @@
"chain_id": 100,
"poa_chain": False,
"default_gas_price_strategy": "eip1559",
"is_gas_estimation_enabled": True,
"is_gas_estimation_enabled": False,
}
PRIVATE_KEY_FILE_PATH = "ethereum_private_key.txt"

WSS_ENDPOINT = os.getenv(
"WEBSOCKET_ENDPOINT",
"wss://rpc.eu-central-2.gateway.fm/ws/v4/gnosis/non-archival/mainnet",
)
GNOSISSCAN_API_URL = "https://api.gnosisscan.io/api?module=contract&action=getabi&address={contract_address}"
MANUAL_GAS_LIMIT = int(
os.getenv(
"MANUAL_GAS_LIMIT",
"100_000",
)
)
BLOCKSCOUT_API_URL = (
"https://gnosis.blockscout.com/api/v2/smart-contracts/{contract_address}"
)

MAX_RETRIES = 3
WAIT_SLEEP = 3.0
@@ -119,9 +126,9 @@ def get_event_signatures(abi: List) -> Tuple[str, str]:

def get_abi(contract_address: str) -> List:
"""Get contract abi"""
abi_request_url = GNOSISSCAN_API_URL.format(contract_address=contract_address)
abi_request_url = BLOCKSCOUT_API_URL.format(contract_address=contract_address)
response = requests.get(abi_request_url).json()
return json.loads(response["result"])
return response["abi"]


def get_contract(
@@ -260,7 +267,11 @@ def send_request( # pylint: disable=too-many-arguments,too-many-locals
print(f"Prompt uploaded: https://gateway.autonolas.tech/ipfs/{v1_file_hash_hex}")
method_name = "request"
methord_args = {"data": v1_file_hash_hex_truncated}
tx_args = {"sender_address": crypto.address, "value": price}
tx_args = {
"sender_address": crypto.address,
"value": price,
"gas": MANUAL_GAS_LIMIT,
}

tries = 0
retries = retries or MAX_RETRIES
2,550 changes: 1,079 additions & 1,471 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mech-client"
version = "0.2.9"
version = "0.2.10"
description = "Basic client to interact with a mech"
authors = ["David Minarsch <david.minarsch@googlemail.com>"]
readme = "README.md"
@@ -26,19 +26,19 @@ include = [

[tool.poetry.dependencies]
python = "^3.10"
open-aea = {version = "==1.42.0", extras = ["cli"]}
open-aea-ledger-ethereum = "==1.42.0"
open-aea-cli-ipfs = "==1.42.0"
open-aea = {version = "==1.50.0", extras = ["cli"]}
open-aea-ledger-ethereum = "==1.50.0"
open-aea-cli-ipfs = "==1.50.0"
websocket-client = ">=0.32.0,<1"
gql = ">=3.4.1"
asn1crypto = ">=1.4.0,<1.5.0"
open-aea-ledger-cosmos = "==1.42.0"
open-aea-ledger-cosmos = "==1.50.0"

[tool.poetry.scripts]
mechx = "mech_client.cli:cli"

[tool.poetry.group.dev.dependencies]
open-autonomy = "==0.13.8"
open-autonomy = "==0.14.10"
tomte = {version = "0.2.15", extras = ["tox"]}

[build-system]
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ isolated_build = True
[base-deps]
deps =
tomte[tests]==0.2.15
open-autonomy==0.13.8
open-autonomy==0.14.10

[testenv:bandit]
skipsdist = True
@@ -192,6 +192,8 @@ commands =

[Authorized Packages]
blspy: 2.0.2
sniffio: ==1.3.1
; has correct licence Apache 2.0 or MIT

; Authorized and unauthorized licenses in LOWER CASE
[Licenses]