seismic-web3 0.1.0__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 (86) hide show
  1. seismic_web3-0.1.0/.claude/settings.local.json +7 -0
  2. seismic_web3-0.1.0/.env.example +19 -0
  3. seismic_web3-0.1.0/.gitignore +29 -0
  4. seismic_web3-0.1.0/.python-version +1 -0
  5. seismic_web3-0.1.0/DEVELOPMENT.md +150 -0
  6. seismic_web3-0.1.0/Makefile +30 -0
  7. seismic_web3-0.1.0/PKG-INFO +71 -0
  8. seismic_web3-0.1.0/README.md +46 -0
  9. seismic_web3-0.1.0/TODO.md +12 -0
  10. seismic_web3-0.1.0/ci.sh +89 -0
  11. seismic_web3-0.1.0/pyproject.toml +96 -0
  12. seismic_web3-0.1.0/src/seismic_web3/__init__.py +145 -0
  13. seismic_web3-0.1.0/src/seismic_web3/_constants.py +17 -0
  14. seismic_web3-0.1.0/src/seismic_web3/_types.py +104 -0
  15. seismic_web3-0.1.0/src/seismic_web3/abis/__init__.py +20 -0
  16. seismic_web3-0.1.0/src/seismic_web3/abis/deposit_contract.py +219 -0
  17. seismic_web3-0.1.0/src/seismic_web3/abis/directory.py +46 -0
  18. seismic_web3-0.1.0/src/seismic_web3/abis/src20.py +138 -0
  19. seismic_web3-0.1.0/src/seismic_web3/chains.py +135 -0
  20. seismic_web3-0.1.0/src/seismic_web3/client.py +188 -0
  21. seismic_web3-0.1.0/src/seismic_web3/contract/__init__.py +1 -0
  22. seismic_web3-0.1.0/src/seismic_web3/contract/abi.py +191 -0
  23. seismic_web3-0.1.0/src/seismic_web3/contract/shielded.py +537 -0
  24. seismic_web3-0.1.0/src/seismic_web3/crypto/__init__.py +11 -0
  25. seismic_web3-0.1.0/src/seismic_web3/crypto/aes.py +85 -0
  26. seismic_web3-0.1.0/src/seismic_web3/crypto/ecdh.py +114 -0
  27. seismic_web3-0.1.0/src/seismic_web3/crypto/nonce.py +29 -0
  28. seismic_web3-0.1.0/src/seismic_web3/crypto/secp.py +47 -0
  29. seismic_web3-0.1.0/src/seismic_web3/module.py +624 -0
  30. seismic_web3-0.1.0/src/seismic_web3/precompiles/__init__.py +35 -0
  31. seismic_web3-0.1.0/src/seismic_web3/precompiles/_base.py +143 -0
  32. seismic_web3-0.1.0/src/seismic_web3/precompiles/aes.py +211 -0
  33. seismic_web3-0.1.0/src/seismic_web3/precompiles/ecdh.py +84 -0
  34. seismic_web3-0.1.0/src/seismic_web3/precompiles/hkdf.py +71 -0
  35. seismic_web3-0.1.0/src/seismic_web3/precompiles/rng.py +97 -0
  36. seismic_web3-0.1.0/src/seismic_web3/precompiles/secp256k1.py +109 -0
  37. seismic_web3-0.1.0/src/seismic_web3/py.typed +0 -0
  38. seismic_web3-0.1.0/src/seismic_web3/rpc.py +65 -0
  39. seismic_web3-0.1.0/src/seismic_web3/src20/__init__.py +94 -0
  40. seismic_web3-0.1.0/src/seismic_web3/src20/crypto.py +65 -0
  41. seismic_web3-0.1.0/src/seismic_web3/src20/directory.py +244 -0
  42. seismic_web3-0.1.0/src/seismic_web3/src20/types.py +55 -0
  43. seismic_web3-0.1.0/src/seismic_web3/src20/watch.py +596 -0
  44. seismic_web3-0.1.0/src/seismic_web3/transaction/__init__.py +1 -0
  45. seismic_web3-0.1.0/src/seismic_web3/transaction/aead.py +90 -0
  46. seismic_web3-0.1.0/src/seismic_web3/transaction/eip712.py +291 -0
  47. seismic_web3-0.1.0/src/seismic_web3/transaction/metadata.py +160 -0
  48. seismic_web3-0.1.0/src/seismic_web3/transaction/send.py +640 -0
  49. seismic_web3-0.1.0/src/seismic_web3/transaction/serialize.py +156 -0
  50. seismic_web3-0.1.0/src/seismic_web3/transaction_types.py +221 -0
  51. seismic_web3-0.1.0/tests/__init__.py +0 -0
  52. seismic_web3-0.1.0/tests/integration/__init__.py +0 -0
  53. seismic_web3-0.1.0/tests/integration/artifacts/deposit_contract.json +395 -0
  54. seismic_web3-0.1.0/tests/integration/artifacts/mock_src20_events.json +123 -0
  55. seismic_web3-0.1.0/tests/integration/artifacts/seismic_counter.json +34 -0
  56. seismic_web3-0.1.0/tests/integration/artifacts/test_token.json +176 -0
  57. seismic_web3-0.1.0/tests/integration/artifacts/transparent_counter.json +34 -0
  58. seismic_web3-0.1.0/tests/integration/conftest.py +303 -0
  59. seismic_web3-0.1.0/tests/integration/contracts.py +69 -0
  60. seismic_web3-0.1.0/tests/integration/test_client_factory.py +34 -0
  61. seismic_web3-0.1.0/tests/integration/test_deposit_contract.py +322 -0
  62. seismic_web3-0.1.0/tests/integration/test_directory.py +130 -0
  63. seismic_web3-0.1.0/tests/integration/test_eip712.py +189 -0
  64. seismic_web3-0.1.0/tests/integration/test_namespace.py +54 -0
  65. seismic_web3-0.1.0/tests/integration/test_precompiles.py +173 -0
  66. seismic_web3-0.1.0/tests/integration/test_seismic_counter.py +140 -0
  67. seismic_web3-0.1.0/tests/integration/test_src20_events.py +259 -0
  68. seismic_web3-0.1.0/tests/integration/test_src20_token.py +208 -0
  69. seismic_web3-0.1.0/tests/integration/test_transparent_counter.py +67 -0
  70. seismic_web3-0.1.0/tests/test_abi.py +152 -0
  71. seismic_web3-0.1.0/tests/test_chains.py +97 -0
  72. seismic_web3-0.1.0/tests/test_client.py +203 -0
  73. seismic_web3-0.1.0/tests/test_contract.py +116 -0
  74. seismic_web3-0.1.0/tests/test_crypto.py +114 -0
  75. seismic_web3-0.1.0/tests/test_deposit_helpers.py +180 -0
  76. seismic_web3-0.1.0/tests/test_eip712.py +784 -0
  77. seismic_web3-0.1.0/tests/test_encryption.py +152 -0
  78. seismic_web3-0.1.0/tests/test_module.py +192 -0
  79. seismic_web3-0.1.0/tests/test_placeholder.py +5 -0
  80. seismic_web3-0.1.0/tests/test_precompiles.py +313 -0
  81. seismic_web3-0.1.0/tests/test_rpc.py +70 -0
  82. seismic_web3-0.1.0/tests/test_send.py +23 -0
  83. seismic_web3-0.1.0/tests/test_serialize.py +124 -0
  84. seismic_web3-0.1.0/tests/test_transaction_types.py +260 -0
  85. seismic_web3-0.1.0/tests/test_types.py +136 -0
  86. seismic_web3-0.1.0/uv.lock +2184 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(100 blocks\" errors when the DB lagged behind the in-memory state.:*)"
5
+ ]
6
+ }
7
+ }
@@ -0,0 +1,19 @@
1
+ # Seismic integration test configuration
2
+ # Copy to .env and fill in your paths, or export these in your shell.
3
+ #
4
+ # Resolution order for each binary:
5
+ # 1. Specific root env var (SFOUNDRY_ROOT / SRETH_ROOT)
6
+ # 2. SEISMIC_WORKSPACE fallback (derives paths from workspace layout)
7
+ #
8
+ # You only need to set ONE of the following:
9
+ # - SEISMIC_WORKSPACE (if your repos follow the standard layout), OR
10
+ # - The individual ROOT vars below
11
+
12
+ # Parent directory containing all seismic-* repos
13
+ # SEISMIC_WORKSPACE=~/code/seismic-workspace
14
+
15
+ # Seismic Foundry repo root (binary: target/debug/sanvil)
16
+ # SFOUNDRY_ROOT=~/code/seismic-workspace/seismic-foundry
17
+
18
+ # Seismic Reth repo root (binary: target/debug/seismic-reth)
19
+ # SRETH_ROOT=~/code/seismic-workspace/seismic-reth
@@ -0,0 +1,29 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+
7
+ # Virtual environments
8
+ .venv/
9
+
10
+ # Distribution / packaging
11
+ dist/
12
+ build/
13
+ *.egg-info/
14
+ *.egg
15
+
16
+ # Tools
17
+ .ruff_cache/
18
+ .pytest_cache/
19
+ .mypy_cache/
20
+
21
+ # IDE
22
+ .vscode/
23
+ .idea/
24
+
25
+ # OS
26
+ .DS_Store
27
+
28
+ # Environment
29
+ .env
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,150 @@
1
+ # Development
2
+
3
+ ## Prerequisites
4
+
5
+ - **Python 3.10+**
6
+ - **[uv](https://docs.astral.sh/uv/)** — install with `curl -LsSf https://astral.sh/uv/install.sh | sh`
7
+
8
+ ## Environment Variables for Integration Tests
9
+
10
+ Integration tests start a local sanvil or seismic-reth node and need to know where the binaries are. Set **one** of the following:
11
+
12
+ | Variable | Description |
13
+ |----------|-------------|
14
+ | `SEISMIC_WORKSPACE` | Parent directory containing `seismic-foundry/` and `seismic-reth/` repos |
15
+ | `SFOUNDRY_ROOT` | Path to seismic-foundry repo root (overrides `SEISMIC_WORKSPACE` for sanvil) |
16
+ | `SRETH_ROOT` | Path to seismic-reth repo root (overrides `SEISMIC_WORKSPACE` for reth) |
17
+
18
+ The binaries are resolved as:
19
+ - **sanvil**: `$SFOUNDRY_ROOT/target/debug/sanvil` or `$SEISMIC_WORKSPACE/seismic-foundry/target/debug/sanvil`
20
+ - **seismic-reth**: `$SRETH_ROOT/target/debug/seismic-reth` or `$SEISMIC_WORKSPACE/seismic-reth/target/debug/seismic-reth`
21
+
22
+ Quick setup:
23
+
24
+ ```bash
25
+ # Option 1: Set workspace root (works for both)
26
+ export SEISMIC_WORKSPACE=~/code/seismic-workspace
27
+
28
+ # Option 2: Set individual roots
29
+ export SFOUNDRY_ROOT=~/code/seismic-workspace/seismic-foundry
30
+ export SRETH_ROOT=~/code/seismic-workspace/seismic-reth
31
+ ```
32
+
33
+ See `.env.example` for a template you can copy to `.env`.
34
+
35
+ ## Commands
36
+
37
+ | Command | Description |
38
+ |---------|-------------|
39
+ | `make install` | Install all dependencies into venv |
40
+ | `make fmt` | Format code with ruff |
41
+ | `make fmt-check` | Check formatting without changes |
42
+ | `make lint` | Run ruff linter |
43
+ | `make typecheck` | Run ty type checker |
44
+ | `make test` | Run unit tests (no node required) |
45
+ | `make test-integration-anvil` | Run integration tests against sanvil |
46
+ | `make test-integration-reth` | Run integration tests against seismic-reth |
47
+ | `make test-all` | Run all tests (unit + integration) |
48
+ | `make ci` | Run all CI checks (fmt-check + lint + typecheck + unit tests) |
49
+
50
+ ## Running CI Locally
51
+
52
+ ```bash
53
+ ./ci.sh # Full CI: lint, typecheck, unit + integration tests
54
+ ./ci.sh --no-anvil # Skip anvil integration tests
55
+ ./ci.sh --no-reth # Skip reth integration tests
56
+ ./ci.sh --no-integration # Skip all integration tests (unit only)
57
+ ```
58
+
59
+ ## Publishing to PyPI
60
+
61
+ ```bash
62
+ # Build
63
+ uv build
64
+
65
+ # Publish (requires authentication)
66
+ uv publish
67
+
68
+ # Or with token
69
+ uv publish --token <PYPI_TOKEN>
70
+ ```
71
+
72
+ ## Project Structure
73
+
74
+ ```
75
+ clients/py/
76
+ ├── pyproject.toml
77
+ ├── Makefile
78
+ ├── ci.sh
79
+ ├── .python-version
80
+ ├── src/
81
+ │ └── seismic_web3/
82
+ │ ├── __init__.py # Public API exports
83
+ │ ├── _types.py # PrivateKey, Bytes32, etc.
84
+ │ ├── chains.py # ChainConfig, SEISMIC_TESTNET, SANVIL
85
+ │ ├── client.py # create_shielded_web3, EncryptionState
86
+ │ ├── module.py # SeismicNamespace (w3.seismic)
87
+ │ ├── transaction_types.py # SeismicSecurityParams, TxSeismic types
88
+ │ ├── py.typed # PEP 561 type marker
89
+ │ ├── abis/
90
+ │ │ ├── __init__.py # Re-exports SRC20_ABI, DIRECTORY_ABI
91
+ │ │ ├── deposit_contract.py # Deposit contract ABI + helpers
92
+ │ │ ├── directory.py # Directory genesis contract ABI
93
+ │ │ └── src20.py # ISRC20 interface ABI + events
94
+ │ ├── contract/
95
+ │ │ ├── abi.py # ABI encoding, shielded type remapping
96
+ │ │ └── shielded.py # ShieldedContract (5-namespace pattern)
97
+ │ ├── crypto/
98
+ │ │ ├── aes.py # AES-GCM encryption
99
+ │ │ ├── ecdh.py # ECDH key agreement
100
+ │ │ ├── nonce.py # Nonce generation
101
+ │ │ └── secp.py # secp256k1 utilities
102
+ │ ├── src20/
103
+ │ │ ├── __init__.py # Re-exports public API
104
+ │ │ ├── types.py # DecryptedTransferLog, DecryptedApprovalLog
105
+ │ │ ├── crypto.py # AES-GCM decryption of encrypted amounts
106
+ │ │ ├── directory.py # Directory contract helpers (viewing keys)
107
+ │ │ └── watch.py # SRC20EventWatcher, factory functions
108
+ │ ├── precompiles/
109
+ │ │ ├── _base.py # Precompile framework (call, gas helpers)
110
+ │ │ ├── rng.py # RNG precompile (0x64)
111
+ │ │ ├── ecdh.py # ECDH precompile (0x65)
112
+ │ │ ├── aes.py # AES encrypt/decrypt (0x66, 0x67)
113
+ │ │ ├── hkdf.py # HKDF precompile (0x68)
114
+ │ │ └── secp256k1.py # secp256k1 sign precompile (0x69)
115
+ │ └── transaction/
116
+ │ ├── aead.py # AAD construction
117
+ │ ├── eip712.py # EIP-712 typed data signing
118
+ │ ├── metadata.py # Transaction metadata
119
+ │ ├── send.py # send_shielded_transaction, signed_call
120
+ │ └── serialize.py # RLP serialization
121
+ └── tests/
122
+ ├── test_abi.py
123
+ ├── test_chains.py
124
+ ├── test_client.py
125
+ ├── test_contract.py
126
+ ├── test_crypto.py
127
+ ├── test_eip712.py
128
+ ├── test_encryption.py
129
+ ├── test_module.py
130
+ ├── test_rpc.py
131
+ ├── test_send.py
132
+ ├── test_serialize.py
133
+ ├── test_transaction_types.py
134
+ ├── test_precompiles.py
135
+ ├── test_types.py
136
+ ├── test_deposit_helpers.py
137
+ └── integration/
138
+ ├── conftest.py
139
+ ├── contracts.py
140
+ ├── artifacts/ # Compiled contract JSON
141
+ ├── test_deposit_contract.py
142
+ ├── test_directory.py
143
+ ├── test_client_factory.py
144
+ ├── test_namespace.py
145
+ ├── test_precompiles.py
146
+ ├── test_seismic_counter.py
147
+ ├── test_src20_events.py
148
+ ├── test_src20_token.py
149
+ └── test_transparent_counter.py
150
+ ```
@@ -0,0 +1,30 @@
1
+ .PHONY: install lint fmt fmt-check typecheck test test-integration-anvil test-integration-reth test-all ci
2
+
3
+ install: ## Install all dependencies into venv
4
+ uv sync --all-extras --dev
5
+
6
+ lint: ## Run ruff linter
7
+ uv run ruff check src/ tests/
8
+
9
+ fmt: ## Format code with ruff
10
+ uv run ruff format src/ tests/
11
+
12
+ fmt-check: ## Check formatting without making changes
13
+ uv run ruff format --check src/ tests/
14
+
15
+ typecheck: ## Run ty type checker
16
+ uv run ty check src/
17
+
18
+ test: ## Run unit tests (no node required)
19
+ uv run pytest tests/ -v --ignore=tests/integration
20
+
21
+ test-integration-anvil: ## Run integration tests against sanvil
22
+ CHAIN=anvil uv run pytest tests/integration/ -v --timeout=120
23
+
24
+ test-integration-reth: ## Run integration tests against seismic-reth
25
+ CHAIN=reth uv run pytest tests/integration/ -v --timeout=120
26
+
27
+ test-all: ## Run all tests (unit + integration)
28
+ uv run pytest tests/ -v --timeout=120
29
+
30
+ ci: fmt-check lint typecheck test ## Run all CI checks
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: seismic-web3
3
+ Version: 0.1.0
4
+ Summary: Seismic Python SDK — web3.py extensions for the Seismic privacy-enabled EVM
5
+ Project-URL: Documentation, https://docs.seismic.systems/clients/python
6
+ Project-URL: Repository, https://github.com/SeismicSystems/seismic
7
+ Project-URL: Source, https://github.com/SeismicSystems/seismic/tree/main/clients/py
8
+ Author: Seismic Systems
9
+ License-Expression: MIT
10
+ Keywords: blockchain,ethereum,evm,privacy,seismic,web3
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: coincurve>=20.0
22
+ Requires-Dist: cryptography>=43.0
23
+ Requires-Dist: web3<8,>=7.0
24
+ Description-Content-Type: text/markdown
25
+
26
+ # seismic-web3
27
+
28
+ Python SDK for [Seismic](https://seismic.systems), built on [web3.py](https://github.com/ethereum/web3.py). Requires **Python 3.10+**.
29
+
30
+ ```bash
31
+ pip install seismic-web3
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ ```python
37
+ from seismic_web3 import SEISMIC_TESTNET, PrivateKey
38
+
39
+ pk = PrivateKey(bytes.fromhex("YOUR_PRIVATE_KEY_HEX"))
40
+
41
+ w3 = SEISMIC_TESTNET.create_client(pk)
42
+
43
+ contract = w3.seismic.contract(address="0x...", abi=ABI)
44
+
45
+ # Shielded write — calldata is encrypted (TxSeismic type 0x4a)
46
+ tx_hash = contract.write.setNumber(42)
47
+ receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
48
+
49
+ # Shielded read — signed, encrypted eth_call
50
+ result = contract.read.getNumber()
51
+ ```
52
+
53
+ `ShieldedContract` exposes five namespaces:
54
+
55
+ | Namespace | What it does | On-chain visibility |
56
+ |-----------|-------------|-------------------|
57
+ | `.write` | Encrypted transaction (`TxSeismic` type `0x4a`) | Calldata hidden |
58
+ | `.read` | Encrypted signed `eth_call` | Calldata + result hidden |
59
+ | `.twrite` | Standard `eth_sendTransaction` | Calldata visible |
60
+ | `.tread` | Standard `eth_call` | Calldata visible |
61
+ | `.dwrite` | Debug write — returns plaintext + encrypted views | Calldata hidden |
62
+
63
+ Both sync and async clients are supported. See the full documentation for details.
64
+
65
+ ## Documentation
66
+
67
+ Full docs are hosted on GitBook: **[docs.seismic.systems/clients/python](https://docs.seismic.systems/clients/python)**
68
+
69
+ ## Contributing
70
+
71
+ See [DEVELOPMENT.md](DEVELOPMENT.md) for local setup, running tests, and publishing.
@@ -0,0 +1,46 @@
1
+ # seismic-web3
2
+
3
+ Python SDK for [Seismic](https://seismic.systems), built on [web3.py](https://github.com/ethereum/web3.py). Requires **Python 3.10+**.
4
+
5
+ ```bash
6
+ pip install seismic-web3
7
+ ```
8
+
9
+ ## Quick start
10
+
11
+ ```python
12
+ from seismic_web3 import SEISMIC_TESTNET, PrivateKey
13
+
14
+ pk = PrivateKey(bytes.fromhex("YOUR_PRIVATE_KEY_HEX"))
15
+
16
+ w3 = SEISMIC_TESTNET.create_client(pk)
17
+
18
+ contract = w3.seismic.contract(address="0x...", abi=ABI)
19
+
20
+ # Shielded write — calldata is encrypted (TxSeismic type 0x4a)
21
+ tx_hash = contract.write.setNumber(42)
22
+ receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
23
+
24
+ # Shielded read — signed, encrypted eth_call
25
+ result = contract.read.getNumber()
26
+ ```
27
+
28
+ `ShieldedContract` exposes five namespaces:
29
+
30
+ | Namespace | What it does | On-chain visibility |
31
+ |-----------|-------------|-------------------|
32
+ | `.write` | Encrypted transaction (`TxSeismic` type `0x4a`) | Calldata hidden |
33
+ | `.read` | Encrypted signed `eth_call` | Calldata + result hidden |
34
+ | `.twrite` | Standard `eth_sendTransaction` | Calldata visible |
35
+ | `.tread` | Standard `eth_call` | Calldata visible |
36
+ | `.dwrite` | Debug write — returns plaintext + encrypted views | Calldata hidden |
37
+
38
+ Both sync and async clients are supported. See the full documentation for details.
39
+
40
+ ## Documentation
41
+
42
+ Full docs are hosted on GitBook: **[docs.seismic.systems/clients/python](https://docs.seismic.systems/clients/python)**
43
+
44
+ ## Contributing
45
+
46
+ See [DEVELOPMENT.md](DEVELOPMENT.md) for local setup, running tests, and publishing.
@@ -0,0 +1,12 @@
1
+ # seismic-web3 TODO
2
+
3
+ Deferred features not included in the initial SDK implementation.
4
+
5
+ ## Block Explorer URL Helpers
6
+
7
+ - Generate URLs for addresses, transactions, tokens, blocks
8
+ - Support for SeismicScan explorer
9
+
10
+ ## Faucet Interaction
11
+
12
+ - Request testnet ETH from the Seismic faucet
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ cd "$(dirname "$0")"
5
+
6
+ # ---------------------------------------------------------------------------
7
+ # Flags
8
+ # ---------------------------------------------------------------------------
9
+ run_anvil=true
10
+ run_reth=true
11
+
12
+ usage() {
13
+ cat <<EOF
14
+ Usage: $0 [OPTIONS]
15
+
16
+ Run CI checks: lint, typecheck, unit tests, and integration tests.
17
+
18
+ Options:
19
+ --no-anvil, -A Skip anvil integration tests
20
+ --no-reth, -R Skip reth integration tests
21
+ --no-integration, -I Skip all integration tests
22
+ -h, --help Show this help
23
+ EOF
24
+ exit 0
25
+ }
26
+
27
+ while [[ $# -gt 0 ]]; do
28
+ case "$1" in
29
+ -A|--no-anvil) run_anvil=false ;;
30
+ -R|--no-reth) run_reth=false ;;
31
+ -I|--no-integration) run_anvil=false; run_reth=false ;;
32
+ -h|--help) usage ;;
33
+ *) echo "Unknown option: $1" >&2; usage ;;
34
+ esac
35
+ shift
36
+ done
37
+
38
+ # ---------------------------------------------------------------------------
39
+ # Check binary environment for integration tests
40
+ # ---------------------------------------------------------------------------
41
+
42
+ if $run_anvil || $run_reth; then
43
+ if [[ -z "${SEISMIC_WORKSPACE:-}" && -z "${SFOUNDRY_ROOT:-}" && -z "${SRETH_ROOT:-}" ]]; then
44
+ echo "WARNING: No binary path env vars set (SEISMIC_WORKSPACE, SFOUNDRY_ROOT, SRETH_ROOT)."
45
+ echo "Integration tests will fail. See .env.example for setup instructions."
46
+ echo ""
47
+ fi
48
+ fi
49
+
50
+ # ---------------------------------------------------------------------------
51
+ # Static checks + unit tests
52
+ # ---------------------------------------------------------------------------
53
+
54
+ echo "==> Installing dependencies"
55
+ uv sync --locked --dev
56
+
57
+ echo "==> Checking formatting"
58
+ uv run ruff format --check src/ tests/
59
+
60
+ echo "==> Running linter"
61
+ uv run ruff check src/ tests/
62
+
63
+ echo "==> Running type checker"
64
+ uv run ty check src/
65
+
66
+ echo "==> Running unit tests"
67
+ uv run pytest tests/ -v --ignore=tests/integration
68
+
69
+ # ---------------------------------------------------------------------------
70
+ # Integration tests
71
+ # ---------------------------------------------------------------------------
72
+
73
+ if $run_anvil; then
74
+ echo ""
75
+ echo "=========================================="
76
+ echo " Integration tests: sanvil (anvil)"
77
+ echo "=========================================="
78
+ CHAIN=anvil uv run pytest tests/integration/ -v --timeout=120
79
+ fi
80
+
81
+ if $run_reth; then
82
+ echo ""
83
+ echo "=========================================="
84
+ echo " Integration tests: seismic-reth"
85
+ echo "=========================================="
86
+ CHAIN=reth uv run pytest tests/integration/ -v --timeout=120
87
+ fi
88
+
89
+ echo "==> All checks passed"
@@ -0,0 +1,96 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "seismic-web3"
7
+ version = "0.1.0"
8
+ description = "Seismic Python SDK — web3.py extensions for the Seismic privacy-enabled EVM"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [{ name = "Seismic Systems" }]
13
+ keywords = ["seismic", "web3", "ethereum", "evm", "privacy", "blockchain"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Typing :: Typed",
24
+ ]
25
+ dependencies = [
26
+ "web3>=7.0,<8",
27
+ "coincurve>=20.0",
28
+ "cryptography>=43.0",
29
+ ]
30
+
31
+ [project.urls]
32
+ Documentation = "https://docs.seismic.systems/clients/python"
33
+ Repository = "https://github.com/SeismicSystems/seismic"
34
+ Source = "https://github.com/SeismicSystems/seismic/tree/main/clients/py"
35
+
36
+ [dependency-groups]
37
+ dev = [
38
+ "ruff>=0.11",
39
+ "ty>=0.0.1a1",
40
+ "pytest>=8.0",
41
+ "pytest-asyncio>=0.25",
42
+ "pytest-timeout>=2.0",
43
+ "requests>=2.0",
44
+ ]
45
+
46
+ [tool.ruff]
47
+ target-version = "py310"
48
+ line-length = 88
49
+
50
+ [tool.ruff.lint]
51
+ select = [
52
+ "E", # pycodestyle errors
53
+ "W", # pycodestyle warnings
54
+ "F", # pyflakes
55
+ "I", # isort
56
+ "B", # flake8-bugbear
57
+ "C4", # flake8-comprehensions
58
+ "UP", # pyupgrade
59
+ "RUF", # ruff-specific rules
60
+ "SIM", # flake8-simplify
61
+ "TCH", # flake8-type-checking
62
+ "ANN", # flake8-annotations
63
+ "PT", # flake8-pytest-style
64
+ ]
65
+ ignore = [
66
+ "ANN401", # allow Any in *args/**kwargs (needed for dynamic ABI args)
67
+ ]
68
+
69
+ [tool.ruff.lint.per-file-ignores]
70
+ "tests/*" = [
71
+ "ANN", # don't require type annotations in tests
72
+ ]
73
+
74
+ [tool.ruff.format]
75
+ quote-style = "double"
76
+ indent-style = "space"
77
+
78
+ [tool.ty.environment]
79
+ python-version = "3.10"
80
+
81
+ [tool.ty.terminal]
82
+ error-on-warning = true
83
+
84
+ [tool.pytest.ini_options]
85
+ asyncio_mode = "auto"
86
+ strict_markers = true
87
+ markers = [
88
+ "integration: requires a running seismic node",
89
+ ]
90
+ filterwarnings = [
91
+ # Upstream web3.py issues — not fixable on our side:
92
+ # https://github.com/ethereum/web3.py/issues — web3 uses the legacy websockets API
93
+ "ignore::DeprecationWarning:websockets.legacy",
94
+ # https://github.com/ethereum/web3.py/issues — web3 passes deprecated param to aiohttp
95
+ "ignore::DeprecationWarning:aiohttp.connector",
96
+ ]