Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
788ad254
Commit
788ad254
authored
Jun 26, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops: refactor
parent
bc1bd1aa
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
493 additions
and
376 deletions
+493
-376
main.go
op-chain-ops/cmd/check-l2/main.go
+474
-360
util.go
op-chain-ops/util/util.go
+19
-16
No files found.
op-chain-ops/cmd/check-l2/main.go
View file @
788ad254
This diff is collapsed.
Click to expand it.
op-chain-ops/util/util.go
View file @
788ad254
...
...
@@ -34,39 +34,42 @@ func NewClients(ctx *cli.Context) (*Clients, error) {
l1RpcURL
:=
ctx
.
String
(
"l1-rpc-url"
)
if
l1RpcURL
!=
""
{
l1Client
,
err
:=
ethclient
.
Dial
(
l1RpcURL
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot dial L1: %w"
,
err
)
}
clients
.
L1Client
=
l1Client
l1RpcClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
l1RpcURL
)
l1Client
,
l1RpcClient
,
l1GethClient
,
err
:=
newClients
(
l1RpcURL
)
if
err
!=
nil
{
return
nil
,
err
}
clients
.
L1Client
=
l1Client
clients
.
L1RpcClient
=
l1RpcClient
clients
.
L1GethClient
=
gethclient
.
New
(
l1RpcClient
)
clients
.
L1GethClient
=
l1GethClient
}
l2RpcURL
:=
ctx
.
String
(
"l2-rpc-url"
)
if
l2RpcURL
!=
""
{
l2Client
,
err
:=
ethclient
.
Dial
(
l2RpcURL
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot dial L2: %w"
,
err
)
}
clients
.
L2Client
=
l2Client
l2RpcClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
l2RpcURL
)
l2Client
,
l2RpcClient
,
l2GethClient
,
err
:=
ethclient
.
Dial
(
l2RpcURL
)
if
err
!=
nil
{
return
nil
,
err
}
clients
.
L2Client
=
l2Client
clients
.
L2RpcClient
=
l2RpcClient
clients
.
L2GethClient
=
gethclient
.
New
(
l2RpcClient
)
clients
.
L2GethClient
=
l2GethClient
}
return
&
clients
,
nil
}
// newClients will create new clients from a given URL
func
newClients
(
url
string
)
(
*
ethclient
.
Client
,
*
rpc
.
Client
,
*
gethclient
.
Client
,
error
)
{
ethClient
,
err
:=
ethclient
.
Dial
(
url
)
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
fmt
.
Errorf
(
"cannot dial ethclient: %w"
,
err
)
}
rpcClient
,
err
:=
rpc
.
DialContext
(
context
.
Background
(),
url
)
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
fmt
.
Errorf
(
"cannot dial rpc client"
,
err
)
}
return
ethClient
,
rpcClient
,
gethclient
.
New
(
rpcClient
),
nil
}
// ClientsFlags represent the flags associated with creating RPC clients.
var
ClientsFlags
=
[]
cli
.
Flag
{
&
cli
.
StringFlag
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment