Skip to content

Commit 7f3bc48

Browse files
authored
fix: Manage Nervos DAO with multisig address (#3329)
* fix: Manage Nervos DAO with multisig address * fix: comments * fix: comments * fix * fix * fix: checkbox is not displaying properly
1 parent fc96a32 commit 7f3bc48

File tree

14 files changed

+129
-42
lines changed

14 files changed

+129
-42
lines changed

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,25 @@ const MultisigAddress = () => {
204204
[listActionOptions]
205205
)
206206

207+
const daoDisabledMessage = useMemo(() => {
208+
if (!wallet.device) return ''
209+
210+
if (
211+
(daoDepositAction.depositFromMultisig && daoDepositAction.isDialogOpen) ||
212+
(daoWithdrawAction.withdrawFromMultisig && daoWithdrawAction.isDialogOpen)
213+
) {
214+
const multisigConfig = daoDepositAction.depositFromMultisig || daoWithdrawAction.withdrawFromMultisig
215+
const { canSign } = getMultisigSignStatus({
216+
multisigConfig: multisigConfig!,
217+
addresses,
218+
})
219+
220+
return canSign ? 'dao-ledger-notice' : 'dao-hardware-not-match'
221+
}
222+
223+
return ''
224+
}, [daoDepositAction, daoWithdrawAction, wallet.device, addresses])
225+
207226
const { keywords, onChange, onBlur } = useSearch(clearSelected, onFilterConfig)
208227

209228
const sendTotalBalance = useMemo(() => {
@@ -584,7 +603,7 @@ const MultisigAddress = () => {
584603
/>
585604
) : null}
586605

587-
{daoDepositAction.depositFromMultisig && daoDepositAction.isDialogOpen ? (
606+
{!daoDisabledMessage && daoDepositAction.depositFromMultisig && daoDepositAction.isDialogOpen ? (
588607
<DepositDialog
589608
balance={multisigBanlances[daoDepositAction.depositFromMultisig.fullPayload]}
590609
wallet={wallet}
@@ -600,12 +619,23 @@ const MultisigAddress = () => {
600619
/>
601620
) : null}
602621

603-
{daoWithdrawAction.withdrawFromMultisig && daoWithdrawAction.isDialogOpen ? (
622+
{!daoDisabledMessage && daoWithdrawAction.withdrawFromMultisig && daoWithdrawAction.isDialogOpen ? (
604623
<MultisigAddressNervosDAODialog
605624
closeDialog={daoWithdrawAction.closeDialog}
606625
multisigConfig={daoWithdrawAction.withdrawFromMultisig}
607626
/>
608627
) : null}
628+
629+
<AlertDialog
630+
show={!!daoDisabledMessage}
631+
message={t(`multisig-address.${daoDisabledMessage}`)}
632+
type="warning"
633+
okProps={{ style: { display: 'none' } }}
634+
onCancel={() => {
635+
daoDepositAction.closeDialog()
636+
daoWithdrawAction.closeDialog()
637+
}}
638+
/>
609639
</div>
610640
)
611641
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const WithdrawDialog = ({
7575
(Number(currentEpochInfo.number) + Number(currentEpochInfo.index) / Number(currentEpochInfo.length))
7676
).toFixed(1)
7777
const message =
78-
epochs >= 0 ? (
78+
epochs > 5 ? (
7979
<>
8080
<Attention />
8181
{t('nervos-dao.notice-wait-time', {

packages/neuron-ui/src/components/WithdrawDialog/withdrawDialog.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
margin: 44px 0 0 0;
6161
border: 1px solid rgba(252, 136, 0, 0.2);
6262
padding: 8px 36px;
63-
width: max-content;
63+
max-width: 760px;
6464
border-radius: 4px;
6565
background: #fff6eb;
6666
color: #f68c2a;

packages/neuron-ui/src/locales/ar.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,8 @@
11711171
"daoWithdraw": "سحب من DAO"
11721172
}
11731173
},
1174+
"dao-ledger-notice": "محافظ Ledger لا تدعم حاليًا معاملات DAO لعناوين التوقيع المتعدد. يُرجى استخدام عنوان بتوقيع فردي أو الانتظار للتحديثات المستقبلية.",
1175+
"dao-hardware-not-match": "المحفظة الصلبة المتصلة حاليًا لا تتطابق مع المحفظة الحالية.",
11741176
"import-dialog": {
11751177
"actions": {
11761178
"cancel": "إلغاء",

packages/neuron-ui/src/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,8 @@
11711171
"daoWithdraw": "DAO Withdraw"
11721172
}
11731173
},
1174+
"dao-ledger-notice": "Ledger wallets currently do not support DAO transactions for multisig addresses. Please use a single-signature address or await future updates.",
1175+
"dao-hardware-not-match": "The hardware wallet currently connected does not match the current wallet.",
11741176
"import-dialog": {
11751177
"actions": {
11761178
"cancel": "Cancel",

packages/neuron-ui/src/locales/es.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,8 @@
11541154
"daoWithdraw": "Retirar de DAO"
11551155
}
11561156
},
1157+
"dao-ledger-notice": "Las billeteras Ledger actualmente no admiten transacciones DAO para direcciones multifirma. Por favor, use una dirección de firma única o espere futuras actualizaciones.",
1158+
"dao-hardware-not-match": "La billetera de hardware conectada actualmente no coincide con la billetera actual.",
11571159
"import-dialog": {
11581160
"actions": {
11591161
"cancel": "Cancelar",

packages/neuron-ui/src/locales/fr.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,8 @@
11611161
"daoWithdraw": "Retirer de DAO"
11621162
}
11631163
},
1164+
"dao-ledger-notice": "Les portefeuilles Ledger ne prennent actuellement pas en charge les transactions DAO pour les adresses multisignatures. Veuillez utiliser une adresse à signature unique ou attendre les futures mises à jour.",
1165+
"dao-hardware-not-match": "Le portefeuille matériel actuellement connecté ne correspond pas au portefeuille actuel.",
11641166
"import-dialog": {
11651167
"actions": {
11661168
"cancel": "Annuler",

packages/neuron-ui/src/locales/zh-tw.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,8 @@
11641164
"daoWithdraw": "從 DAO 取出"
11651165
}
11661166
},
1167+
"dao-ledger-notice": "Ledger 錢包目前不支援多重簽名地址的 DAO 交易。請使用單一簽名地址或等待未來的更新。",
1168+
"dao-hardware-not-match": "當前連接的硬體錢包與當前錢包不匹配。",
11671169
"import-dialog": {
11681170
"actions": {
11691171
"cancel": "取消",

packages/neuron-ui/src/locales/zh.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,8 @@
11631163
"daoWithdraw": "从 DAO 取出"
11641164
}
11651165
},
1166+
"dao-ledger-notice": "Ledger 钱包目前不支持多签地址的 DAO 交易。请使用单签地址或等待未来的更新。",
1167+
"dao-hardware-not-match": "当前连接的硬件钱包与当前钱包不匹配。",
11661168
"import-dialog": {
11671169
"actions": {
11681170
"cancel": "取消",

packages/neuron-ui/src/styles/mixin.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,23 +196,23 @@
196196
height: 20px;
197197
padding-left: 30px;
198198
line-height: 20px;
199-
background: url('../widgets/Icons/Checkbox.svg') no-repeat left top;
199+
background: url('widgets/Icons/Checkbox.svg') no-repeat left top;
200200
user-select: none;
201201
}
202202
input[type='checkbox']:checked + span {
203-
background: url('../widgets/Icons/CheckboxSelected.svg') no-repeat left top;
203+
background: url('widgets/Icons/CheckboxSelected.svg') no-repeat left top;
204204
}
205205

206206
input[type='checkbox']:disabled:checked + span {
207-
background: url('../widgets/Icons/CheckboxSelected.svg') no-repeat left top;
207+
background: url('widgets/Icons/CheckboxSelected.svg') no-repeat left top;
208208
opacity: 0.5;
209209
}
210210
input[type='checkbox']:disabled + span {
211211
cursor: not-allowed;
212-
background: url('../widgets/Icons/CheckboxDisabled.svg') no-repeat left top;
212+
background: url('widgets/Icons/CheckboxDisabled.svg') no-repeat left top;
213213

214214
@media (prefers-color-scheme: dark) {
215-
background: url('../widgets/Icons/CheckboxDisabledDark.svg') no-repeat left top;
215+
background: url('widgets/Icons/CheckboxDisabledDark.svg') no-repeat left top;
216216
}
217217
}
218218
}

0 commit comments

Comments
 (0)