feat(trading-service, mining-admin-web): 支持在管理后台配置做市商钱包地址

- 后端: 在 UpdateConfigDto 和 updateConfig 方法中添加 kavaWalletAddress 字段
- 前端: 在充值对话框中添加钱包地址配置输入框

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-29 07:53:04 -08:00
parent 6bcfa18b01
commit 40389fcfc7
5 changed files with 58 additions and 6 deletions

View File

@ -78,6 +78,10 @@ class UpdateConfigDto {
@IsOptional()
@IsNumber()
discountRate?: number;
@IsOptional()
@IsString()
kavaWalletAddress?: string;
}
class UpdateMakerConfigDto {

View File

@ -760,6 +760,7 @@ export class MarketMakerService {
maxIntervalMs?: number;
priceStrategy?: string;
discountRate?: number;
kavaWalletAddress?: string;
},
): Promise<MarketMakerConfig | null> {
const config = await this.getConfig(name);

View File

@ -6,6 +6,7 @@ import { PageHeader } from '@/components/layout/page-header';
import {
useMarketMakerConfig,
useInitializeMarketMaker,
useUpdateMarketMakerConfig,
useDepositCash,
useWithdrawCash,
useDepositShares,
@ -80,8 +81,10 @@ export default function MarketMakerPage() {
const refreshOrdersMutation = useRefreshOrders();
const cancelAllOrdersMutation = useCancelAllOrders();
const setDepthEnabledMutation = useSetDepthEnabled();
const updateConfigMutation = useUpdateMarketMakerConfig();
const [initAccountSeq, setInitAccountSeq] = useState('MM001');
const [walletAddressInput, setWalletAddressInput] = useState('');
const [depositCashAmount, setDepositCashAmount] = useState('');
const [withdrawCashAmount, setWithdrawCashAmount] = useState('');
const [depositSharesAmount, setDepositSharesAmount] = useState('');
@ -253,9 +256,30 @@ export default function MarketMakerPage() {
</div>
</div>
) : (
<div className="text-center text-muted-foreground py-4">
<AlertCircle className="h-8 w-8 mx-auto mb-2 text-yellow-500" />
<p></p>
<div className="space-y-4">
<div className="text-center text-muted-foreground py-2">
<AlertCircle className="h-6 w-6 mx-auto mb-2 text-yellow-500" />
<p className="text-sm"></p>
</div>
<div>
<Label className="text-xs"> (Kava EVM)</Label>
<Input
value={walletAddressInput}
onChange={(e) => setWalletAddressInput(e.target.value)}
placeholder="0x..."
className="mt-1"
/>
</div>
<Button
className="w-full"
onClick={() => {
updateConfigMutation.mutate({ kavaWalletAddress: walletAddressInput });
setWalletAddressInput('');
}}
disabled={updateConfigMutation.isPending || !walletAddressInput || !walletAddressInput.startsWith('0x')}
>
{updateConfigMutation.isPending ? '保存中...' : '保存钱包地址'}
</Button>
</div>
)}
</TabsContent>
@ -449,9 +473,30 @@ export default function MarketMakerPage() {
</div>
</div>
) : (
<div className="text-center text-muted-foreground py-4">
<AlertCircle className="h-8 w-8 mx-auto mb-2 text-yellow-500" />
<p></p>
<div className="space-y-4">
<div className="text-center text-muted-foreground py-2">
<AlertCircle className="h-6 w-6 mx-auto mb-2 text-yellow-500" />
<p className="text-sm"></p>
</div>
<div>
<Label className="text-xs"> (Kava EVM)</Label>
<Input
value={walletAddressInput}
onChange={(e) => setWalletAddressInput(e.target.value)}
placeholder="0x..."
className="mt-1"
/>
</div>
<Button
className="w-full"
onClick={() => {
updateConfigMutation.mutate({ kavaWalletAddress: walletAddressInput });
setWalletAddressInput('');
}}
disabled={updateConfigMutation.isPending || !walletAddressInput || !walletAddressInput.startsWith('0x')}
>
{updateConfigMutation.isPending ? '保存中...' : '保存钱包地址'}
</Button>
</div>
)}
</TabsContent>

View File

@ -142,6 +142,7 @@ export const marketMakerApi = {
maxIntervalMs?: number;
priceStrategy?: string;
discountRate?: number;
kavaWalletAddress?: string;
}): Promise<{ success: boolean; message: string }> => {
const response = await tradingClient.post(`/admin/market-maker/${name}/config`, data);
return response.data;

View File

@ -39,6 +39,7 @@ export function useUpdateMarketMakerConfig() {
maxIntervalMs?: number;
priceStrategy?: string;
discountRate?: number;
kavaWalletAddress?: string;
}) => marketMakerApi.updateConfig(MARKET_MAKER_NAME, data),
onSuccess: (data) => {
toast({ title: '成功', description: data.message });