primecli 0.9.0__tar.gz → 0.9.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {primecli-0.9.0 → primecli-0.9.1}/PKG-INFO +2 -2
  2. {primecli-0.9.0 → primecli-0.9.1}/README.md +1 -1
  3. {primecli-0.9.0 → primecli-0.9.1}/primecli/degenprime.py +49 -42
  4. {primecli-0.9.0 → primecli-0.9.1}/primecli.egg-info/PKG-INFO +2 -2
  5. {primecli-0.9.0 → primecli-0.9.1}/pyproject.toml +1 -1
  6. {primecli-0.9.0 → primecli-0.9.1}/LICENSE +0 -0
  7. {primecli-0.9.0 → primecli-0.9.1}/primecli/__init__.py +0 -0
  8. {primecli-0.9.0 → primecli-0.9.1}/primecli/arbprime.py +0 -0
  9. {primecli-0.9.0 → primecli-0.9.1}/primecli/deltaprime.py +0 -0
  10. {primecli-0.9.0 → primecli-0.9.1}/primecli/health_monitor.py +0 -0
  11. {primecli-0.9.0 → primecli-0.9.1}/primecli.egg-info/SOURCES.txt +0 -0
  12. {primecli-0.9.0 → primecli-0.9.1}/primecli.egg-info/dependency_links.txt +0 -0
  13. {primecli-0.9.0 → primecli-0.9.1}/primecli.egg-info/entry_points.txt +0 -0
  14. {primecli-0.9.0 → primecli-0.9.1}/primecli.egg-info/requires.txt +0 -0
  15. {primecli-0.9.0 → primecli-0.9.1}/primecli.egg-info/top_level.txt +0 -0
  16. {primecli-0.9.0 → primecli-0.9.1}/setup.cfg +0 -0
  17. {primecli-0.9.0 → primecli-0.9.1}/tests/test_aero_rebalance.py +0 -0
  18. {primecli-0.9.0 → primecli-0.9.1}/tests/test_cross_file_identity.py +0 -0
  19. {primecli-0.9.0 → primecli-0.9.1}/tests/test_gas_limit.py +0 -0
  20. {primecli-0.9.0 → primecli-0.9.1}/tests/test_gas_pricing.py +0 -0
  21. {primecli-0.9.0 → primecli-0.9.1}/tests/test_health_meter.py +0 -0
  22. {primecli-0.9.0 → primecli-0.9.1}/tests/test_health_monitor.py +0 -0
  23. {primecli-0.9.0 → primecli-0.9.1}/tests/test_paraswap_validator.py +0 -0
  24. {primecli-0.9.0 → primecli-0.9.1}/tests/test_redstone_encoding.py +0 -0
  25. {primecli-0.9.0 → primecli-0.9.1}/tests/test_to_wei_units.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: primecli
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: Agent-friendly CLI tools for the DeltaPrime (Avalanche + Arbitrum) and DegenPrime (Base) lending and leverage protocols. Preview-by-default; no Etherscan key required.
5
5
  Author: Mnemosyne-quest contributors
6
6
  License: MIT
@@ -47,7 +47,7 @@ Built for agent use:
47
47
  - RedStone-signed solvency math handled internally, with a regression test pinning the half-boundary `toFixed(8)` encoding.
48
48
  - ParaSwap calldata validated client-side against the on-chain executor allowlist before broadcast.
49
49
 
