From 28eeb1186afde761e6b74760032fd14ef857088a Mon Sep 17 00:00:00 2001 From: "Jose. Palazuelos" Date: Wed, 31 Jan 2024 01:46:23 -0600 Subject: [PATCH] Bitso refactor better separation of concerns --- BitsoAPI/Bitso.php | 20 ++++++++++---------- BitsoAPI/Client.php | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/BitsoAPI/Bitso.php b/BitsoAPI/Bitso.php index 61a77a0..fbcbe6a 100644 --- a/BitsoAPI/Bitso.php +++ b/BitsoAPI/Bitso.php @@ -133,7 +133,7 @@ public function account_status(): array $JSONPayload = ''; $type = 'PRIVATE'; - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } @@ -176,7 +176,7 @@ public function fees(): array $HTTPMethod = 'GET'; $JSONPayload = ''; - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } @@ -208,7 +208,7 @@ public function withdrawals( $RequestPath = '/api/v3/withdrawals/?'.$parameters; $HTTPMethod = 'GET'; - return Client::getData($path, $RequestPath, $HTTPMethod, '', $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, ''); } public function fundings($params = []): array @@ -244,7 +244,7 @@ public function fundings($params = []): array $JSONPayload = ''; $type = 'PRIVATE'; - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } public function user_trades($params = [], $ids = []): array @@ -275,7 +275,7 @@ public function user_trades($params = [], $ids = []): array $JSONPayload = ''; $type = 'PRIVATE'; - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } public function open_orders($params): array @@ -297,7 +297,7 @@ public function open_orders($params): array $JSONPayload = ''; $type = 'PRIVATE'; - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } public function lookup_order($ids) @@ -319,7 +319,7 @@ public function lookup_order($ids) $JSONPayload = ''; $type = 'PRIVATE'; - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } public function cancel_order($ids): array @@ -336,7 +336,7 @@ public function cancel_order($ids): array $HTTPMethod = 'DELETE'; $JSONPayload = ''; - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } public function place_order($params): array @@ -346,7 +346,7 @@ public function place_order($params): array $HTTPMethod = 'POST'; $JSONPayload = json_encode($params, JSON_THROW_ON_ERROR); - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } public function fundingDestination($params): array @@ -368,7 +368,7 @@ public function fundingDestination($params): array $JSONPayload = ''; $type = 'PRIVATE'; - return Client::getData($path, $RequestPath, $HTTPMethod, $JSONPayload, $this); + return Client::getData($this, $path, $RequestPath, $HTTPMethod, $JSONPayload); } public function setCredentials($key, $secret): static diff --git a/BitsoAPI/Client.php b/BitsoAPI/Client.php index 91fdd58..1df62fe 100644 --- a/BitsoAPI/Client.php +++ b/BitsoAPI/Client.php @@ -76,7 +76,7 @@ public static function checkAndDecode($result) // All the other API methods... - public static function getData($path, $RequestPath, $HTTPMethod, $JSONPayload = '', Bitso $instance): array + public static function getData(Bitso $instance, $path, $RequestPath, $HTTPMethod, $JSONPayload = ''): array { $nonce = self::makeNonce(); $message = $nonce . $HTTPMethod . $RequestPath . $JSONPayload;