Commit 1bb2366
feat!: Account model refinements and further alignment with ts variant (#227)
* refactor: algod and api generator refinements aligning with ts
* chore: txnleases
* feat: default value handling of required fields; omitting txn leases field
* fix(api): refine format parameter handling in client generator template
- Only set format=msgpack when msgpack is explicitly selected
- Remove unnecessary format=json assignments for JSON-only endpoints
- Align with TypeScript client behavior
* fix(api): regenerate algod client with refined format handling
Generated output from updated client.py.j2 template:
- Remove format=json for endpoints that only support JSON
- Simplify msgpack format selection logic
- Reduce unnecessary query parameters
* fix(serde): handle dataclass fields that shadow builtin names
When dataclasses use slots=True and have fields named 'bytes' or 'type',
the class namespace contains member descriptors that interfere with
get_type_hints() evaluation.
Fix by passing explicit globalns with builtins and empty localns to
get_type_hints() to avoid the class namespace pollution.
Fixes TypeError: unsupported operand type(s) for |: 'member_descriptor' and 'NoneType'
* fix(algod): make LedgerAppParams schema fields optional
The local_state_schema and global_state_schema fields may not always
be present in wire data from the ledger state delta endpoint.
Make them optional with default=None to handle missing fields gracefully.
* feat(test): integrate polytest mock server for API client testing
Add Docker container-based mock server fixtures using testcontainers:
- MockServerContainer class to manage PollyJS mock server lifecycle
- Session-scoped fixtures for algod, indexer, and kmd mock servers
- Mock server replays pre-recorded HAR files for deterministic testing
- Fixtures automatically start/stop containers per test session
- Configure via POLYTEST_MOCK_SERVER_IMAGE and POLYTEST_RECORDINGS_PATH env vars
- Add test configuration constants matching TS mock server config
* build: add testcontainers dependency and polytest poe tasks
- Add testcontainers>=4.0.0 to dev dependencies for mock server containers
- Add polytest generate/validate tasks for algod, indexer, kmd clients
- Update transact polytest config to use algorandfoundation repo
- Add polytest-generate-all and polytest-validate-all aggregate tasks
- Add group_common_tests pytest marker for polytest test groups
* ci: add polytest validation to check-python workflow
- Install Rust toolchain and polytest CLI
- Run polytest-validate-algod to ensure test structure matches polytest config
- Validates that generated test files follow the expected naming conventions
* refactor(test): move manual algod tests to dedicated folder
Move manually written tests to tests/modules/algod_client/manual/ to
distinguish them from polytest-generated test stubs:
- test_block.py
- test_ledger_state_delta.py
- test_pending_transaction_information.py
- test_raw_transaction.py
- test_simulate_transactions.py
- test_suggested_params.py
Also fix localnet tests to use AlgorandClient.default_localnet().client.algod
consistently instead of mixing mock server with localnet transactions.
* test(algod): generate polytest stubs for all algod client endpoints
Add NOT IMPLEMENTED test stubs for algod client API endpoints:
- DELETE endpoints (catchup, ledger_sync)
- GET endpoints (boxes, state proofs, deltas, devmode, experimental, etc.)
- POST endpoints (catchup, ledger_sync, shutdown, teal, transactions)
All stubs are marked with @pytest.mark.skip(reason='Test not implemented')
and follow the polytest naming convention matching TypeScript tests.
These stubs serve as placeholders for future test implementation and
ensure structural parity with algokit-utils-ts polytest suite.
* test(algod): implement polytest stubs aligning with TypeScript tests
- Implement test_get_genesis.py, test_get_health.py, test_get_versions.py
- Implement test_get_v2_status.py, test_get_v2_ledger_supply.py
- Implement test_get_v2_transactions_params.py
- Implement test_get_v2_accounts_address.py with localnet
- Implement test_get_v2_blocks_round.py with mainnet/testnet endpoints
- Implement test_get_v2_deltas_round.py with mainnet endpoint
- Skip msgpack-related tests matching TypeScript approach
- All tests verify client methods return correct model types
* fix(test): move integration tests to manual folders and fix lint ignores
- Move indexer and kmd integration tests to manual/ folders
- These tests require localnet with indexer/kmd, not mock server
- Update tests to use localnet clients directly
- Add E501, W292, I001 lint ignores for tests/modules/**/* in pyproject.toml
- Fix trailing newlines in polytest stub files (pre-commit format)
* style: fix indentation in oas-generator template renderer
* chore: update api client to support latest refined specs with inline duplicate schemas removed
* chore: refine fixtures for cross worker access to mock server with filelock dependency
* feat: add graceful handling of unknown transaction types
* refactor: ensure models that are not used anywhere and/or are referenced by filtered oas tags are not generated
* chore: extra fixes for unknown txn support
* chore: adding snapshot testing; migration notes
* chore: remove refs
* chore: linter tweaks
* chore: sqlite as default value from spec; retry mechanism for generated clients; minor alignment with latest on ts
* feat: support fetching oas specs directly from oas-generator repo
* chore: integrate docker image from fork; shared action
* chore: temporarily comment out polytest validate in ci
* docs: regen docs
* chore: regen clients
* chore: regen kmd clients; simplify remote oas fetching
* chore: refine mock server fixtures
* chore: refine pre commit; fix mypy warnings
* chore: add jitter and polling health check to the mock server fixture
* docs: remove mentions of oas shorthand
* test: add indexer client polytest tests (#225)
* test: add indexer client polytest tests
- Add 21 indexer client endpoint tests aligned with TypeScript implementation
- Add test constants for indexer test data (address, app_id, asset_id, txid, round)
- Add JSON snapshots for all indexer endpoints
- Tests use mock server recordings for deterministic testing
* test: add KMD client polytest tests (#224)
- Add 23 KMD client endpoint tests aligned with TypeScript implementation
- Fix init_wallet_handle method name in kmd_account_manager.py
- Fix manual test_key_management.py (remove non-existent display_mnemonic param)
- Add JSON snapshots for KMD endpoints with recordings
- Most tests skipped due to missing mock server recordings (require localnet)
* chore: add support for overriding mock server urls for local dev
* docs: update migration guide
* chore: refresh kmd client
* chore: refresh docs
* feat: add support for skip tag in oas generator; dropping dryrun
* chore: update branch for oas generator remote source to main
* chore: further simplify mock server
* chore: wip aligning with ts account model refinements
* refactor: adds MX domain separation for arbitrary bytes signing
* refactor: decouples signing from algokit-algosdk
* refactor: remove backward compatibility for LogicSigAccount and deprecate TransactionSignerAccount
BREAKING CHANGES:
- Remove LogicSigAccount.lsig property (algosdk compatibility)
- Remove LogicSigAccount.algokit_lsig property
- Deprecate TransactionSignerAccount class (use TransactionSignerAccountProtocol)
- AccountManager.rekeyed() now returns TransactionSignerAccountProtocol instead of TransactionSignerAccount
Aligns with TypeScript PR #465 which removes backward compatibility for secretless signing architecture.
* feat!: align signing abstractions with algokit-utils-ts PR #465
Refactors account and signing abstractions to match TypeScript naming conventions
and adds missing functionality for feature parity.
## Breaking Changes
- `MultiSigAccount` renamed to `MultisigAccount`
- `signing_accounts` parameter/property renamed to `sub_signers`
- `HasAddress` protocol renamed to `Addressable`
- `HasTransactionSigner` renamed to `AddressWithTransactionSigner`
- `HasLsigSigner` renamed to `AddressWithLsigSigner`
- `HasProgramDataSigner` renamed to `AddressWithProgramDataSigner`
- `HasMxBytesSigner` renamed to `AddressWithMxBytesSigner`
- `LogicSigAccount.delegate()` now accepts `LsigSigner` callback instead of full account
- `ProgramDataSigner` signature changed to `(data: bytes, program_address: bytes)`
## New Features
- Added `sending_address` parameter to `generate_address_with_signers()` for rekeyed account support
- Added `logic_multi_signature` (lmsig) field to `LogicSignature` for multisig delegation
- Added `sanity_check_program()` validation for TEAL bytecode
- Added `decode_logic_signature()` function
- Added helper methods to `LogicSigAccount`:
- `bytes_to_sign_for_delegation()`
- `program_data_to_sign()`
- `sign_program_data()`
- `addr` property alias
- Added `addr` property alias to `MultisigAccount`
## Files Changed
- `src/algokit_transact/signer.py` - Protocol renames, `sending_address` param
- `src/algokit_transact/signing/logic_signature.py` - Added `lmsig` field
- `src/algokit_transact/signing/validation.py` - New file with `sanity_check_program()`
- `src/algokit_transact/codec/signed.py` - Added `decode_logic_signature()`
- `src/algokit_transact/__init__.py` - Updated exports
- `src/algokit_utils/models/account.py` - Major refactor of account classes
- `src/algokit_utils/accounts/account_manager.py` - Updated for renames
- `src/algokit_utils/protocols/signer.py` - Fixed `ProgramDataSigner` signature
- `src/algokit_utils/protocols/account.py` - Updated docstrings
## Related
- Aligns with: algorandfoundation/algokit-utils-ts#465
* refactor: replace SigningAccount with AddressWithSigners from algokit-transact
- Update imports from algokit_utils to algokit_transact.signer
- Replace SigningAccount type hints with AddressWithSigners across 18 test files
- Change .address property access to .addr for account objects
- Preserve app_address and AccountInformation.address unchanged
* chore: moving logic and multi sigs to transact
* feat: algo25 implementation (#233)
* feat: algo25 implementation
* chore: add user facing algo25 export
* refactor: migrate algokit_algosdk dependencies to algokit_common
- Add get_application_address() to algokit_common/address.py
- Add MICROALGOS_TO_ALGOS_RATIO, MIN_TXN_FEE to algokit_common/constants.py
- Update account_manager to use algokit_algo25.seed_from_mnemonic() + nacl
instead of algosdk.mnemonic.to_private_key()
- Replace algosdk.logic.get_application_address() with algokit_common
- Replace algosdk.encoding.encode/decode_address() with algokit_common
- Replace algosdk.constants.* with algokit_common constants
- Update tests to use nacl + algokit_algo25 for account generation
This aligns with algokit-utils-ts PR #479 architecture, reducing dependency
on vendored algokit_algosdk package. SourceMap and BoxReference remain in
algokit_algosdk for now due to complexity.
BREAKING CHANGE: Internal imports changed from algokit_algosdk to algokit_common.
Public API remains compatible.
* refactor: replace SimulationTrace wrapper with algod client type and rename SendingAddress to ReadableAddress
- Remove custom SimulationTrace dataclass wrapper from algokit_utils/models/simulate.py
- Use SimulateTransactionResult directly from algokit_algod_client.models
- Update transaction_composer.py to return raw SimulateTransactionResult from algod responses
- Update logic_error.py to use SimulateTransactionResult type
- Rename SendingAddress to ReadableAddress in algokit_transact for cross-language consistency with TypeScript
BREAKING CHANGE: SimulationTrace class removed; use SimulateTransactionResult instead.
Field names differ: `trace` -> `exec_trace`, `logs` -> `txn_result.logs`.
SendingAddress renamed to ReadableAddress.
* fix(ci): install algokit CLI separately to avoid import conflict
The algokit CLI imports from algokit_utils and expects SigningAccount,
which was removed in the decoupling branch. Installing algokit as a uv
tool gives it its own isolated environment with its bundled algokit_utils.
* refactor(ci): remove unused py-algorand-sdk dep and use uvx for algokit
- Remove py-algorand-sdk from cicd group (only used in TYPE_CHECKING)
- Replace uv tool install + algokit with uvx algokit (simpler, idiomatic)
- Empty cicd group kept for potential future CI-only dependencies
* chore: refresh uv.lock
* refactor: simplify LogicSigAccount, MultisigAccount and program validation
---------
Co-authored-by: Daniel McGregor <daniel.mcgregor@makerx.com.au>1 parent 2e77178 commit 1bb2366
File tree
90 files changed
+4458
-2927
lines changed- .github/workflows
- docs/markdown
- autoapi
- algokit_utils
- accounts
- account_manager
- kmd_account_manager
- algo25
- algorand
- applications
- app_client
- app_factory
- app_spec
- arc32
- arc56
- assets/asset_manager
- clients/client_manager
- errors/logic_error
- models
- account
- simulate
- state
- protocols
- account
- signer
- typed_clients
- transactions
- transaction_composer
- types
- transact
- capabilities
- src
- algokit_algo25
- algokit_algosdk
- algokit_common
- algokit_transact
- codec
- signing
- algokit_utils
- accounts
- applications
- assets
- errors
- models
- protocols
- transactions
- tests
- accounts
- applications
- assets
- clients/algorand_client
- modules
- algo25
- algod_client/manual
- indexer_client
- manual
- transactions
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
90 files changed
+4458
-2927
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
| |||
25 | 35 | | |
26 | 36 | | |
27 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
28 | 46 | | |
29 | 47 | | |
30 | 48 | | |
31 | 49 | | |
32 | 50 | | |
33 | 51 | | |
34 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
43 | 111 | | |
44 | 112 | | |
45 | 113 | | |
| |||
0 commit comments