Skip to content

Commit

Permalink
fix(wallet): fix from-to in chain history provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Jun 10, 2024
1 parent 94972b7 commit 0f6bc03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/features/src/transactions/views/transactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { AppLayout } from "@/components/app-layout"

import { formatCompact } from "@/common/lib/numbers"
import { getTxSide } from "@/common/lib/tx"
import { TxSide } from "@/common/types"
import { MenuBar } from "@/components/menu-bar"
import clsx from "clsx"
import dayjs from "dayjs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import type {

//import { healthCheck } from "../utils/health-check-utils";

const convertToTransactionBody = (data: any[]): Mina.TransactionBody[] => {
const convertToTransactionBody = (
data: any[],
address: string,
): Mina.TransactionBody[] => {
return data.map((item) => ({
type: item.type.toLowerCase() as Mina.TransactionType,
from: item.account,
to: item.account,
from: item.direction === "OUT" ? address : item.account,
to: item.direction === "OUT" ? item.account : address,
fee: item.fee,
nonce: "", // Not available
amount: item.amount,
Expand All @@ -22,7 +25,7 @@ const convertToTransactionBody = (data: any[]): Mina.TransactionBody[] => {
hash: item.transactionHash,
failureReason: "", // Not available
dateTime: new Date(item.age).toISOString(),
isDelegation: false, // Not available
isDelegation: item.type === "delegation",
}))
}

Expand All @@ -39,7 +42,7 @@ export const createChainHistoryProvider = (
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return convertToTransactionBody(data.data)
return convertToTransactionBody(data.data, args.addresses[0] ?? "")
}
// TODO: remove txByHashes method
const transactionsByHashes = async (): Promise<Tx[]> => {
Expand Down

0 comments on commit 0f6bc03

Please sign in to comment.