diff options
| author | Adam Soltys <[email protected]> | 2024-09-24 12:30:51 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-24 12:30:51 -0700 |
| commit | 80365c227c5a774ad65f5dad8b989e1966630160 (patch) | |
| tree | a9d6cd130e48e815fb60b91263c5d9b5a83b8808 /lib/register.ts | |
| parent | 8c8c71d54d23960ffc4caa94619bae7c6a69514b (diff) | |
| download | coinos-server-80365c227c5a774ad65f5dad8b989e1966630160.tar.gz coinos-server-80365c227c5a774ad65f5dad8b989e1966630160.zip | |
reconcile onchain balance
Diffstat (limited to 'lib/register.ts')
| -rw-r--r-- | lib/register.ts | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/register.ts b/lib/register.ts index eb20ae23..f2e97fed 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -4,7 +4,7 @@ import { v4 } from "uuid"; import config from "$config"; import countries from "$lib/countries"; -import { s } from "$lib/db"; +import { db } from "$lib/db"; import { l, warn } from "$lib/logging"; import { fail, getUser } from "$lib/utils"; @@ -52,10 +52,20 @@ export default async (user, ip) => { user.migrated = true; user.locktime = 300; - await s(`user:${id}`, user); - await s(`user:${username}`, id); - await s(`user:${pubkey}`, id); - await s(`balance:${id}`, 0); + let account = JSON.stringify({ + id, + type: "ecash", + name: "Spending", + }); + + db.multi() + .set(`user:${id}`, JSON.stringify(user)) + .set(`user:${username}`, id) + .set(`user:${pubkey}`, id) + .set(`balance:${id}`, 0) + .set(`account:${id}`, account) + .lPush(`${id}:accounts`, id) + .exec(); l("new user", username); |
