diff --git a/common/utils/util.go b/common/utils/util.go index 202d7801..faef363c 100644 --- a/common/utils/util.go +++ b/common/utils/util.go @@ -7,6 +7,7 @@ import ( ) func GenerateMockUserOperation() *model.UserOperationItem { + //TODO use config return &model.UserOperationItem{ Sender: "0x4A2FD3215420376DA4eD32853C19E4755deeC4D1", Nonce: "1", diff --git a/service/chain_service/chain_config.go b/service/chain_service/chain_config.go index e686b131..3ce2b73d 100644 --- a/service/chain_service/chain_config.go +++ b/service/chain_service/chain_config.go @@ -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", @@ -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 } }