Skip to content

Commit

Permalink
Merge branch 'frontend-fix-types'
Browse files Browse the repository at this point in the history
  • Loading branch information
thisconnect committed Oct 10, 2024
2 parents c452561 + b61a18a commit c4867b8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
13 changes: 8 additions & 5 deletions frontends/web/src/api/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ export const getBalance = (code: AccountCode): Promise<IBalance> => {
return apiGet(`account/${code}/balance`);
};

export type TTransactionStatus = 'complete' | 'pending' | 'failed';
export type TTransactionType = 'send' | 'receive' | 'send_to_self';

export interface ITransaction {
addresses: string[];
amount: IAmount;
Expand All @@ -249,9 +252,9 @@ export interface ITransaction {
numConfirmations: number;
numConfirmationsComplete: number;
size: number;
status: 'complete' | 'pending' | 'failed';
status: TTransactionStatus;
time: string | null;
type: 'send' | 'receive' | 'self';
type: TTransactionType;
txID: string;
vsize: number;
weight: number;
Expand Down Expand Up @@ -374,8 +377,8 @@ export interface IFeeTarget {
}

export interface IFeeTargetList {
feeTargets: IFeeTarget[],
defaultFeeTarget: FeeTargetCode
feeTargets: IFeeTarget[];
defaultFeeTarget: FeeTargetCode;
}

export const getFeeTargetList = (code: AccountCode): Promise<IFeeTargetList> => {
Expand Down Expand Up @@ -443,7 +446,7 @@ export const connectKeystore = (code: AccountCode): Promise<{ success: boolean;
export type TSignMessage = { success: false, aborted?: boolean; errorMessage?: string; } | { success: true; signature: string; }

export type TSignWalletConnectTx = {
success: false,
success: false;
aborted?: boolean;
errorMessage?: string;
} | {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
* limitations under the License.
*/

import type { ITransaction } from '@/api/account';
import type { TTransactionStatus, TTransactionType } from '@/api/account';
import { Warning } from '@/components/icon/icon';
import { ArrowIn, ArrowOut, ArrowSelf } from './icons';

type TProps = Pick<ITransaction, 'status' | 'type'>;
type TProps = {
status: TTransactionStatus;
type: TTransactionType;
};

export const Arrow = ({ status, type }: TProps) => {
if (status === 'failed') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ITransaction, IAmount, getTransaction } from '@/api/account';
import { ITransaction, IAmount, getTransaction, TTransactionStatus, TTransactionType } from '@/api/account';
import { A } from '@/components/anchor/anchor';
import { Dialog } from '@/components/dialog/dialog';
import { FiatConversion } from '@/components/rates/rates';
Expand All @@ -35,8 +35,8 @@ type TProps = {
accountCode: string;
internalID: string;
note: string;
status: ITransaction['status'];
type: ITransaction['type'];
status: TTransactionStatus;
type: TTransactionType;
numConfirmations: number;
numConfirmationsComplete: number;
time: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/

import { useTranslation } from 'react-i18next';
import type { ITransaction } from '@/api/account';
import type { TTransactionStatus } from '@/api/account';
import { ProgressRing } from '@/components/progressRing/progressRing';
import { TxDetail } from './detail';
import transactionStyle from '@/components/transactions/transactions.module.css';
import parentStyle from '@/components/transactions/transaction.module.css';

type TProps = {
status: ITransaction['status'];
status: TTransactionStatus;
numConfirmations: number;
numConfirmationsComplete: number;
}
Expand Down

0 comments on commit c4867b8

Please sign in to comment.