Skip to content

Commit

Permalink
min input amount data fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Baligabor committed Jan 15, 2024
1 parent b6812cc commit e66f04f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
14 changes: 10 additions & 4 deletions app/Http/Livewire/CjmainComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ public function render()
'Content-Type: application/json-patch+json',
];
foreach ($cjMain as $key => $value) {
$roundId = $value['roundId'];
$data = [
'roundCheckpoints' => [
[
'roundId' => $value['roundId'],
'roundId' => $roundId,
'stateId' => 0,
],
],
Expand All @@ -41,11 +42,16 @@ public function render()
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
}

curl_close($ch);
if(isset(json_decode($response, true)['roundStates'][0]['coinjoinState']['events'][0]['roundParameters']['allowedInputAmounts']))
if(isset(json_decode($response, true)['roundStates']))
{
$cjMain[$key]['allowedInputAmounts'] = json_decode($response, true)['roundStates'][0]['coinjoinState']['events'][0]['roundParameters']['allowedInputAmounts'];
$filtered = array_filter(json_decode($response, true)['roundStates'], function ($object) use ($roundId) {
return $object['id'] === $roundId;
});
$keys = array_keys($filtered);
if (isset($keys[0])) {
$cjMain[$key]['allowedInputAmounts'] = $filtered[$keys[0]]['coinjoinState']['events'][0]['roundParameters']['allowedInputAmounts'];
}
}
}
$nodata = null;
Expand Down
13 changes: 10 additions & 3 deletions app/Http/Livewire/CjtestComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ public function render()
'Content-Type: application/json-patch+json',
];
foreach ($cjTest as $key => $value) {
$roundId = $value['roundId'];
$data = [
'roundCheckpoints' => [
[
'roundId' => $value['roundId'],
'roundId' => $roundId,
'stateId' => 0,
],
],
Expand All @@ -43,9 +44,15 @@ public function render()
}

curl_close($ch);
if(isset(json_decode($response, true)['roundStates'][0]['coinjoinState']['events'][0]['roundParameters']['allowedInputAmounts']))
if(isset(json_decode($response, true)['roundStates']))
{
$cjTest[$key]['allowedInputAmounts'] = json_decode($response, true)['roundStates'][0]['coinjoinState']['events'][0]['roundParameters']['allowedInputAmounts'];
$filtered = array_filter(json_decode($response, true)['roundStates'], function ($object) use ($roundId) {
return $object['id'] === $roundId;
});
$keys = array_keys($filtered);
if (isset($keys[0])) {
$cjTest[$key]['allowedInputAmounts'] = $filtered[$keys[0]]['coinjoinState']['events'][0]['roundParameters']['allowedInputAmounts'];
}
}
}
$nodata = null;
Expand Down

0 comments on commit e66f04f

Please sign in to comment.