Skip to content

Commit

Permalink
Fix explorer url in History table (#2187)
Browse files Browse the repository at this point in the history
  • Loading branch information
onnovisser authored Jun 4, 2024
1 parent 7e8384b commit 8e7be03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions centrifuge-app/src/components/Portfolio/Transactions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AssetTransactionType, InvestorTransactionType, Pool, Token, TokenBalance } from '@centrifuge/centrifuge-js'
import { formatBalance } from '@centrifuge/centrifuge-react'
import { Network, formatBalance, useGetExplorerUrl } from '@centrifuge/centrifuge-react'
import {
AnchorButton,
Box,
Expand Down Expand Up @@ -38,9 +38,11 @@ type Row = {
pool?: Pool
poolId: string
trancheId: string
network: Network
}

export function Transactions({ onlyMostRecent, narrow, txTypes, address, trancheId }: TransactionsProps) {
const explorer = useGetExplorerUrl()
const columns = [
{
align: 'left',
Expand Down Expand Up @@ -103,11 +105,11 @@ export function Transactions({ onlyMostRecent, narrow, txTypes, address, tranche
!narrow && {
align: 'center',
header: 'View transaction',
cell: ({ hash }: Row) => {
cell: ({ hash, network }: Row) => {
return (
<Stack
as="a"
href={`${import.meta.env.REACT_APP_SUBSCAN_URL}/extrinsic/${hash}`}
href={explorer.tx(hash, network)}
target="_blank"
rel="noopener noreferrer"
aria-label="Transaction on Subscan.io"
Expand Down Expand Up @@ -137,6 +139,9 @@ export function Transactions({ onlyMostRecent, narrow, txTypes, address, tranche
amount: ['INVEST_ORDER_UPDATE', 'INVEST_ORDER_CANCEL', 'INVEST_EXECUTION', 'REDEEM_COLLECT'].includes(tx.type)
? tx.currencyAmount
: tx.tokenAmount,
network: ['TRANSFER_IN', 'TRANSFER_OUT', 'INVEST_LP_COLLECT', 'REDEEM_LP_COLLECT'].includes(tx.type)
? Number(tx.account.chainId)
: 'centrifuge',
hash: tx.hash,
poolId: tx.poolId,
pool,
Expand Down
3 changes: 3 additions & 0 deletions centrifuge-js/src/modules/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,9 @@ export function getPoolsModule(inst: Centrifuge) {
orderBy: TIMESTAMP_DESC
) {
nodes {
account {
chainId
}
timestamp
type
poolId
Expand Down

0 comments on commit 8e7be03

Please sign in to comment.