Skip to content

Commit

Permalink
Remove toggle to avoid editor errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Virus-Axel committed Mar 26, 2023
1 parent b1c40fb commit 82e0aff
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions addons/solana_client/scripts/request_handler.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ const MAX_GODOT_INT: int = 9223372036854775807
@export var unique_id: int = 0
var commitment: String = "finalized"

@export var synchronous := true:
set(value):
synchronous = value
toggle_connect_response()
@export var synchronous := true

@export var enable_minimum_context_slot := false:
set(value):
Expand Down Expand Up @@ -61,6 +58,8 @@ func _get_property_list():
func _ready():
var random_number: PackedInt64Array = rand_from_seed(Time.get_unix_time_from_system())
unique_id = random_number[0]

request_completed.connect(Callable(self, "handle_asynchronous_response"))
#print(await get_block_height())
#print(await get_balance("6WEPfubN443TJ4tr8z2SsP8f3o1eXRzn4Wv2X2ykY4JX"))
#print(await get_account_info("6WEPfubN443TJ4tr8z2SsP8f3o1eXRzn4Wv2X2ykY4JX"))
Expand All @@ -80,12 +79,6 @@ func increment_unique_id():
unique_id += 1


func toggle_connect_response():
if synchronous:
request_completed.disconnect(Callable(self, "handle_asynchronous_response"))
else:
request_completed.connect(Callable(self, "handle_asynchronous_response"))

func parse_response_data(data: Array) -> Variant:
if data.is_empty():
emit_signal("error", "INTERNAL", "HTTP response data is invalid.")
Expand Down Expand Up @@ -634,7 +627,8 @@ func get_commitment() -> String:


func handle_asynchronous_response(result, response_code, headers, body) -> void:
parse_response_data([result, response_code, headers, body])
if not synchronous:
parse_response_data([result, response_code, headers, body])


func create_filter(offset: int = -1, match_data: String = "", encoded: bool = true, data_size: int = -1):
Expand Down

0 comments on commit 82e0aff

Please sign in to comment.