feat: add multi-network payment support

- Redesign payment UI with a two-step flow (select coin/network → pay)
  - Add wallet address validation in Telegram bot
  - Rename NetworkEthereum constant from "eth" to "ethereum"
This commit is contained in:
line-6000
2026-04-13 03:52:45 +08:00
parent 32ca778735
commit 5e4d5dfae4
16 changed files with 1459 additions and 827 deletions
+25
View File
@@ -1,6 +1,7 @@
package comm
import (
"encoding/json"
"fmt"
"log"
@@ -26,6 +27,30 @@ func (c *BaseCommController) CreateTransaction(ctx echo.Context) (err error) {
return c.SucJson(ctx, resp)
}
// SwitchNetwork 切换支付网络,创建或返回子订单
func (c *BaseCommController) SwitchNetwork(ctx echo.Context) (err error) {
req := new(request.SwitchNetworkRequest)
if err = ctx.Bind(req); err != nil {
return c.FailJson(ctx, constant.ParamsMarshalErr)
}
if err = c.ValidateStruct(ctx, req); err != nil {
return c.FailJson(ctx, err)
}
resp, err := service.SwitchNetwork(req)
if err != nil {
return c.FailJson(ctx, err)
}
jsonBytes, err := json.MarshalIndent(resp, "", " ")
if err != nil {
return c.FailJson(ctx, err)
}
fmt.Printf("switch network response: \n%s", string(jsonBytes))
return c.SucJson(ctx, resp)
}
func (c *BaseCommController) CreateTransactionAndRedirect(ctx echo.Context) (err error) {
req := new(request.CreateTransactionRequest)
if err = ctx.Bind(req); err != nil {