Commit 3072c0e
authored
feat: x-algokit-byte-length support and block model restructuring for cross-SDK alignment (#242)
* feat: add x-algokit-byte-length vendor extension support for fixed-length byte validation
- Add byte_length and list_inner_byte_length fields to TypeInfo in builder.py
- Update _build_metadata() to generate fixed-length byte serde helpers
- Add encode_fixed_bytes_base64/decode_fixed_bytes_base64 helpers for 32/64 byte validation
- Add encode_fixed_bytes_sequence/decode_fixed_bytes_sequence for array validation
- Regenerate API clients with fixed-length byte fields (group, lease, signature, etc.)
- Update OAS_BRANCH to fix/byte-len-validation for spec generation
* refactor(algod-client): restructure block models to align with JS SDK
Align Python block model structure with the JavaScript SDK and OpenAPI
spec for cross-SDK consistency.
Structural changes:
- Rename GetBlock -> BlockResponse (matches OAS spec + JS/TS SDKs)
- Add TxnCommitments nested type for transaction roots (txn, txn256)
- Add RewardState nested type for reward fields (fees, rwd, earn, etc.)
- Add UpgradeState nested type for protocol upgrade state
- Add UpgradeVote nested type for upgrade vote parameters
- Refactor BlockHeader to use flattened nested types
- Change BlockEvalDelta.bytes -> bytes_value (avoid Python keyword)
- Fix inner_txns type: SignedTxnInBlock -> SignedTxnWithAD
- Make previous_block_hash and genesis_hash non-optional with defaults
- Fix get_block() to return BlockResponse (typed) instead of Block
- Export typed BlockResponse from _block.py instead of untyped version
BREAKING CHANGE:
- GetBlock removed, use BlockResponse instead
- Field access patterns changed in BlockHeader:
- header.fee_sink -> header.reward_state.fee_sink
- header.current_protocol -> header.upgrade_state.current_protocol
- header.upgrade_propose -> header.upgrade_vote.upgrade_propose
- header.transactions_root -> header.txn_commitments.transactions_root
- Block response structure: result.header -> result.block.header
* refactor: excludes block models from generated code
Excludes block models from the generated client code to allow separate handling.
This change introduces a mechanism to conditionally include block models during code generation based on a client configuration. It also updates the AVM debugger source map generation by incorporating hashes in the standard AVM debugger format.
Skips tests that depend on msgpack handling until mock server is fixed.
* fix(algod-client): restore block model types to public exports
Ensures all block-related types (ApplyData, BlockEvalDelta, BlockStateDelta,
SignedTxnWithAD, TxnCommitments, RewardState, UpgradeState, UpgradeVote, etc.)
remain publicly exported from algokit_algod_client.models for type hints,
isinstance checks, and IDE autocomplete. These types are returned by the public
API and must be accessible to users. Aligns with TypeScript SDK behavior.1 parent 22bde9a commit 3072c0e
File tree
34 files changed
+635
-154
lines changed- api/oas-generator/src/oas_generator
- renderer
- templates/models
- src
- algokit_algod_client
- models
- algokit_indexer_client/models
- algokit_kmd_client/models
- algokit_utils
- tests
- modules/algod_client
- manual
34 files changed
+635
-154
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 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 | + | |
43 | 110 | | |
44 | 111 | | |
45 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
| |||
219 | 224 | | |
220 | 225 | | |
221 | 226 | | |
| 227 | + | |
222 | 228 | | |
223 | 229 | | |
224 | 230 | | |
| |||
462 | 468 | | |
463 | 469 | | |
464 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
465 | 475 | | |
466 | 476 | | |
467 | 477 | | |
| |||
585 | 595 | | |
586 | 596 | | |
587 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
588 | 607 | | |
589 | 608 | | |
590 | 609 | | |
| |||
593 | 612 | | |
594 | 613 | | |
595 | 614 | | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
596 | 624 | | |
597 | 625 | | |
598 | 626 | | |
| |||
908 | 936 | | |
909 | 937 | | |
910 | 938 | | |
911 | | - | |
| 939 | + | |
912 | 940 | | |
913 | 941 | | |
914 | 942 | | |
915 | | - | |
| 943 | + | |
916 | 944 | | |
917 | 945 | | |
918 | 946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | | - | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
90 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
| |||
132 | 139 | | |
133 | 140 | | |
134 | 141 | | |
| 142 | + | |
| 143 | + | |
135 | 144 | | |
136 | 145 | | |
137 | 146 | | |
138 | | - | |
| 147 | + | |
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
| |||
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
40 | 56 | | |
41 | 57 | | |
42 | 58 | | |
| |||
77 | 93 | | |
78 | 94 | | |
79 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
80 | 126 | | |
81 | 127 | | |
82 | 128 | | |
| |||
0 commit comments