Skip to content

Commit

Permalink
feat: hide open source tag if xudt-compatible code is not public
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Dec 18, 2024
1 parent 39b4589 commit 9f91434
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/constants/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export const MainnetContractHashTags: ContractHashTag[] = [
depType: 'code',
hashType: 'data1',
tag: 'xUDT',
category: 'lock',
category: 'type',
},
{
codeHashes: ['0x4a4dce1df3dffff7f8b2cd7dff7303df3b6150c9788cb75dcf6747247132b9f5'],
Expand Down Expand Up @@ -660,15 +660,15 @@ export const TestnetContractHashTags: ContractHashTag[] = [
depType: 'code',
hashType: 'type',
tag: 'xUDT(final_rls)',
category: 'lock',
category: 'type',
},
{
codeHashes: ['0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95'],
txHashes: ['0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f-0'],
depType: 'code',
hashType: 'data1',
tag: 'xUDT',
category: 'lock',
category: 'type',
},
{
codeHashes: [
Expand Down
9 changes: 8 additions & 1 deletion src/pages/Xudt/UDTComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 (
<>
Expand All @@ -203,7 +210,7 @@ export const UDTOverviewCard = ({
{tags.map(tag => (
<XUDTTag tagName={tag} to="/xudts" tooltip />
))}
{xudtCodeUrl ? (
{isOpenSourceXudt && xudtCodeUrl ? (
<Link className={styles.openSource} to={xudtCodeUrl}>
{t('scripts.open_source_script')}
<OpenSourceIcon />
Expand Down

0 comments on commit 9f91434

Please sign in to comment.