50
- **Current version:** 0.9.0 The 0.x line is pre-1.0, so breaking changes are possible. See [Releases](https://github.com/Mnemosyne-quest/primecli/releases).
50
+ **Current version:** 0.9.1 The 0.x line is pre-1.0, so breaking changes are possible. See [Releases](https://github.com/Mnemosyne-quest/primecli/releases).
51
51
 
52
52
  > **Breaking change in 0.5.0:** there is no longer a default signing key. Earlier versions silently fell back to a baked-in agent when no key was configured; that fallback has been removed. With no key configured, every command now fails closed with `No signing key found...`. Set a key explicitly (see [Configuration](#configuration)).
53
53
 
@@ -16,7 +16,7 @@ Built for agent use:
16
16
  - RedStone-signed solvency math handled internally, with a regression test pinning the half-boundary `toFixed(8)` encoding.
17
17
  - ParaSwap calldata validated client-side against the on-chain executor allowlist before broadcast.
18
18
 
19
- **Current version:** 0.9.0 The 0.x line is pre-1.0, so breaking changes are possible. See [Releases](https://github.com/Mnemosyne-quest/primecli/releases).
19
+ **Current version:** 0.9.1 The 0.x line is pre-1.0, so breaking changes are possible. See [Releases](https://github.com/Mnemosyne-quest/primecli/releases).
20
20
 
21
21
  > **Breaking change in 0.5.0:** there is no longer a default signing key. Earlier versions silently fell back to a baked-in agent when no key was configured; that fallback has been removed. With no key configured, every command now fails closed with `No signing key found...`. Set a key explicitly (see [Configuration](#configuration)).
22
22
 
@@ -4353,8 +4353,10 @@ def _aero_rebalance_events(account: str, from_block=None, to_block="latest"):
4353
4353
  if from_block is None:
4354
4354
  # The shared emitter went live with the 2026-06-16 migration; a recent window
4355
4355
  # covers all post-migration history. Public Base RPCs cap getLogs at 50k blocks,
4356
- # so default to ~180k blocks back (≈4 days at 2s/block) and page under the cap.
4357
- from_block = max(0, latest - 180_000)
4356
+ # so default to ~90k blocks back (≈50h at 2s/block, covering the 48h KO window)
4357
+ # and page under the cap. All four event types are fetched in ONE getLogs per
4358
+ # chunk (topic0 OR-list) below, so this stays fast enough for a per-tick call.
4359
+ from_block = max(0, latest - 90_000)
4358
4360
  # Non-indexed arg types per event (indexed userContract/user/tokenId/executor live
4359
4361
  # in the topics, not the data blob).
4360
4362
  nonindexed = {
@@ -4364,47 +4366,52 @@ def _aero_rebalance_events(account: str, from_block=None, to_block="latest"):
4364
4366
  "RebalanceExecuted": ["uint160", "uint160", "uint256", "uint256"],
4365
4367
  }
4366
4368
  CHUNK = 45_000 # under the public-RPC 50k-block getLogs cap
4369
+ # Reverse map topic0 -> event name so a SINGLE getLogs (topic0 as an OR-list) returns
4370
+ # all four event types per chunk, then is demuxed here. One scan per event type
4371
+ # (the previous approach) meant 4x the getLogs round-trips, which timed out the
4372
+ # per-tick range-monitor call.
4373
+ t0_to_name = {t.lower().removeprefix("0x"): n for n, t in REBALANCE_TOPIC0.items()}
4374
+ all_topic0 = list(REBALANCE_TOPIC0.values())
4367
4375
  out = []
4368
- for name, topic0 in REBALANCE_TOPIC0.items():
4369
- logs = []
4370
- start = from_block
4371
- try:
4372
- while start <= to_block:
4373
- end = min(start + CHUNK - 1, to_block)
4374
- logs.extend(w3.eth.get_logs({"address": emitter, "fromBlock": start,
4375
- "toBlock": end, "topics": [topic0, acct_topic]}))
4376
- start = end + 1
4377
- except Exception as e:
4378
- print(f" (getLogs failed for {name}: {type(e).__name__}: {str(e)[:120]})")
4379
- continue
4380
- for lg in logs:
4381
- ev = {"event": name, "block": lg["blockNumber"],
4382
- "logIndex": lg["logIndex"], "tx": lg["transactionHash"].hex()}
4383
- # topic2 is tokenId (Created/Updated/Canceled) or executor (Executed);
4384
- # for Executed the OLD tokenId is topic3.
4385
- topics = lg["topics"]
4386
- decoded = w3.codec.decode(nonindexed[name], bytes(lg["data"]))
4387
- if name == "RebalanceExecuted":
4388
- ev["executor"] = "0x" + topics[2].hex()[-40:]
4389
- ev["tokenId"] = int(topics[3].hex(), 16)
4390
- ev["oldRefSqrtPriceX96"] = decoded[0]
4391
- ev["currentSqrtPriceX96"] = decoded[1]
4392
- ev["newTokenId"] = decoded[2]
4393
- ev["timestamp"] = decoded[3]
4394
- else:
4395
- ev["tokenId"] = int(topics[3].hex(), 16) if len(topics) > 3 else None
4396
- if name == "RebalanceOrderCreated":
4397
- ev["rangeBps"] = [decoded[0], decoded[1]]
4398
- ev["triggerBps"] = [decoded[2], decoded[3]]
4399
- ev["executionFeeWeth"] = decoded[4]
4400
- ev["timestamp"] = decoded[5]
4401
- elif name == "RebalanceOrderUpdated":
4402
- ev["rangeBps"] = [decoded[0], decoded[1]]
4403
- ev["triggerBps"] = [decoded[2], decoded[3]]
4404
- ev["timestamp"] = decoded[4]
4405
- elif name == "RebalanceOrderCanceled":
4406
- ev["timestamp"] = decoded[0]
4407
- out.append(ev)
4376
+ start = from_block
4377
+ try:
4378
+ while start <= to_block:
4379
+ end = min(start + CHUNK - 1, to_block)
4380
+ chunk_logs = w3.eth.get_logs({"address": emitter, "fromBlock": start,
4381
+ "toBlock": end, "topics": [all_topic0, acct_topic]})
4382
+ for lg in chunk_logs:
4383
+ name = t0_to_name.get(lg["topics"][0].hex().lower().removeprefix("0x"))
4384
+ if name is None:
4385
+ continue
4386
+ ev = {"event": name, "block": lg["blockNumber"],
4387
+ "logIndex": lg["logIndex"], "tx": lg["transactionHash"].hex()}
4388
+ # topic2 is executor (Executed); topic3 is the tokenId (all four events).
4389
+ topics = lg["topics"]
4390
+ decoded = w3.codec.decode(nonindexed[name], bytes(lg["data"]))
4391
+ if name == "RebalanceExecuted":
4392
+ ev["executor"] = "0x" + topics[2].hex()[-40:]
4393
+ ev["tokenId"] = int(topics[3].hex(), 16)
4394
+ ev["oldRefSqrtPriceX96"] = decoded[0]
4395
+ ev["currentSqrtPriceX96"] = decoded[1]
4396
+ ev["newTokenId"] = decoded[2]
4397
+ ev["timestamp"] = decoded[3]
4398
+ else:
4399
+ ev["tokenId"] = int(topics[3].hex(), 16) if len(topics) > 3 else None
4400
+ if name == "RebalanceOrderCreated":
4401
+ ev["rangeBps"] = [decoded[0], decoded[1]]
4402
+ ev["triggerBps"] = [decoded[2], decoded[3]]
4403
+ ev["executionFeeWeth"] = decoded[4]
4404
+ ev["timestamp"] = decoded[5]
4405
+ elif name == "RebalanceOrderUpdated":
4406
+ ev["rangeBps"] = [decoded[0], decoded[1]]
4407
+ ev["triggerBps"] = [decoded[2], decoded[3]]
4408
+ ev["timestamp"] = decoded[4]
4409
+ elif name == "RebalanceOrderCanceled":
4410
+ ev["timestamp"] = decoded[0]
4411
+ out.append(ev)
4412
+ start = end + 1
4413
+ except Exception as e:
4414
+ print(f" (getLogs failed: {type(e).__name__}: {str(e)[:120]})")
4408
4415
  out.sort(key=lambda e: (e["block"], e["logIndex"]))
4409
4416
  return out
4410
4417
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: primecli
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: Agent-friendly CLI tools for the DeltaPrime (Avalanche + Arbitrum) and DegenPrime (Base) lending and leverage protocols. Preview-by-default; no Etherscan key required.
5
5
  Author: Mnemosyne-quest contributors
6
6
  License: MIT
@@ -47,7 +47,7 @@ Built for agent use:
47
47
  - RedStone-signed solvency math handled internally, with a regression test pinning the half-boundary `toFixed(8)` encoding.
48
48
  - ParaSwap calldata validated client-side against the on-chain executor allowlist before broadcast.
49
49
 
50
- **Current version:** 0.9.0 The 0.x line is pre-1.0, so breaking changes are possible. See [Releases](https://github.com/Mnemosyne-quest/primecli/releases).
50
+ **Current version:** 0.9.1 The 0.x line is pre-1.0, so breaking changes are possible. See [Releases](https://github.com/Mnemosyne-quest/primecli/releases).
51
51
 
52
52
  > **Breaking change in 0.5.0:** there is no longer a default signing key. Earlier versions silently fell back to a baked-in agent when no key was configured; that fallback has been removed. With no key configured, every command now fails closed with `No signing key found...`. Set a key explicitly (see [Configuration](#configuration)).
53
53
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "primecli"
7
- version = "0.9.0"
7
+ version = "0.9.1"
8
8
  description = "Agent-friendly CLI tools for the DeltaPrime (Avalanche + Arbitrum) and DegenPrime (Base) lending and leverage protocols. Preview-by-default; no Etherscan key required."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes
File without changes
File without changes