Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ allium auth setup --method x402_key --private-key 0x... --network eip155:8453
allium auth setup --method x402_privy \
--privy-app-id ... --privy-app-secret ... \
--privy-wallet-id ... --network eip155:8453
allium auth setup --method tempo --private-key 0x... --chain-id 42431
allium auth setup --method tempo --private-key 0x... --chain-id 4217
```

| Method | Description |
Expand Down Expand Up @@ -227,7 +227,7 @@ allium auth setup

# Non-interactive setup (for scripts/CI)
allium auth setup --method api_key --api-key sk-...
allium auth setup --method tempo --private-key 0x... --chain-id 42431
allium auth setup --method tempo --private-key 0x... --chain-id 4217

# List all configured profiles
allium auth list
Expand Down
4 changes: 2 additions & 2 deletions cli/commands/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _build_profile_from_args(
@click.option(
"--chain-id",
default=None,
help="Tempo chain ID, e.g. 42431 (for tempo).",
help="Tempo chain ID, e.g. 4217 (for tempo).",
)
@click.option("--privy-app-id", default=None, help="Privy App ID (for x402_privy).")
@click.option(
Expand Down Expand Up @@ -253,7 +253,7 @@ def auth_setup(
\b
allium auth setup
allium auth setup --method api_key --api-key sk-...
allium auth setup --method tempo --private-key 0x... --chain-id 42431
allium auth setup --method tempo --private-key 0x... --chain-id 4217
"""
if method:
profile = _build_profile_from_args(
Expand Down
4 changes: 0 additions & 4 deletions cli/types/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class AuthMethod(StrEnum):

class TargetNetwork(StrEnum):
BASE_MAINNET = "eip155:8453"
BASE_SEPOLIA = "eip155:84532"

@property
def label(self) -> str:
Expand All @@ -21,13 +20,11 @@ def label(self) -> str:

_NETWORK_LABELS: dict[TargetNetwork, str] = {
TargetNetwork.BASE_MAINNET: "Base Mainnet",
TargetNetwork.BASE_SEPOLIA: "Base Sepolia (Testnet)",
}


class TempoChainId(StrEnum):
MAINNET = "4217"
TESTNET = "42431"

@property
def label(self) -> str:
Expand All @@ -36,7 +33,6 @@ def label(self) -> str:

_TEMPO_LABELS: dict[TempoChainId, str] = {
TempoChainId.MAINNET: "Tempo Mainnet",
TempoChainId.TESTNET: "Tempo Testnet",
}


Expand Down
2 changes: 0 additions & 2 deletions cli/types/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

ALL_NETWORK_LABELS: dict[str, str] = {
"eip155:8453": "Base Mainnet",
"eip155:84532": "Base Sepolia (Testnet)",
"4217": "Tempo Mainnet",
"42431": "Tempo Testnet",
}

METHOD_LABELS: dict[str, str] = {
Expand Down
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ fi

git pull origin main --ff-only

cz bump
uv run cz bump

git push origin main --tags
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_multiple_profile_types(self, mgr):
mgr.add_profile("key", ApiKeyProfile(api_key="sk-1"))
mgr.add_profile(
"tempo",
TempoProfile(private_key="0xabc", chain_id=TempoChainId.TESTNET),
TempoProfile(private_key="0xabc", chain_id=TempoChainId.MAINNET),
)
profiles = mgr.list_profiles()
assert isinstance(profiles["key"], ApiKeyProfile)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cost_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_multiple_entries(self, log):
log.log_payment(
method="tempo",
endpoint=f"/api/v1/test/{i}",
network="42431",
network="4217",
raw_amount=str(100000 * (i + 1)),
token="tempo",
wallet="tempo-account",
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_groups_by_method_and_network(self, log):
log.log_payment(
method="tempo",
endpoint="/c",
network="42431",
network="4217",
raw_amount="500000",
token="tempo",
wallet="tempo",
Expand All @@ -112,7 +112,7 @@ def test_groups_by_method_and_network(self, log):
totals = log.total()
assert totals["x402:eip155:8453"]["calls"] == 2
assert totals["x402:eip155:8453"]["amount"] == Decimal("3.000000")
assert totals["tempo:42431"]["calls"] == 1
assert totals["tempo:4217"]["calls"] == 1

def test_empty_log(self, log):
assert log.total() == {}
Expand Down
23 changes: 3 additions & 20 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def test_x402_key_roundtrip(self):
assert p.target_network == TargetNetwork.BASE_MAINNET

def test_tempo_roundtrip(self):
p = TempoProfile(private_key="0xabc", chain_id=TempoChainId.TESTNET)
p = TempoProfile(private_key="0xabc", chain_id=TempoChainId.MAINNET)
assert p.method == "tempo"
assert p.chain_id == TempoChainId.TESTNET
assert p.chain_id == TempoChainId.MAINNET

def test_discriminated_union_from_dict(self):
config = AlliumConfig.model_validate(
Expand Down Expand Up @@ -91,11 +91,9 @@ def test_auth_method_values(self):

def test_target_network_label(self):
assert TargetNetwork.BASE_MAINNET.label == "Base Mainnet"
assert TargetNetwork.BASE_SEPOLIA.label == "Base Sepolia (Testnet)"

def test_tempo_chain_id_label(self):
assert TempoChainId.MAINNET.label == "Tempo Mainnet"
assert TempoChainId.TESTNET.label == "Tempo Testnet"


class TestGetTempoConfig:
Expand All @@ -114,28 +112,13 @@ def test_mainnet_resolves_rpc_url(self):
assert chain_id == 4217
assert rpc_url == CHAIN_RPC_URLS[4217]

def test_testnet_resolves_rpc_url(self):
from unittest.mock import patch

from mpp.methods.tempo._defaults import CHAIN_RPC_URLS

from cli.auth.tempo import TempoAccount, _get_tempo_config

profile = TempoProfile(
private_key="0x" + "ab" * 32, chain_id=TempoChainId.TESTNET
)
with patch.object(TempoAccount, "from_key", return_value=None):
_, rpc_url, chain_id = _get_tempo_config(profile)
assert chain_id == 42431
assert rpc_url == CHAIN_RPC_URLS[42431]

def test_unsupported_chain_id_raises(self):
from unittest.mock import patch

from cli.auth.tempo import _get_tempo_config

profile = TempoProfile(
private_key="0x" + "ab" * 32, chain_id=TempoChainId.TESTNET
private_key="0x" + "ab" * 32, chain_id=TempoChainId.MAINNET
)
with patch.object(profile, "chain_id", "99999"):
with pytest.raises(ValueError, match="Unsupported Tempo chain ID: 99999"):
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading