mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
mempool weather added
This commit is contained in:
@@ -45,6 +45,6 @@ class Test extends Command
|
|||||||
'temperature' => 1
|
'temperature' => 1
|
||||||
]);
|
]);
|
||||||
|
|
||||||
cache()->put('mempool-weather', $result['choices'][0]['text'], now()->addMinutes(60));
|
echo $result['choices'][0]['text'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,6 @@ use Livewire\Component;
|
|||||||
class MempoolWeather extends Component
|
class MempoolWeather extends Component
|
||||||
{
|
{
|
||||||
public string $weather = '';
|
public string $weather = '';
|
||||||
|
|
||||||
public $fastestFee;
|
|
||||||
public $halfHourFee;
|
|
||||||
public $hourFee;
|
|
||||||
public $economyFee;
|
|
||||||
public $minimumFee;
|
|
||||||
public $changed;
|
public $changed;
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
@@ -26,13 +20,6 @@ class MempoolWeather extends Component
|
|||||||
Artisan::call(CacheRecommendedFees::class);
|
Artisan::call(CacheRecommendedFees::class);
|
||||||
$this->weather = cache()->get('mempool-weather');
|
$this->weather = cache()->get('mempool-weather');
|
||||||
}
|
}
|
||||||
$result = Http::get('https://mempool.space/api/v1/fees/recommended');
|
|
||||||
$result = $result->json();
|
|
||||||
$this->fastestFee = $result['fastestFee'];
|
|
||||||
$this->halfHourFee = $result['halfHourFee'];
|
|
||||||
$this->hourFee = $result['hourFee'];
|
|
||||||
$this->economyFee = $result['economyFee'];
|
|
||||||
$this->minimumFee = $result['minimumFee'];
|
|
||||||
$this->changed = cache()->get('mempool-weather-changed');
|
$this->changed = cache()->get('mempool-weather-changed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
@googlefonts
|
@googlefonts
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
|
<script src="https://mempool.space/mempool.js"></script>
|
||||||
<script src="{{ asset('dist/jquery.js') }}"></script>
|
<script src="{{ asset('dist/jquery.js') }}"></script>
|
||||||
<script src="{{ asset('vendor/jvector/jquery-jvectormap-2.0.5.min.js') }}"></script>
|
<script src="{{ asset('vendor/jvector/jquery-jvectormap-2.0.5.min.js') }}"></script>
|
||||||
<script src="{{ asset('vendor/jvector/maps/world-mill.js') }}"></script>
|
<script src="{{ asset('vendor/jvector/maps/world-mill.js') }}"></script>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<link rel="stylesheet" href="{{ asset('vendor/jvector/jquery-jvectormap-2.0.5.css') }}" type="text/css"
|
<link rel="stylesheet" href="{{ asset('vendor/jvector/jquery-jvectormap-2.0.5.css') }}" type="text/css"
|
||||||
media="screen"/>
|
media="screen"/>
|
||||||
|
<script src="https://mempool.space/mempool.js"></script>
|
||||||
<script src="{{ asset('dist/jquery.js') }}"></script>
|
<script src="{{ asset('dist/jquery.js') }}"></script>
|
||||||
<script src="{{ asset('vendor/jvector/jquery-jvectormap-2.0.5.min.js') }}"></script>
|
<script src="{{ asset('vendor/jvector/jquery-jvectormap-2.0.5.min.js') }}"></script>
|
||||||
<script src="{{ asset('vendor/jvector/maps/world-mill.js') }}"></script>
|
<script src="{{ asset('vendor/jvector/maps/world-mill.js') }}"></script>
|
||||||
|
|||||||
@@ -14,7 +14,44 @@
|
|||||||
<div class="text-md leading-6 text-gray-900 text-center max-w-screen-2xl">
|
<div class="text-md leading-6 text-gray-900 text-center max-w-screen-2xl">
|
||||||
{{ $weather }} (um {{ \App\Support\Carbon::parse($changed)->asTime() }} Uhr aktualisiert - stündlich)
|
{{ $weather }} (um {{ \App\Support\Carbon::parse($changed)->asTime() }} Uhr aktualisiert - stündlich)
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div
|
||||||
|
x-data="{
|
||||||
|
fastestFee: null,
|
||||||
|
halfHourFee: null,
|
||||||
|
hourFee: null,
|
||||||
|
economyFee: null,
|
||||||
|
minimumFee: null,
|
||||||
|
init() {
|
||||||
|
const that = this;
|
||||||
|
const init = async () => {
|
||||||
|
const { bitcoin: { websocket } } = mempoolJS({
|
||||||
|
hostname: 'mempool.space'
|
||||||
|
});
|
||||||
|
const ws = websocket.initClient({
|
||||||
|
options: ['stats'],
|
||||||
|
});
|
||||||
|
ws.addEventListener('message', function incoming({data}) {
|
||||||
|
const res = JSON.parse(data.toString());
|
||||||
|
that.fastestFee = res.fees.fastestFee;
|
||||||
|
that.halfHourFee = res.fees.halfHourFee;
|
||||||
|
that.hourFee = res.fees.hourFee;
|
||||||
|
that.economyFee = res.fees.economyFee;
|
||||||
|
that.minimumFee = res.fees.minimumFee;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template x-if="!minimumFee">
|
||||||
|
<div class="text-amber-500 w-[384px]">
|
||||||
|
<div class="h-3 w-3">
|
||||||
|
<span class="animate-ping inline-flex h-full w-full rounded-full bg-amber-500 opacity-75"></span>
|
||||||
|
</div>
|
||||||
|
Loading fees...
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template x-if="minimumFee">
|
||||||
<div
|
<div
|
||||||
_ngcontent-serverapp-c131=""
|
_ngcontent-serverapp-c131=""
|
||||||
class="flex flex-col justify-around p-5 leading-6 text-center text-white break-words"
|
class="flex flex-col justify-around p-5 leading-6 text-center text-white break-words"
|
||||||
@@ -106,7 +143,7 @@
|
|||||||
class="m-auto leading-7 border-b border-gray-200 border-solid text-gray-900"
|
class="m-auto leading-7 border-b border-gray-200 border-solid text-gray-900"
|
||||||
style="list-style: outside;"
|
style="list-style: outside;"
|
||||||
>
|
>
|
||||||
{{ $minimumFee }}
|
<span x-text="minimumFee"></span>
|
||||||
<span
|
<span
|
||||||
_ngcontent-serverapp-c126=""
|
_ngcontent-serverapp-c126=""
|
||||||
class="inline-flex relative top-0 text-xs leading-4 text-gray-900"
|
class="inline-flex relative top-0 text-xs leading-4 text-gray-900"
|
||||||
@@ -136,7 +173,7 @@
|
|||||||
class="m-auto leading-7 border-b border-gray-200 border-solid text-gray-900"
|
class="m-auto leading-7 border-b border-gray-200 border-solid text-gray-900"
|
||||||
style="list-style: outside;"
|
style="list-style: outside;"
|
||||||
>
|
>
|
||||||
{{ $hourFee }}
|
<span x-text="hourFee"></span>
|
||||||
<span
|
<span
|
||||||
_ngcontent-serverapp-c126=""
|
_ngcontent-serverapp-c126=""
|
||||||
class="inline-flex relative top-0 text-xs leading-4 text-gray-900"
|
class="inline-flex relative top-0 text-xs leading-4 text-gray-900"
|
||||||
@@ -165,7 +202,7 @@
|
|||||||
class="m-auto leading-7 border-b border-gray-200 border-solid text-gray-900"
|
class="m-auto leading-7 border-b border-gray-200 border-solid text-gray-900"
|
||||||
style="list-style: outside;"
|
style="list-style: outside;"
|
||||||
>
|
>
|
||||||
{{ $halfHourFee }}
|
<span x-text="halfHourFee"></span>
|
||||||
<span
|
<span
|
||||||
_ngcontent-serverapp-c126=""
|
_ngcontent-serverapp-c126=""
|
||||||
class="inline-flex relative top-0 text-xs leading-4 text-gray-900"
|
class="inline-flex relative top-0 text-xs leading-4 text-gray-900"
|
||||||
@@ -195,7 +232,7 @@
|
|||||||
class="m-auto leading-7 border-b border-gray-200 border-solid text-gray-900"
|
class="m-auto leading-7 border-b border-gray-200 border-solid text-gray-900"
|
||||||
style="list-style: outside;"
|
style="list-style: outside;"
|
||||||
>
|
>
|
||||||
{{ $fastestFee }}
|
<span x-text="fastestFee"></span>
|
||||||
<span
|
<span
|
||||||
_ngcontent-serverapp-c126=""
|
_ngcontent-serverapp-c126=""
|
||||||
class="inline-flex relative top-0 text-xs leading-4 text-gray-900"
|
class="inline-flex relative top-0 text-xs leading-4 text-gray-900"
|
||||||
@@ -214,7 +251,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</app-fees-box>
|
</app-fees-box>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user