Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-delegates
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu authored Jun 6, 2024
2 parents 4ec23fa + 4c0891b commit 5e99cd1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ape_safe/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import json
from datetime import datetime
from functools import reduce
from typing import Dict, Iterator, List, Optional, Union, cast

from ape.api import AccountAPI
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 @@ -28,6 +30,12 @@
)
from ape_safe.utils import get_safe_tx_hash, order_by_signer

APE_SAFE_VERSION = get_package_version(__name__)
APE_SAFE_USER_AGENT = f"Ape-Safe/{APE_SAFE_VERSION} {USER_AGENT}"
# NOTE: Origin must be a string, but can be json that contains url & name fields
ORIGIN = json.dumps(dict(url="https://apeworx.io", name="Ape Safe", ua=APE_SAFE_USER_AGENT))
assert len(ORIGIN) <= 200 # NOTE: Must be less than 200 chars

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 @@ -121,7 +129,7 @@ def post_transaction(
b"",
)
)
post_dict: Dict = {"signature": signature.hex() if signature else None}
post_dict: Dict = {"signature": signature.hex() if signature else None, "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 5e99cd1

Please sign in to comment.