fix: link memo
This commit is contained in:
@@ -165,12 +165,12 @@ class MnemonicController extends Controller
|
||||
return response()->json(['code' => 1, 'msg' => '无权操作'], 403);
|
||||
}
|
||||
|
||||
$discovery->discoverIndexZero($mnemonic);
|
||||
$discovery->discoverActivated($mnemonic);
|
||||
|
||||
return response()->json([
|
||||
'code' => 0,
|
||||
'msg' => '',
|
||||
'data' => $this->walletsPayload($mnemonic),
|
||||
'data' => $this->walletsPayload($mnemonic, $discovery),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ class MnemonicController extends Controller
|
||||
|
||||
RateLimiter::hit($throttleKey, self::REFRESH_DECAY_SECONDS);
|
||||
|
||||
$discovery->discoverIndexZero($mnemonic);
|
||||
$discovery->discoverActivated($mnemonic);
|
||||
|
||||
$addresses = WalletAddress::query()
|
||||
->where('mnemonic_id', $mnemonic->id)
|
||||
@@ -214,11 +214,10 @@ class MnemonicController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// Re-read from wallet_addresses so the popup shows persisted rows.
|
||||
return response()->json([
|
||||
'code' => 0,
|
||||
'msg' => 'ok',
|
||||
'data' => array_merge($this->walletsPayload($mnemonic), [
|
||||
'data' => array_merge($this->walletsPayload($mnemonic, $discovery), [
|
||||
'refreshed' => $ok,
|
||||
'failed' => $fail,
|
||||
'retry_after' => self::REFRESH_DECAY_SECONDS,
|
||||
@@ -239,35 +238,13 @@ class MnemonicController extends Controller
|
||||
/**
|
||||
* @return array{mnemonic_id: int, source: string, refresh_url: string, addresses: list<array<string, mixed>>}
|
||||
*/
|
||||
private function walletsPayload(WalletMnemonic $mnemonic): array
|
||||
private function walletsPayload(WalletMnemonic $mnemonic, MnemonicWalletDiscovery $discovery): array
|
||||
{
|
||||
$addresses = WalletAddress::query()
|
||||
->where('mnemonic_id', $mnemonic->id)
|
||||
->orderBy('id')
|
||||
->get();
|
||||
|
||||
$data = $addresses->map(function (WalletAddress $addr) {
|
||||
$coins = $addr->formattedCoins();
|
||||
|
||||
return [
|
||||
'id' => $addr->id,
|
||||
'address' => $addr->address,
|
||||
'chain_type' => $addr->chain_type ?: '',
|
||||
'source' => $addr->source ?: '',
|
||||
'derive_index' => $addr->derive_index,
|
||||
'usdt' => $coins['usdt'],
|
||||
'trx' => $coins['trx'],
|
||||
'eth' => $coins['eth'],
|
||||
'btc' => $coins['btc'],
|
||||
'bnb' => $coins['bnb'],
|
||||
];
|
||||
})->values()->all();
|
||||
|
||||
return [
|
||||
'mnemonic_id' => $mnemonic->id,
|
||||
'source' => $mnemonic->source ?: '',
|
||||
'refresh_url' => route($this->portal().'.mnemonics.wallets.refresh', $mnemonic->id),
|
||||
'addresses' => $data,
|
||||
'addresses' => $discovery->walletCards($mnemonic),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user