Skip to content

Commit 16274c1

Browse files
committed
update readme
1 parent 72c5af7 commit 16274c1

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

README.md

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
11
# zkevm-ethtx-manager
2-
zkevm-ethtx-manager
2+
Stateless manager to sent transactions to L1.
3+
4+
## Main Funtions
5+
### Add Transaction
6+
`func (c *Client) Add(ctx context.Context, to *common.Address, forcedNonce *uint64, value *big.Int, data []byte) (common.Hash, error)`
7+
8+
Adds a transaction to be sent to L1. The returned hash is calculated over the *to*, *nonce*, *value* and *data* fields.
9+
10+
Parameter forcedNonce is optional, if nil is passed the current nonce is obtained from the L1 node.
11+
12+
### Get Transaction Status
13+
`func (c *Client) Result(ctx context.Context, id common.Hash) (MonitoredTxResult, error)`
14+
15+
Result returns the current result of the transaction execution with all the details.
16+
17+
### Get All Transactions Status
18+
`func (c *Client) ResultsByStatus(ctx context.Context, statuses []MonitoredTxStatus) ([]MonitoredTxResult, error)`
19+
20+
ResultsByStatus returns all the results for all the monitored txs matching the provided statuses.
21+
If the statuses are empty, all the statuses are considered.
22+
23+
### Pending L1 Transactions
24+
`func (c *Client) PendingL1Txs(ctx context.Context) (bool, error)`
25+
26+
Returns whether there are pending transactions to be mined in L1.
27+
28+
### Transactions statuses
29+
30+
- **Created**: the tx was just added to the volatile storage
31+
- **Sent**: transaction was sent to L1
32+
- **Failed**: the tx was already mined and failed with an error that can't be recovered automatically, ex: the data in the tx is invalid and the tx gets reverted
33+
- **Confirmed**: the tx was already mined and the receipt status is Successful. Confirmation waits for the configured number of blocks to be considered final.
34+
- **Reorged**: is used when a monitored tx was already confirmed but the L1 block where this tx was confirmed has been reorged, in this situation the caller needs to review this information and wait until it gets confirmed again in a future block.
35+
- **Done**: the tx was set by the owner as done

ethtxmanager/ethtxmanager.go

-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ func (c *Client) Add(ctx context.Context, to *common.Address, forcedNonce *uint6
156156

157157
// ResultsByStatus returns all the results for all the monitored txs matching the provided statuses
158158
// if the statuses are empty, all the statuses are considered.
159-
//
160-
// the slice is returned is in order by created_at field ascending
161159
func (c *Client) ResultsByStatus(ctx context.Context, statuses []MonitoredTxStatus) ([]MonitoredTxResult, error) {
162160
mTxs, err := c.storage.GetByStatus(ctx, statuses)
163161
if err != nil {

ethtxmanager/monitoredtx.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
const (
12-
// MonitoredTxStatusCreated mean the tx was just added to the storage
12+
// MonitoredTxStatusCreated means the tx was just added to the storage
1313
MonitoredTxStatusCreated = MonitoredTxStatus("created")
1414

1515
// MonitoredTxStatusSent means that at least a eth tx was sent to the network

0 commit comments

Comments
 (0)