Commit 03ff6e04 authored by tom's avatar tom

type fixes

parent 4edeccbc
/* eslint-disable max-len */
export const tx = {
hash: '0x1ea365d2144796f793883534aa51bf20d23292b19478994eede23dfc599e7c34',
status: 'success' as TxStatus,
status: 'ok' as Transaction['status'],
block_num: 15006918,
confirmation_num: 283,
confirmation_duration: 30,
......@@ -52,4 +52,4 @@ export const tx = {
export type TxType = 'contract-call' | 'transaction' | 'token-transfer' | 'internal-tx' | 'multicall';
export type TxStatus = 'success' | 'failed' | 'pending';
import type { Transaction } from 'types/api/transaction';
......@@ -4,7 +4,7 @@ export const data = [
{
id: 1,
type: 'call' as TxInternalsType,
status: 'success' as const,
status: 'ok' as const,
from: { hash: '0x12E80C27BfFBB76b4A8d26FF2bfd3C9f310FFA01' },
to: { hash: '0xF7A558692dFB5F456e291791da7FAE8Dd046574e' },
value: 0.25207646303,
......@@ -13,7 +13,7 @@ export const data = [
{
id: 2,
type: 'delegate_call' as TxInternalsType,
status: 'success' as const,
status: 'error' as const,
from: { hash: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45' },
to: { hash: '0x12E80C27BfFBB76b4A8d26FF2bfd3C9f310FFA01' },
value: 0.5633333,
......@@ -22,7 +22,7 @@ export const data = [
{
id: 3,
type: 'static_call' as TxInternalsType,
status: 'failed' as const,
status: 'error' as const,
from: { hash: '0x97Aa2EfcF35c0f4c9AaDDCa8c2330fa7A9533830' },
to: { hash: '0x35317007D203b8a86CA727ad44E473E40450E378' },
value: 0.421152366,
......
......@@ -7,7 +7,7 @@ export interface Transaction {
hash: string;
result: string;
confirmations: number;
status: string;
status: 'ok' | 'error' | null;
block: number;
timestamp: string;
confirmation_duration: Array<number>;
......@@ -18,8 +18,8 @@ export interface Transaction {
fee: Fee;
gas_price: number;
type: number;
gas_used: number;
gas_limit: number;
gas_used: string;
gas_limit: string;
max_fee_per_gas?: number;
max_priority_fee_per_gas?: number;
priority_fee?: number;
......
import { Tag, TagLabel, TagLeftIcon, Tooltip } from '@chakra-ui/react';
import React from 'react';
import type { Transaction } from 'types/api/transaction';
import errorIcon from 'icons/status/error.svg';
import pendingIcon from 'icons/status/pending.svg';
import successIcon from 'icons/status/success.svg';
export interface Props {
status: 'success' | 'failed' | 'pending';
status: Transaction['status'];
errorText?: string;
}
......@@ -16,17 +18,17 @@ const TxStatus = ({ status, errorText }: Props) => {
let colorScheme;
switch (status) {
case 'success':
case 'ok':
label = 'Success';
icon = successIcon;
colorScheme = 'green';
break;
case 'failed':
case 'error':
label = 'Failed';
icon = errorIcon;
colorScheme = 'red';
break;
case 'pending':
case null:
label = 'Pending';
icon = pendingIcon;
// FIXME: it's not gray on mockups
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment