Skip to content

Commit

Permalink
Add min input amount to testnet CJ rounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Lévai Norbert committed Jan 11, 2024
1 parent 79626bd commit 2cd2b2a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
35 changes: 35 additions & 0 deletions app/Http/Livewire/CjtestComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,41 @@ public function render()
{
try {
$cjTest = Http::get('https://wasabiwallet.co/WabiSabi/human-monitor')->json()['roundStates'];
$statusUrl = 'https://wasabiwallet.co/WabiSabi/status';

$headers = [
'Accept: application/json',
'Content-Type: application/json-patch+json',
];
foreach ($cjTest as $key => $value) {
$data = [
'roundCheckpoints' => [
[
'roundId' => $value['roundId'],
'stateId' => 0,
],
],
];

$ch = curl_init($statusUrl);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);

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']))
{
$cjTest[$key]['allowedInputAmounts'] = json_decode($response, true)['roundStates'][0]['coinjoinState']['events'][0]['roundParameters']['allowedInputAmounts'];
}
}
$nodata = null;
} catch (\Exception $th) {
$nodata = 'No data from server!';
Expand Down
3 changes: 3 additions & 0 deletions resources/views/livewire/cjtest-component.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
</p>
<p class="mb-0"><strong>Input count:</strong> <span class="text-orange">{{$item['inputCount']}}</p>
<p class="mb-0"><strong>Max suggested amount:</strong> <span class="text-orange">{{$item['maxSuggestedAmount']}}</span></p>
@if (isset($item['allowedInputAmounts']))
<p class="mb-0"><strong>Min input amount:</strong> <span class="text-orange">{{$item['allowedInputAmounts']['min']}}</span></p>
@endif
@if ($item['phase'] === 'InputRegistration')
<p class="mb-0"><strong>Next phase in:</strong> <span class="text-blue">{{$item['inputRegistrationRemaining']}}</span></p>
@endif
Expand Down

0 comments on commit 2cd2b2a

Please sign in to comment.