aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-16 22:49:08 -0800
committerAdam Soltys <[email protected]>2026-02-16 22:49:08 -0800
commit6e5c851fe1c4e7402014c5a42c8a5f919365a2c7 (patch)
treec991392f71f45275cccea6864fa7f64e7c7ad053
parentee0513838b1d336fa60eb9a8f7ca1ce43e6d9e40 (diff)
downloadcoinos-server-6e5c851fe1c4e7402014c5a42c8a5f919365a2c7.tar.gz
coinos-server-6e5c851fe1c4e7402014c5a42c8a5f919365a2c7.zip
trigger import
-rw-r--r--routes/users.ts19
1 files changed, 18 insertions, 1 deletions
diff --git a/routes/users.ts b/routes/users.ts
index 8d67444d..3fe9077a 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -959,7 +959,7 @@ export default {
async updateAccount(req, res) {
const { id } = req.params;
const { id: uid } = req.user;
- const { name, autowithdraw, threshold, reserve, destination, currency } =
+ const { name, autowithdraw, threshold, reserve, destination, currency, fingerprint, pubkey } =
req.body;
const pos = await db.lPos(`${uid}:accounts`, id);
@@ -972,8 +972,25 @@ export default {
if (reserve !== undefined) account.reserve = reserve;
if (destination !== undefined) account.destination = destination.trim();
if (currency !== undefined) account.currency = currency;
+
+ let needsImport = false;
+ if (fingerprint !== undefined && pubkey !== undefined) {
+ account.fingerprint = fingerprint;
+ account.pubkey = pubkey;
+ account.importedAt = null;
+ needsImport = true;
+ }
+
await s(`account:${id}`, account);
+ if (needsImport) {
+ importAccountHistory(account).then(() => {
+ emit(uid, "payment", { aid: id, type: "import" });
+ }).catch((e) =>
+ console.error("importAccountHistory failed:", e.message),
+ );
+ }
+
res.send(account);
},