Skip to content

Commit

Permalink
Merge pull request #14 from HORNET-Storage/my-tinker-branch
Browse files Browse the repository at this point in the history
Changing address on transaction to Witness Transaction ID
  • Loading branch information
f7f376a1fcd0d0e11a10ed1b6577c9 authored Jul 18, 2024
2 parents 8abf877 + 9a33605 commit 96f271b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/api/activity.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import config from '@app/config/config';

export interface WalletTransaction {
id: number;
address: string;
witness_tx_id: string;
date: number;
output: string;
value: string;
Expand All @@ -28,7 +28,7 @@ export const getUserActivities = (): Promise<WalletTransaction[]> => {
// eslint-disable-next-line
return data.map((item: any) => ({
id: item.ID,
address: item.Address,
witness_tx_id: item.WitnessTxId,
date: new Date(item.Date).getTime(),
output: item.Output,
value: item.Value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as S from './ActivityStoryItem.styles';
import { BaseRow } from '@app/components/common/BaseRow/BaseRow';
import { BaseCol } from '@app/components/common/BaseCol/BaseCol';

export const ActivityStoryItem: React.FC<WalletTransaction> = ({ address, date, output, value }) => {
export const ActivityStoryItem: React.FC<WalletTransaction> = ({ witness_tx_id, date, output, value }) => {
const { t } = useTranslation();

// Convert value to number
Expand All @@ -18,8 +18,8 @@ export const ActivityStoryItem: React.FC<WalletTransaction> = ({ address, date,
<S.TransactionCard>
<BaseRow gutter={[20, 20]} wrap={true} align="middle">
<BaseCol span={24}>
<S.Label>{t('Address')}:</S.Label>
<S.Address style={{ color: 'var(--text-main)' }}>{address}</S.Address>
<S.Label>{t('Witness Transaction ID')}:</S.Label>
<S.Address style={{ color: 'var(--text-main)' }}>{witness_tx_id}</S.Address>
</BaseCol>
<BaseCol span={24}>
<S.Label>{t('Output')}:</S.Label>
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useBalanceData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import config from '@app/config/config';

interface Transaction {
id: number;
address: string;
witness_tx_id: string;
date: string;
output: string;
value: number;
Expand Down Expand Up @@ -32,12 +32,13 @@ const useBalanceData = () => {
setBalanceData(balanceData);

// Fetch transaction data
const transactionsResponse = await fetch('http://localhost:5000/transactions/latest');
const transactionsResponse = await fetch(`${config.baseURL}/transactions/latest`);
if (!transactionsResponse.ok) {
throw new Error(`Network response was not ok (status: ${transactionsResponse.status})`);
}
const transactionsData: Transaction[] = await transactionsResponse.json();
setTransactions(transactionsData);
console.log('Transactions data:', transactionsData);
} catch (error) {
console.error('Error fetching data:', error);
} finally {
Expand Down

0 comments on commit 96f271b

Please sign in to comment.