Skip to content

Commit

Permalink
add TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
cherry-yl-sh committed Mar 7, 2024
1 parent 03d464a commit ff7d4c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions common/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func GenerateMockUserOperation() *model.UserOperationItem {
//TODO use config
return &model.UserOperationItem{
Sender: "0x4A2FD3215420376DA4eD32853C19E4755deeC4D1",
Nonce: "1",
Expand Down
11 changes: 6 additions & 5 deletions service/chain_service/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
)

var NetworkInfoMap map[types.NetWork]types.NetworkInfo
var NetWorkClientMap map[types.NetWork]ethclient.Client
var NetworkInfoMap map[types.NetWork]*types.NetworkInfo
var NetWorkClientMap map[types.NetWork]*ethclient.Client

func init() {
ConfigInit()
ClientInit()
}
func ConfigInit() {
NetworkInfoMap = map[types.NetWork]types.NetworkInfo{
//TODO api key secret store
NetworkInfoMap = map[types.NetWork]*types.NetworkInfo{
types.Ethereum: {
Name: "ethereum",
RpcUrl: "https://eth-mainnet.g.alchemy.com/v2/bIZQS43-rJMgv2_SiHqfVvXa-Z1UGoGt",
Expand All @@ -26,13 +27,13 @@ func ConfigInit() {
}

func ClientInit() {
NetWorkClientMap = make(map[types.NetWork]ethclient.Client)
NetWorkClientMap = make(map[types.NetWork]*ethclient.Client)
for chain, networkInfo := range NetworkInfoMap {
client, err := ethclient.Dial(networkInfo.RpcUrl)
if err != nil {
panic(err)
}
NetWorkClientMap[chain] = *client
NetWorkClientMap[chain] = client
continue
}
}

0 comments on commit ff7d4c5

Please sign in to comment.