MCPcopy Create free account
hub / github.com/cameri/nostream / getBalanceByPubkey

Method getBalanceByPubkey

src/repositories/user-repository.ts:104–114  ·  view source on GitHub ↗
(pubkey: Pubkey, client: DatabaseClient = this.dbClient)

Source from the content-addressed store, hash-verified

102 }
103
104 public async getBalanceByPubkey(pubkey: Pubkey, client: DatabaseClient = this.dbClient): Promise<bigint> {
105 logger('get balance for pubkey: %s', pubkey)
106
107 const [user] = await client<DBUser>('users').select('balance').where('pubkey', toBuffer(pubkey)).limit(1)
108
109 if (!user) {
110 return 0n
111 }
112
113 return BigInt(user.balance)
114 }
115
116 public async admitUser(pubkey: Pubkey, admittedAt: Date, client: DatabaseClient = this.dbClient): Promise<void> {
117 logger('admit user: %s at %s', pubkey, admittedAt)

Callers

nothing calls this directly

Calls 1

toBufferFunction · 0.90

Tested by

no test coverage detected