From dc84e03dad9aa2f0da5283f3b5d5188d20186ffa Mon Sep 17 00:00:00 2001 From: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> Date: Tue, 10 Aug 2021 18:30:31 +0800 Subject: [PATCH] added a/b symbol for PoolPairData (#332) --- apps/whale/src/module.api/poolpair.controller.e2e.ts | 6 +++++- apps/whale/src/module.api/poolpair.controller.spec.ts | 6 +++++- apps/whale/src/module.api/poolpair.controller.ts | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/whale/src/module.api/poolpair.controller.e2e.ts b/apps/whale/src/module.api/poolpair.controller.e2e.ts index 6ab424a60c..acc5625e85 100644 --- a/apps/whale/src/module.api/poolpair.controller.e2e.ts +++ b/apps/whale/src/module.api/poolpair.controller.e2e.ts @@ -95,11 +95,13 @@ describe('list', () => { status: true, tokenA: { id: '2', + symbol: 'B', reserve: '50', blockCommission: '0' }, tokenB: { id: '0', + symbol: 'DFI', reserve: '300', blockCommission: '0' }, @@ -171,11 +173,13 @@ describe('get', () => { status: true, tokenA: { id: expect.any(String), + symbol: 'A', reserve: '100', blockCommission: '0' }, tokenB: { - id: expect.any(String), + id: '0', + symbol: 'DFI', reserve: '200', blockCommission: '0' }, diff --git a/apps/whale/src/module.api/poolpair.controller.spec.ts b/apps/whale/src/module.api/poolpair.controller.spec.ts index 1bd7342651..edc48a3faa 100644 --- a/apps/whale/src/module.api/poolpair.controller.spec.ts +++ b/apps/whale/src/module.api/poolpair.controller.spec.ts @@ -128,11 +128,13 @@ describe('list', () => { status: true, tokenA: { id: '2', + symbol: 'B', reserve: '50', blockCommission: '0' }, tokenB: { id: '0', + symbol: 'DFI', reserve: '300', blockCommission: '0' }, @@ -204,11 +206,13 @@ describe('get', () => { status: true, tokenA: { id: expect.any(String), + symbol: 'USDT', reserve: '100', blockCommission: '0' }, tokenB: { - id: expect.any(String), + id: '0', + symbol: 'DFI', reserve: '200', blockCommission: '0' }, diff --git a/apps/whale/src/module.api/poolpair.controller.ts b/apps/whale/src/module.api/poolpair.controller.ts index 981f6e112f..2c83b66660 100644 --- a/apps/whale/src/module.api/poolpair.controller.ts +++ b/apps/whale/src/module.api/poolpair.controller.ts @@ -63,17 +63,20 @@ export class PoolPairController { } function mapPoolPair (id: string, info: PoolPairInfo, totalLiquidityUsd?: BigNumber, apr?: PoolPairData['apr']): PoolPairData { + const [symbolA, symbolB] = info.symbol.split('-') return { id: id, symbol: info.symbol, name: info.name, status: info.status, tokenA: { + symbol: symbolA, id: info.idTokenA, reserve: info.reserveA.toFixed(), blockCommission: info.blockCommissionA.toFixed() }, tokenB: { + symbol: symbolB, id: info.idTokenB, reserve: info.reserveB.toFixed(), blockCommission: info.blockCommissionB.toFixed()