Skip to content

Commit

Permalink
update AddressResolver transactions withDecimal
Browse files Browse the repository at this point in the history
  • Loading branch information
Dora Noda committed Aug 15, 2023
1 parent 91e3213 commit c045994
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/api-gateway/resolvers/address-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { logger } from "onefx/lib/integrated-gateways/logger";
import { UserInputError } from "apollo-server-koa";
import { emptyPage } from "@/server/service/indexed-chain-service";
import { TransactionConnection } from "@/api-gateway/resolvers/types/transaction-type";
import { divDecimals } from "@/server/service/utils/div-decimals";

@Resolver(() => Address)
export class AddressResolver {
Expand All @@ -32,7 +33,16 @@ export class AddressResolver {
const txs = txsWithPageInfo.data.map(
// @ts-ignore
(tx) => ({
node: { ...tx, id: txHashId(tx.hash) },
node: {
...tx,
id: txHashId(tx.hash),
valueWithDecimal: divDecimals(tx.value),
gasPriceWithDecimal: divDecimals(tx.gasPrice),
maxFeePerGasWithDecimal: divDecimals(tx.maxFeePerGas),
maxPriorityFeePerGasWithDecimal: divDecimals(
tx.maxPriorityFeePerGas
),
},
cursor: (args.first ? args.after : args.before) ?? "",
})
);
Expand Down

0 comments on commit c045994

Please sign in to comment.