Skip to content

Commit 9f91434

Browse files
committed
feat: hide open source tag if xudt-compatible code is not public
1 parent 39b4589 commit 9f91434

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/constants/scripts.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export const MainnetContractHashTags: ContractHashTag[] = [
268268
depType: 'code',
269269
hashType: 'data1',
270270
tag: 'xUDT',
271-
category: 'lock',
271+
category: 'type',
272272
},
273273
{
274274
codeHashes: ['0x4a4dce1df3dffff7f8b2cd7dff7303df3b6150c9788cb75dcf6747247132b9f5'],
@@ -660,15 +660,15 @@ export const TestnetContractHashTags: ContractHashTag[] = [
660660
depType: 'code',
661661
hashType: 'type',
662662
tag: 'xUDT(final_rls)',
663-
category: 'lock',
663+
category: 'type',
664664
},
665665
{
666666
codeHashes: ['0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95'],
667667
txHashes: ['0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f-0'],
668668
depType: 'code',
669669
hashType: 'data1',
670670
tag: 'xUDT',
671-
category: 'lock',
671+
category: 'type',
672672
},
673673
{
674674
codeHashes: [

src/pages/Xudt/UDTComp.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ import { ReactComponent as EditIcon } from '../../assets/edit.svg'
3030
import XUDTTokenIcon from '../../assets/sudt_token.png'
3131
import { ReactComponent as OpenSourceIcon } from '../../assets/open-source.svg'
3232
import { scripts } from '../ScriptList'
33+
import { IS_MAINNET } from '../../constants/common'
34+
import { MainnetContractHashTags, TestnetContractHashTags } from '../../constants/scripts'
35+
36+
const scriptDataList = IS_MAINNET ? MainnetContractHashTags : TestnetContractHashTags
3337

3438
const IssuerContent: FC<{ address: string }> = ({ address }) => {
3539
const { t } = useTranslation()
@@ -185,6 +189,9 @@ export const UDTOverviewCard = ({
185189
)
186190

187191
const tags = xudt?.xudtTags ?? []
192+
const isOpenSourceXudt = xudt
193+
? scriptDataList.some(s => s.tag.startsWith('xUDT') && s.codeHashes.includes(xudt?.typeScript.codeHash))
194+
: false
188195

189196
return (
190197
<>
@@ -203,7 +210,7 @@ export const UDTOverviewCard = ({
203210
{tags.map(tag => (
204211
<XUDTTag tagName={tag} to="/xudts" tooltip />
205212
))}
206-
{xudtCodeUrl ? (
213+
{isOpenSourceXudt && xudtCodeUrl ? (
207214
<Link className={styles.openSource} to={xudtCodeUrl}>
208215
{t('scripts.open_source_script')}
209216
<OpenSourceIcon />

0 commit comments

Comments
 (0)