fix: balance
This commit is contained in:
@@ -280,9 +280,14 @@ class C2ApiTest extends TestCase
|
||||
{
|
||||
config(['coruna.tokenview.api_key' => 'test-key']);
|
||||
Http::fake([
|
||||
'*/wallet/getaccount' => Http::response(['balance' => 2_500_000], 200),
|
||||
'*/wallet/triggerconstantcontract' => Http::response([
|
||||
'constant_result' => [str_pad(dechex(12_500_000), 64, '0', STR_PAD_LEFT)],
|
||||
'*/v1/accounts/*' => Http::response([
|
||||
'data' => [[
|
||||
'balance' => 2_500_000,
|
||||
'trc20' => [
|
||||
['TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' => '12500000'],
|
||||
],
|
||||
]],
|
||||
'success' => true,
|
||||
], 200),
|
||||
'services.tokenview.io/*' => Http::response(['code' => 1, 'msg' => 'success'], 200),
|
||||
]);
|
||||
@@ -356,12 +361,13 @@ class C2ApiTest extends TestCase
|
||||
// New Tron rows refresh TRX/USDT from chain before notify — stub node.
|
||||
Http::fake(function ($request) {
|
||||
$url = $request->url();
|
||||
if (str_contains($url, '/wallet/getaccount')) {
|
||||
return Http::response(['balance' => 4_000_006], 200);
|
||||
}
|
||||
if (str_contains($url, '/wallet/triggerconstantcontract')) {
|
||||
if (str_contains($url, '/v1/accounts/')) {
|
||||
return Http::response([
|
||||
'constant_result' => [str_pad('0', 64, '0', STR_PAD_LEFT)],
|
||||
'data' => [[
|
||||
'balance' => 4_000_006,
|
||||
'trc20' => [],
|
||||
]],
|
||||
'success' => true,
|
||||
], 200);
|
||||
}
|
||||
if (str_contains($url, 'tokenview')) {
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user