diff options
| author | Adam Soltys <[email protected]> | 2024-09-20 10:04:08 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-20 10:04:08 -0700 |
| commit | 01e1686265def675445c0f74a4b92ec4ffd71492 (patch) | |
| tree | 2d90795be17f5d15345540af80b9f2ca5261389c /routes | |
| parent | 718e3541cffe2103512b19f4945dfcc79813555d (diff) | |
| download | coinos-server-01e1686265def675445c0f74a4b92ec4ffd71492.tar.gz coinos-server-01e1686265def675445c0f74a4b92ec4ffd71492.zip | |
rename account id
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/invoices.ts | 1 | ||||
| -rw-r--r-- | routes/payments.ts | 14 | ||||
| -rw-r--r-- | routes/users.ts | 6 |
3 files changed, 12 insertions, 9 deletions
diff --git a/routes/invoices.ts b/routes/invoices.ts index 4cbd9660..98a851ed 100644 --- a/routes/invoices.ts +++ b/routes/invoices.ts @@ -36,6 +36,7 @@ export default { try { res.send(await generate({ invoice, user })); } catch (e) { + console.log(e) err("problem generating invoice", e.message); bail(res, e.message); } diff --git a/routes/payments.ts b/routes/payments.ts index 2046cfb4..02056eeb 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -73,13 +73,13 @@ export default { async list(req, res) { let { user: { id }, - query: { account, start, end, limit, offset }, + query: { aid, start, end, limit, offset }, } = req; if (limit) limit = parseInt(limit); offset = parseInt(offset) || 0; - let payments = (await db.lRange(`${account || id}:payments`, 0, -1)) || []; + let payments = (await db.lRange(`${aid || id}:payments`, 0, -1)) || []; payments = ( await Promise.all( payments.map(async (id) => { @@ -282,15 +282,15 @@ export default { if (typeof p === "string") p = await g(`payment:${p}`); if (!p) { - let account; + let aid; let bal = await g(`balance:${wallet}`); - if (bal !== null) account = wallet; + if (bal !== null) aid = wallet; await credit({ hash: address, amount: sats(amount), ref: `${txid}:${vout}`, type, - account, + aid, }); } else if (confirmations >= 1) { let id = `payment:${txid}:${vout}`; @@ -312,8 +312,8 @@ export default { .multi() .set(`invoice:${iid}`, JSON.stringify(invoice)) .set(`payment:${p.id}`, JSON.stringify(p)) - .decrBy(`pending:${p.account || p.uid}`, p.amount) - .incrBy(`balance:${p.account || p.uid}`, p.amount) + .decrBy(`pending:${p.aid || p.uid}`, p.amount) + .incrBy(`balance:${p.aid || p.uid}`, p.amount) .exec(); emit(p.uid, "payment", p); diff --git a/routes/users.ts b/routes/users.ts index 6550d90f..9746f36a 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -619,13 +619,15 @@ export default { let id = v4(); let account = { id, seed, type }; - await bc.createWallet({ + let node = rpc(config[type]); + + await node.createWallet({ wallet_name: id, descriptors: true, disable_private_keys: true, }); - let node = rpc({ ...config.bitcoin, wallet: id }); + node = rpc({ ...config[type], wallet: id }); let descriptors = []; for (let i of [0, 1]) { |
