From c34877a5726cccbde3c10674e7e4711d4e0fbd5f Mon Sep 17 00:00:00 2001 From: Aristides Staffieri Date: Wed, 29 Nov 2023 08:33:52 -0700 Subject: [PATCH] parses asset code from hex to ascii --- src/index.ts | 2 +- src/service/mercury/helpers/transformers.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3b25b03..59232be 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,7 +87,7 @@ async function main() { const server = initApiServer(mercuryClient, logger, redis); try { - await server.listen({ port }); + await server.listen({ port, host: "0.0.0.0" }); logger.info(`Running in ${env} mode`); } catch (err) { server.log.error(err); diff --git a/src/service/mercury/helpers/transformers.ts b/src/service/mercury/helpers/transformers.ts index 9d9395a..e4b6771 100644 --- a/src/service/mercury/helpers/transformers.ts +++ b/src/service/mercury/helpers/transformers.ts @@ -116,9 +116,13 @@ const transformAccountBalances = async ( }, {} as NonNullable); const classicBalances = classicBalanceData.reduce((prev, curr) => { + const codeAscii = Buffer.from( + curr.assetByAsset.code.substring(2), + "hex" + ).toString("utf8"); prev[`${curr.assetByAsset.code}:${curr.assetByAsset.issuer}`] = { token: { - code: curr.assetByAsset.code, + code: codeAscii, issuer: { key: curr.assetByAsset.issuer, },