Updated topMakers to return user accounts in buffer format

This commit is contained in:
Luke Steyn
2024-05-24 16:21:07 +08:00
parent a2c4dc44fb
commit ba79d7dbf2
2 changed files with 31 additions and 1 deletions

View File

@@ -364,6 +364,32 @@ export const getAccountFromId = async (
).then((results) => results.filter((user) => !!user));
};
export const getRawAccountFromId = async (
userMapClient: RedisClient,
topMakers: string[]
): Promise<
{
userAccountPubKey: string;
accountBase64: string;
}[]
> => {
return Promise.all(
topMakers.map(async (userAccountPubKey) => {
const userAccountEncoded = await userMapClient.getRaw(userAccountPubKey);
if (userAccountEncoded) {
return {
userAccountPubKey,
accountBase64: userAccountEncoded.split('::')[1],
};
}
return {
userAccountPubKey,
accountBase64: null,
};
})
).then((results) => results.filter((user) => !!user));
};
export function errorHandler(
err: Error,
_req: Request,