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
8d67ffb1
Unverified
Commit
8d67ffb1
authored
Aug 15, 2023
by
Ethen Pociask
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[indexer.docs] Remove client and redundant submodule
parent
9a954c5d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
78 deletions
+0
-78
client.go
indexer/api/client.go
+0
-71
bridge_transfers_e2e_test.go
indexer/e2e_tests/bridge_transfers_e2e_test.go
+0
-6
forge-std
lib/forge-std
+0
-1
No files found.
indexer/api/client.go
deleted
100644 → 0
View file @
9a954c5d
package
api
import
(
"encoding/json"
"fmt"
"net/http"
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum/go-ethereum/common"
)
// Client defines the methods for interfacing with the indexer API.
type
Client
struct
{
url
string
c
*
http
.
Client
}
// NewClient creates a client that uses the given RPC client.
func
NewClient
(
c
*
http
.
Client
,
url
string
)
*
Client
{
return
&
Client
{
url
:
url
,
c
:
c
,
}
}
// Close closes the underlying RPC connection.
func
(
ec
*
Client
)
Close
()
{
ec
.
c
.
CloseIdleConnections
()
}
// GetDepositsByAddress returns all associated (L1->L2) deposits for a provided L1 address.
func
(
ic
*
Client
)
GetDepositsByAddress
(
addr
common
.
Address
)
([]
*
database
.
L1BridgeDepositWithTransactionHashes
,
error
)
{
var
deposits
[]
*
database
.
L1BridgeDepositWithTransactionHashes
resp
,
err
:=
ic
.
c
.
Get
(
ic
.
url
+
depositPath
+
addr
.
Hex
())
if
err
!=
nil
{
return
nil
,
err
}
defer
resp
.
Body
.
Close
()
if
resp
.
StatusCode
!=
http
.
StatusOK
{
return
nil
,
fmt
.
Errorf
(
"unexpected status code: %d"
,
resp
.
StatusCode
)
}
if
err
:=
json
.
NewDecoder
(
resp
.
Body
)
.
Decode
(
&
deposits
);
err
!=
nil
{
return
nil
,
err
}
return
deposits
,
nil
}
// GetWithdrawalsByAddress returns all associated (L2->L1) withdrawals for a provided L2 address.
func
(
ic
*
Client
)
GetWithdrawalsByAddress
(
addr
common
.
Address
)
([]
*
database
.
L2BridgeWithdrawalWithTransactionHashes
,
error
)
{
var
withdrawals
[]
*
database
.
L2BridgeWithdrawalWithTransactionHashes
resp
,
err
:=
ic
.
c
.
Get
(
ic
.
url
+
depositPath
+
addr
.
Hex
())
if
err
!=
nil
{
return
nil
,
err
}
defer
resp
.
Body
.
Close
()
if
resp
.
StatusCode
!=
http
.
StatusOK
{
return
nil
,
fmt
.
Errorf
(
"unexpected status code: %d"
,
resp
.
StatusCode
)
}
if
err
:=
json
.
NewDecoder
(
resp
.
Body
)
.
Decode
(
&
withdrawals
);
err
!=
nil
{
return
nil
,
err
}
return
withdrawals
,
nil
}
indexer/e2e_tests/bridge_transfers_e2e_test.go
View file @
8d67ffb1
...
...
@@ -280,10 +280,4 @@ func TestE2EBridgeTransfersL2ToL1MessagePasserReceive(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
proveReceipt
.
TxHash
,
aliceWithdrawals
[
0
]
.
ProvenL1TransactionHash
)
require
.
Equal
(
t
,
finalizeReceipt
.
TxHash
,
aliceWithdrawals
[
0
]
.
FinalizedL1TransactionHash
)
// (3) Test API query for L2ToL1MessagePasser withdrawals
respWithdrawals
,
err
:=
testSuite
.
Client
.
GetWithdrawalsByAddress
(
aliceAddr
)
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
proveReceipt
.
TxHash
,
respWithdrawals
[
0
]
.
ProvenL1TransactionHash
)
require
.
Equal
(
t
,
finalizeReceipt
.
TxHash
,
respWithdrawals
[
0
]
.
FinalizedL1TransactionHash
)
}
forge-std
@
74cfb77e
Subproject commit 74cfb77e308dd188d2f58864aaf44963ae6b88b1
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