algokit-utils 5.0.0a3__py3-none-any.whl
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.
- algokit_abi/__init__.py +9 -0
- algokit_abi/_arc32_to_arc56.py +242 -0
- algokit_abi/_arc56_serde.py +161 -0
- algokit_abi/abi.py +667 -0
- algokit_abi/arc32.py +210 -0
- algokit_abi/arc56.py +821 -0
- algokit_abi/py.typed +0 -0
- algokit_algo25/__init__.py +38 -0
- algokit_algo25/_encoding.py +46 -0
- algokit_algo25/_wordlist.py +2065 -0
- algokit_algo25/exceptions.py +29 -0
- algokit_algo25/mnemonic.py +128 -0
- algokit_algo25/py.typed +0 -0
- algokit_algod_client/__init__.py +10 -0
- algokit_algod_client/client.py +1585 -0
- algokit_algod_client/config.py +36 -0
- algokit_algod_client/exceptions.py +59 -0
- algokit_algod_client/models/__init__.py +229 -0
- algokit_algod_client/models/_account.py +150 -0
- algokit_algod_client/models/_account_application_response.py +25 -0
- algokit_algod_client/models/_account_asset_response.py +25 -0
- algokit_algod_client/models/_account_participation.py +53 -0
- algokit_algod_client/models/_account_state_delta.py +30 -0
- algokit_algod_client/models/_allocations_for_genesis_file.py +23 -0
- algokit_algod_client/models/_allocations_for_genesis_file_state_model.py +42 -0
- algokit_algod_client/models/_application.py +23 -0
- algokit_algod_client/models/_application_initial_states.py +37 -0
- algokit_algod_client/models/_application_kvstorage.py +29 -0
- algokit_algod_client/models/_application_local_state.py +33 -0
- algokit_algod_client/models/_application_params.py +63 -0
- algokit_algod_client/models/_application_state_operation.py +41 -0
- algokit_algod_client/models/_application_state_schema.py +22 -0
- algokit_algod_client/models/_asset.py +23 -0
- algokit_algod_client/models/_asset_holding.py +29 -0
- algokit_algod_client/models/_asset_params.py +102 -0
- algokit_algod_client/models/_avm_key_value.py +28 -0
- algokit_algod_client/models/_avm_value.py +32 -0
- algokit_algod_client/models/_block.py +363 -0
- algokit_algod_client/models/_block_hash_response.py +14 -0
- algokit_algod_client/models/_block_txids_response.py +14 -0
- algokit_algod_client/models/_box.py +36 -0
- algokit_algod_client/models/_box_descriptor.py +24 -0
- algokit_algod_client/models/_boxes_response.py +21 -0
- algokit_algod_client/models/_build_version_contains_the_current_algod_build_version_information.py +34 -0
- algokit_algod_client/models/_compile_response.py +24 -0
- algokit_algod_client/models/_disassemble_response.py +14 -0
- algokit_algod_client/models/_error_response.py +22 -0
- algokit_algod_client/models/_eval_delta.py +32 -0
- algokit_algod_client/models/_eval_delta_key_value.py +28 -0
- algokit_algod_client/models/_genesis_file_in_json.py +53 -0
- algokit_algod_client/models/_get_block_time_stamp_offset_response.py +14 -0
- algokit_algod_client/models/_get_sync_round_response.py +14 -0
- algokit_algod_client/models/_ledger_state_delta.py +389 -0
- algokit_algod_client/models/_light_block_header_proof.py +32 -0
- algokit_algod_client/models/_node_status_response.py +118 -0
- algokit_algod_client/models/_pending_transaction_response.py +91 -0
- algokit_algod_client/models/_pending_transactions_response.py +29 -0
- algokit_algod_client/models/_post_transactions_response.py +14 -0
- algokit_algod_client/models/_scratch_change.py +23 -0
- algokit_algod_client/models/_serde_helpers.py +241 -0
- algokit_algod_client/models/_simulate_initial_states.py +25 -0
- algokit_algod_client/models/_simulate_request.py +54 -0
- algokit_algod_client/models/_simulate_request_transaction_group.py +25 -0
- algokit_algod_client/models/_simulate_response.py +44 -0
- algokit_algod_client/models/_simulate_trace_config.py +30 -0
- algokit_algod_client/models/_simulate_transaction_group_result.py +46 -0
- algokit_algod_client/models/_simulate_transaction_result.py +41 -0
- algokit_algod_client/models/_simulate_unnamed_resources_accessed.py +64 -0
- algokit_algod_client/models/_simulation_eval_overrides.py +40 -0
- algokit_algod_client/models/_simulation_opcode_trace_unit.py +55 -0
- algokit_algod_client/models/_simulation_transaction_exec_trace.py +82 -0
- algokit_algod_client/models/_source_map.py +30 -0
- algokit_algod_client/models/_state_delta.py +6 -0
- algokit_algod_client/models/_state_proof.py +28 -0
- algokit_algod_client/models/_state_proof_message.py +44 -0
- algokit_algod_client/models/_supply_response.py +26 -0
- algokit_algod_client/models/_teal_key_value.py +28 -0
- algokit_algod_client/models/_teal_key_value_store.py +6 -0
- algokit_algod_client/models/_teal_value.py +32 -0
- algokit_algod_client/models/_transaction_group_ledger_state_deltas_for_round_response.py +21 -0
- algokit_algod_client/models/_transaction_parameters_response.py +45 -0
- algokit_algod_client/models/_transaction_proof.py +44 -0
- algokit_algod_client/models/_version_contains_the_current_algod_version.py +38 -0
- algokit_algod_client/models/suggested_params.py +42 -0
- algokit_algod_client/py.typed +1 -0
- algokit_algod_client/types.py +7 -0
- algokit_algosdk/__init__.py +38 -0
- algokit_algosdk/account.py +32 -0
- algokit_algosdk/app_access.py +228 -0
- algokit_algosdk/box_reference.py +100 -0
- algokit_algosdk/constants.py +147 -0
- algokit_algosdk/encoding.py +89 -0
- algokit_algosdk/error.py +180 -0
- algokit_algosdk/logic.py +61 -0
- algokit_algosdk/logicsig.py +218 -0
- algokit_algosdk/mnemonic.py +216 -0
- algokit_algosdk/multisig.py +161 -0
- algokit_algosdk/py.typed +0 -0
- algokit_algosdk/transaction.py +596 -0
- algokit_algosdk/wordlist.py +2054 -0
- algokit_common/__init__.py +50 -0
- algokit_common/address.py +34 -0
- algokit_common/constants.py +47 -0
- algokit_common/hashing.py +25 -0
- algokit_common/py.typed +0 -0
- algokit_common/serde/__init__.py +40 -0
- algokit_common/serde/_core.py +610 -0
- algokit_common/serde/_primitives.py +135 -0
- algokit_common/source_map.py +158 -0
- algokit_indexer_client/__init__.py +10 -0
- algokit_indexer_client/client.py +1456 -0
- algokit_indexer_client/config.py +36 -0
- algokit_indexer_client/exceptions.py +59 -0
- algokit_indexer_client/models/__init__.py +148 -0
- algokit_indexer_client/models/_account.py +161 -0
- algokit_indexer_client/models/_account_participation.py +53 -0
- algokit_indexer_client/models/_account_response.py +19 -0
- algokit_indexer_client/models/_account_state_delta.py +29 -0
- algokit_indexer_client/models/_accounts_response.py +29 -0
- algokit_indexer_client/models/_application.py +35 -0
- algokit_indexer_client/models/_application_local_state.py +45 -0
- algokit_indexer_client/models/_application_local_states_response.py +29 -0
- algokit_indexer_client/models/_application_log_data.py +28 -0
- algokit_indexer_client/models/_application_logs_response.py +33 -0
- algokit_indexer_client/models/_application_params.py +62 -0
- algokit_indexer_client/models/_application_response.py +20 -0
- algokit_indexer_client/models/_application_state_schema.py +22 -0
- algokit_indexer_client/models/_applications_response.py +29 -0
- algokit_indexer_client/models/_asset.py +35 -0
- algokit_indexer_client/models/_asset_balances_response.py +29 -0
- algokit_indexer_client/models/_asset_holding.py +41 -0
- algokit_indexer_client/models/_asset_holdings_response.py +29 -0
- algokit_indexer_client/models/_asset_params.py +102 -0
- algokit_indexer_client/models/_asset_response.py +19 -0
- algokit_indexer_client/models/_assets_response.py +29 -0
- algokit_indexer_client/models/_block.py +150 -0
- algokit_indexer_client/models/_block_headers_response.py +29 -0
- algokit_indexer_client/models/_block_rewards.py +38 -0
- algokit_indexer_client/models/_block_upgrade_state.py +34 -0
- algokit_indexer_client/models/_block_upgrade_vote.py +26 -0
- algokit_indexer_client/models/_box.py +36 -0
- algokit_indexer_client/models/_box_descriptor.py +24 -0
- algokit_indexer_client/models/_box_reference.py +28 -0
- algokit_indexer_client/models/_boxes_response.py +29 -0
- algokit_indexer_client/models/_error_response.py +18 -0
- algokit_indexer_client/models/_eval_delta.py +32 -0
- algokit_indexer_client/models/_eval_delta_key_value.py +28 -0
- algokit_indexer_client/models/_hash_factory.py +14 -0
- algokit_indexer_client/models/_hb_proof_fields.py +57 -0
- algokit_indexer_client/models/_health_check.py +42 -0
- algokit_indexer_client/models/_holding_ref.py +23 -0
- algokit_indexer_client/models/_indexer_state_proof_message.py +40 -0
- algokit_indexer_client/models/_locals_ref.py +23 -0
- algokit_indexer_client/models/_merkle_array_proof.py +29 -0
- algokit_indexer_client/models/_mini_asset_holding.py +38 -0
- algokit_indexer_client/models/_on_completion.py +25 -0
- algokit_indexer_client/models/_participation_updates.py +22 -0
- algokit_indexer_client/models/_resource_ref.py +42 -0
- algokit_indexer_client/models/_serde_helpers.py +241 -0
- algokit_indexer_client/models/_state_delta.py +6 -0
- algokit_indexer_client/models/_state_proof_fields.py +57 -0
- algokit_indexer_client/models/_state_proof_participant.py +20 -0
- algokit_indexer_client/models/_state_proof_reveal.py +25 -0
- algokit_indexer_client/models/_state_proof_sig_slot.py +20 -0
- algokit_indexer_client/models/_state_proof_signature.py +37 -0
- algokit_indexer_client/models/_state_proof_tracking.py +32 -0
- algokit_indexer_client/models/_state_proof_verifier.py +24 -0
- algokit_indexer_client/models/_state_schema.py +25 -0
- algokit_indexer_client/models/_teal_key_value.py +28 -0
- algokit_indexer_client/models/_teal_key_value_store.py +6 -0
- algokit_indexer_client/models/_teal_value.py +32 -0
- algokit_indexer_client/models/_transaction.py +213 -0
- algokit_indexer_client/models/_transaction_application.py +105 -0
- algokit_indexer_client/models/_transaction_asset_config.py +31 -0
- algokit_indexer_client/models/_transaction_asset_freeze.py +29 -0
- algokit_indexer_client/models/_transaction_asset_transfer.py +41 -0
- algokit_indexer_client/models/_transaction_heartbeat.py +52 -0
- algokit_indexer_client/models/_transaction_keyreg.py +59 -0
- algokit_indexer_client/models/_transaction_payment.py +33 -0
- algokit_indexer_client/models/_transaction_response.py +19 -0
- algokit_indexer_client/models/_transaction_signature.py +35 -0
- algokit_indexer_client/models/_transaction_signature_logicsig.py +59 -0
- algokit_indexer_client/models/_transaction_signature_multisig.py +36 -0
- algokit_indexer_client/models/_transaction_signature_multisig_subsignature.py +28 -0
- algokit_indexer_client/models/_transaction_state_proof.py +32 -0
- algokit_indexer_client/models/_transactions_response.py +29 -0
- algokit_indexer_client/py.typed +1 -0
- algokit_indexer_client/types.py +7 -0
- algokit_kmd_client/__init__.py +10 -0
- algokit_kmd_client/client.py +1240 -0
- algokit_kmd_client/config.py +36 -0
- algokit_kmd_client/exceptions.py +59 -0
- algokit_kmd_client/models/__init__.py +112 -0
- algokit_kmd_client/models/_classical_signatures.py +4 -0
- algokit_kmd_client/models/_create_wallet_request.py +30 -0
- algokit_kmd_client/models/_create_wallet_response.py +19 -0
- algokit_kmd_client/models/_delete_key_request.py +27 -0
- algokit_kmd_client/models/_delete_multisig_request.py +27 -0
- algokit_kmd_client/models/_digest_represents_a32_byte_value_holding_the256_bit_hash_digest.py +4 -0
- algokit_kmd_client/models/_ed25519_public_key.py +4 -0
- algokit_kmd_client/models/_export_key_request.py +27 -0
- algokit_kmd_client/models/_export_key_response.py +24 -0
- algokit_kmd_client/models/_export_master_key_request.py +22 -0
- algokit_kmd_client/models/_export_master_key_response.py +18 -0
- algokit_kmd_client/models/_export_multisig_request.py +23 -0
- algokit_kmd_client/models/_export_multisig_response.py +26 -0
- algokit_kmd_client/models/_generate_key_request.py +18 -0
- algokit_kmd_client/models/_generate_key_response.py +19 -0
- algokit_kmd_client/models/_import_key_request.py +28 -0
- algokit_kmd_client/models/_import_key_response.py +19 -0
- algokit_kmd_client/models/_import_multisig_request.py +30 -0
- algokit_kmd_client/models/_import_multisig_response.py +19 -0
- algokit_kmd_client/models/_init_wallet_handle_token_request.py +22 -0
- algokit_kmd_client/models/_init_wallet_handle_token_response.py +18 -0
- algokit_kmd_client/models/_list_keys_request.py +18 -0
- algokit_kmd_client/models/_list_keys_response.py +18 -0
- algokit_kmd_client/models/_list_multisig_request.py +18 -0
- algokit_kmd_client/models/_list_multisig_response.py +18 -0
- algokit_kmd_client/models/_list_wallets_request.py +11 -0
- algokit_kmd_client/models/_list_wallets_response.py +25 -0
- algokit_kmd_client/models/_master_derivation_key.py +4 -0
- algokit_kmd_client/models/_multisig_sig.py +33 -0
- algokit_kmd_client/models/_multisig_subsig.py +23 -0
- algokit_kmd_client/models/_public_key.py +4 -0
- algokit_kmd_client/models/_release_wallet_handle_token_request.py +18 -0
- algokit_kmd_client/models/_rename_wallet_request.py +26 -0
- algokit_kmd_client/models/_rename_wallet_response.py +19 -0
- algokit_kmd_client/models/_renew_wallet_handle_token_request.py +18 -0
- algokit_kmd_client/models/_renew_wallet_handle_token_response.py +19 -0
- algokit_kmd_client/models/_serde_helpers.py +241 -0
- algokit_kmd_client/models/_sign_multisig_response.py +24 -0
- algokit_kmd_client/models/_sign_multisig_txn_request.py +45 -0
- algokit_kmd_client/models/_sign_program_multisig_request.py +50 -0
- algokit_kmd_client/models/_sign_program_multisig_response.py +24 -0
- algokit_kmd_client/models/_sign_program_request.py +37 -0
- algokit_kmd_client/models/_sign_program_response.py +24 -0
- algokit_kmd_client/models/_sign_transaction_response.py +24 -0
- algokit_kmd_client/models/_sign_txn_request.py +36 -0
- algokit_kmd_client/models/_signature.py +4 -0
- algokit_kmd_client/models/_tx_type.py +4 -0
- algokit_kmd_client/models/_versions_request.py +11 -0
- algokit_kmd_client/models/_versions_response.py +19 -0
- algokit_kmd_client/models/_wallet.py +38 -0
- algokit_kmd_client/models/_wallet_handle.py +24 -0
- algokit_kmd_client/models/_wallet_info_request.py +18 -0
- algokit_kmd_client/models/_wallet_info_response.py +19 -0
- algokit_kmd_client/py.typed +1 -0
- algokit_kmd_client/types.py +7 -0
- algokit_transact/__init__.py +190 -0
- algokit_transact/codec/__init__.py +0 -0
- algokit_transact/codec/msgpack.py +11 -0
- algokit_transact/codec/serde.py +7 -0
- algokit_transact/codec/signed.py +57 -0
- algokit_transact/codec/transaction.py +65 -0
- algokit_transact/exceptions.py +17 -0
- algokit_transact/logicsig.py +220 -0
- algokit_transact/models/__init__.py +0 -0
- algokit_transact/models/app_call.py +447 -0
- algokit_transact/models/asset_config.py +19 -0
- algokit_transact/models/asset_freeze.py +11 -0
- algokit_transact/models/asset_transfer.py +13 -0
- algokit_transact/models/common.py +17 -0
- algokit_transact/models/heartbeat.py +21 -0
- algokit_transact/models/key_registration.py +14 -0
- algokit_transact/models/payment.py +14 -0
- algokit_transact/models/signed_transaction.py +21 -0
- algokit_transact/models/state_proof.py +150 -0
- algokit_transact/models/transaction.py +88 -0
- algokit_transact/multisig.py +93 -0
- algokit_transact/ops/__init__.py +0 -0
- algokit_transact/ops/fees.py +47 -0
- algokit_transact/ops/group.py +28 -0
- algokit_transact/ops/ids.py +14 -0
- algokit_transact/ops/validate.py +503 -0
- algokit_transact/py.typed +0 -0
- algokit_transact/signer.py +195 -0
- algokit_transact/signing/__init__.py +0 -0
- algokit_transact/signing/logic_signature.py +19 -0
- algokit_transact/signing/multisig.py +84 -0
- algokit_transact/signing/types.py +39 -0
- algokit_transact/signing/validation.py +63 -0
- algokit_utils/__init__.py +23 -0
- algokit_utils/_debugging.py +304 -0
- algokit_utils/accounts/__init__.py +2 -0
- algokit_utils/accounts/account_manager.py +1051 -0
- algokit_utils/accounts/kmd_account_manager.py +206 -0
- algokit_utils/algo25.py +46 -0
- algokit_utils/algorand.py +383 -0
- algokit_utils/applications/__init__.py +7 -0
- algokit_utils/applications/abi.py +280 -0
- algokit_utils/applications/app_client.py +2193 -0
- algokit_utils/applications/app_deployer.py +788 -0
- algokit_utils/applications/app_factory.py +1140 -0
- algokit_utils/applications/app_manager.py +575 -0
- algokit_utils/applications/app_spec/__init__.py +6 -0
- algokit_utils/applications/enums.py +40 -0
- algokit_utils/assets/__init__.py +1 -0
- algokit_utils/assets/asset_manager.py +344 -0
- algokit_utils/clients/__init__.py +41 -0
- algokit_utils/clients/client_manager.py +756 -0
- algokit_utils/clients/dispenser_api_client.py +212 -0
- algokit_utils/common.py +40 -0
- algokit_utils/config.py +159 -0
- algokit_utils/errors/__init__.py +1 -0
- algokit_utils/errors/logic_error.py +160 -0
- algokit_utils/models/__init__.py +7 -0
- algokit_utils/models/account.py +12 -0
- algokit_utils/models/amount.py +198 -0
- algokit_utils/models/application.py +90 -0
- algokit_utils/models/network.py +29 -0
- algokit_utils/models/simulate.py +7 -0
- algokit_utils/models/state.py +53 -0
- algokit_utils/models/transaction.py +49 -0
- algokit_utils/protocols/__init__.py +3 -0
- algokit_utils/protocols/account.py +11 -0
- algokit_utils/protocols/signer.py +17 -0
- algokit_utils/protocols/typed_clients.py +110 -0
- algokit_utils/py.typed +0 -0
- algokit_utils/transact.py +195 -0
- algokit_utils/transactions/__init__.py +3 -0
- algokit_utils/transactions/builders/__init__.py +67 -0
- algokit_utils/transactions/builders/app.py +248 -0
- algokit_utils/transactions/builders/asset.py +256 -0
- algokit_utils/transactions/builders/common.py +263 -0
- algokit_utils/transactions/builders/keyreg.py +103 -0
- algokit_utils/transactions/builders/method_call.py +380 -0
- algokit_utils/transactions/builders/payment.py +43 -0
- algokit_utils/transactions/composer_resources.py +409 -0
- algokit_utils/transactions/fee_coverage.py +79 -0
- algokit_utils/transactions/helpers.py +9 -0
- algokit_utils/transactions/transaction_composer.py +1574 -0
- algokit_utils/transactions/transaction_creator.py +699 -0
- algokit_utils/transactions/transaction_sender.py +1240 -0
- algokit_utils/transactions/types.py +262 -0
- algokit_utils-5.0.0a3.dist-info/METADATA +105 -0
- algokit_utils-5.0.0a3.dist-info/RECORD +337 -0
- algokit_utils-5.0.0a3.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
import base64
|
|
3
|
+
from binascii import Error as BinasciiError
|
|
4
|
+
from collections.abc import Callable, Iterable, Mapping
|
|
5
|
+
from dataclasses import is_dataclass
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from typing import TypeAlias, TypeVar
|
|
8
|
+
|
|
9
|
+
from algokit_common.serde import from_wire, to_wire
|
|
10
|
+
|
|
11
|
+
DecodedT = TypeVar("DecodedT")
|
|
12
|
+
EnumValueT = TypeVar("EnumValueT", bound=Enum)
|
|
13
|
+
MapKeyT = TypeVar("MapKeyT")
|
|
14
|
+
BytesLike: TypeAlias = bytes | bytearray | memoryview
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _coerce_bytes(value: bytes | bytearray | memoryview) -> bytes:
|
|
18
|
+
if isinstance(value, memoryview):
|
|
19
|
+
return value.tobytes()
|
|
20
|
+
if isinstance(value, bytearray):
|
|
21
|
+
return bytes(value)
|
|
22
|
+
return value
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def encode_bytes_base64(value: BytesLike) -> str:
|
|
26
|
+
return base64.b64encode(_coerce_bytes(value)).decode("ascii")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def decode_bytes_base64(raw: object) -> bytes:
|
|
30
|
+
if isinstance(raw, bytes | bytearray | memoryview):
|
|
31
|
+
return bytes(raw)
|
|
32
|
+
if isinstance(raw, str):
|
|
33
|
+
try:
|
|
34
|
+
return base64.b64decode(raw.encode("ascii"), validate=True)
|
|
35
|
+
except (BinasciiError, UnicodeEncodeError) as exc:
|
|
36
|
+
raise ValueError("Invalid base64 payload") from exc
|
|
37
|
+
raise TypeError(f"Unsupported value for bytes field: {type(raw)!r}")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def encode_fixed_bytes_base64(value: BytesLike, expected_length: int) -> str:
|
|
41
|
+
"""Encode fixed-length bytes to base64, validating the length."""
|
|
42
|
+
coerced = _coerce_bytes(value)
|
|
43
|
+
if len(coerced) != expected_length:
|
|
44
|
+
raise ValueError(f"Expected {expected_length} bytes, got {len(coerced)}")
|
|
45
|
+
return base64.b64encode(coerced).decode("ascii")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def decode_fixed_bytes_base64(raw: object, expected_length: int) -> bytes:
|
|
49
|
+
"""Decode base64 to fixed-length bytes, validating the length."""
|
|
50
|
+
decoded = decode_bytes_base64(raw)
|
|
51
|
+
if len(decoded) != expected_length:
|
|
52
|
+
raise ValueError(f"Expected {expected_length} bytes, got {len(decoded)}")
|
|
53
|
+
return decoded
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def decode_bytes_map_key(raw: object) -> bytes:
|
|
57
|
+
if isinstance(raw, bytes | bytearray | memoryview):
|
|
58
|
+
return bytes(raw)
|
|
59
|
+
if isinstance(raw, str):
|
|
60
|
+
try:
|
|
61
|
+
return decode_bytes_base64(raw)
|
|
62
|
+
except ValueError:
|
|
63
|
+
try:
|
|
64
|
+
return raw.encode("utf-8")
|
|
65
|
+
except UnicodeEncodeError as fallback_exc:
|
|
66
|
+
raise ValueError("Invalid bytes map key") from fallback_exc
|
|
67
|
+
raise TypeError(f"Unsupported map key for bytes field: {type(raw)!r}")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def encode_bytes_sequence(values: Iterable[BytesLike | None] | None) -> list[str | None] | None:
|
|
71
|
+
if values is None:
|
|
72
|
+
return None
|
|
73
|
+
encoded: list[str | None] = []
|
|
74
|
+
for value in values:
|
|
75
|
+
if value is None:
|
|
76
|
+
encoded.append(None)
|
|
77
|
+
continue
|
|
78
|
+
if not isinstance(value, bytes | bytearray | memoryview):
|
|
79
|
+
raise TypeError(f"Unsupported value for bytes field sequence: {type(value)!r}")
|
|
80
|
+
encoded.append(encode_bytes_base64(value))
|
|
81
|
+
return encoded or None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def decode_bytes_sequence(raw: object) -> list[bytes | None] | None:
|
|
85
|
+
if not isinstance(raw, list):
|
|
86
|
+
return None
|
|
87
|
+
decoded: list[bytes | None] = []
|
|
88
|
+
for item in raw:
|
|
89
|
+
if item is None:
|
|
90
|
+
decoded.append(None)
|
|
91
|
+
continue
|
|
92
|
+
decoded.append(decode_bytes_base64(item))
|
|
93
|
+
return decoded or None
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def encode_fixed_bytes_sequence(
|
|
97
|
+
values: Iterable[BytesLike | None] | None, expected_length: int
|
|
98
|
+
) -> list[str | None] | None:
|
|
99
|
+
"""Encode a sequence of fixed-length bytes to base64, validating each element's length."""
|
|
100
|
+
if values is None:
|
|
101
|
+
return None
|
|
102
|
+
encoded: list[str | None] = []
|
|
103
|
+
for value in values:
|
|
104
|
+
if value is None:
|
|
105
|
+
encoded.append(None)
|
|
106
|
+
continue
|
|
107
|
+
if not isinstance(value, bytes | bytearray | memoryview):
|
|
108
|
+
raise TypeError(f"Unsupported value for bytes field sequence: {type(value)!r}")
|
|
109
|
+
encoded.append(encode_fixed_bytes_base64(value, expected_length))
|
|
110
|
+
return encoded or None
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def decode_fixed_bytes_sequence(raw: object, expected_length: int) -> list[bytes | None] | None:
|
|
114
|
+
"""Decode a sequence of base64 strings to fixed-length bytes, validating each element's length."""
|
|
115
|
+
if not isinstance(raw, list):
|
|
116
|
+
return None
|
|
117
|
+
decoded: list[bytes | None] = []
|
|
118
|
+
for item in raw:
|
|
119
|
+
if item is None:
|
|
120
|
+
decoded.append(None)
|
|
121
|
+
continue
|
|
122
|
+
decoded.append(decode_fixed_bytes_base64(item, expected_length))
|
|
123
|
+
return decoded or None
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def encode_model_sequence(values: Iterable[object] | None) -> list[dict[str, object]] | None:
|
|
127
|
+
if values is None:
|
|
128
|
+
return None
|
|
129
|
+
encoded: list[dict[str, object]] = []
|
|
130
|
+
for value in values:
|
|
131
|
+
if value is None:
|
|
132
|
+
continue
|
|
133
|
+
encoded.append(to_wire(value))
|
|
134
|
+
return encoded or None
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def decode_model_sequence(cls_factory: Callable[[], type[DecodedT]], raw: object) -> list[DecodedT] | None:
|
|
138
|
+
if not isinstance(raw, list):
|
|
139
|
+
return None
|
|
140
|
+
cls = cls_factory()
|
|
141
|
+
decoded: list[DecodedT] = []
|
|
142
|
+
for item in raw:
|
|
143
|
+
if isinstance(item, Mapping):
|
|
144
|
+
decoded.append(from_wire(cls, item))
|
|
145
|
+
return decoded or None
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def encode_enum_sequence(values: Iterable[object] | None) -> list[object] | None:
|
|
149
|
+
if values is None:
|
|
150
|
+
return None
|
|
151
|
+
encoded: list[object] = []
|
|
152
|
+
for value in values:
|
|
153
|
+
if value is None:
|
|
154
|
+
continue
|
|
155
|
+
encoded.append(value.value if hasattr(value, "value") else value)
|
|
156
|
+
return encoded or None
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def decode_enum_sequence(enum_factory: Callable[[], type[EnumValueT]], raw: object) -> list[EnumValueT] | None:
|
|
160
|
+
if not isinstance(raw, list):
|
|
161
|
+
return None
|
|
162
|
+
enum_cls = enum_factory()
|
|
163
|
+
decoded: list[EnumValueT] = []
|
|
164
|
+
for item in raw:
|
|
165
|
+
try:
|
|
166
|
+
decoded.append(enum_cls(item))
|
|
167
|
+
except Exception:
|
|
168
|
+
continue
|
|
169
|
+
return decoded or None
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def encode_model_mapping(
|
|
173
|
+
factory: Callable[[], type[DecodedT]],
|
|
174
|
+
mapping: Mapping[object, object] | None,
|
|
175
|
+
*,
|
|
176
|
+
key_encoder: Callable[[object], str] | None = None,
|
|
177
|
+
) -> dict[str, object] | None:
|
|
178
|
+
if mapping is None:
|
|
179
|
+
return None
|
|
180
|
+
cls = factory()
|
|
181
|
+
encoded: dict[str, object] = {}
|
|
182
|
+
for key, value in mapping.items():
|
|
183
|
+
if value is None:
|
|
184
|
+
continue
|
|
185
|
+
encoded_key: str
|
|
186
|
+
if key_encoder is not None:
|
|
187
|
+
encoded_key = key_encoder(key)
|
|
188
|
+
elif isinstance(key, str):
|
|
189
|
+
encoded_key = key
|
|
190
|
+
else:
|
|
191
|
+
encoded_key = str(key)
|
|
192
|
+
if isinstance(value, cls) or is_dataclass(value):
|
|
193
|
+
encoded[encoded_key] = to_wire(value)
|
|
194
|
+
else:
|
|
195
|
+
encoded[encoded_key] = value
|
|
196
|
+
return encoded or None
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def decode_model_mapping(
|
|
200
|
+
factory: Callable[[], type[DecodedT]],
|
|
201
|
+
raw: object,
|
|
202
|
+
*,
|
|
203
|
+
key_decoder: Callable[[object], MapKeyT] | None = None,
|
|
204
|
+
) -> dict[MapKeyT, DecodedT] | None:
|
|
205
|
+
if not isinstance(raw, Mapping):
|
|
206
|
+
return None
|
|
207
|
+
cls = factory()
|
|
208
|
+
decoded: dict[MapKeyT, DecodedT] = {}
|
|
209
|
+
for key, value in raw.items():
|
|
210
|
+
if isinstance(value, Mapping):
|
|
211
|
+
decoded_key = key_decoder(key) if key_decoder is not None else key
|
|
212
|
+
decoded[decoded_key] = from_wire(cls, value)
|
|
213
|
+
return decoded or None
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def decode_optional_bool(raw: object) -> bool | None:
|
|
217
|
+
if raw is None:
|
|
218
|
+
return None
|
|
219
|
+
return bool(raw)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def mapping_encoder(
|
|
223
|
+
factory: Callable[[], type[DecodedT]],
|
|
224
|
+
*,
|
|
225
|
+
key_encoder: Callable[[object], str] | None = None,
|
|
226
|
+
) -> Callable[[Mapping[object, object] | None], dict[str, object] | None]:
|
|
227
|
+
def _encode(mapping: Mapping[object, object] | None) -> dict[str, object] | None:
|
|
228
|
+
return encode_model_mapping(factory, mapping, key_encoder=key_encoder)
|
|
229
|
+
|
|
230
|
+
return _encode
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def mapping_decoder(
|
|
234
|
+
factory: Callable[[], type[DecodedT]],
|
|
235
|
+
*,
|
|
236
|
+
key_decoder: Callable[[object], MapKeyT] | None = None,
|
|
237
|
+
) -> Callable[[object], dict[MapKeyT, DecodedT] | None]:
|
|
238
|
+
def _decode(raw: object) -> dict[MapKeyT, DecodedT] | None:
|
|
239
|
+
return decode_model_mapping(factory, raw, key_decoder=key_decoder)
|
|
240
|
+
|
|
241
|
+
return _decode
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import nested, wire
|
|
7
|
+
|
|
8
|
+
from ._merkle_array_proof import MerkleArrayProof
|
|
9
|
+
from ._serde_helpers import decode_bytes_base64, decode_model_sequence, encode_bytes_base64, encode_model_sequence
|
|
10
|
+
from ._state_proof_reveal import StateProofReveal
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(slots=True)
|
|
14
|
+
class StateProofFields:
|
|
15
|
+
r"""
|
|
16
|
+
\[sp\] represents a state proof.
|
|
17
|
+
|
|
18
|
+
Definition:
|
|
19
|
+
crypto/stateproof/structs.go : StateProof
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
part_proofs: MerkleArrayProof | None = field(
|
|
23
|
+
default=None,
|
|
24
|
+
metadata=nested("part-proofs", lambda: MerkleArrayProof),
|
|
25
|
+
)
|
|
26
|
+
positions_to_reveal: list[int] | None = field(
|
|
27
|
+
default=None,
|
|
28
|
+
metadata=wire("positions-to-reveal"),
|
|
29
|
+
)
|
|
30
|
+
reveals: list[StateProofReveal] | None = field(
|
|
31
|
+
default=None,
|
|
32
|
+
metadata=wire(
|
|
33
|
+
"reveals",
|
|
34
|
+
encode=encode_model_sequence,
|
|
35
|
+
decode=lambda raw: decode_model_sequence(lambda: StateProofReveal, raw),
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
salt_version: int | None = field(
|
|
39
|
+
default=None,
|
|
40
|
+
metadata=wire("salt-version"),
|
|
41
|
+
)
|
|
42
|
+
sig_commit: bytes | None = field(
|
|
43
|
+
default=None,
|
|
44
|
+
metadata=wire(
|
|
45
|
+
"sig-commit",
|
|
46
|
+
encode=encode_bytes_base64,
|
|
47
|
+
decode=decode_bytes_base64,
|
|
48
|
+
),
|
|
49
|
+
)
|
|
50
|
+
sig_proofs: MerkleArrayProof | None = field(
|
|
51
|
+
default=None,
|
|
52
|
+
metadata=nested("sig-proofs", lambda: MerkleArrayProof),
|
|
53
|
+
)
|
|
54
|
+
signed_weight: int | None = field(
|
|
55
|
+
default=None,
|
|
56
|
+
metadata=wire("signed-weight"),
|
|
57
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import nested, wire
|
|
7
|
+
|
|
8
|
+
from ._state_proof_verifier import StateProofVerifier
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(slots=True)
|
|
12
|
+
class StateProofParticipant:
|
|
13
|
+
verifier: StateProofVerifier | None = field(
|
|
14
|
+
default=None,
|
|
15
|
+
metadata=nested("verifier", lambda: StateProofVerifier),
|
|
16
|
+
)
|
|
17
|
+
weight: int | None = field(
|
|
18
|
+
default=None,
|
|
19
|
+
metadata=wire("weight"),
|
|
20
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import nested, wire
|
|
7
|
+
|
|
8
|
+
from ._state_proof_participant import StateProofParticipant
|
|
9
|
+
from ._state_proof_sig_slot import StateProofSigSlot
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass(slots=True)
|
|
13
|
+
class StateProofReveal:
|
|
14
|
+
participant: StateProofParticipant | None = field(
|
|
15
|
+
default=None,
|
|
16
|
+
metadata=nested("participant", lambda: StateProofParticipant),
|
|
17
|
+
)
|
|
18
|
+
position: int | None = field(
|
|
19
|
+
default=None,
|
|
20
|
+
metadata=wire("position"),
|
|
21
|
+
)
|
|
22
|
+
sig_slot: StateProofSigSlot | None = field(
|
|
23
|
+
default=None,
|
|
24
|
+
metadata=nested("sig-slot", lambda: StateProofSigSlot),
|
|
25
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import nested, wire
|
|
7
|
+
|
|
8
|
+
from ._state_proof_signature import StateProofSignature
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(slots=True)
|
|
12
|
+
class StateProofSigSlot:
|
|
13
|
+
lower_sig_weight: int | None = field(
|
|
14
|
+
default=None,
|
|
15
|
+
metadata=wire("lower-sig-weight"),
|
|
16
|
+
)
|
|
17
|
+
signature: StateProofSignature | None = field(
|
|
18
|
+
default=None,
|
|
19
|
+
metadata=nested("signature", lambda: StateProofSignature),
|
|
20
|
+
)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import nested, wire
|
|
7
|
+
|
|
8
|
+
from ._merkle_array_proof import MerkleArrayProof
|
|
9
|
+
from ._serde_helpers import decode_bytes_base64, encode_bytes_base64
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass(slots=True)
|
|
13
|
+
class StateProofSignature:
|
|
14
|
+
falcon_signature: bytes | None = field(
|
|
15
|
+
default=None,
|
|
16
|
+
metadata=wire(
|
|
17
|
+
"falcon-signature",
|
|
18
|
+
encode=encode_bytes_base64,
|
|
19
|
+
decode=decode_bytes_base64,
|
|
20
|
+
),
|
|
21
|
+
)
|
|
22
|
+
merkle_array_index: int | None = field(
|
|
23
|
+
default=None,
|
|
24
|
+
metadata=wire("merkle-array-index"),
|
|
25
|
+
)
|
|
26
|
+
proof: MerkleArrayProof | None = field(
|
|
27
|
+
default=None,
|
|
28
|
+
metadata=nested("proof", lambda: MerkleArrayProof),
|
|
29
|
+
)
|
|
30
|
+
verifying_key: bytes | None = field(
|
|
31
|
+
default=None,
|
|
32
|
+
metadata=wire(
|
|
33
|
+
"verifying-key",
|
|
34
|
+
encode=encode_bytes_base64,
|
|
35
|
+
decode=decode_bytes_base64,
|
|
36
|
+
),
|
|
37
|
+
)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import wire
|
|
7
|
+
|
|
8
|
+
from ._serde_helpers import decode_bytes_base64, encode_bytes_base64
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(slots=True)
|
|
12
|
+
class StateProofTracking:
|
|
13
|
+
next_round: int | None = field(
|
|
14
|
+
default=None,
|
|
15
|
+
metadata=wire("next-round"),
|
|
16
|
+
)
|
|
17
|
+
online_total_weight: int | None = field(
|
|
18
|
+
default=None,
|
|
19
|
+
metadata=wire("online-total-weight"),
|
|
20
|
+
)
|
|
21
|
+
type_: int | None = field(
|
|
22
|
+
default=None,
|
|
23
|
+
metadata=wire("type"),
|
|
24
|
+
)
|
|
25
|
+
voters_commitment: bytes | None = field(
|
|
26
|
+
default=None,
|
|
27
|
+
metadata=wire(
|
|
28
|
+
"voters-commitment",
|
|
29
|
+
encode=encode_bytes_base64,
|
|
30
|
+
decode=decode_bytes_base64,
|
|
31
|
+
),
|
|
32
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import wire
|
|
7
|
+
|
|
8
|
+
from ._serde_helpers import decode_fixed_bytes_base64, encode_fixed_bytes_base64
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(slots=True)
|
|
12
|
+
class StateProofVerifier:
|
|
13
|
+
commitment: bytes | None = field(
|
|
14
|
+
default=None,
|
|
15
|
+
metadata=wire(
|
|
16
|
+
"commitment",
|
|
17
|
+
encode=lambda v: encode_fixed_bytes_base64(v, 64),
|
|
18
|
+
decode=lambda raw: decode_fixed_bytes_base64(raw, 64),
|
|
19
|
+
),
|
|
20
|
+
)
|
|
21
|
+
key_lifetime: int | None = field(
|
|
22
|
+
default=None,
|
|
23
|
+
metadata=wire("key-lifetime"),
|
|
24
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import wire
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(slots=True)
|
|
10
|
+
class StateSchema:
|
|
11
|
+
r"""
|
|
12
|
+
Represents a \[apls\] local-state or \[apgs\] global-state schema. These schemas
|
|
13
|
+
determine how much storage may be used in a local-state or global-state for an
|
|
14
|
+
application. The more space used, the larger minimum balance must be maintained in the
|
|
15
|
+
account holding the data.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
num_byte_slices: int = field(
|
|
19
|
+
default=0,
|
|
20
|
+
metadata=wire("num-byte-slice"),
|
|
21
|
+
)
|
|
22
|
+
num_uints: int = field(
|
|
23
|
+
default=0,
|
|
24
|
+
metadata=wire("num-uint"),
|
|
25
|
+
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import nested, wire
|
|
7
|
+
|
|
8
|
+
from ._serde_helpers import decode_bytes_base64, encode_bytes_base64
|
|
9
|
+
from ._teal_value import TealValue
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass(slots=True)
|
|
13
|
+
class TealKeyValue:
|
|
14
|
+
"""
|
|
15
|
+
Represents a key-value pair in an application store.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
value: TealValue = field(
|
|
19
|
+
metadata=nested("value", lambda: TealValue, required=True),
|
|
20
|
+
)
|
|
21
|
+
key: bytes = field(
|
|
22
|
+
default=b"",
|
|
23
|
+
metadata=wire(
|
|
24
|
+
"key",
|
|
25
|
+
encode=encode_bytes_base64,
|
|
26
|
+
decode=decode_bytes_base64,
|
|
27
|
+
),
|
|
28
|
+
)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AUTO-GENERATED: oas_generator
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
|
|
6
|
+
from algokit_common.serde import wire
|
|
7
|
+
|
|
8
|
+
from ._serde_helpers import decode_bytes_base64, encode_bytes_base64
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(slots=True)
|
|
12
|
+
class TealValue:
|
|
13
|
+
"""
|
|
14
|
+
Represents a TEAL value.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
bytes_: bytes = field(
|
|
18
|
+
default=b"",
|
|
19
|
+
metadata=wire(
|
|
20
|
+
"bytes",
|
|
21
|
+
encode=encode_bytes_base64,
|
|
22
|
+
decode=decode_bytes_base64,
|
|
23
|
+
),
|
|
24
|
+
)
|
|
25
|
+
type_: int = field(
|
|
26
|
+
default=0,
|
|
27
|
+
metadata=wire("type"),
|
|
28
|
+
)
|
|
29
|
+
uint: int = field(
|
|
30
|
+
default=0,
|
|
31
|
+
metadata=wire("uint"),
|
|
32
|
+
)
|