Skip to content

Commit

Permalink
update API
Browse files Browse the repository at this point in the history
  • Loading branch information
cherry-yl-sh committed Mar 14, 2024
1 parent 00ebc7d commit 400eeb8
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 8 deletions.
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down
8 changes: 4 additions & 4 deletions service/dashboard_service/dashboard_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
)

// TODO just Temp Mock
var mockStrategyMap = map[string]*model.Strategy{}
var MockStrategyMap = map[string]*model.Strategy{}
var payMasterSupport = map[string]bool{}
var entryPointSupport = map[string]bool{}

func init() {
mockStrategyMap["1"] = &model.Strategy{
MockStrategyMap["1"] = &model.Strategy{
Id: "1",
EntryPointAddress: "0x0576a174D229E3cFA37253523E645A78A0C91B57",
PayMasterAddress: "0x0000000000325602a77416A16136FDafd04b299f",
Expand All @@ -21,7 +21,7 @@ func init() {
EntryPointTag: types.EntrypointV06,
Token: types.USDT,
}
mockStrategyMap["2"] = &model.Strategy{
MockStrategyMap["2"] = &model.Strategy{
Id: "2",
EntryPointAddress: "0x0576a174D229E3cFA37253523E645A78A0C91B57",
PayMasterAddress: "0x0000000000325602a77416A16136FDafd04b299f",
Expand All @@ -35,7 +35,7 @@ func init() {
payMasterSupport["0x0000000000325602a77416A16136FDafd04b299f"] = true
}
func GetStrategyById(strategyId string) *model.Strategy {
return mockStrategyMap[strategyId]
return MockStrategyMap[strategyId]
}
func GetSupportEntryPoint() {

Expand Down
14 changes: 12 additions & 2 deletions service/operator/get_support_entry_point_execute.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
package operator

import "AAStarCommunity/EthPaymaster_BackService/common/model"
import (
"AAStarCommunity/EthPaymaster_BackService/common/model"
"AAStarCommunity/EthPaymaster_BackService/common/types"
)

func GetSupportEntrypointExecute(network string) (*model.GetSupportEntryPointResponse, error) {
return &model.GetSupportEntryPointResponse{
EntrypointDomains: &[]model.EntrypointDomain{},
EntrypointDomains: &[]model.EntrypointDomain{
{
Address: "0x0576a174D229E3cFA37253523E645A78A0C91B57",
Desc: "desc",
NetWork: types.Sepolia,
StrategyId: "1",
},
},
}, nil
}
11 changes: 11 additions & 0 deletions service/operator/get_support_entry_point_execute_test.go
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
package operator

import (
"github.com/stretchr/testify/assert"
"testing"
)

func TestGetSupportEntrypointExecute(t *testing.T) {
res, err := GetSupportEntrypointExecute("network")
assert.NoError(t, err)
t.Log(res.EntrypointDomains)
}
5 changes: 3 additions & 2 deletions service/operator/get_support_strategy_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package operator

import (
"AAStarCommunity/EthPaymaster_BackService/common/model"
"AAStarCommunity/EthPaymaster_BackService/service/dashboard_service"
)

func GetSupportStrategyExecute(network string) (*model.Result, error) {
return &model.Result{}, nil
func GetSupportStrategyExecute(network string) (map[string]*model.Strategy, error) {
return dashboard_service.MockStrategyMap, nil
}
13 changes: 13 additions & 0 deletions service/operator/get_support_strategy_execute_test.go
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
package operator

import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"
)

func TestGetSupportStrategyExecute(t *testing.T) {
res, err := GetSupportStrategyExecute("network")
assert.NoError(t, err)
assert.NotNil(t, res)
fmt.Println(res["1"])
}

0 comments on commit 400eeb8

Please sign in to comment.