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
18f6d631
Unverified
Commit
18f6d631
authored
Oct 31, 2023
by
Ethen Pociask
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[indexer.api.add_withdrawal_hash] better code comments and variable naming
parent
da7fb497
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
31 deletions
+31
-31
generated.ts
indexer/api-ts/generated.ts
+2
-2
api_test.go
indexer/api/api_test.go
+2
-2
models.go
indexer/api/models/models.go
+27
-27
No files found.
indexer/api-ts/generated.ts
View file @
18f6d631
...
...
@@ -38,8 +38,8 @@ export interface WithdrawalItem {
timestamp
:
number
/* uint64 */
;
l2BlockHash
:
string
;
amount
:
string
;
proofTransaction
Hash
:
string
;
claimTransaction
Hash
:
string
;
L1ProvenTx
Hash
:
string
;
L1FinalizedTx
Hash
:
string
;
l1TokenAddress
:
string
;
l2TokenAddress
:
string
;
}
...
...
indexer/api/api_test.go
View file @
18f6d631
...
...
@@ -149,8 +149,8 @@ func TestL2BridgeWithdrawalsByAddressHandler(t *testing.T) {
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
To
,
withdrawal
.
Tx
.
ToAddress
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
TransactionHash
,
common
.
HexToHash
(
"0x789"
)
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
Amount
,
withdrawal
.
Tx
.
Amount
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
ProofTransaction
Hash
,
common
.
HexToHash
(
"0x123"
)
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
ClaimTransaction
Hash
,
common
.
HexToHash
(
"0x123"
)
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
L1ProvenTx
Hash
,
common
.
HexToHash
(
"0x123"
)
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
L1FinalizedTx
Hash
,
common
.
HexToHash
(
"0x123"
)
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
L1TokenAddress
,
withdrawal
.
TokenPair
.
RemoteTokenAddress
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
L2TokenAddress
,
withdrawal
.
TokenPair
.
LocalTokenAddress
.
String
())
assert
.
Equal
(
t
,
resp
.
Items
[
0
]
.
Timestamp
,
withdrawal
.
Tx
.
Timestamp
)
...
...
indexer/api/models/models.go
View file @
18f6d631
...
...
@@ -28,18 +28,18 @@ type DepositResponse struct {
// WithdrawalItem ... Data model for API JSON response
type
WithdrawalItem
struct
{
Guid
string
`json:"guid"`
From
string
`json:"from"`
To
string
`json:"to"`
TransactionHash
string
`json:"transactionHash"`
MessageHash
string
`json:"m
essageHash"`
Timestamp
uint64
`json:"timestamp"`
L2BlockHash
string
`json:"l2BlockHash"`
Amount
string
`json:"amount"`
ProofTransactionHash
string
`json:"proofTransaction
Hash"`
ClaimTransactionHash
string
`json:"claimTransaction
Hash"`
L1TokenAddress
string
`json:"l1TokenAddress"`
L2TokenAddress
string
`json:"l2TokenAddress"`
Guid
string
`json:"guid"`
From
string
`json:"from"`
To
string
`json:"to"`
TransactionHash
string
`json:"transactionHash"`
CrossDomainMessageHash
string
`json:"crossDomainM
essageHash"`
Timestamp
uint64
`json:"timestamp"`
L2BlockHash
string
`json:"l2BlockHash"`
Amount
string
`json:"amount"`
L1ProvenTxHash
string
`json:"L1ProvenTx
Hash"`
L1FinalizedTxHash
string
`json:"L1FinalizedTx
Hash"`
L1TokenAddress
string
`json:"l1TokenAddress"`
L2TokenAddress
string
`json:"l2TokenAddress"`
}
// WithdrawalResponse ... Data model for API JSON response
...
...
@@ -55,24 +55,24 @@ func CreateWithdrawalResponse(withdrawals *database.L2BridgeWithdrawalsResponse)
items
:=
make
([]
WithdrawalItem
,
len
(
withdrawals
.
Withdrawals
))
for
i
,
withdrawal
:=
range
withdrawals
.
Withdrawals
{
msg
:=
withdrawal
.
L2BridgeWithdrawal
.
CrossDomainMessageHash
if
msg
==
nil
{
msg
=
&
common
.
Hash
{
}
cdh
:=
withdrawal
.
L2BridgeWithdrawal
.
CrossDomainMessageHash
if
cdh
==
nil
{
// Zero value indicates that the withdrawal didn't have a cross domain message
cdh
=
&
common
.
Hash
{
0
}
}
item
:=
WithdrawalItem
{
Guid
:
withdrawal
.
L2BridgeWithdrawal
.
TransactionWithdrawalHash
.
String
(),
L2BlockHash
:
withdrawal
.
L2BlockHash
.
String
(),
Timestamp
:
withdrawal
.
L2BridgeWithdrawal
.
Tx
.
Timestamp
,
From
:
withdrawal
.
L2BridgeWithdrawal
.
Tx
.
FromAddress
.
String
(),
To
:
withdrawal
.
L2BridgeWithdrawal
.
Tx
.
ToAddress
.
String
(),
TransactionHash
:
withdrawal
.
L2TransactionHash
.
String
(),
Amount
:
withdrawal
.
L2BridgeWithdrawal
.
Tx
.
Amount
.
String
(),
MessageHash
:
msg
.
String
(),
ProofTransactionHash
:
withdrawal
.
ProvenL1TransactionHash
.
String
(),
ClaimTransactionHash
:
withdrawal
.
FinalizedL1TransactionHash
.
String
(),
L1TokenAddress
:
withdrawal
.
L2BridgeWithdrawal
.
TokenPair
.
RemoteTokenAddress
.
String
(),
L2TokenAddress
:
withdrawal
.
L2BridgeWithdrawal
.
TokenPair
.
LocalTokenAddress
.
String
(),
Guid
:
withdrawal
.
L2BridgeWithdrawal
.
TransactionWithdrawalHash
.
String
(),
L2BlockHash
:
withdrawal
.
L2BlockHash
.
String
(),
Timestamp
:
withdrawal
.
L2BridgeWithdrawal
.
Tx
.
Timestamp
,
From
:
withdrawal
.
L2BridgeWithdrawal
.
Tx
.
FromAddress
.
String
(),
To
:
withdrawal
.
L2BridgeWithdrawal
.
Tx
.
ToAddress
.
String
(),
TransactionHash
:
withdrawal
.
L2TransactionHash
.
String
(),
Amount
:
withdrawal
.
L2BridgeWithdrawal
.
Tx
.
Amount
.
String
(),
CrossDomainMessageHash
:
cdh
.
String
(),
L1ProvenTxHash
:
withdrawal
.
ProvenL1TransactionHash
.
String
(),
L1FinalizedTxHash
:
withdrawal
.
FinalizedL1TransactionHash
.
String
(),
L1TokenAddress
:
withdrawal
.
L2BridgeWithdrawal
.
TokenPair
.
RemoteTokenAddress
.
String
(),
L2TokenAddress
:
withdrawal
.
L2BridgeWithdrawal
.
TokenPair
.
LocalTokenAddress
.
String
(),
}
items
[
i
]
=
item
}
...
...
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