diff --git a/apps/whale-api/src/module.api/consortium.controller.spec.ts b/apps/whale-api/src/module.api/consortium.controller.spec.ts index 00e30415af..558a113ab3 100644 --- a/apps/whale-api/src/module.api/consortium.controller.spec.ts +++ b/apps/whale-api/src/module.api/consortium.controller.spec.ts @@ -306,31 +306,31 @@ describe('getTransactionHistory', () => { mintLimit: '40.00000000' }]) - txIds.push(await alice.rpc.token.mintTokens(`0.5@${symbolBTC}`)) - txIds.push(await bob.rpc.token.mintTokens(`0.5@${symbolBTC}`)) + txIds.push(await alice.rpc.token.mintTokens({ amounts: [`0.5@${symbolBTC}`] })) + txIds.push(await bob.rpc.token.mintTokens({ amounts: [`0.5@${symbolBTC}`] })) await alice.generate(1) await bob.generate(1) await tGroup.waitForSync() - txIds.push(await alice.rpc.token.mintTokens(`0.1@${symbolBTC}`)) + txIds.push(await alice.rpc.token.mintTokens({ amounts: [`0.1@${symbolBTC}`] })) txIds.push(await alice.rpc.token.burnTokens(`0.1@${symbolBTC}`, accountAlice)) - txIds.push(await bob.rpc.token.mintTokens(`0.1@${symbolBTC}`)) + txIds.push(await bob.rpc.token.mintTokens({ amounts: [`0.1@${symbolBTC}`] })) txIds.push(await bob.rpc.token.burnTokens(`0.1@${symbolBTC}`, accountBob)) await alice.generate(1) await bob.generate(1) await tGroup.waitForSync() - await alice.rpc.token.mintTokens(`1@${symbolBTC}`) + await alice.rpc.token.mintTokens({ amounts: [`1@${symbolBTC}`] }) await alice.generate(1) - await alice.rpc.token.mintTokens(`2@${symbolETH}`) + await alice.rpc.token.mintTokens({ amounts: [`2@${symbolETH}`] }) await alice.generate(1) await alice.rpc.token.burnTokens(`1@${symbolETH}`, accountAlice) await alice.generate(1) await tGroup.waitForSync() - await bob.rpc.token.mintTokens(`4@${symbolBTC}`) + await bob.rpc.token.mintTokens({ amounts: [`4@${symbolBTC}`] }) await bob.generate(1) await bob.rpc.token.burnTokens(`2@${symbolBTC}`, accountBob) diff --git a/apps/whale-api/src/module.api/consortium.service.ts b/apps/whale-api/src/module.api/consortium.service.ts index ca24b3a4ef..8cffe7d9ac 100644 --- a/apps/whale-api/src/module.api/consortium.service.ts +++ b/apps/whale-api/src/module.api/consortium.service.ts @@ -100,22 +100,16 @@ export class ConsortiumService { } private async getPaginatedHistoryTransactionsResponse (pageIndex: number, limit: number, members: MemberDetail[]): Promise { - const transactions: AccountHistory[] = await this.rpcClient.account.listAccountHistory(members.map(m => m.ownerAddress), { + const memberAddresses = members.map(m => m.ownerAddress) + + const transactions: AccountHistory[] = await this.rpcClient.account.listAccountHistory(memberAddresses, { txtypes: [DfTxType.MINT_TOKEN, DfTxType.BURN_TOKEN], including_start: true, start: pageIndex * limit, limit }) - const promises = [] - for (let i = 0; i < members.length; i++) { - promises.push(this.rpcClient.account.historyCount(members[i].ownerAddress, { txtype: DfTxType.BURN_TOKEN })) - promises.push(this.rpcClient.account.historyCount(members[i].ownerAddress, { txtype: DfTxType.MINT_TOKEN })) - } - const counts = await Promise.all(promises) - const totalTxCount = counts.reduce((prev, curr) => { - return prev + curr - }, 0) + const totalTxCount = await this.rpcClient.account.historyCount(memberAddresses, { txtypes: [DfTxType.BURN_TOKEN, DfTxType.MINT_TOKEN] }) return { transactions: transactions.map(tx => {