Commit 03ff6e04 authored by tom's avatar tom

type fixes

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