Skip to content

Commit cbc53e0

Browse files
committed
feat: update
1 parent 3fbdbfd commit cbc53e0

File tree

6 files changed

+90
-16
lines changed

6 files changed

+90
-16
lines changed

packages/neuron-ui/src/components/LockInfoDialog/index.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,23 @@ const ShortAddr = ({
3535
return null
3636
}
3737

38-
const shortAddr = scriptToAddress(lockScript, { isMainnet, deprecated: true })
38+
try {
39+
const shortAddr = scriptToAddress(lockScript, { isMainnet, deprecated: true })
3940

40-
return (
41-
<>
42-
<div title={t('transaction.deprecated-address-format')} className={styles.title}>
43-
{t('transaction.deprecated-address-format')}
44-
</div>
45-
<div className={styles.shortAddr}>
46-
<span>{shortAddr}</span>
47-
<Copy className={styles.copyIcon} onClick={() => onCopy(shortAddr)} />
48-
</div>
49-
</>
50-
)
41+
return (
42+
<>
43+
<div title={t('transaction.deprecated-address-format')} className={styles.title}>
44+
{t('transaction.deprecated-address-format')}
45+
</div>
46+
<div className={styles.shortAddr}>
47+
<span>{shortAddr}</span>
48+
<Copy className={styles.copyIcon} onClick={() => onCopy(shortAddr)} />
49+
</div>
50+
</>
51+
)
52+
} catch (error) {
53+
return null
54+
}
5155
}
5256

5357
const LockInfoDialog = ({ lockInfo, isMainnet, onDismiss }: LockInfoDialogProps) => {

packages/neuron-ui/src/components/MultisigAddress/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ const MultisigAddress = () => {
445445
<div>
446446
<div className={styles.titleWrap}>
447447
<p>Code_hash</p>
448-
<div className={clsx(styles.tag, item.isLegacy && styles.legacy)}>
448+
<div className={clsx(styles.badge, item.isLegacy && styles.legacy)}>
449449
{item.isLegacy ? 'Legacy' : 'Recommended'}
450450
</div>
451451
</div>

packages/neuron-ui/src/components/MultisigAddress/multisigAddress.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
color: var(--main-text-color);
142142
font-weight: 500;
143143

144-
.tag {
144+
.badge {
145145
font-size: 12px;
146146
line-height: 18px;
147147
color: var(--tabs-active);

packages/neuron-ui/src/components/ScriptTag/index.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import {
1111
ChequeLockInfoOnLina,
1212
clsx,
1313
} from 'utils'
14+
import Tooltip from 'widgets/Tooltip'
15+
import CopyZone from 'widgets/CopyZone'
16+
import { Copy } from 'widgets/Icons/icon'
1417
import styles from './scriptTag.module.scss'
1518

1619
const ScriptTag = ({
@@ -45,6 +48,36 @@ const ScriptTag = ({
4548
return null
4649
}
4750

51+
if (LegacyMultiSigLockInfo.TagName === foundLock.TagName || MultiSigLockInfo.TagName === foundLock.TagName) {
52+
const isLegacy = LegacyMultiSigLockInfo.TagName === foundLock.TagName
53+
return (
54+
<div className={clsx(styles.tagWrap, className)}>
55+
<Tooltip
56+
tip={
57+
<div>
58+
<div className={styles.titleWrap}>
59+
<p>Code_hash</p>
60+
<div className={clsx(styles.badge, isLegacy && styles.legacy)}>
61+
{isLegacy ? 'Legacy' : 'Recommended'}
62+
</div>
63+
</div>
64+
<CopyZone content={foundLock.CodeHash} className={styles.copyLockCodeHash}>
65+
{foundLock.CodeHash}
66+
<Copy />
67+
</CopyZone>
68+
</div>
69+
}
70+
showTriangle
71+
placement="top"
72+
>
73+
<button type="button" className={styles.tag} onClick={onClick}>
74+
Multisig
75+
<span className={clsx(!isLegacy && styles.highlight)}>(@{foundLock.CodeHash.slice(0, 8)})</span>
76+
</button>
77+
</Tooltip>
78+
</div>
79+
)
80+
}
4881
return (
4982
<button type="button" className={clsx(styles.tag, className)} onClick={onClick}>
5083
{foundLock.TagName}

packages/neuron-ui/src/components/ScriptTag/scriptTag.module.scss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
@import '../../styles/mixin.scss';
2+
3+
.tagWrap {
4+
display: inline-block;
5+
6+
.titleWrap {
7+
display: flex;
8+
align-items: center;
9+
column-gap: 4px;
10+
color: var(--main-text-color);
11+
font-weight: 500;
12+
13+
.badge {
14+
font-size: 12px;
15+
line-height: 18px;
16+
color: var(--tabs-active);
17+
font-weight: 500;
18+
background: var(--tag-background-color);
19+
padding: 0 4px;
20+
border-radius: 2px;
21+
max-width: 200px;
22+
}
23+
.legacy {
24+
color: var(--third-text-color);
25+
background: var(--input-border-color);
26+
}
27+
}
28+
29+
.copyLockCodeHash {
30+
@include copyAddress;
31+
}
32+
}
33+
134
.tag {
235
margin: auto 4px;
336
padding: 0 6px;
@@ -6,4 +39,8 @@
639
background-color: var(--script-tag-background-color);
740
color: var(--script-tag-color);
841
cursor: pointer;
42+
43+
.highlight {
44+
color: var(--primary-color);
45+
}
946
}

packages/neuron-ui/src/utils/enums.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ export enum LegacyMultiSigLockInfo {
155155
HashType = 'type',
156156
CodeHashIndex = '0x01',
157157
ArgsLen = '20',
158-
TagName = 'secp256k1/multisig/@5c5069eb',
158+
TagName = 'Multisig(@5c5069eb)',
159159
}
160160

161161
export enum MultiSigLockInfo {
162162
CodeHash = '0x36c971b8d41fbd94aabca77dc75e826729ac98447b46f91e00796155dddb0d29',
163163
HashType = 'data1',
164164
CodeHashIndex = '0x01',
165165
ArgsLen = '20',
166-
TagName = 'secp256k1/multisig/@36c971b8',
166+
TagName = 'Multisig(@36c971b8)',
167167
}
168168

169169
export enum LocktimeLockInfo {

0 commit comments

Comments
 (0)