@@ -13,6 +13,7 @@ import (
13
13
"google.golang.org/grpc"
14
14
15
15
"github.com/zeta-chain/zetacore/e2e/config"
16
+ authoritytypes "github.com/zeta-chain/zetacore/x/authority/types"
16
17
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
17
18
fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types"
18
19
lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types"
@@ -28,18 +29,30 @@ type E2EClients struct {
28
29
EvmAuth * bind.TransactOpts
29
30
30
31
// the gRPC clients for ZetaChain
31
- CctxClient crosschaintypes.QueryClient
32
- FungibleClient fungibletypes.QueryClient
33
- AuthClient authtypes.QueryClient
34
- BankClient banktypes.QueryClient
35
- ObserverClient observertypes.QueryClient
36
- LightClient lightclienttypes.QueryClient
32
+ AuthorityClient authoritytypes.QueryClient
33
+ CctxClient crosschaintypes.QueryClient
34
+ FungibleClient fungibletypes.QueryClient
35
+ AuthClient authtypes.QueryClient
36
+ BankClient banktypes.QueryClient
37
+ ObserverClient observertypes.QueryClient
38
+ LightClient lightclienttypes.QueryClient
37
39
38
40
// the RPC clients for ZetaChain
39
41
ZevmClient * ethclient.Client
40
42
ZevmAuth * bind.TransactOpts
41
43
}
42
44
45
+ // zetaChainClients contains all the RPC clients and gRPC clients for ZetaChain
46
+ type zetaChainClients struct {
47
+ AuthorityClient authoritytypes.QueryClient
48
+ CctxClient crosschaintypes.QueryClient
49
+ FungibleClient fungibletypes.QueryClient
50
+ AuthClient authtypes.QueryClient
51
+ BankClient banktypes.QueryClient
52
+ ObserverClient observertypes.QueryClient
53
+ LightClient lightclienttypes.QueryClient
54
+ }
55
+
43
56
// getClientsFromConfig get clients from config
44
57
func getClientsFromConfig (ctx context.Context , conf config.Config , account config.Account ) (
45
58
E2EClients ,
@@ -60,7 +73,7 @@ func getClientsFromConfig(ctx context.Context, conf config.Config, account confi
60
73
if err != nil {
61
74
return E2EClients {}, fmt .Errorf ("failed to get evm client: %w" , err )
62
75
}
63
- cctxClient , fungibleClient , authClient , bankClient , observerClient , lightclientClient , err := getZetaClients (
76
+ zetaChainClients , err := getZetaClients (
64
77
conf .RPCs .ZetaCoreGRPC ,
65
78
)
66
79
if err != nil {
@@ -72,18 +85,19 @@ func getClientsFromConfig(ctx context.Context, conf config.Config, account confi
72
85
}
73
86
74
87
return E2EClients {
75
- BtcRPCClient : btcRPCClient ,
76
- SolanaClient : solanaClient ,
77
- EvmClient : evmClient ,
78
- EvmAuth : evmAuth ,
79
- CctxClient : cctxClient ,
80
- FungibleClient : fungibleClient ,
81
- AuthClient : authClient ,
82
- BankClient : bankClient ,
83
- ObserverClient : observerClient ,
84
- LightClient : lightclientClient ,
85
- ZevmClient : zevmClient ,
86
- ZevmAuth : zevmAuth ,
88
+ BtcRPCClient : btcRPCClient ,
89
+ SolanaClient : solanaClient ,
90
+ EvmClient : evmClient ,
91
+ EvmAuth : evmAuth ,
92
+ AuthorityClient : zetaChainClients .AuthorityClient ,
93
+ CctxClient : zetaChainClients .CctxClient ,
94
+ FungibleClient : zetaChainClients .FungibleClient ,
95
+ AuthClient : zetaChainClients .AuthClient ,
96
+ BankClient : zetaChainClients .BankClient ,
97
+ ObserverClient : zetaChainClients .ObserverClient ,
98
+ LightClient : zetaChainClients .LightClient ,
99
+ ZevmClient : zevmClient ,
100
+ ZevmAuth : zevmAuth ,
87
101
}, nil
88
102
}
89
103
@@ -140,25 +154,29 @@ func getEVMClient(
140
154
141
155
// getZetaClients get zeta clients
142
156
func getZetaClients (rpc string ) (
143
- crosschaintypes.QueryClient ,
144
- fungibletypes.QueryClient ,
145
- authtypes.QueryClient ,
146
- banktypes.QueryClient ,
147
- observertypes.QueryClient ,
148
- lightclienttypes.QueryClient ,
157
+ zetaChainClients ,
149
158
error ,
150
159
) {
151
160
grpcConn , err := grpc .Dial (rpc , grpc .WithInsecure ())
152
161
if err != nil {
153
- return nil , nil , nil , nil , nil , nil , err
162
+ return zetaChainClients {} , err
154
163
}
155
164
165
+ authorityClient := authoritytypes .NewQueryClient (grpcConn )
156
166
cctxClient := crosschaintypes .NewQueryClient (grpcConn )
157
167
fungibleClient := fungibletypes .NewQueryClient (grpcConn )
158
168
authClient := authtypes .NewQueryClient (grpcConn )
159
169
bankClient := banktypes .NewQueryClient (grpcConn )
160
170
observerClient := observertypes .NewQueryClient (grpcConn )
161
171
lightclientClient := lightclienttypes .NewQueryClient (grpcConn )
162
172
163
- return cctxClient , fungibleClient , authClient , bankClient , observerClient , lightclientClient , nil
173
+ return zetaChainClients {
174
+ AuthorityClient : authorityClient ,
175
+ CctxClient : cctxClient ,
176
+ FungibleClient : fungibleClient ,
177
+ AuthClient : authClient ,
178
+ BankClient : bankClient ,
179
+ ObserverClient : observerClient ,
180
+ LightClient : lightclientClient ,
181
+ }, nil
164
182
}
0 commit comments