feat: 钱包类型枚举与前端账号类型展示

后端:
- 新增 WalletType 枚举(MAGIC/SAFE),移除 safe/magic 字符串硬编码
- RelayClientService/BlockchainService/AccountService/OrderSigningService 使用枚举
- Builder Relayer API 类型使用常量 RELAYER_TYPE_PROXY/SAFE

前端:
- 账户列表、详情、导入 Modal 显示账号类型(Magic/Safe Tag)
- 导入账户 Modal 移除安全提示 Alert,移除 showAlert 与相关 i18n
- 移除无用 i18n key:securityTip、securityTipDesc、walletTypeMagic、walletTypeSafe、magicNotSupported
- 钱包类型 Tag 简化为仅显示 Magic 或 Safe

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WrBug
2026-02-14 01:14:04 +08:00
co-authored by Cursor
parent fc6fa8b419
commit 3405a1cda3
13 changed files with 133 additions and 61 deletions
+7
View File
@@ -181,6 +181,13 @@ const AccountDetail: React.FC = () => {
<Descriptions.Item label={t('account.accountName')}>
{account.accountName || '-'}
</Descriptions.Item>
{account.walletType && (
<Descriptions.Item label={t('account.walletType')}>
<Tag color={account.walletType.toLowerCase() === 'magic' ? 'purple' : 'blue'}>
{account.walletType.toLowerCase() === 'magic' ? 'Magic' : 'Safe'}
</Tag>
</Descriptions.Item>
)}
<Descriptions.Item label={t('account.walletAddress')} span={isMobile ? 1 : 2}>
<span style={{
fontFamily: 'monospace',
-2
View File
@@ -35,8 +35,6 @@ const AccountImport: React.FC = () => {
form={form}
onSuccess={handleSuccess}
onCancel={() => navigate('/accounts')}
showAlert={true}
showCancelButton={true}
/>
</Card>
</div>
+31 -4
View File
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
import { Card, Table, Button, Space, Tag, Popconfirm, message, Typography, Spin, Modal, Descriptions, Divider, Form, Input, Alert } from 'antd'
import { Card, Table, Button, Space, Tag, Popconfirm, message, Typography, Spin, Modal, Descriptions, Divider, Form, Input } from 'antd'
import { PlusOutlined, ReloadOutlined, EditOutlined, CopyOutlined } from '@ant-design/icons'
import { useTranslation } from 'react-i18next'
import { useAccountStore } from '../store/accountStore'
@@ -303,6 +303,20 @@ const AccountList: React.FC = () => {
)
}
},
{
title: t('accountList.walletType'),
dataIndex: 'walletType',
key: 'walletType',
render: (walletType: string) => {
if (!walletType) return '-'
const type = walletType.toLowerCase()
return (
<Tag color={type === 'magic' ? 'purple' : 'blue'}>
{type === 'magic' ? 'Magic' : 'Safe'}
</Tag>
)
}
},
{
title: t('accountList.balance'),
dataIndex: 'balance',
@@ -392,7 +406,7 @@ const AccountList: React.FC = () => {
style={{ marginLeft: '4px', padding: '0 4px' }}
/>
</div>
<div>
<div style={{ marginBottom: '4px' }}>
<strong>{t('accountList.proxyAddress')}:</strong> {record.proxyAddress ? `${record.proxyAddress.slice(0, 6)}...${record.proxyAddress.slice(-4)}` : '-'}
<Button
type="text"
@@ -405,6 +419,14 @@ const AccountList: React.FC = () => {
style={{ marginLeft: '4px', padding: '0 4px' }}
/>
</div>
{record.walletType && (
<div style={{ marginBottom: '4px' }}>
<strong>{t('accountList.walletType')}:</strong>{' '}
<Tag color={record.walletType.toLowerCase() === 'magic' ? 'purple' : 'blue'} style={{ marginLeft: '4px' }}>
{record.walletType.toLowerCase() === 'magic' ? 'Magic' : 'Safe'}
</Tag>
</div>
)}
</div>
<div style={{
fontSize: '14px',
@@ -654,6 +676,13 @@ const AccountList: React.FC = () => {
/>
</Space>
</Descriptions.Item>
{detailAccount.walletType && (
<Descriptions.Item label={t('accountList.walletType')}>
<Tag color={detailAccount.walletType.toLowerCase() === 'magic' ? 'purple' : 'blue'}>
{detailAccount.walletType.toLowerCase() === 'magic' ? 'Magic' : 'Safe'}
</Tag>
</Descriptions.Item>
)}
<Descriptions.Item label={t('accountList.totalBalance')} span={isMobile ? 1 : 2}>
{detailBalanceLoading ? (
<Spin size="small" />
@@ -868,8 +897,6 @@ const AccountList: React.FC = () => {
setAccountImportModalVisible(false)
accountImportForm.resetFields()
}}
showAlert={true}
showCancelButton={true}
/>
</Modal>
</div>
@@ -1120,8 +1120,6 @@ const AddModal: React.FC<AddModalProps> = ({
setAccountImportModalVisible(false)
accountImportForm.resetFields()
}}
showAlert={true}
showCancelButton={true}
/>
</Modal>