diff --git a/src/components/TransactionParameters/index.tsx b/src/components/TransactionParameters/index.tsx
index dbe6ce379..3238cfd3c 100644
--- a/src/components/TransactionParameters/index.tsx
+++ b/src/components/TransactionParameters/index.tsx
@@ -3,7 +3,7 @@ import { FC, ReactNode } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { Link } from 'react-router-dom'
import classNames from 'classnames'
-import { useCKBNode } from '../../hooks/useCKBNode'
+import { explorerService } from '../../services/ExplorerService'
import { matchTxHash } from '../../utils/util'
import Loading from '../AwesomeLoadings/Spinner'
import HashTag from '../HashTag'
@@ -48,9 +48,8 @@ const Field = ({
const TransactionParameters: FC<{ hash: string }> = ({ hash }) => {
const [t] = useTranslation()
- const { nodeService } = useCKBNode()
- const { data, isLoading } = useQuery(['tx', hash], () => nodeService.getTx(hash))
+ const { data, isLoading } = useQuery(['explorer-tx', hash], () => explorerService.api.fetchTransactionByHash(hash))
if (isLoading) {
return (
@@ -59,9 +58,9 @@ const TransactionParameters: FC<{ hash: string }> = ({ hash }) => {
)
}
- if (!data?.result?.transaction) return
{`Transaction ${hash} not loaded`}
+ if (!data) return
{`Transaction ${hash} not loaded`}
- const { header_deps: headerDeps, cell_deps: cellDeps, witnesses } = data.result.transaction
+ const { headerDeps, cellDeps, witnesses } = data
const parameters = [
{
@@ -84,8 +83,8 @@ const TransactionParameters: FC<{ hash: string }> = ({ hash }) => {
content: cellDeps.length ? (
cellDeps.map(cellDep => {
const {
- out_point: { tx_hash: txHash, index },
- dep_type: depType,
+ outPoint: { txHash, index },
+ depType,
} = cellDep
const hashTag = matchTxHash(txHash, Number(index))
return (
diff --git a/src/constants/scripts.ts b/src/constants/scripts.ts
index 76b8a9ab8..474187ec1 100644
--- a/src/constants/scripts.ts
+++ b/src/constants/scripts.ts
@@ -268,7 +268,7 @@ export const MainnetContractHashTags: ContractHashTag[] = [
depType: 'code',
hashType: 'data1',
tag: 'xUDT',
- category: 'lock',
+ category: 'type',
},
{
codeHashes: ['0x4a4dce1df3dffff7f8b2cd7dff7303df3b6150c9788cb75dcf6747247132b9f5'],
@@ -660,7 +660,7 @@ export const TestnetContractHashTags: ContractHashTag[] = [
depType: 'code',
hashType: 'type',
tag: 'xUDT(final_rls)',
- category: 'lock',
+ category: 'type',
},
{
codeHashes: ['0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95'],
@@ -668,7 +668,7 @@ export const TestnetContractHashTags: ContractHashTag[] = [
depType: 'code',
hashType: 'data1',
tag: 'xUDT',
- category: 'lock',
+ category: 'type',
},
{
codeHashes: [
diff --git a/src/models/Transaction/index.ts b/src/models/Transaction/index.ts
index 75403c826..c40985eb6 100644
--- a/src/models/Transaction/index.ts
+++ b/src/models/Transaction/index.ts
@@ -35,6 +35,9 @@ export interface Transaction {
maxCyclesInEpoch: number | null
maxCycles: number | null
createTimestamp?: number
+ cellDeps: CellDep[]
+ headerDeps: string[]
+ witnesses: string[]
}
export interface BtcTx {
diff --git a/src/pages/Transaction/state.ts b/src/pages/Transaction/state.ts
index 7e37461c2..384a2c8d7 100644
--- a/src/pages/Transaction/state.ts
+++ b/src/pages/Transaction/state.ts
@@ -26,6 +26,9 @@ export const defaultTransactionInfo: Transaction = {
cycles: null,
maxCyclesInEpoch: null,
maxCycles: null,
+ cellDeps: [],
+ headerDeps: [],
+ witnesses: [],
}
export const defaultTransactionLiteDetails: TransactionRecord[] = [
diff --git a/src/pages/Xudt/UDTComp.tsx b/src/pages/Xudt/UDTComp.tsx
index 6218dbf1c..5ac052dd1 100644
--- a/src/pages/Xudt/UDTComp.tsx
+++ b/src/pages/Xudt/UDTComp.tsx
@@ -30,6 +30,10 @@ import { ReactComponent as EditIcon } from '../../assets/edit.svg'
import XUDTTokenIcon from '../../assets/sudt_token.png'
import { ReactComponent as OpenSourceIcon } from '../../assets/open-source.svg'
import { scripts } from '../ScriptList'
+import { IS_MAINNET } from '../../constants/common'
+import { MainnetContractHashTags, TestnetContractHashTags } from '../../constants/scripts'
+
+const scriptDataList = IS_MAINNET ? MainnetContractHashTags : TestnetContractHashTags
const IssuerContent: FC<{ address: string }> = ({ address }) => {
const { t } = useTranslation()
@@ -185,6 +189,9 @@ export const UDTOverviewCard = ({
)
const tags = xudt?.xudtTags ?? []
+ const isOpenSourceXudt = xudt
+ ? scriptDataList.some(s => s.tag.startsWith('xUDT') && s.codeHashes.includes(xudt?.typeScript.codeHash))
+ : false
return (
<>
@@ -203,7 +210,7 @@ export const UDTOverviewCard = ({
{tags.map(tag => (
))}
- {xudtCodeUrl ? (
+ {isOpenSourceXudt && xudtCodeUrl ? (
{t('scripts.open_source_script')}
diff --git a/src/utils/transformer.ts b/src/utils/transformer.ts
index 81c91492e..1b1c3f105 100644
--- a/src/utils/transformer.ts
+++ b/src/utils/transformer.ts
@@ -35,6 +35,9 @@ export const transformToTransaction = (
cycles: null,
maxCyclesInEpoch: null,
maxCycles: null,
+ cellDeps: [],
+ headerDeps: [],
+ witnesses: [],
}
}