Skip to content

Commit b3d5838

Browse files
authored
Return the expected type from the address/transactions/<address> endpoint (#1108)
This returns a view of the raw database but the client expects a simplified and preparsed output, which makes more sense. This updates the interface accordingly, using the existing function that is exactly designed for this. This only break the coded added in PayButton/paybutton#617 since the output of the api call was unused before. Test Plan: The api tests are still green.
1 parent 0a91e41 commit b3d5838

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pages/api/address/transactions/[address].ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextApiResponse, NextApiRequest } from 'next'
22
import { parseAddress } from 'utils/validators'
33
import { DEFAULT_TX_PAGE_SIZE, RESPONSE_MESSAGES, TX_PAGE_SIZE_LIMIT } from 'constants/index'
4-
import { fetchPaginatedAddressTransactions } from 'services/transactionService'
4+
import { fetchPaginatedAddressTransactions, getSimplifiedTransactions } from 'services/transactionService'
55
import { upsertAddress } from 'services/addressService'
66
import Cors from 'cors'
77
import { runMiddleware } from 'utils/index'
@@ -37,7 +37,8 @@ export default async (req: NextApiRequest, res: NextApiResponse): Promise<void>
3737
const serverOnly = req.query.serverOnly === '1'
3838

3939
try {
40-
const transactions = await fetchPaginatedAddressTransactions(address, page, pageSize, orderBy, orderDesc)
40+
const transactionsWithAddressAndPrices = await fetchPaginatedAddressTransactions(address, page, pageSize, orderBy, orderDesc)
41+
const transactions = getSimplifiedTransactions(transactionsWithAddressAndPrices)
4142
res.status(200).send(transactions)
4243
} catch (err: any) {
4344
switch (err.message) {

0 commit comments

Comments
 (0)