-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deploy-web): fixed error handling for transaction page (#213)
- Loading branch information
Showing
23 changed files
with
309 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
export type RestCosmostTransactionResponse = { | ||
tx: { | ||
body: { | ||
messages: { | ||
"@type": string; | ||
client_id: string; | ||
header: { | ||
"@type": string; | ||
signed_header: { | ||
header: { | ||
version: { | ||
block: string; | ||
app: string; | ||
}; | ||
chain_id: string; | ||
height: string; | ||
time: string; | ||
last_block_id: { | ||
hash: string; | ||
part_set_header: { | ||
total: number; | ||
hash: string; | ||
}; | ||
}; | ||
last_commit_hash: string; | ||
data_hash: string; | ||
validators_hash: string; | ||
next_validators_hash: string; | ||
consensus_hash: string; | ||
app_hash: string; | ||
last_results_hash: string; | ||
evidence_hash: string; | ||
proposer_address: string; | ||
}; | ||
commit: { | ||
height: string; | ||
round: number; | ||
block_id: { | ||
hash: string; | ||
part_set_header: { | ||
total: number; | ||
hash: string; | ||
}; | ||
}; | ||
signatures: { | ||
block_id_flag: string; | ||
validator_address: string; | ||
timestamp: string; | ||
signature: string; | ||
}[]; | ||
}; | ||
}; | ||
}; | ||
}[]; | ||
}; | ||
auth_info: { | ||
signer_infos: [ | ||
{ | ||
public_key: { | ||
"@type": string; | ||
key: string; | ||
}; | ||
mode_info: { | ||
single: { | ||
mode: string; | ||
}; | ||
}; | ||
sequence: string; | ||
} | ||
]; | ||
fee: { | ||
amount: [ | ||
{ | ||
denom: string; | ||
amount: string; | ||
} | ||
]; | ||
gas_limit: string; | ||
payer: string; | ||
granter: string; | ||
}; | ||
}; | ||
signatures: string[]; | ||
}; | ||
tx_response: { | ||
height: string; | ||
txhash: string; | ||
codespace: string; | ||
code: number; | ||
data: string; | ||
raw_log: string; | ||
logs: { | ||
msg_index: number; | ||
log: string; | ||
events: { | ||
type: string; | ||
attributes: { | ||
key: string; | ||
value: string; | ||
}[]; | ||
}[]; | ||
}[]; | ||
info: string; | ||
gas_wanted: string; | ||
gas_used: string; | ||
tx: { | ||
type: string; | ||
value: { | ||
msg: { | ||
type: string; | ||
value: { | ||
from_address: string; | ||
to_address: string; | ||
amount: { | ||
denom: string; | ||
amount: string; | ||
}[]; | ||
}; | ||
}[]; | ||
fee: { | ||
amount: { | ||
denom: string; | ||
amount: string; | ||
}[]; | ||
gas: string; | ||
}; | ||
signatures: { | ||
pub_key: { | ||
type: string; | ||
value: string; | ||
}; | ||
signature: string; | ||
}[]; | ||
memo: string; | ||
}; | ||
}; | ||
timestamp: string; | ||
events: { | ||
type: string; | ||
attributes: { | ||
key: string; | ||
value: string; | ||
index: boolean; | ||
}[]; | ||
}[]; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export type ApiTransactionResponse = { | ||
height: number | string; | ||
datetime: Date; | ||
hash: string; | ||
multisigThreshold?: number; | ||
signers?: string[]; | ||
isSuccess: boolean; | ||
error: string | null; | ||
gasUsed: number; | ||
gasWanted: number; | ||
fee: number; | ||
memo: string; | ||
messages: { | ||
id: string; | ||
type: string; | ||
data: unknown; | ||
relatedDeploymentId: string | null; | ||
}[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals", | ||
"extends": "next/core-web-vitals" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/stats-web/src/app/addresses/[address]/deployments/[dseq]/EventRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { TableCell, TableRow } from "@/components/ui/table"; | ||
import { useFriendlyMessageType } from "@/hooks/useFriendlyMessageType"; | ||
import { getSplitText } from "@/hooks/useShortText"; | ||
import { UrlService } from "@/lib/urlUtils"; | ||
import Link from "next/link"; | ||
import { FormattedTime } from "react-intl"; | ||
|
||
export const EventRow = ({ | ||
event | ||
}: React.PropsWithChildren<{ | ||
event: { | ||
txHash: string; | ||
date: string; | ||
type: string; | ||
}; | ||
}>) => { | ||
return ( | ||
<TableRow> | ||
<TableCell> | ||
<Link href={UrlService.transaction(event.txHash)} target="_blank"> | ||
{getSplitText(event.txHash, 6, 6)} | ||
</Link> | ||
</TableCell> | ||
<TableCell align="center">{useFriendlyMessageType(event.type)}</TableCell> | ||
<TableCell align="center"> | ||
<FormattedTime value={event.date} day="2-digit" month="2-digit" year="numeric" /> | ||
</TableCell> | ||
</TableRow> | ||
); | ||
}; |
22 changes: 22 additions & 0 deletions
22
apps/stats-web/src/app/addresses/[address]/transactions/TransactionTypeCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Badge } from "@/components/ui/badge"; | ||
import { useFriendlyMessageType } from "@/hooks/useFriendlyMessageType"; | ||
import { TransactionRowType } from "@/lib/zod/transactionRow"; | ||
import { Row } from "@tanstack/react-table"; | ||
|
||
export const TransactionTypeCell = ({ | ||
row | ||
}: React.PropsWithChildren<{ | ||
row: Row<TransactionRowType>; | ||
}>) => { | ||
const friendlyMessage = useFriendlyMessageType(row.original.messages[0].type); | ||
const firstMessageType = row.original.messages[0].isReceiver ? "Receive" : friendlyMessage; | ||
|
||
return ( | ||
<> | ||
<Badge className="h-4 max-w-[120px] bg-primary"> | ||
<span className="truncate">{firstMessageType}</span> | ||
</Badge> | ||
<span className="text-xs">{row.original.messages.length > 1 ? " +" + (row.original.messages.length - 1) : ""}</span> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.