near-jsonrpc-client 1.0.5__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.
- near_jsonrpc_client/__init__.py +27 -0
- near_jsonrpc_client/api_methods_async.py +450 -0
- near_jsonrpc_client/api_methods_sync.py +450 -0
- near_jsonrpc_client/base_client.py +148 -0
- near_jsonrpc_client/client.py +13 -0
- near_jsonrpc_client/errors.py +35 -0
- near_jsonrpc_client/transport.py +43 -0
- near_jsonrpc_client-1.0.5.dist-info/METADATA +10 -0
- near_jsonrpc_client-1.0.5.dist-info/RECORD +357 -0
- near_jsonrpc_client-1.0.5.dist-info/WHEEL +5 -0
- near_jsonrpc_client-1.0.5.dist-info/licenses/LICENSE +201 -0
- near_jsonrpc_client-1.0.5.dist-info/top_level.txt +2 -0
- near_jsonrpc_models/__init__.py +3378 -0
- near_jsonrpc_models/access_key.py +18 -0
- near_jsonrpc_models/access_key_creation_config_view.py +13 -0
- near_jsonrpc_models/access_key_info_view.py +10 -0
- near_jsonrpc_models/access_key_list.py +9 -0
- near_jsonrpc_models/access_key_permission.py +21 -0
- near_jsonrpc_models/access_key_permission_view.py +25 -0
- near_jsonrpc_models/access_key_view.py +10 -0
- near_jsonrpc_models/account_creation_config_view.py +13 -0
- near_jsonrpc_models/account_data_view.py +30 -0
- near_jsonrpc_models/account_id.py +25 -0
- near_jsonrpc_models/account_id_validity_rules_version.py +8 -0
- near_jsonrpc_models/account_info.py +12 -0
- near_jsonrpc_models/account_view.py +18 -0
- near_jsonrpc_models/account_with_public_key.py +10 -0
- near_jsonrpc_models/action_creation_config_view.py +32 -0
- near_jsonrpc_models/action_error.py +13 -0
- near_jsonrpc_models/action_error_kind.py +200 -0
- near_jsonrpc_models/action_view.py +133 -0
- near_jsonrpc_models/actions_validation_error.py +150 -0
- near_jsonrpc_models/add_gas_key_action.py +10 -0
- near_jsonrpc_models/add_key_action.py +12 -0
- near_jsonrpc_models/bandwidth_request.py +14 -0
- near_jsonrpc_models/bandwidth_request_bitmap.py +11 -0
- near_jsonrpc_models/bandwidth_requests.py +16 -0
- near_jsonrpc_models/bandwidth_requests_v1.py +9 -0
- near_jsonrpc_models/block_header_inner_lite_view.py +22 -0
- near_jsonrpc_models/block_header_view.py +53 -0
- near_jsonrpc_models/block_id.py +16 -0
- near_jsonrpc_models/block_reference.py +21 -0
- near_jsonrpc_models/block_status_view.py +10 -0
- near_jsonrpc_models/call_result.py +10 -0
- near_jsonrpc_models/catchup_status_view.py +28 -0
- near_jsonrpc_models/chunk_distribution_network_config.py +12 -0
- near_jsonrpc_models/chunk_distribution_uris.py +10 -0
- near_jsonrpc_models/chunk_hash.py +4 -0
- near_jsonrpc_models/chunk_header_view.py +39 -0
- near_jsonrpc_models/cloud_archival_writer_config.py +14 -0
- near_jsonrpc_models/compilation_error.py +29 -0
- near_jsonrpc_models/congestion_control_config_view.py +58 -0
- near_jsonrpc_models/congestion_info_view.py +11 -0
- near_jsonrpc_models/contract_code_view.py +9 -0
- near_jsonrpc_models/cost_gas_used.py +10 -0
- near_jsonrpc_models/create_account_action.py +7 -0
- near_jsonrpc_models/crypto_hash.py +7 -0
- near_jsonrpc_models/current_epoch_validator_info.py +35 -0
- near_jsonrpc_models/data_receipt_creation_config_view.py +20 -0
- near_jsonrpc_models/data_receiver_view.py +8 -0
- near_jsonrpc_models/delegate_action.py +28 -0
- near_jsonrpc_models/delete_account_action.py +6 -0
- near_jsonrpc_models/delete_gas_key_action.py +6 -0
- near_jsonrpc_models/delete_key_action.py +7 -0
- near_jsonrpc_models/deploy_contract_action.py +8 -0
- near_jsonrpc_models/deploy_global_contract_action.py +10 -0
- near_jsonrpc_models/detailed_debug_status.py +15 -0
- near_jsonrpc_models/deterministic_account_state_init.py +13 -0
- near_jsonrpc_models/deterministic_account_state_init_v1.py +8 -0
- near_jsonrpc_models/deterministic_state_init_action.py +8 -0
- near_jsonrpc_models/direction.py +7 -0
- near_jsonrpc_models/dump_config.py +20 -0
- near_jsonrpc_models/duration_as_std_schema_provider.py +7 -0
- near_jsonrpc_models/dynamic_resharding_config_view.py +23 -0
- near_jsonrpc_models/epoch_id.py +8 -0
- near_jsonrpc_models/epoch_sync_config.py +25 -0
- near_jsonrpc_models/error_wrapper_for_genesis_config_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_block_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_call_function_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_chunk_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_client_config_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_gas_price_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_light_client_next_block_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_light_client_proof_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_maintenance_windows_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_network_info_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_protocol_config_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_query_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_receipt_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_split_storage_info_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_state_changes_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_status_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_transaction_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_validator_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_view_access_key_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_view_access_key_list_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_view_account_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_view_code_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_view_gas_key_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_view_gas_key_list_error.py +24 -0
- near_jsonrpc_models/error_wrapper_for_rpc_view_state_error.py +24 -0
- near_jsonrpc_models/execution_metadata_view.py +9 -0
- near_jsonrpc_models/execution_outcome_view.py +31 -0
- near_jsonrpc_models/execution_outcome_with_id_view.py +12 -0
- near_jsonrpc_models/execution_status_view.py +29 -0
- near_jsonrpc_models/ext_costs_config_view.py +162 -0
- near_jsonrpc_models/external_storage_config.py +17 -0
- near_jsonrpc_models/external_storage_location.py +34 -0
- near_jsonrpc_models/fee.py +17 -0
- near_jsonrpc_models/final_execution_outcome_view.py +23 -0
- near_jsonrpc_models/final_execution_outcome_with_receipt_view.py +26 -0
- near_jsonrpc_models/final_execution_status.py +27 -0
- near_jsonrpc_models/finality.py +9 -0
- near_jsonrpc_models/function_args.py +13 -0
- near_jsonrpc_models/function_call_action.py +10 -0
- near_jsonrpc_models/function_call_error.py +52 -0
- near_jsonrpc_models/function_call_permission.py +24 -0
- near_jsonrpc_models/gas_key.py +17 -0
- near_jsonrpc_models/gas_key_info_view.py +8 -0
- near_jsonrpc_models/gas_key_list.py +7 -0
- near_jsonrpc_models/gas_key_view.py +12 -0
- near_jsonrpc_models/gcconfig.py +19 -0
- near_jsonrpc_models/genesis_config.py +121 -0
- near_jsonrpc_models/genesis_config_error.py +7 -0
- near_jsonrpc_models/genesis_config_request.py +7 -0
- near_jsonrpc_models/global_contract_deploy_mode.py +13 -0
- near_jsonrpc_models/global_contract_identifier.py +17 -0
- near_jsonrpc_models/global_contract_identifier_view.py +17 -0
- near_jsonrpc_models/host_error.py +212 -0
- near_jsonrpc_models/internal_error.py +16 -0
- near_jsonrpc_models/invalid_access_key_error.py +54 -0
- near_jsonrpc_models/invalid_tx_error.py +135 -0
- near_jsonrpc_models/json_rpc_request_for_block.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_block_effects.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_broadcast_tx_async.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_broadcast_tx_commit.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_changes.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_chunk.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_client_config.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_call_function.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_changes.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_changes_in_block.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_congestion_level.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_genesis_config.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_light_client_block_proof.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_light_client_proof.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_maintenance_windows.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_protocol_config.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_receipt.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_split_storage_info.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_tx_status.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_validators_ordered.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_view_access_key.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_view_access_key_list.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_view_account.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_view_code.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_view_gas_key.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_view_gas_key_list.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_experimental_view_state.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_gas_price.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_genesis_config.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_health.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_light_client_proof.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_maintenance_windows.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_network_info.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_next_light_client_block.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_query.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_send_tx.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_status.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_tx.py +10 -0
- near_jsonrpc_models/json_rpc_request_for_validators.py +10 -0
- near_jsonrpc_models/json_rpc_response_for_array_of_range_of_uint64_and_rpc_maintenance_windows_error.py +21 -0
- near_jsonrpc_models/json_rpc_response_for_array_of_validator_stake_view_and_rpc_validator_error.py +21 -0
- near_jsonrpc_models/json_rpc_response_for_crypto_hash_and_rpc_transaction_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_genesis_config_and_genesis_config_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_nullable_rpc_health_response_and_rpc_status_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_block_response_and_rpc_block_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_call_function_response_and_rpc_call_function_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_chunk_response_and_rpc_chunk_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_client_config_response_and_rpc_client_config_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_congestion_level_response_and_rpc_chunk_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_gas_price_response_and_rpc_gas_price_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_light_client_block_proof_response_and_rpc_light_client_proof_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_light_client_execution_proof_response_and_rpc_light_client_proof_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_light_client_next_block_response_and_rpc_light_client_next_block_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_network_info_response_and_rpc_network_info_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_protocol_config_response_and_rpc_protocol_config_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_query_response_and_rpc_query_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_receipt_response_and_rpc_receipt_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_split_storage_info_response_and_rpc_split_storage_info_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_state_changes_in_block_by_type_response_and_rpc_state_changes_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_state_changes_in_block_response_and_rpc_state_changes_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_status_response_and_rpc_status_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_transaction_response_and_rpc_transaction_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_validator_response_and_rpc_validator_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_view_access_key_list_response_and_rpc_view_access_key_list_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_view_access_key_response_and_rpc_view_access_key_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_view_account_response_and_rpc_view_account_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_view_code_response_and_rpc_view_code_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_view_gas_key_list_response_and_rpc_view_gas_key_list_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_view_gas_key_response_and_rpc_view_gas_key_error.py +20 -0
- near_jsonrpc_models/json_rpc_response_for_rpc_view_state_response_and_rpc_view_state_error.py +20 -0
- near_jsonrpc_models/known_producer_view.py +13 -0
- near_jsonrpc_models/light_client_block_lite_view.py +9 -0
- near_jsonrpc_models/limit_config.py +81 -0
- near_jsonrpc_models/log_summary_style.py +7 -0
- near_jsonrpc_models/merkle_path_item.py +8 -0
- near_jsonrpc_models/method_resolve_error.py +7 -0
- near_jsonrpc_models/missing_trie_value.py +8 -0
- near_jsonrpc_models/missing_trie_value_context.py +9 -0
- near_jsonrpc_models/mutable_config_value.py +7 -0
- near_jsonrpc_models/near_gas.py +8 -0
- near_jsonrpc_models/near_token.py +7 -0
- near_jsonrpc_models/network_info_view.py +17 -0
- near_jsonrpc_models/next_epoch_validator_info.py +13 -0
- near_jsonrpc_models/non_delegate_action.py +71 -0
- near_jsonrpc_models/peer_id.py +6 -0
- near_jsonrpc_models/peer_info_view.py +26 -0
- near_jsonrpc_models/prepare_error.py +16 -0
- near_jsonrpc_models/protocol_version_check_config.py +9 -0
- near_jsonrpc_models/public_key.py +7 -0
- near_jsonrpc_models/range_of_uint64.py +7 -0
- near_jsonrpc_models/receipt_enum_view.py +48 -0
- near_jsonrpc_models/receipt_validation_error.py +76 -0
- near_jsonrpc_models/receipt_view.py +13 -0
- near_jsonrpc_models/rpc_block_error.py +25 -0
- near_jsonrpc_models/rpc_block_request.py +20 -0
- near_jsonrpc_models/rpc_block_response.py +12 -0
- near_jsonrpc_models/rpc_call_function_error.py +64 -0
- near_jsonrpc_models/rpc_call_function_request.py +31 -0
- near_jsonrpc_models/rpc_call_function_response.py +13 -0
- near_jsonrpc_models/rpc_chunk_error.py +38 -0
- near_jsonrpc_models/rpc_chunk_request.py +18 -0
- near_jsonrpc_models/rpc_chunk_response.py +13 -0
- near_jsonrpc_models/rpc_client_config_error.py +16 -0
- near_jsonrpc_models/rpc_client_config_request.py +7 -0
- near_jsonrpc_models/rpc_client_config_response.py +185 -0
- near_jsonrpc_models/rpc_congestion_level_request.py +18 -0
- near_jsonrpc_models/rpc_congestion_level_response.py +5 -0
- near_jsonrpc_models/rpc_gas_price_error.py +22 -0
- near_jsonrpc_models/rpc_gas_price_request.py +6 -0
- near_jsonrpc_models/rpc_gas_price_response.py +6 -0
- near_jsonrpc_models/rpc_health_request.py +7 -0
- near_jsonrpc_models/rpc_health_response.py +7 -0
- near_jsonrpc_models/rpc_known_producer.py +9 -0
- near_jsonrpc_models/rpc_light_client_block_proof_request.py +7 -0
- near_jsonrpc_models/rpc_light_client_block_proof_response.py +9 -0
- near_jsonrpc_models/rpc_light_client_execution_proof_request.py +23 -0
- near_jsonrpc_models/rpc_light_client_execution_proof_response.py +12 -0
- near_jsonrpc_models/rpc_light_client_next_block_error.py +30 -0
- near_jsonrpc_models/rpc_light_client_next_block_request.py +6 -0
- near_jsonrpc_models/rpc_light_client_next_block_response.py +19 -0
- near_jsonrpc_models/rpc_light_client_proof_error.py +55 -0
- near_jsonrpc_models/rpc_maintenance_windows_error.py +16 -0
- near_jsonrpc_models/rpc_maintenance_windows_request.py +6 -0
- near_jsonrpc_models/rpc_network_info_error.py +16 -0
- near_jsonrpc_models/rpc_network_info_request.py +7 -0
- near_jsonrpc_models/rpc_network_info_response.py +15 -0
- near_jsonrpc_models/rpc_peer_info.py +9 -0
- near_jsonrpc_models/rpc_protocol_config_error.py +22 -0
- near_jsonrpc_models/rpc_protocol_config_request.py +20 -0
- near_jsonrpc_models/rpc_protocol_config_response.py +103 -0
- near_jsonrpc_models/rpc_query_error.py +122 -0
- near_jsonrpc_models/rpc_query_request.py +185 -0
- near_jsonrpc_models/rpc_query_response.py +50 -0
- near_jsonrpc_models/rpc_receipt_error.py +24 -0
- near_jsonrpc_models/rpc_receipt_request.py +6 -0
- near_jsonrpc_models/rpc_receipt_response.py +13 -0
- near_jsonrpc_models/rpc_request_validation_error_kind.py +23 -0
- near_jsonrpc_models/rpc_send_transaction_request.py +9 -0
- near_jsonrpc_models/rpc_split_storage_info_error.py +16 -0
- near_jsonrpc_models/rpc_split_storage_info_request.py +5 -0
- near_jsonrpc_models/rpc_split_storage_info_response.py +11 -0
- near_jsonrpc_models/rpc_state_changes_error.py +25 -0
- near_jsonrpc_models/rpc_state_changes_in_block_by_type_request.py +129 -0
- near_jsonrpc_models/rpc_state_changes_in_block_by_type_response.py +9 -0
- near_jsonrpc_models/rpc_state_changes_in_block_request.py +20 -0
- near_jsonrpc_models/rpc_state_changes_in_block_response.py +9 -0
- near_jsonrpc_models/rpc_status_error.py +37 -0
- near_jsonrpc_models/rpc_status_request.py +7 -0
- near_jsonrpc_models/rpc_status_response.py +41 -0
- near_jsonrpc_models/rpc_transaction_error.py +43 -0
- near_jsonrpc_models/rpc_transaction_response.py +17 -0
- near_jsonrpc_models/rpc_transaction_status_request.py +21 -0
- near_jsonrpc_models/rpc_validator_error.py +22 -0
- near_jsonrpc_models/rpc_validator_request.py +20 -0
- near_jsonrpc_models/rpc_validator_response.py +28 -0
- near_jsonrpc_models/rpc_validators_ordered_request.py +6 -0
- near_jsonrpc_models/rpc_view_access_key_error.py +55 -0
- near_jsonrpc_models/rpc_view_access_key_list_error.py +45 -0
- near_jsonrpc_models/rpc_view_access_key_list_request.py +24 -0
- near_jsonrpc_models/rpc_view_access_key_list_response.py +13 -0
- near_jsonrpc_models/rpc_view_access_key_request.py +28 -0
- near_jsonrpc_models/rpc_view_access_key_response.py +13 -0
- near_jsonrpc_models/rpc_view_account_error.py +45 -0
- near_jsonrpc_models/rpc_view_account_request.py +24 -0
- near_jsonrpc_models/rpc_view_account_response.py +20 -0
- near_jsonrpc_models/rpc_view_code_error.py +54 -0
- near_jsonrpc_models/rpc_view_code_request.py +24 -0
- near_jsonrpc_models/rpc_view_code_response.py +12 -0
- near_jsonrpc_models/rpc_view_gas_key_error.py +55 -0
- near_jsonrpc_models/rpc_view_gas_key_list_error.py +45 -0
- near_jsonrpc_models/rpc_view_gas_key_list_request.py +24 -0
- near_jsonrpc_models/rpc_view_gas_key_list_response.py +11 -0
- near_jsonrpc_models/rpc_view_gas_key_request.py +28 -0
- near_jsonrpc_models/rpc_view_gas_key_response.py +15 -0
- near_jsonrpc_models/rpc_view_state_error.py +54 -0
- near_jsonrpc_models/rpc_view_state_request.py +31 -0
- near_jsonrpc_models/rpc_view_state_response.py +14 -0
- near_jsonrpc_models/runtime_config_view.py +30 -0
- near_jsonrpc_models/runtime_fees_config_view.py +29 -0
- near_jsonrpc_models/shard_id.py +16 -0
- near_jsonrpc_models/shard_layout.py +34 -0
- near_jsonrpc_models/shard_layout_v0.py +15 -0
- near_jsonrpc_models/shard_layout_v1.py +22 -0
- near_jsonrpc_models/shard_layout_v2.py +19 -0
- near_jsonrpc_models/shard_layout_v3.py +17 -0
- near_jsonrpc_models/shard_uid.py +17 -0
- near_jsonrpc_models/signature.py +7 -0
- near_jsonrpc_models/signed_delegate_action.py +8 -0
- near_jsonrpc_models/signed_transaction.py +7 -0
- near_jsonrpc_models/signed_transaction_view.py +19 -0
- near_jsonrpc_models/slashed_validator.py +7 -0
- near_jsonrpc_models/stake_action.py +12 -0
- near_jsonrpc_models/state_change_cause_view.py +50 -0
- near_jsonrpc_models/state_change_kind_view.py +31 -0
- near_jsonrpc_models/state_change_with_cause_view.py +129 -0
- near_jsonrpc_models/state_item.py +10 -0
- near_jsonrpc_models/state_sync_config.py +14 -0
- near_jsonrpc_models/status_sync_info.py +17 -0
- near_jsonrpc_models/storage_error.py +46 -0
- near_jsonrpc_models/storage_get_mode.py +9 -0
- near_jsonrpc_models/storage_usage_config_view.py +11 -0
- near_jsonrpc_models/store_key.py +12 -0
- near_jsonrpc_models/store_value.py +12 -0
- near_jsonrpc_models/strict_model.py +5 -0
- near_jsonrpc_models/sync_checkpoint.py +7 -0
- near_jsonrpc_models/sync_concurrency.py +19 -0
- near_jsonrpc_models/sync_config.py +23 -0
- near_jsonrpc_models/tier1proxy_view.py +7 -0
- near_jsonrpc_models/tracked_shards_config.py +42 -0
- near_jsonrpc_models/transfer_action.py +6 -0
- near_jsonrpc_models/transfer_to_gas_key_action.py +8 -0
- near_jsonrpc_models/tx_execution_error.py +21 -0
- near_jsonrpc_models/tx_execution_status.py +14 -0
- near_jsonrpc_models/use_global_contract_action.py +8 -0
- near_jsonrpc_models/validator_info.py +6 -0
- near_jsonrpc_models/validator_kickout_reason.py +67 -0
- near_jsonrpc_models/validator_kickout_view.py +8 -0
- near_jsonrpc_models/validator_stake_view.py +13 -0
- near_jsonrpc_models/validator_stake_view_v1.py +10 -0
- near_jsonrpc_models/version.py +10 -0
- near_jsonrpc_models/view_state_result.py +10 -0
- near_jsonrpc_models/vmconfig_view.py +44 -0
- near_jsonrpc_models/vmkind.py +9 -0
- near_jsonrpc_models/wasm_trap.py +9 -0
- near_jsonrpc_models/witness_config_view.py +17 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
"""Auto-generated API mixin (generated by ApiGenerator).
|
|
2
|
+
|
|
3
|
+
This file contains APIMixinSync which provides generated API methods.
|
|
4
|
+
The runtime provides a NearBaseClientSync implementation (located in 'base_client')
|
|
5
|
+
that exposes `_call(...)`.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from .base_client import NearBaseClientSync
|
|
10
|
+
|
|
11
|
+
import near_jsonrpc_models
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class APIMixinSync:
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def experimental_call_function(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcCallFunctionRequest) -> near_jsonrpc_models.RpcCallFunctionResponse:
|
|
18
|
+
"""
|
|
19
|
+
Calls a view function on a contract and returns the result.
|
|
20
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
21
|
+
"""
|
|
22
|
+
return self._call(
|
|
23
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalCallFunction,
|
|
24
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcCallFunctionResponseAndRpcCallFunctionError,
|
|
25
|
+
params=params,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
def experimental_changes(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcStateChangesInBlockByTypeRequest) -> near_jsonrpc_models.RpcStateChangesInBlockResponse:
|
|
29
|
+
"""
|
|
30
|
+
[Deprecated] Returns changes for a given account, contract or contract code for given block height or hash. Consider using changes instead.
|
|
31
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
32
|
+
"""
|
|
33
|
+
return self._call(
|
|
34
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalChanges,
|
|
35
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcStateChangesError,
|
|
36
|
+
params=params,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def experimental_changes_in_block(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcStateChangesInBlockRequest) -> near_jsonrpc_models.RpcStateChangesInBlockByTypeResponse:
|
|
40
|
+
"""
|
|
41
|
+
[Deprecated] Returns changes in block for given block height or hash over all transactions for all the types. Includes changes like account_touched, access_key_touched, data_touched, contract_code_touched. Consider using block_effects instead
|
|
42
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
43
|
+
"""
|
|
44
|
+
return self._call(
|
|
45
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalChangesInBlock,
|
|
46
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcStateChangesError,
|
|
47
|
+
params=params,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def experimental_congestion_level(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcCongestionLevelRequest) -> near_jsonrpc_models.RpcCongestionLevelResponse:
|
|
51
|
+
"""
|
|
52
|
+
Queries the congestion level of a shard. More info about congestion [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)
|
|
53
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
54
|
+
"""
|
|
55
|
+
return self._call(
|
|
56
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalCongestionLevel,
|
|
57
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcCongestionLevelResponseAndRpcChunkError,
|
|
58
|
+
params=params,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def experimental_genesis_config(self: NearBaseClientSync) -> near_jsonrpc_models.GenesisConfig:
|
|
62
|
+
"""
|
|
63
|
+
[Deprecated] Get initial state and parameters for the genesis block. Consider genesis_config instead.
|
|
64
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
65
|
+
"""
|
|
66
|
+
params = near_jsonrpc_models.GenesisConfigRequest.model_validate(None)
|
|
67
|
+
return self._call(
|
|
68
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalGenesisConfig,
|
|
69
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForGenesisConfigAndGenesisConfigError,
|
|
70
|
+
params=params,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
def experimental_light_client_block_proof(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcLightClientBlockProofRequest) -> near_jsonrpc_models.RpcLightClientBlockProofResponse:
|
|
74
|
+
"""
|
|
75
|
+
Returns the proofs for a transaction execution.
|
|
76
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
77
|
+
"""
|
|
78
|
+
return self._call(
|
|
79
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalLightClientBlockProof,
|
|
80
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcLightClientBlockProofResponseAndRpcLightClientProofError,
|
|
81
|
+
params=params,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
def experimental_light_client_proof(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcLightClientExecutionProofRequest) -> near_jsonrpc_models.RpcLightClientExecutionProofResponse:
|
|
85
|
+
"""
|
|
86
|
+
Returns the proofs for a transaction execution.
|
|
87
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
88
|
+
"""
|
|
89
|
+
return self._call(
|
|
90
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalLightClientProof,
|
|
91
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcLightClientProofError,
|
|
92
|
+
params=params,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
def experimental_maintenance_windows(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcMaintenanceWindowsRequest) -> near_jsonrpc_models.JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError:
|
|
96
|
+
"""
|
|
97
|
+
[Deprecated] Returns the future windows for maintenance in current epoch for the specified account. In the maintenance windows, the node will not be block producer or chunk producer. Consider using maintenance_windows instead.
|
|
98
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
99
|
+
"""
|
|
100
|
+
return self._call(
|
|
101
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalMaintenanceWindows,
|
|
102
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError,
|
|
103
|
+
params=params,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
def experimental_protocol_config(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcProtocolConfigRequest) -> near_jsonrpc_models.RpcProtocolConfigResponse:
|
|
107
|
+
"""
|
|
108
|
+
A configuration that defines the protocol-level parameters such as gas/storage costs, limits, feature flags, other settings
|
|
109
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
110
|
+
"""
|
|
111
|
+
return self._call(
|
|
112
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalProtocolConfig,
|
|
113
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcProtocolConfigResponseAndRpcProtocolConfigError,
|
|
114
|
+
params=params,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
def experimental_receipt(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcReceiptRequest) -> near_jsonrpc_models.RpcReceiptResponse:
|
|
118
|
+
"""
|
|
119
|
+
Fetches a receipt by its ID (as is, without a status or execution outcome)
|
|
120
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
121
|
+
"""
|
|
122
|
+
return self._call(
|
|
123
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalReceipt,
|
|
124
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcReceiptResponseAndRpcReceiptError,
|
|
125
|
+
params=params,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
def experimental_split_storage_info(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcSplitStorageInfoRequest) -> near_jsonrpc_models.RpcSplitStorageInfoResponse:
|
|
129
|
+
"""
|
|
130
|
+
Contains the split storage information. More info on split storage [here](https://near-nodes.io/archival/split-storage-archival)
|
|
131
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
132
|
+
"""
|
|
133
|
+
return self._call(
|
|
134
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalSplitStorageInfo,
|
|
135
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcSplitStorageInfoResponseAndRpcSplitStorageInfoError,
|
|
136
|
+
params=params,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
def experimental_tx_status(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcTransactionStatusRequest) -> near_jsonrpc_models.RpcTransactionResponse:
|
|
140
|
+
"""
|
|
141
|
+
Queries status of a transaction by hash, returning the final transaction result and details of all receipts.
|
|
142
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
143
|
+
"""
|
|
144
|
+
return self._call(
|
|
145
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalTxStatus,
|
|
146
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError,
|
|
147
|
+
params=params,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
def experimental_validators_ordered(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcValidatorsOrderedRequest) -> near_jsonrpc_models.JsonRpcResponseForArrayOfValidatorStakeViewAndRpcValidatorError:
|
|
151
|
+
"""
|
|
152
|
+
Returns the current epoch validators ordered in the block producer order with repetition. This endpoint is solely used for bridge currently and is not intended for other external use cases.
|
|
153
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
154
|
+
"""
|
|
155
|
+
return self._call(
|
|
156
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalValidatorsOrdered,
|
|
157
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForArrayOfValidatorStakeViewAndRpcValidatorError,
|
|
158
|
+
params=params,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
def experimental_view_access_key(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcViewAccessKeyRequest) -> near_jsonrpc_models.RpcViewAccessKeyResponse:
|
|
162
|
+
"""
|
|
163
|
+
Returns information about a single access key for given account.
|
|
164
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
165
|
+
"""
|
|
166
|
+
return self._call(
|
|
167
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalViewAccessKey,
|
|
168
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcViewAccessKeyResponseAndRpcViewAccessKeyError,
|
|
169
|
+
params=params,
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
def experimental_view_access_key_list(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcViewAccessKeyListRequest) -> near_jsonrpc_models.RpcViewAccessKeyListResponse:
|
|
173
|
+
"""
|
|
174
|
+
Returns all access keys for a given account.
|
|
175
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
176
|
+
"""
|
|
177
|
+
return self._call(
|
|
178
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalViewAccessKeyList,
|
|
179
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcViewAccessKeyListResponseAndRpcViewAccessKeyListError,
|
|
180
|
+
params=params,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
def experimental_view_account(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcViewAccountRequest) -> near_jsonrpc_models.RpcViewAccountResponse:
|
|
184
|
+
"""
|
|
185
|
+
Returns information about an account for given account_id.
|
|
186
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
187
|
+
"""
|
|
188
|
+
return self._call(
|
|
189
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalViewAccount,
|
|
190
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcViewAccountResponseAndRpcViewAccountError,
|
|
191
|
+
params=params,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
def experimental_view_code(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcViewCodeRequest) -> near_jsonrpc_models.RpcViewCodeResponse:
|
|
195
|
+
"""
|
|
196
|
+
Returns the contract code (Wasm binary) deployed to the account.
|
|
197
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
198
|
+
"""
|
|
199
|
+
return self._call(
|
|
200
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalViewCode,
|
|
201
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcViewCodeResponseAndRpcViewCodeError,
|
|
202
|
+
params=params,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
def experimental_view_gas_key(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcViewGasKeyRequest) -> near_jsonrpc_models.RpcViewGasKeyResponse:
|
|
206
|
+
"""
|
|
207
|
+
Returns information about a single gas key for given account.
|
|
208
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
209
|
+
"""
|
|
210
|
+
return self._call(
|
|
211
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalViewGasKey,
|
|
212
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcViewGasKeyResponseAndRpcViewGasKeyError,
|
|
213
|
+
params=params,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
def experimental_view_gas_key_list(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcViewGasKeyListRequest) -> near_jsonrpc_models.RpcViewGasKeyListResponse:
|
|
217
|
+
"""
|
|
218
|
+
Returns all gas keys for a given account.
|
|
219
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
220
|
+
"""
|
|
221
|
+
return self._call(
|
|
222
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalViewGasKeyList,
|
|
223
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcViewGasKeyListResponseAndRpcViewGasKeyListError,
|
|
224
|
+
params=params,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
def experimental_view_state(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcViewStateRequest) -> near_jsonrpc_models.RpcViewStateResponse:
|
|
228
|
+
"""
|
|
229
|
+
Returns the state (key-value pairs) of a contract based on the key prefix.
|
|
230
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
231
|
+
"""
|
|
232
|
+
return self._call(
|
|
233
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForExperimentalViewState,
|
|
234
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcViewStateResponseAndRpcViewStateError,
|
|
235
|
+
params=params,
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
def block(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcBlockRequest) -> near_jsonrpc_models.RpcBlockResponse:
|
|
239
|
+
"""
|
|
240
|
+
Returns block details for given height or hash
|
|
241
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
242
|
+
"""
|
|
243
|
+
return self._call(
|
|
244
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForBlock,
|
|
245
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcBlockResponseAndRpcBlockError,
|
|
246
|
+
params=params,
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
def block_effects(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcStateChangesInBlockRequest) -> near_jsonrpc_models.RpcStateChangesInBlockByTypeResponse:
|
|
250
|
+
"""
|
|
251
|
+
Returns changes in block for given block height or hash over all transactions for all the types. Includes changes like account_touched, access_key_touched, data_touched, contract_code_touched.
|
|
252
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
253
|
+
"""
|
|
254
|
+
return self._call(
|
|
255
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForBlockEffects,
|
|
256
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcStateChangesInBlockByTypeResponseAndRpcStateChangesError,
|
|
257
|
+
params=params,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
def broadcast_tx_async(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcSendTransactionRequest) -> near_jsonrpc_models.CryptoHash:
|
|
261
|
+
"""
|
|
262
|
+
[Deprecated] Sends a transaction and immediately returns transaction hash. Consider using send_tx instead.
|
|
263
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
264
|
+
"""
|
|
265
|
+
return self._call(
|
|
266
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForBroadcastTxAsync,
|
|
267
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForCryptoHashAndRpcTransactionError,
|
|
268
|
+
params=params,
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
def broadcast_tx_commit(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcSendTransactionRequest) -> near_jsonrpc_models.RpcTransactionResponse:
|
|
272
|
+
"""
|
|
273
|
+
[Deprecated] Sends a transaction and waits until transaction is fully complete. (Has a 10 second timeout). Consider using send_tx instead.
|
|
274
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
275
|
+
"""
|
|
276
|
+
return self._call(
|
|
277
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForBroadcastTxCommit,
|
|
278
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError,
|
|
279
|
+
params=params,
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
def changes(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcStateChangesInBlockByTypeRequest) -> near_jsonrpc_models.RpcStateChangesInBlockResponse:
|
|
283
|
+
"""
|
|
284
|
+
Returns changes for a given account, contract or contract code for given block height or hash.
|
|
285
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
286
|
+
"""
|
|
287
|
+
return self._call(
|
|
288
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForChanges,
|
|
289
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcStateChangesInBlockResponseAndRpcStateChangesError,
|
|
290
|
+
params=params,
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
def chunk(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcChunkRequest) -> near_jsonrpc_models.RpcChunkResponse:
|
|
294
|
+
"""
|
|
295
|
+
Returns details of a specific chunk. You can run a block details query to get a valid chunk hash.
|
|
296
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
297
|
+
"""
|
|
298
|
+
return self._call(
|
|
299
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForChunk,
|
|
300
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcChunkResponseAndRpcChunkError,
|
|
301
|
+
params=params,
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
def client_config(self: NearBaseClientSync) -> near_jsonrpc_models.RpcClientConfigResponse:
|
|
305
|
+
"""
|
|
306
|
+
Queries client node configuration
|
|
307
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
308
|
+
"""
|
|
309
|
+
params = near_jsonrpc_models.RpcClientConfigRequest.model_validate(None)
|
|
310
|
+
return self._call(
|
|
311
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForClientConfig,
|
|
312
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcClientConfigResponseAndRpcClientConfigError,
|
|
313
|
+
params=params,
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
def gas_price(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcGasPriceRequest) -> near_jsonrpc_models.RpcGasPriceResponse:
|
|
317
|
+
"""
|
|
318
|
+
Returns gas price for a specific block_height or block_hash. Using [null] will return the most recent block's gas price.
|
|
319
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
320
|
+
"""
|
|
321
|
+
return self._call(
|
|
322
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForGasPrice,
|
|
323
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcGasPriceResponseAndRpcGasPriceError,
|
|
324
|
+
params=params,
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
def genesis_config(self: NearBaseClientSync) -> near_jsonrpc_models.GenesisConfig:
|
|
328
|
+
"""
|
|
329
|
+
Get initial state and parameters for the genesis block
|
|
330
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
331
|
+
"""
|
|
332
|
+
params = near_jsonrpc_models.GenesisConfigRequest.model_validate(None)
|
|
333
|
+
return self._call(
|
|
334
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForGenesisConfig,
|
|
335
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForGenesisConfigAndGenesisConfigError,
|
|
336
|
+
params=params,
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
def health(self: NearBaseClientSync) -> near_jsonrpc_models.JsonRpcResponseForNullableRpcHealthResponseAndRpcStatusError:
|
|
340
|
+
"""
|
|
341
|
+
Returns the current health status of the RPC node the client connects to.
|
|
342
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
343
|
+
"""
|
|
344
|
+
params = near_jsonrpc_models.RpcHealthRequest.model_validate(None)
|
|
345
|
+
return self._call(
|
|
346
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForHealth,
|
|
347
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForNullableRpcHealthResponseAndRpcStatusError,
|
|
348
|
+
params=params,
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
def light_client_proof(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcLightClientExecutionProofRequest) -> near_jsonrpc_models.RpcLightClientExecutionProofResponse:
|
|
352
|
+
"""
|
|
353
|
+
Returns the proofs for a transaction execution.
|
|
354
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
355
|
+
"""
|
|
356
|
+
return self._call(
|
|
357
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForLightClientProof,
|
|
358
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcLightClientExecutionProofResponseAndRpcLightClientProofError,
|
|
359
|
+
params=params,
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
def maintenance_windows(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcMaintenanceWindowsRequest) -> near_jsonrpc_models.JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError:
|
|
363
|
+
"""
|
|
364
|
+
Returns the future windows for maintenance in current epoch for the specified account. In the maintenance windows, the node will not be block producer or chunk producer.
|
|
365
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
366
|
+
"""
|
|
367
|
+
return self._call(
|
|
368
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForMaintenanceWindows,
|
|
369
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForArrayOfRangeOfUint64AndRpcMaintenanceWindowsError,
|
|
370
|
+
params=params,
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
def network_info(self: NearBaseClientSync) -> near_jsonrpc_models.RpcNetworkInfoResponse:
|
|
374
|
+
"""
|
|
375
|
+
Queries the current state of node network connections. This includes information about active peers, transmitted data, known producers, etc.
|
|
376
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
377
|
+
"""
|
|
378
|
+
params = near_jsonrpc_models.RpcNetworkInfoRequest.model_validate(None)
|
|
379
|
+
return self._call(
|
|
380
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForNetworkInfo,
|
|
381
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcNetworkInfoResponseAndRpcNetworkInfoError,
|
|
382
|
+
params=params,
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
def next_light_client_block(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcLightClientNextBlockRequest) -> near_jsonrpc_models.RpcLightClientNextBlockResponse:
|
|
386
|
+
"""
|
|
387
|
+
Returns the next light client block.
|
|
388
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
389
|
+
"""
|
|
390
|
+
return self._call(
|
|
391
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForNextLightClientBlock,
|
|
392
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcLightClientNextBlockResponseAndRpcLightClientNextBlockError,
|
|
393
|
+
params=params,
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
def query(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcQueryRequest) -> near_jsonrpc_models.RpcQueryResponse:
|
|
397
|
+
"""
|
|
398
|
+
This module allows you to make generic requests to the network. The `RpcQueryRequest` struct takes in a [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html) and a [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html). The `BlockReference` enum allows you to specify a block by `Finality`, `BlockId` or `SyncCheckpoint`. The `QueryRequest` enum provides multiple variants for performing the following actions: - View an account's details - View a contract's code - View the state of an account - View the `AccessKey` of an account - View the `AccessKeyList` of an account - Call a function in a contract deployed on the network.
|
|
399
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
400
|
+
"""
|
|
401
|
+
return self._call(
|
|
402
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForQuery,
|
|
403
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcQueryResponseAndRpcQueryError,
|
|
404
|
+
params=params,
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
def send_tx(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcSendTransactionRequest) -> near_jsonrpc_models.RpcTransactionResponse:
|
|
408
|
+
"""
|
|
409
|
+
Sends transaction. Returns the guaranteed execution status and the results the blockchain can provide at the moment.
|
|
410
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
411
|
+
"""
|
|
412
|
+
return self._call(
|
|
413
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForSendTx,
|
|
414
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError,
|
|
415
|
+
params=params,
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
def status(self: NearBaseClientSync) -> near_jsonrpc_models.RpcStatusResponse:
|
|
419
|
+
"""
|
|
420
|
+
Requests the status of the connected RPC node. This includes information about sync status, nearcore node version, protocol version, the current set of validators, etc.
|
|
421
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
422
|
+
"""
|
|
423
|
+
params = near_jsonrpc_models.RpcStatusRequest.model_validate(None)
|
|
424
|
+
return self._call(
|
|
425
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForStatus,
|
|
426
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcStatusResponseAndRpcStatusError,
|
|
427
|
+
params=params,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
def tx(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcTransactionStatusRequest) -> near_jsonrpc_models.RpcTransactionResponse:
|
|
431
|
+
"""
|
|
432
|
+
Queries status of a transaction by hash and returns the final transaction result.
|
|
433
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
434
|
+
"""
|
|
435
|
+
return self._call(
|
|
436
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForTx,
|
|
437
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcTransactionResponseAndRpcTransactionError,
|
|
438
|
+
params=params,
|
|
439
|
+
)
|
|
440
|
+
|
|
441
|
+
def validators(self: NearBaseClientSync, *, params: near_jsonrpc_models.RpcValidatorRequest) -> near_jsonrpc_models.RpcValidatorResponse:
|
|
442
|
+
"""
|
|
443
|
+
Queries active validators on the network. Returns details and the state of validation on the blockchain.
|
|
444
|
+
High-level method: returns the result model or raises NearClientError/NearRpcError/NearHttpError.
|
|
445
|
+
"""
|
|
446
|
+
return self._call(
|
|
447
|
+
request_model=near_jsonrpc_models.JsonRpcRequestForValidators,
|
|
448
|
+
response_model=near_jsonrpc_models.JsonRpcResponseForRpcValidatorResponseAndRpcValidatorError,
|
|
449
|
+
params=params,
|
|
450
|
+
)
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
from typing import Type
|
|
2
|
+
from uuid import uuid4
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
import requests
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
from typing import get_args
|
|
8
|
+
|
|
9
|
+
from .errors import (
|
|
10
|
+
ClientError,
|
|
11
|
+
TransportError,
|
|
12
|
+
HttpError,
|
|
13
|
+
RpcError,
|
|
14
|
+
RequestTimeoutError,
|
|
15
|
+
)
|
|
16
|
+
from .transport import HttpTransportAsync, HttpTransportSync
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _extract_method(request_model: Type[BaseModel]) -> str:
|
|
20
|
+
field = request_model.model_fields.get("method")
|
|
21
|
+
if field is None:
|
|
22
|
+
raise ClientError(
|
|
23
|
+
f"{request_model.__name__} does not define a 'method' field"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
args = get_args(field.annotation)
|
|
27
|
+
if len(args) != 1 or not isinstance(args[0], str):
|
|
28
|
+
raise ClientError(
|
|
29
|
+
f"Invalid JSON-RPC method definition in {request_model.__name__}"
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return args[0]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_response(response_model: Type[BaseModel], response_json: dict):
|
|
36
|
+
"""Shared response parsing and error handling."""
|
|
37
|
+
try:
|
|
38
|
+
parsed = response_model.model_validate(response_json)
|
|
39
|
+
except Exception as e:
|
|
40
|
+
raise ClientError("Invalid response format") from e
|
|
41
|
+
|
|
42
|
+
inner = parsed.root
|
|
43
|
+
if hasattr(inner, "error") and inner.error is not None:
|
|
44
|
+
raise RpcError(inner)
|
|
45
|
+
return inner.result
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# ===================== Async Client =====================
|
|
49
|
+
class NearBaseClientAsync:
|
|
50
|
+
def __init__(
|
|
51
|
+
self,
|
|
52
|
+
*,
|
|
53
|
+
base_url: str,
|
|
54
|
+
timeout: float = 10.0,
|
|
55
|
+
headers: dict[str, str] | None = None,
|
|
56
|
+
):
|
|
57
|
+
self._transport = HttpTransportAsync(
|
|
58
|
+
base_url=base_url, timeout=timeout, headers=headers
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
async def _call(
|
|
62
|
+
self,
|
|
63
|
+
*,
|
|
64
|
+
request_model: Type[BaseModel],
|
|
65
|
+
response_model: Type[BaseModel],
|
|
66
|
+
params: BaseModel,
|
|
67
|
+
debug=False
|
|
68
|
+
):
|
|
69
|
+
request = request_model(
|
|
70
|
+
jsonrpc="2.0",
|
|
71
|
+
id=str(uuid4()),
|
|
72
|
+
method=_extract_method(request_model),
|
|
73
|
+
params=params,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
payload = request.model_dump(by_alias=True)
|
|
77
|
+
if debug:
|
|
78
|
+
print("➡️ JSON-RPC Request payload:", payload)
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
response = await self._transport.post(json=payload)
|
|
82
|
+
if debug:
|
|
83
|
+
print("⬅️ JSON-RPC Raw Response:", response.text)
|
|
84
|
+
|
|
85
|
+
except httpx.TimeoutException as e:
|
|
86
|
+
raise RequestTimeoutError() from e
|
|
87
|
+
except httpx.RequestError as e:
|
|
88
|
+
raise TransportError(str(e)) from e
|
|
89
|
+
|
|
90
|
+
if 500 <= response.status_code < 600:
|
|
91
|
+
raise HttpError(status_code=response.status_code, body=response.text)
|
|
92
|
+
|
|
93
|
+
return _parse_response(response_model, response.json())
|
|
94
|
+
|
|
95
|
+
async def close(self):
|
|
96
|
+
await self._transport.close()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# ===================== Sync Client =====================
|
|
100
|
+
class NearBaseClientSync:
|
|
101
|
+
def __init__(
|
|
102
|
+
self,
|
|
103
|
+
*,
|
|
104
|
+
base_url: str,
|
|
105
|
+
timeout: float = 10.0,
|
|
106
|
+
headers: dict[str, str] | None = None,
|
|
107
|
+
):
|
|
108
|
+
self._transport = HttpTransportSync(
|
|
109
|
+
base_url=base_url, timeout=timeout, headers=headers
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
def _call(
|
|
113
|
+
self,
|
|
114
|
+
*,
|
|
115
|
+
request_model: Type[BaseModel],
|
|
116
|
+
response_model: Type[BaseModel],
|
|
117
|
+
params: BaseModel,
|
|
118
|
+
debug=False
|
|
119
|
+
):
|
|
120
|
+
request = request_model(
|
|
121
|
+
jsonrpc="2.0",
|
|
122
|
+
id=str(uuid4()),
|
|
123
|
+
method=_extract_method(request_model),
|
|
124
|
+
params=params,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
payload = request.model_dump(by_alias=True)
|
|
128
|
+
if debug:
|
|
129
|
+
print("➡️ JSON-RPC Request payload:", payload)
|
|
130
|
+
|
|
131
|
+
try:
|
|
132
|
+
response = self._transport.post(json=payload)
|
|
133
|
+
if debug:
|
|
134
|
+
print("⬅️ JSON-RPC Raw Response:", response.text)
|
|
135
|
+
|
|
136
|
+
# handle sync transport exceptions (requests or httpx sync)
|
|
137
|
+
except requests.Timeout as e:
|
|
138
|
+
raise RequestTimeoutError() from e
|
|
139
|
+
except requests.RequestException as e:
|
|
140
|
+
raise TransportError(str(e)) from e
|
|
141
|
+
|
|
142
|
+
if 500 <= response.status_code < 600:
|
|
143
|
+
raise HttpError(status_code=response.status_code, body=response.text)
|
|
144
|
+
|
|
145
|
+
return _parse_response(response_model, response.json())
|
|
146
|
+
|
|
147
|
+
def close(self):
|
|
148
|
+
self._transport.close()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from near_jsonrpc_client.api_methods_async import APIMixinAsync
|
|
2
|
+
from near_jsonrpc_client.api_methods_sync import APIMixinSync
|
|
3
|
+
from .base_client import NearBaseClientAsync, NearBaseClientSync
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class NearClientAsync(NearBaseClientAsync, APIMixinAsync):
|
|
7
|
+
"""NearClientAsync with generated API methods mixed in."""
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class NearClientSync(NearBaseClientSync, APIMixinSync):
|
|
12
|
+
"""NearClientSync with generated API methods mixed in."""
|
|
13
|
+
pass
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ClientError(Exception):
|
|
5
|
+
"""Base error for all NEAR client related failures."""
|
|
6
|
+
pass
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransportError(ClientError):
|
|
10
|
+
"""Network-level errors (timeout, DNS, connection, etc)."""
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class HttpError(ClientError):
|
|
15
|
+
"""Non-200 HTTP responses."""
|
|
16
|
+
|
|
17
|
+
def __init__(self, status_code: int, body: str | None = None):
|
|
18
|
+
self.status_code = status_code
|
|
19
|
+
self.body = body
|
|
20
|
+
super().__init__(f"HTTP error {status_code}")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RpcError(ClientError):
|
|
24
|
+
"""JSON-RPC error object wrapping the Pydantic error model."""
|
|
25
|
+
|
|
26
|
+
def __init__(self, error: BaseModel):
|
|
27
|
+
self.error = error
|
|
28
|
+
super().__init__(getattr(error, "message", "RPC Error"))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class RequestTimeoutError(ClientError):
|
|
32
|
+
"""Timeout Error"""
|
|
33
|
+
|
|
34
|
+
def __init__(self):
|
|
35
|
+
super().__init__("Timeout Error")
|