Skip to content

Commit

Permalink
Best Version Yet
Browse files Browse the repository at this point in the history
  • Loading branch information
tjayrush committed Jul 22, 2024
1 parent 6445ede commit 677a1d0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
7 changes: 7 additions & 0 deletions app/transaction_ex.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type TransactionEx struct {
Function string `json:"function"`
HasToken bool `json:"hasToken"`
IsError bool `json:"isError"`
LogCount uint64 `json:"logCount"`
}

func NewTransactionEx(a *App, tx *types.Transaction) *TransactionEx {
Expand All @@ -40,6 +41,11 @@ func NewTransactionEx(a *App, tx *types.Transaction) *TransactionEx {
} else if len(ether) > 5 {
ether = ether[:5]
}
logCount := 0
if tx.Receipt != nil {
logCount = len(tx.Receipt.Logs)
}

return &TransactionEx{
BlockNumber: tx.BlockNumber,
TransactionIndex: tx.TransactionIndex,
Expand All @@ -53,6 +59,7 @@ func NewTransactionEx(a *App, tx *types.Transaction) *TransactionEx {
Ether: ether,
HasToken: tx.HasToken,
IsError: tx.IsError,
LogCount: uint64(logCount),
// Function: tx.Function(),
}
}
27 changes: 13 additions & 14 deletions frontend/src/views/History/HistoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IconCircleCheck } from "@tabler/icons-react";
import { app } from "@gocode/models";
import { createColumnHelper, ColumnDef } from "@tanstack/react-table";
import { CustomMeta } from "../CustomMeta";
import lClasses from "../Columns.module.css";

type CustomColumnDef<TData, TValue> = ColumnDef<TData, TValue> & {
meta?: CustomMeta;
Expand All @@ -13,45 +14,43 @@ const txColumnHelper = createColumnHelper<app.TransactionEx>();
export const txColumns: CustomColumnDef<app.TransactionEx, any>[] = [
txColumnHelper.accessor((row) => `${row.blockNumber}.${row.transactionIndex}`, {
id: "blockTx",
header: () => "txId",
header: () => "Id",
cell: (info) => info.getValue(),
size: 100,
meta: { className: "small" },
meta: { className: lClasses.small },
}),
txColumnHelper.accessor("date", {
header: () => "Date",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "medium" },
meta: { className: lClasses.medium },
}),
txColumnHelper.accessor("fromName", {
header: () => "From",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "wide" },
meta: { className: lClasses.wide },
}),
txColumnHelper.accessor("toName", {
header: () => "To",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "wide" },
}),
txColumnHelper.accessor("logCount", {
header: () => "nEvents",
cell: (info) => info.renderValue(),
meta: { className: lClasses.medium },
}),
txColumnHelper.accessor("ether", {
header: () => "Ether",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "medium" },
meta: { className: lClasses.medium },
}),
txColumnHelper.accessor("hasToken", {
header: () => "hasToken",
cell: (info) => (info.getValue() ? <IconCircleCheck size={20} color="white" fill="green" /> : ""),
size: 100,
meta: { className: "small-centered" },
meta: { className: lClasses.centered },
}),
txColumnHelper.accessor("isError", {
header: () => "isError",
cell: (info) => (info.getValue() ? <IconCircleCheck size={20} color="green" fill="red" /> : ""),
size: 100,
meta: { className: "small-centered" },
meta: { className: lClasses.centered },
}),
];
25 changes: 9 additions & 16 deletions frontend/src/views/Names/NameTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IconCircleCheck } from "@tabler/icons-react";
import { types } from "@gocode/models";
import { createColumnHelper, ColumnDef } from "@tanstack/react-table";
import { CustomMeta } from "../CustomMeta";
import lClasses from "../Columns.module.css";

type CustomColumnDef<TData, TValue> = ColumnDef<TData, TValue> & {
meta?: CustomMeta;
Expand All @@ -14,49 +15,41 @@ export const nameColumns: CustomColumnDef<types.Name, any>[] = [
nameColumnHelper.accessor("address", {
header: () => "Address",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "wide" },
meta: { className: lClasses.wide },
}),
nameColumnHelper.accessor("tags", {
header: () => "Tags",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "wide" },
meta: { className: lClasses.wide },
}),
nameColumnHelper.accessor("name", {
header: () => "Name",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "wide" },
meta: { className: lClasses.wide },
}),
nameColumnHelper.accessor("symbol", {
header: () => "Symbol",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "small" },
meta: { className: lClasses.small },
}),
nameColumnHelper.accessor("decimals", {
header: () => "Decimals",
cell: (info) => info.renderValue(),
size: 100,
meta: { className: "small" },
meta: { className: lClasses.small },
}),
nameColumnHelper.accessor("isContract", {
header: () => "isContract",
cell: (info) => (info.getValue() ? <IconCircleCheck size={20} color="white" fill="green" /> : ""),
size: 100,
meta: { className: "small-centered" },
meta: { className: lClasses.centered },
}),
nameColumnHelper.accessor("isErc20", {
header: () => "isErc20",
cell: (info) => (info.getValue() ? <IconCircleCheck size={20} color="white" fill="green" /> : ""),
size: 100,
meta: { className: "small-centered" },
meta: { className: lClasses.centered },
}),
nameColumnHelper.accessor("isErc721", {
header: () => "isErc721",
cell: (info) => (info.getValue() ? <IconCircleCheck size={20} color="white" fill="green" /> : ""),
size: 100,
meta: { className: "small-centered" },
meta: { className: lClasses.centered },
}),
];
2 changes: 2 additions & 0 deletions frontend/wailsjs/go/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export namespace app {
function: string;
hasToken: boolean;
isError: boolean;
logCount: number;

static createFrom(source: any = {}) {
return new TransactionEx(source);
Expand All @@ -35,6 +36,7 @@ export namespace app {
this.function = source["function"];
this.hasToken = source["hasToken"];
this.isError = source["isError"];
this.logCount = source["logCount"];
}

convertValues(a: any, classs: any, asMap: boolean = false): any {
Expand Down

0 comments on commit 677a1d0

Please sign in to comment.