feat: 实现 Builder API Key 系统级配置和 Gasless 交易支持

- 新增系统配置表(SystemConfig)用于存储 Builder API Key
- 实现 Builder API Key 的前端配置页面
- 集成 Builder Relayer API 支持 Gasless 交易
- 在 API 健康检查中添加 Builder Relayer API 检测
- 移除前端 API 测试功能,简化配置页面
- 修复赎回仓位时的 Builder API Key 检查逻辑
- 更新错误处理,引导用户配置 Builder API Key
This commit is contained in:
WrBug
2025-12-06 23:10:26 +08:00
parent 3369dbb248
commit bfbbbdd1de
27 changed files with 1971 additions and 233 deletions
+45
View File
@@ -233,8 +233,10 @@
"statistics": "Statistics",
"users": "User Management",
"systemSettings": "System",
"systemOverview": "Overview",
"language": "Language",
"apiHealth": "API Health",
"builderApiKey": "Builder API Key",
"proxy": "Proxy",
"notifications": "Notifications",
"logout": "Logout",
@@ -302,6 +304,49 @@
"systemSettingsDesc": "Configure proxy, view API health status",
"footer": "Please use the above pages for configuration management."
},
"builderApiKey": {
"title": "Builder API Key Configuration",
"alertTitle": "What is Builder API Key?",
"description": "Builder API Key is a system-level configuration, not related to your account. It is an API credential for Polymarket's Builder service, used to execute Gasless (no gas fee) transactions.",
"purposeTitle": "Main purposes:",
"purpose1": "Execute Gasless transactions: Operations like redeeming positions and creating orders don't require gas fees",
"purpose2": "Improve user experience: No need to prepare MATIC tokens in wallet for gas fees",
"purpose3": "Reduce transaction costs: Gas fees are covered by Builder service",
"getApiKey": "Get API Key:",
"openSettings": "Go to Polymarket Settings",
"apiKey": "Builder API Key",
"secret": "Builder Secret",
"passphrase": "Builder Passphrase",
"apiKeyPlaceholder": "Please enter Builder API Key",
"secretPlaceholder": "Please enter Builder Secret",
"passphrasePlaceholder": "Please enter Builder Passphrase",
"apiKeyHelp": "Configured, enter new value to update",
"secretHelp": "Configured, enter new value to update",
"passphraseHelp": "Configured, enter new value to update",
"saveSuccess": "Builder API Key configuration saved successfully",
"saveFailed": "Failed to save Builder API Key configuration",
"getFailed": "Failed to get Builder API Key configuration",
"notConfigured": "Builder API Key not configured, please go to System Settings to configure",
"notConfiguredError": "Builder API Key not configured, cannot execute Gasless transactions. Please go to System Settings to configure Builder API Key.",
"apiReference": "API Reference Documentation",
"apiReferenceDesc": "Learn more about Builder API usage:",
"relayerApiDocs": "Builder Relayer API Documentation",
"builderDocs": "Builder Development Documentation",
"apiTest": "API Test",
"apiTestDesc": "Test if Builder API is working correctly",
"testNonce": "Test Get Nonce",
"testNonceHelp": "Enter Safe address (proxyAddress)",
"testDeployed": "Test Check Deployed Status",
"testDeployedHelp": "Enter Safe address (proxyAddress)",
"testTransaction": "Test Get Transaction Status",
"testTransactionHelp": "Enter transaction ID",
"testAddressRequired": "Please enter address",
"testTransactionIdRequired": "Please enter transaction ID",
"testAddressPlaceholder": "Enter address, e.g., 0x...",
"testTransactionIdPlaceholder": "Enter transaction ID",
"testSuccess": "Test successful",
"testFailed": "Test failed"
},
"resetPassword": {
"title": "Reset Password",
"firstUse": "First Time Using System",
+45
View File
@@ -150,8 +150,10 @@
"statistics": "统计信息",
"users": "用户管理",
"systemSettings": "系统管理",
"systemOverview": "概览",
"language": "语言",
"apiHealth": "API健康",
"builderApiKey": "Builder API Key",
"proxy": "代理",
"notifications": "消息推送",
"logout": "退出登录",
@@ -214,6 +216,49 @@
"systemSettingsDesc": "配置代理、查看 API 健康状态",
"footer": "请使用上述页面进行配置管理。"
},
"builderApiKey": {
"title": "Builder API Key 配置",
"alertTitle": "什么是 Builder API Key",
"description": "Builder API Key 是系统级别的配置,与您的账户无关。它是 Polymarket 提供的 Builder 服务的 API 凭证,用于执行 Gasless(免 gas 费)交易。",
"purposeTitle": "主要用途:",
"purpose1": "执行 Gasless 交易:赎回仓位、创建订单等操作无需支付 gas 费用",
"purpose2": "提升用户体验:无需在钱包中准备 MATIC 代币作为 gas 费",
"purpose3": "降低交易成本:由 Builder 服务承担 gas 费用",
"getApiKey": "获取 API Key",
"openSettings": "前往 Polymarket 设置页面",
"apiKey": "Builder API Key",
"secret": "Builder Secret",
"passphrase": "Builder Passphrase",
"apiKeyPlaceholder": "请输入 Builder API Key",
"secretPlaceholder": "请输入 Builder Secret",
"passphrasePlaceholder": "请输入 Builder Passphrase",
"apiKeyHelp": "已配置,输入新值以更新",
"secretHelp": "已配置,输入新值以更新",
"passphraseHelp": "已配置,输入新值以更新",
"saveSuccess": "保存 Builder API Key 配置成功",
"saveFailed": "保存 Builder API Key 配置失败",
"getFailed": "获取 Builder API Key 配置失败",
"notConfigured": "Builder API Key 未配置,请前往系统设置页面配置",
"notConfiguredError": "Builder API Key 未配置,无法执行 Gasless 交易。请前往系统设置页面配置 Builder API Key。",
"apiReference": "API 参考文档",
"apiReferenceDesc": "了解更多关于 Builder API 的使用方法:",
"relayerApiDocs": "Builder Relayer API 文档",
"builderDocs": "Builder 开发文档",
"apiTest": "API 测试",
"apiTestDesc": "测试 Builder API 是否正常工作",
"testNonce": "测试获取 Nonce",
"testNonceHelp": "输入 Safe 地址(proxyAddress",
"testDeployed": "测试检查部署状态",
"testDeployedHelp": "输入 Safe 地址(proxyAddress",
"testTransaction": "测试获取交易状态",
"testTransactionHelp": "输入交易ID",
"testAddressRequired": "请输入地址",
"testTransactionIdRequired": "请输入交易ID",
"testAddressPlaceholder": "输入地址,例如:0x...",
"testTransactionIdPlaceholder": "输入交易ID",
"testSuccess": "测试成功",
"testFailed": "测试失败"
},
"resetPassword": {
"title": "重置密码",
"firstUse": "首次使用系统",
+45
View File
@@ -233,8 +233,10 @@
"statistics": "統計信息",
"users": "用戶管理",
"systemSettings": "系統管理",
"systemOverview": "概覽",
"language": "語言",
"apiHealth": "API健康",
"builderApiKey": "Builder API Key",
"proxy": "代理",
"notifications": "消息推送",
"logout": "退出登錄",
@@ -302,6 +304,49 @@
"systemSettingsDesc": "配置代理、查看 API 健康狀態",
"footer": "請使用上述頁面進行配置管理。"
},
"builderApiKey": {
"title": "Builder API Key 配置",
"alertTitle": "什麼是 Builder API Key",
"description": "Builder API Key 是系統級別的配置,與您的賬戶無關。它是 Polymarket 提供的 Builder 服務的 API 憑證,用於執行 Gasless(免 gas 費)交易。",
"purposeTitle": "主要用途:",
"purpose1": "執行 Gasless 交易:贖回倉位、創建訂單等操作無需支付 gas 費用",
"purpose2": "提升用戶體驗:無需在錢包中準備 MATIC 代幣作為 gas 費",
"purpose3": "降低交易成本:由 Builder 服務承擔 gas 費用",
"getApiKey": "獲取 API Key",
"openSettings": "前往 Polymarket 設置頁面",
"apiKey": "Builder API Key",
"secret": "Builder Secret",
"passphrase": "Builder Passphrase",
"apiKeyPlaceholder": "請輸入 Builder API Key",
"secretPlaceholder": "請輸入 Builder Secret",
"passphrasePlaceholder": "請輸入 Builder Passphrase",
"apiKeyHelp": "已配置,輸入新值以更新",
"secretHelp": "已配置,輸入新值以更新",
"passphraseHelp": "已配置,輸入新值以更新",
"saveSuccess": "保存 Builder API Key 配置成功",
"saveFailed": "保存 Builder API Key 配置失敗",
"getFailed": "獲取 Builder API Key 配置失敗",
"notConfigured": "Builder API Key 未配置,請前往系統設置頁面配置",
"notConfiguredError": "Builder API Key 未配置,無法執行 Gasless 交易。請前往系統設置頁面配置 Builder API Key。",
"apiReference": "API 參考文檔",
"apiReferenceDesc": "了解更多關於 Builder API 的使用方法:",
"relayerApiDocs": "Builder Relayer API 文檔",
"builderDocs": "Builder 開發文檔",
"apiTest": "API 測試",
"apiTestDesc": "測試 Builder API 是否正常工作",
"testNonce": "測試獲取 Nonce",
"testNonceHelp": "輸入 Safe 地址(proxyAddress",
"testDeployed": "測試檢查部署狀態",
"testDeployedHelp": "輸入 Safe 地址(proxyAddress",
"testTransaction": "測試獲取交易狀態",
"testTransactionHelp": "輸入交易ID",
"testAddressRequired": "請輸入地址",
"testTransactionIdRequired": "請輸入交易ID",
"testAddressPlaceholder": "輸入地址,例如:0x...",
"testTransactionIdPlaceholder": "輸入交易ID",
"testSuccess": "測試成功",
"testFailed": "測試失敗"
},
"resetPassword": {
"title": "重置密碼",
"firstUse": "首次使用系統",