Skip to content

Commit

Permalink
refactor(API): add a user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Jun 5, 2024
1 parent b491134 commit 8a9df63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ape_safe/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Dict, Iterator, Optional, Union, cast

from ape.types import AddressType, HexBytes, MessageSignature
from ape.utils.misc import USER_AGENT, get_package_version
from eip712.common import SafeTxV1, SafeTxV2

from ape_safe.client.base import BaseSafeClient
Expand All @@ -25,6 +26,9 @@
)
from ape_safe.utils import get_safe_tx_hash, order_by_signer

APE_SAFE_VERSION = get_package_version(__name__)
ORIGIN = f"Ape-Safe/{APE_SAFE_VERSION} ({USER_AGENT})"

TRANSACTION_SERVICE_URL = {
# NOTE: If URLs need to be updated, a list of available service URLs can be found at
# https://docs.safe.global/safe-core-api/available-services.
Expand Down Expand Up @@ -116,7 +120,7 @@ def post_transaction(
b"",
)
)
post_dict: Dict = {"signature": signature.hex()}
post_dict: Dict = {"signature": signature.hex(), "origin": ORIGIN}

for key, value in tx_data.model_dump(by_alias=True, mode="json").items():
if isinstance(value, HexBytes):
Expand Down

0 comments on commit 8a9df63

Please sign in to comment.