<?php
// Adresse du portefeuille Solana à surveiller
$walletAddress = '5KvwBBrW9uc2ZXG39LPzGixwsoTbhXafZtUKGrbwdQsK';
// Endpoint RPC de Solana pour le réseau principal
$rpcEndpoint = 'https://api.mainnet-beta.solana.com';
// Fonction pour effectuer des requêtes JSON-RPC
function solanaRpcRequest($method, $params = []) {
global $rpcEndpoint;
$payload = json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => $method,
'params' => $params
]);
$ch = curl_init($rpcEndpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
// Obtenir le solde du portefeuille
function getWalletBalance($walletAddress) {
$response = solanaRpcRequest('getBalance', [$walletAddress]);
return isset($response['result']['value']) ? $response['result']['value'] : null;
}
// Obtenir les transactions récentes
function getWalletTransactions($walletAddress) {
$response = solanaRpcRequest('getSignaturesForAddress', [$walletAddress, ['limit' => 10]]);
return isset($response['result']) ? $response['result'] : [];
}
// Interface utilisateur
$balance = getWalletBalance($walletAddress);
$transactions = getWalletTransactions($walletAddress);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Suivi du Portefeuille Solana</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
.container {
max-width: 800px;
margin: auto;
}
h1 {
text-align: center;
}
.balance {
background: #f4f4f4;
padding: 10px;
border: 1px solid #ccc;
margin-bottom: 20px;
}
table {
width: 100%;
border-collapse: collapse;
}
table th, table td {
border: 1px solid #ddd;
padding: 8px;
text-align: center;
}
table th {
background: #f4f4f4;
}
</style>
</head>
<body>
<div class="container">
<h1>Suivi du Portefeuille Solana</h1>
<div class="balance">
<h2>Solde</h2>
<p><?php echo number_format($balance / 1000000000, 3); ?> SOL</p>
</div>
<div class="transactions">
<h2>Transactions Récentes</h2>
<table>
<thead>
<tr>
<th>Signature</th>
<th>Slot</th>
<th>Heure du Bloc</th>
</tr>
</thead>
<tbody>
<?php foreach ($transactions as $tx): ?>
<tr>
<td><?php echo $tx['signature']; ?></td>
<td><?php echo $tx['slot']; ?></td>
<td><?php echo isset($tx['blockTime']) ? date('Y-m-d H:i:s', $tx['blockTime']) : 'N/A'; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>