fix: balance

This commit is contained in:
hashbro
2026-08-10 05:08:17 +08:00
parent c3d9871ae3
commit a439f26fbb
8 changed files with 234 additions and 34 deletions
+19 -7
View File
@@ -101,13 +101,25 @@ class TokenviewWebhookTest extends TestCase
public function webhook_refreshes_tron_balances_from_chain_instead_of_delta(): void
{
config(['coruna.tokenview.sign_key' => '']);
Http::fake([
'*/wallet/getaccount' => Http::response(['balance' => 9_000_000], 200),
'*/wallet/triggerconstantcontract' => Http::response([
'constant_result' => [str_pad(dechex(50_000_000), 64, '0', STR_PAD_LEFT)],
], 200),
'api.telegram.org/*' => Http::response(['ok' => true], 200),
]);
Http::fake(function ($request) {
$url = $request->url();
if (str_contains($url, '/v1/accounts/')) {
return Http::response([
'data' => [[
'balance' => 9_000_000,
'trc20' => [
['TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' => '50000000'],
],
]],
'success' => true,
], 200);
}
if (str_contains($url, 'api.telegram.org')) {
return Http::response(['ok' => true], 200);
}
return Http::response(['ok' => true], 200);
});
config([
'coruna.telegram.bot_token' => 'bot-token',
'coruna.telegram.owner_chat_id' => '12345',